/* completIn Panel — app shell and shared components.
   Colours, fonts and measures come only from tokens.css. The sidebar is always dark: it uses the
   --nav-* tokens, plus the two below that the design hard-codes for the footer avatar. */

:root {
    --nav-surface: #161B22; /* sidebar avatar fill (dark `surface`, fixed in both themes) */
    --nav-avatar-line: #2A313C; /* sidebar avatar border (dark `line`, fixed in both themes) */
    /* modal backdrop and shadow (design: rgba(4,7,11,.68) and rgba(0,0,0,.45)), dark in both themes */
    --scrim: color-mix(in srgb, var(--nav-bg) 68%, transparent);
    --shadow-dialog: 0 24px 64px color-mix(in srgb, var(--nav-bg) 45%, transparent);
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.45;
}

a { color: var(--accent-text); }
a:hover { color: var(--text); }

:focus-visible {
    outline: 2px solid var(--accent-text);
    outline-offset: 2px;
}

input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }

h1:focus { outline: none; }

.muted { color: var(--muted); }

.mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* ---------- shell ---------- */

/* Wraps on narrow screens: the sidebar moves above the content (design spec §6). */
.shell {
    display: flex;
    flex-wrap: wrap;
    min-height: 100vh;
    background: var(--bg);
}

.shell-main {
    flex: 999 1 560px;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content {
    padding: var(--content-padding);
    display: flex;
    flex-direction: column;
    gap: var(--block-gap);
}

/* ---------- brand ---------- */

.brand {
    --brand-accent: var(--accent);
    --brand-text: var(--text);
    --brand-tagline: var(--accent-text);
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-symbol path { stroke: var(--brand-accent); }
.brand-symbol circle { fill: var(--brand-accent); }

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.brand-name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 21px;
    letter-spacing: -0.03em;
    line-height: 1;
    color: var(--brand-text);
}

.brand-accent { color: var(--brand-accent); }

.brand-tagline {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.3em;
    line-height: 1;
    color: var(--brand-tagline);
}

/* ---------- sidebar ---------- */

.sidenav {
    flex: 1 0 var(--sidebar-width);
    min-width: 0; /* a long e-mail ellipsizes instead of widening the sidebar */
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 22px 14px 18px;
    background: var(--nav-bg);
    border-right: 1px solid var(--nav-line);
}

.sidenav .brand {
    --brand-accent: var(--nav-accent);
    --brand-text: var(--nav-text-active);
    --brand-tagline: var(--nav-accent);
}

.sidenav-brand {
    display: flex;
    padding: 0 10px;
    text-decoration: none;
}

.sidenav-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidenav-group-label {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--nav-text);
    padding: 0 12px 6px;
}

.sidenav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--control-height);
    padding: 0 12px;
    border-radius: var(--radius-control);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: var(--nav-text);
}

.sidenav-item:hover { color: var(--nav-text-active); }

.sidenav-item.active {
    background: var(--nav-active-bg);
    color: var(--nav-text-active);
}

.sidenav-item.active svg { color: var(--nav-accent); }

.sidenav-user {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 10px 0;
    border-top: 1px solid var(--nav-line);
}

.sidenav-avatar {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--nav-surface);
    border: 1px solid var(--nav-avatar-line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--nav-accent);
}

.sidenav-user-text {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidenav-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--nav-text-active);
}

.sidenav-user-email {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--nav-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidenav-signout {
    margin: 0;
    flex: none;
}

/* ---------- buttons ---------- */

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--control-height);
    height: var(--control-height);
    padding: 0;
    border-radius: var(--radius-control);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.icon-button:hover { background: var(--raise); }

.icon-button--nav {
    border-color: transparent;
    background: transparent;
    color: var(--nav-text);
}

.icon-button--nav:hover {
    background: transparent;
    color: var(--nav-text-active);
}

/* ---------- top bar ---------- */

.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 32px;
    border-bottom: 1px solid var(--line);
}

.topbar-path {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.topbar-path-home { color: var(--accent-text); }

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

/* Wide screens: the shell is exactly the viewport; the sidebar and the top bar stay put and only .content
   scrolls (the user card stays at the bottom of the viewport). Narrow screens keep the normal page scroll. */
@media (min-width: 901px) {
    .shell { height: 100vh; height: 100dvh; min-height: 0; flex-wrap: nowrap; overflow: hidden; }
    .sidenav { flex: 0 0 var(--sidebar-width); overflow-y: auto; }
    .shell-main { flex: 1 1 0; }
    .topbar { flex: none; }
    .content { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
    .content > * { flex-shrink: 0; }
}

@media print {
    .shell { height: auto; overflow: visible; }
    .content { overflow: visible; }
}

/* The sidebar wraps above the content (design spec §6). */
@media (max-width: 900px) {
    .sidenav { flex-basis: 100%; }
}

/* ---------- month picker (SfDatePicker restyled as the design's button) ---------- */

.month-picker {
    position: relative;
    display: inline-flex;
}

.month-picker-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--control-height);
    padding: 0 16px;
    border-radius: var(--radius-control);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.month-picker-button:hover { background: var(--raise); }

.month-picker-backdrop {
    position: fixed;
    inset: 0;
    z-index: 900;
}

.month-picker-popup {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 901;
}

/* ---------- page header ---------- */

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.page-header-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.page-header h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.page-header p {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
}

.page-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* ---------- cards ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    min-width: 0;
    overflow: hidden;
}

.card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
}

.card-header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.card-header h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.card-header p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.card-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* ---------- indicators ---------- */

.kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
    gap: 16px;
}

.kpi {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kpi-label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.kpi-value {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    white-space: nowrap;
}

.kpi-hint {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
}

/* ---------- chips ---------- */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: var(--radius-chip);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.chip--accent { background: var(--accent-soft); color: var(--accent-text); }
.chip--info { background: var(--info-soft); color: var(--info); }
.chip--warn { background: var(--warn-soft); color: var(--warn); }
.chip--danger { background: var(--danger-soft); color: var(--danger); }
.chip--neutral { background: var(--raise); color: var(--text); }

/* ---------- modal footer ---------- */

.modal-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 24px;
    border-top: 1px solid var(--line);
    background: var(--raise);
}

.modal-footer--split { justify-content: space-between; }

.modal-footer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* ---------- modal (design spec §8; modal-edit-company.html, modal-cancel-nfse.html) ----------
   Drawn by ModalPageLayout for the static SSR security pages; later SfDialogs take the same measures. */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 950;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 72px 20px 40px;
    background: var(--scrim);
    overflow-y: auto;
}

.modal {
    width: 100%;
    max-width: 560px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-dialog);
    box-shadow: var(--shadow-dialog);
    overflow: hidden;
}

.modal--narrow { max-width: 460px; }

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 16px 16px 24px;
    border-bottom: 1px solid var(--line);
}

.modal-header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.modal-header-text p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.modal-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
}

.modal-close {
    flex: none;
    width: var(--control-height);
    height: var(--control-height);
}

.modal-body {
    padding: 20px 24px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-confirm {
    padding: 24px 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-confirm-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--control-height);
    height: var(--control-height);
    border-radius: 10px;
    background: var(--danger-soft);
    color: var(--danger);
}

.modal-text {
    margin: 0;
    color: var(--muted);
}

.modal-form {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-footer-form { display: contents; }

/* ---------- settings (design: settings.html) ---------- */

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(480px, 100%), 1fr));
    gap: var(--block-gap);
    align-items: start;
}

/* A card of label/value rows: mono label on the left, value or actions on the right. */
.card--rows { padding: 0 20px 8px; }
.card--rows .card-header { padding: 18px 0 14px; }

.rows {
    margin: 0;
    display: flex;
    flex-direction: column;
}

.rows-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 16px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.rows--modal .rows-item:first-child { border-top: 0; padding-top: 0; }

.rows-item dt {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.rows-item dd {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    font-weight: 600;
    text-align: right;
    overflow-wrap: anywhere;
}

.rows-item dd.payment-instructions { white-space: pre-line; }

.banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    padding: 14px 18px;
    border-radius: var(--radius-card);
    border: 1px solid var(--line);
}

.banner--warn {
    border-color: var(--warn);
    background: var(--warn-soft);
}

.banner-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.banner-icon { display: inline-flex; flex: none; }
.banner--warn .banner-icon { color: var(--warn); }

.banner-text {
    display: flex;
    flex-direction: column;
}

.banner-title { font-weight: 700; }

.banner-detail {
    font-size: 13px;
    color: var(--muted);
}

/* ---------- security modals ---------- */

.totp-setup {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 20px;
}

.totp-setup .modal-text { flex: 1 1 100%; }

/* QR code: dark modules on a light square in both themes, so every authenticator app can read it. */
.qr {
    flex: none;
    width: 168px;
    border-radius: var(--radius-control);
    background: var(--nav-text-active);
    color: var(--nav-bg);
}

.qr svg {
    display: block;
    width: 100%;
    height: auto;
}

.totp-setup .field { flex: 1 1 200px; }

.totp-key {
    display: block;
    padding: 10px 12px;
    border-radius: var(--radius-control);
    background: var(--raise);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.06em;
    word-spacing: 0.2em;
    overflow-wrap: anywhere;
    user-select: all;
}

.totp-code { max-width: 200px; letter-spacing: 0.3em; }

.recovery-codes {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.recovery-codes code {
    display: block;
    padding: 8px 12px;
    border-radius: var(--radius-control);
    background: var(--raise);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.passkey-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
}

.passkey-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 8px 0;
    border-top: 1px solid var(--line);
}

.passkey-item:first-child { border-top: 0; padding-top: 0; }

.passkey-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.passkey-name svg { flex: none; color: var(--muted); }

.passkey-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.passkey-actions form { margin: 0; display: contents; }

/* ---------- empty state ---------- */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 48px 20px;
    text-align: center;
    color: var(--muted);
}

.empty-state p { margin: 0; }

/* ---------- sign-in layout (design spec §7.9) ---------- */

.auth {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 72px 20px 40px;
    background-color: var(--bg);
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 24px 24px;
}

.auth-toggle {
    position: absolute;
    top: 16px;
    right: 20px;
}

.auth-column {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.auth-brand .brand { gap: 14px; }
.auth-brand .brand-symbol { width: 46px; height: 46px; }
.auth-brand .brand-text { gap: 7px; }
.auth-brand .brand-name { font-size: 26px; }
.auth-brand .brand-tagline { font-size: 10px; }

.auth-card {
    width: 100%;
    padding: 28px 28px 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-dialog);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Sign-in card contents (screens login.html, verify-totp.html). Native inputs on purpose: these pages are
   static SSR forms, and Syncfusion fields need an interactive circuit to post their values. */

.auth-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.auth-head h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.auth-head p {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
}

.auth-form {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-text { margin: 0; }

.auth-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 12px;
}

.auth-link {
    display: inline-flex;
    align-items: center;
    min-height: var(--control-height);
    font-size: 13px;
    font-weight: 600;
}

.auth-link--muted { color: var(--muted); }

.auth-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 12px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
}

.auth-divider span {
    flex: 1 1 0;
    height: 1px;
    background: var(--line);
}

.auth-passkey {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-hint {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

.auth-identity {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 12px;
    padding: 4px 6px 4px 14px;
    border-radius: var(--radius-control);
    background: var(--raise);
    font-size: 12px;
    min-width: 0;
}

.auth-identity .mono { overflow-wrap: anywhere; }
.auth-identity .auth-link { padding: 0 8px; }

.auth-footer {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.auth-footer-home { color: var(--accent-text); }

/* ---------- form fields and buttons (static SSR forms) ---------- */

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

.field-label { font-size: 12px; font-weight: 600; color: var(--muted); }

.field-hint {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
}

.field-error {
    font-size: 12px;
    font-weight: 600;
    color: var(--danger);
}

.input, .input-group {
    min-height: var(--control-height);
    width: 100%;
    border-radius: var(--radius-control);
    border: 1px solid var(--line);
    background: var(--field);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
}

.input { padding: 0 12px; }

.input.mono { font-family: var(--font-mono); }

.input:focus, .input-group:focus-within, .otp-digit:focus {
    outline: none;
    border-color: var(--accent-text);
}

.input.invalid, .input-group:has(.invalid) { border-color: var(--danger); }

.input-group {
    display: flex;
    align-items: center;
}

.input-group-input {
    flex: 1 1 0;
    min-width: 0;
    height: calc(var(--control-height) - 2px);
    padding: 0 12px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
}

.icon-button--ghost {
    width: calc(var(--control-height) - 2px);
    height: calc(var(--control-height) - 2px);
    border-color: transparent;
    background: transparent;
    color: var(--muted);
}

.icon-button--ghost:hover { background: transparent; color: var(--text); }
.icon-button--ghost[aria-pressed="true"] { color: var(--accent-text); }

.check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: var(--control-height);
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
}

.check input {
    flex: none;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--control-height);
    padding: 0 16px;
    border-radius: var(--radius-control);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover { background: var(--raise); color: var(--text); }

.btn--primary {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 700;
}

.btn--primary:hover { background: var(--accent); color: var(--on-accent); filter: brightness(1.06); }

.btn--block { width: 100%; }

.btn--compact { padding: 0 12px; font-size: 13px; }

.btn--danger {
    border-color: var(--danger);
    background: var(--danger);
    color: var(--on-danger);
    font-weight: 700;
}

.btn--danger:hover { background: var(--danger); color: var(--on-danger); filter: brightness(1.06); }

/* destructive action isolated on the left of a modal footer: red text, no fill */
.btn--destructive-text,
.btn--destructive-text:hover {
    border-color: transparent;
    background: transparent;
    color: var(--danger);
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-control);
    border: 1px solid var(--line);
    font-size: 13px;
    font-weight: 600;
}

.alert-icon { flex: none; }

.alert--danger {
    border-color: var(--danger);
    background: var(--danger-soft);
    color: var(--danger);
}

.alert--warn {
    border-color: var(--warn);
    background: var(--warn-soft);
    color: var(--warn);
}

.alert--success {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-text);
}

.otp {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.otp legend { padding: 0; margin-bottom: 8px; }

.otp-digits {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

.otp-digit {
    width: 100%;
    min-height: 56px;
    padding: 0;
    border-radius: var(--radius-control);
    border: 1px solid var(--line);
    background: var(--field);
    color: var(--text);
    text-align: center;
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 600;
}

.otp--error .otp-digit { border-color: var(--danger); }

/* ---------- Blazor error bar ---------- */

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: var(--danger-soft);
    color: var(--danger);
    border-top: 1px solid var(--danger);
    backdrop-filter: blur(8px);
}

#blazor-error-ui .reload { color: var(--danger); font-weight: 600; }

#blazor-error-ui .dismiss {
    margin-left: auto;
    border: 0;
    background: transparent;
    color: var(--danger);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

/* ---------- narrow screens ---------- */

@media (max-width: 560px) {
    .topbar { padding: 12px 16px; }
    .content { padding: 24px 16px 32px; }
}

/* ---------- list toolbar, filter chips, client cell (design: clients.html) ---------- */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
}

.toolbar-search { flex: 1 1 260px; max-width: 420px; }
.toolbar-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.filter-chip {
    display: inline-flex;
    align-items: center;
    min-height: var(--control-height);
    padding: 0 14px;
    border-radius: var(--radius-chip);
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.filter-chip:hover { color: var(--text); }

.filter-chip[aria-pressed="true"] {
    border-color: var(--accent-text);
    background: var(--accent-soft);
    color: var(--accent-text);
}

.chip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.chip-dot--series2 { background: var(--series2); }

.client-cell { line-height: 1.4; display: flex; align-items: center; gap: 12px; min-width: 0; }
.client-cell-text { display: flex; flex-direction: column; min-width: 0; }
.client-cell-text > * { flex: none; max-width: 100%; }

.client-link {
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-link:hover { color: var(--accent-text); }

.client-sub {
    font-size: 12px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.avatar {
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-control);
    background: var(--raise);
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-text);
}

.muted { color: var(--muted); }

.mono {
    font-family: var(--font-mono);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ---------- form rows inside a modal ---------- */

.form-row { display: grid; gap: 12px; align-items: start; }
.form-row--2 { grid-template-columns: 1fr 1fr; }
.form-row--address { grid-template-columns: 1fr 1.2fr 1fr; }

@media (max-width: 480px) {
    .form-row--2, .form-row--address { grid-template-columns: 1fr; }
}

/* ---------- systems (design: systems.html, modal-new-system.html) ---------- */

.segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 3px;
    min-height: var(--control-height);
    box-sizing: border-box;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--field);
}

.segmented button {
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.segmented button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); }
.segmented button:disabled { cursor: default; }
.segmented button:disabled:not([aria-pressed="true"]) { opacity: 0.5; }

.rate-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; line-height: 1.35; }
.rate-pending { font-size: 12px; color: var(--muted); white-space: nowrap; }

.card-total {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-top: 1px solid var(--line);
    font-size: 13px;
    color: var(--muted);
}

.card-total .mono { color: var(--text); font-weight: 600; }

.form-link { color: var(--accent-text); font-weight: 600; }


.alert .form-link { margin-left: 6px; }

/* ---------- hours & billing (design: hours.html, modal-log-hours.html, modal-close-billing-period.html) ---------- */

.cell-stack { line-height: 1.4; }
.cell-strong { font-weight: 600; }
.cell-text { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; line-height: 1.4; }
.late-chip { cursor: help; }

.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }

/* open period line under the Log hours form */
.period-note {
    padding: 12px 14px;
    border-radius: var(--radius-control);
    background: var(--raise);
    font-size: 13px;
    color: var(--muted);
}

/* read-only value in a form ("Period starts") */
.field-readonly {
    display: flex;
    align-items: center;
    min-height: var(--control-height);
    padding: 0 12px;
    border-radius: var(--radius-control);
    background: var(--raise);
    color: var(--text);
    font-size: 13px;
}

/* close summary: entries, hours, rate, amount to invoice */
.close-summary {
    margin: 0;
    padding: 4px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
}

.close-summary > div {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 16px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.close-summary > div:first-child { border-top: 0; }
.close-summary dt { font-size: 13px; color: var(--muted); }
.close-summary dd { margin: 0; font-weight: 600; text-align: right; font-size: 13px; }
.close-summary-total dt { font-weight: 700; color: var(--text); font-size: 14px; }
.close-summary-total dd {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-text);
}

.period-foot {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--muted);
}

/* ---------- import hours (design: modal-import-hours-1-upload.html, modal-import-hours-2-review.html) ---------- */

.modal-body.modal-body--flush { padding: 0; gap: 0; }

.modal-footer-leading { min-width: 0; }

.import-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.04em;
}

.import-step { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.import-step--current { color: var(--accent-text); font-weight: 600; }

.import-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--raise);
}

.import-step--current .import-step-num { background: var(--accent-soft); }
.import-steps-line { flex: none; width: 32px; height: 1px; background: var(--line); }

.import-source { display: flex; flex-direction: column; gap: 6px; }

.import-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 20px;
    border-radius: 10px;
    border: 1px dashed var(--line);
    background: var(--field);
    text-align: center;
    overflow-wrap: anywhere;
}

.import-drop--error { border-color: var(--danger); }
.import-drop-icon { display: inline-flex; color: var(--accent-text); }
.import-drop-title { font-weight: 600; color: var(--text); }
.import-drop-hint { font-size: 12px; color: var(--muted); }

.import-drop-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
}

.import-or {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
}

.import-or span { flex: 1 1 0; height: 1px; background: var(--line); }

.import-columns {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border-radius: var(--radius-control);
    background: var(--raise);
}

.import-columns-label { font-size: 13px; color: var(--muted); }
.import-columns-list { display: flex; flex-wrap: wrap; gap: 8px; font-family: var(--font-mono); font-size: 12px; }

.import-column {
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: var(--surface);
}

.import-template {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    min-height: var(--control-height);
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-text);
}

.import-template:hover { color: var(--text); }

.import-review-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 24px;
}

.import-counters { display: flex; flex-wrap: wrap; gap: 8px; }
.import-review-alerts { display: flex; flex-direction: column; gap: 10px; padding: 0 24px 16px; }

.import-grid .e-grid .e-headercell:first-child, .import-grid .e-grid .e-rowcell:first-child { padding-left: 24px; }
.import-grid .e-grid .e-headercell:last-child, .import-grid .e-grid .e-rowcell:last-child { padding-right: 24px; }

.import-status { display: flex; flex-direction: column; gap: 4px; line-height: 1.4; }
.import-reason { font-size: 12px; color: var(--muted); }
.import-late { font-size: 12px; color: var(--warn); }
.import-total { font-size: 13px; white-space: nowrap; }

.import-pick { width: 100%; }

/* ---------- hours report (design: modal-hours-report.html) ----------
   The paper previews the client's PDF: it carries .t-light, so the tokens inside it are the light theme's
   (white paper, dark text) in both themes. */

.modal-header-extra {
    margin-left: auto;
    align-self: center;
    flex: 0 1 320px;
    min-width: 0;
}

.report-picker { width: 100%; }

.modal-body.modal-body--report { padding: 20px 24px; background: var(--raise); }

.report-paper {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 28px 32px;
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 6px 24px color-mix(in srgb, var(--nav-bg) 25%, transparent);
    font-size: 13px;
}

.report-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.report-brand { display: flex; align-items: center; gap: 10px; }
.report-brand path { stroke: var(--accent); }
.report-brand circle { fill: var(--accent); }

.report-brand-name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -0.03em;
}

.report-brand-name span { color: var(--accent-text); }

.report-heading {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    text-align: right;
}

.report-heading h3 { margin: 0; font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.report-heading .mono { font-size: 12px; color: var(--muted); }

.report-info {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 6px 32px;
    margin: 0;
    padding: 12px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.report-info > div { display: flex; gap: 4px; min-width: 0; }
.report-info dt { color: var(--muted); }
.report-info dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

.report-none { margin: 0; color: var(--muted); }

.report-table { width: 100%; border-collapse: collapse; }

.report-table th {
    padding: 0 12px 8px 0;
    border-bottom: 2px solid var(--text);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-align: left;
    color: var(--muted);
}

.report-table td {
    padding: 7px 12px 7px 0;
    border-bottom: 1px solid var(--raise);
    vertical-align: top;
    overflow-wrap: anywhere;
}

.report-table th:last-child, .report-table td:last-child { padding-right: 0; }
.report-table .num { text-align: right; }
.report-table .mono { font-size: 12px; }
.report-table .report-date { width: 92px; color: var(--muted); }

.report-totals {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-self: flex-end;
    width: min(100%, 300px);
    margin: 0;
}

.report-totals > div { display: flex; justify-content: space-between; gap: 16px; }
.report-totals dt { color: var(--muted); }
.report-totals dd { margin: 0; font-size: 12px; }

.report-totals .report-total {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 2px solid var(--text);
    font-weight: 700;
}

.report-totals .report-total dt { color: var(--text); font-size: 14px; }
.report-totals .report-total dd { font-size: 14px; font-weight: 600; }

.report-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 16px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-size: 11px;
    color: var(--muted);
}

.report-foot > div { display: flex; flex-direction: column; gap: 2px; }
.report-foot strong { color: var(--text); font-weight: 600; }

@media (max-width: 600px) {
    .modal-header:has(.modal-header-extra) { flex-wrap: wrap; }
    .modal-header:has(.modal-header-extra) .modal-header-text { flex: 1 1 0; min-width: 0; }
    .modal-header-extra { order: 3; flex-basis: 100%; }
    .report-heading { align-items: flex-start; text-align: left; }
    .modal-body.modal-body--report { padding: 12px; }
    .report-paper { padding: 20px 16px; }
    .report-info { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- invoices and client detail (design: invoices.html, modal-invoice-detail.html, client-detail.html) ---------- */

/* a lone indicator keeps a column's width instead of stretching across the row */
.kpis--fill { grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); }

/* modal title followed by a status chip */
.modal-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* label/value rows of a read-only modal (Invoice detail) */
.facts { margin: 0; display: flex; flex-direction: column; }

.facts > div {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 16px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.facts > div:first-child { border-top: 0; padding-top: 0; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.facts > .facts-block { flex-direction: column; align-items: stretch; }
.facts > .facts-block dd { text-align: left; font-weight: 400; line-height: 1.5; }
.facts-total dt { font-weight: 700; color: var(--text); font-size: 14px; }
.facts-total dd { font-family: var(--font-display); font-size: 20px; font-weight: 700; }

.modal-actions-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* share messages (Copy message, E-mail message): the text to paste, a value with its Copy button */
.share-text {
    margin: 0;
    padding: 12px 14px;
    border-radius: var(--radius-control);
    background: var(--raise);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 50vh;
    overflow-y: auto;
}
.share-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.share-row--head { margin-bottom: 4px; }
.share-value { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--text); }

/* client detail header: back link, avatar, name with status chip */
.detail-head { display: flex; flex-direction: column; gap: 8px; }

.back-link {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: var(--control-height);
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
}

.back-link:hover { color: var(--text); }

.detail-head .page-header { align-items: center; }
.detail-title { display: flex; align-items: center; gap: 16px; min-width: 0; }
.detail-title .page-header-text { min-width: 0; }
.detail-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

.detail-avatar {
    flex: none;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-card);
    background: var(--surface);
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-text);
}

/* main column of cards with the Company details card beside it; stacks when narrow */
.detail-layout { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--block-gap); }
.detail-main { flex: 6 1 560px; min-width: 0; display: flex; flex-direction: column; gap: var(--block-gap); }
.detail-side { flex: 1 1 300px; }

/* stacked label over value (Company details) */
.stacked-facts { margin: 0; padding: 0 20px 8px; display: flex; flex-direction: column; }

.stacked-facts > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.stacked-facts dt {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.stacked-facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.stacked-facts dd.mono, .stacked-facts dd.muted { font-weight: 400; }

/* ---------- Issue NFS-e (design: modal-issue-nfse.html, invoices.html) ---------- */

/* service line under the tomador: system and period on the left, hours × rate on the right */
.service-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    padding: 12px 14px;
    border-radius: var(--radius-control);
    background: var(--raise);
    font-size: 13px;
}

.service-line .mono { white-space: nowrap; }

/* a field error followed by the link that fixes it (Edit client, Open Settings) */
.field-error-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }

.field-link {
    padding: 0;
    border: 0;
    background: none;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-text);
    text-decoration: underline;
    cursor: pointer;
}

.field-link:hover { color: var(--text); }
.field-link:disabled { cursor: default; color: var(--muted); text-decoration: none; }

/* Receita and CEP lookups: the field with its Fetch button, the busy note and the "was:" line under a filled field */
.input-action { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.input-action > :first-child { flex: 1 1 190px; min-width: 0; }
.field-busy { display: inline-flex; align-items: center; gap: 8px; }
.field-busy .spinner { width: 12px; height: 12px; }
.field-was {
    font-size: 12px;
    font-weight: 500;
    font-style: italic;
    color: var(--muted);
}

.alert--info {
    align-items: center;
    border-color: var(--info);
    background: var(--info-soft);
    color: var(--info);
}

.spinner {
    flex: none;
    width: 16px;
    height: 16px;
    box-sizing: border-box;
    border: 2px solid var(--info-soft);
    border-top-color: var(--info);
    border-radius: 50%;
    animation: spinner-turn 0.8s linear infinite;
}

@keyframes spinner-turn { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .spinner { animation-duration: 2.4s; }
}

/* status chip with a note under it ("Stuck since 14:05") */
.status-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.status-note { font-size: 12px; font-weight: 600; color: var(--danger); }

/* a disabled row action keeps its tooltip (a disabled button gets no pointer events) */
.issue-blocked { display: inline-flex; border-radius: var(--radius-control); }

/* Cancel NFS-e: counter next to the hint, and the "After cancelling" radios with their explanation */
.field-hint--split { display: flex; justify-content: space-between; gap: 12px; }
.radio-list { display: flex; flex-direction: column; gap: 10px; }
.radio-option { display: flex; flex-direction: column; gap: 2px; }
.radio-option .field-hint { padding-left: 26px; }

/* Invoice detail: the authorship lines under the facts (muted .field-hint paragraphs) */
.authorship { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.authorship p { margin: 0; }

/* Users page: the per-user History disclosure */
.user-history { padding: 12px 20px; border-top: 1px solid var(--line); }
.user-history summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.user-history ul { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.user-history li { font-size: 13px; }

/* Invoice detail: disabled file buttons with their note, and the attempts history */
.files-pending { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.history { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.history-title { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.history-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.history-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 16px; font-size: 13px; }
.history-files { display: flex; gap: 12px; flex: 1 0 100%; }
.history-files a { text-decoration: none; }
.history-files a:hover { text-decoration: underline; }
.history-message { flex: 1 0 100%; color: var(--muted); overflow-wrap: anywhere; }

/* ---------- expense categories (design: settings.html) ---------- */

.card-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px 20px;
}

.chip--roomy { padding: 8px 14px; font-size: 13px; }

.e-btn.btn-dashed { border-style: dashed; }

.category-add { display: flex; gap: 8px; align-items: flex-start; }
.category-add-input { flex: 1; min-width: 0; }

.category-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    max-height: 460px;
    overflow-y: auto;
}

.category-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.category-row:first-child { border-top: 0; }
.category-row--archived .category-name { color: var(--muted); }

.category-name { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 600; overflow-wrap: anywhere; }

.category-rename { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.category-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.icon-button--small { width: 32px; height: 32px; }
.icon-button:disabled { opacity: 0.4; cursor: default; }

/* ---------- expenses (design: expenses.html, modal-new-expense.html) ---------- */

.split { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 24px; }
.split-main { flex: 6 1 560px; min-width: 0; }
.split-side { flex: 1 1 260px; min-width: 0; }

.cell-overdue { color: var(--danger); }

.category-share-list { display: flex; flex-direction: column; gap: 16px; padding: 0 20px 20px; }
.category-share { display: flex; flex-direction: column; gap: 8px; }

.category-share-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.category-share-name { font-weight: 600; }
.category-share-name span { font-weight: 500; color: var(--muted); }
.category-share-bar { height: 8px; border-radius: 4px; background: var(--raise); }
.category-share-fill { height: 8px; border-radius: 4px; background: var(--accent); }

.inline-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--field);
}

.inline-box-text { flex: 1 1 auto; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }

.link-button {
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-weight: 600;
    color: var(--accent-text);
    cursor: pointer;
}

.link-button:hover { color: var(--text); text-decoration: underline; }

/* A form's submit drawn as a sign-in page link (Access denied's Sign out): keeps the link's size. */
.link-button.auth-link { font-size: 13px; }

/* After :hover, so a disabled link button never lights up. */
.link-button:disabled,
.link-button:disabled:hover {
    color: var(--muted);
    font-weight: 500;
    text-decoration: none;
    cursor: not-allowed;
}

.receipt-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px dashed var(--line);
    background: var(--field);
}

.receipt-box--error { border-color: var(--danger); }
.receipt-box-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 200px; }
.receipt-box-title { font-weight: 600; overflow-wrap: anywhere; }
.receipt-box-hint { font-size: 12px; color: var(--muted); }
.receipt-box-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------- overview (design: overview.html) ---------- */

.chip-dot--bar2 { background: var(--bar2); }

.overview-dashboard { margin-top: 0; }

/* SfDashboardLayout panels carry their own chrome; the card inside is the panel. */
.overview-dashboard .e-panel { background: transparent; border: 0; box-shadow: none; }
.overview-dashboard .e-panel .e-panel-container,
.overview-dashboard .e-panel .e-panel-content { height: 100%; overflow: visible; }

.overview-card { height: 100%; padding: 20px; display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.overview-card .card-header { padding: 0; }
.overview-card--table { padding: 20px 0 0; gap: 12px; }
.overview-card--table .card-header { padding: 0 20px; }

.overview-card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.chart-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .chip-dot { width: 10px; height: 10px; border-radius: 2px; }
.chart-box { flex: 1 1 auto; min-height: 0; }

/* Stacked (SfDashboardLayout MediaQuery, see OverviewPage): the row heights are tuned for the 12-column layout and
   scale with the width, so on narrow screens each panel takes its content's height instead; the inline
   position, size and the container height are set by the component, hence !important. */
@media (max-width: 900px) {
    .overview-dashboard .e-dashboardlayout.e-control { height: auto !important; display: flex; flex-direction: column; gap: 16px; }
    .overview-dashboard .e-panel { position: static !important; width: 100% !important; height: auto !important; }
    .overview-card { height: auto; overflow: visible; }
    .overview-card--table { overflow-x: auto; }
    .chart-box { flex: 0 0 auto; height: 320px; }
}

.split-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; }
.split-bar-fill { background: var(--accent); }
.split-bar-rest { flex: 1 1 0; background: var(--series2); }

.breakdown-rows { display: flex; flex-direction: column; gap: 14px; }
.breakdown-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.breakdown-row > div { display: flex; flex-direction: column; gap: 4px; }
.breakdown-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.breakdown-name .chip-dot { width: 10px; height: 10px; border-radius: 2px; }
.breakdown-detail { font-size: 12px; color: var(--muted); }

.result-block { display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.result-block--small { padding-top: 10px; }
.result-value { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -0.02em; color: var(--accent-text); white-space: nowrap; }
.result-value--small { font-size: 18px; }
.result-value--negative { color: var(--danger); }

.systems-total {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-top: 1px solid var(--line);
}
.systems-total .cell-strong { flex: 1 1 auto; }
.systems-total .mono { font-weight: 600; text-align: right; }
.systems-total-hours { width: 80px; }
.systems-total-amount { width: 116px; }

.pending-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pending-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
}
.pending-text { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.pending-title {
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-weight: 600;
    color: var(--text);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.pending-title:hover { color: var(--accent-text); text-decoration: underline; }
.pending-detail { font-size: 12px; color: var(--muted); }
