/*
 * CCTV Financial Management — visual system refresh
 * Loaded after app.css so the established application structure stays intact.
 */

/* Self-hosted Inter (variable weight axis). Falls back to the system UI stack. */
@font-face {
    font-family: 'InterVariable';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/fonts/inter-latin-wght-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
        U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
        U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'InterVariable';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/fonts/inter-latin-ext-wght-normal.woff2') format('woff2');
    unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF,
        U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --navy-950: #050b18;
    --navy-900: #091529;
    --navy-850: #0d1d35;
    --navy-800: #142946;
    --ink-950: #101828;
    --ink-800: #27364d;
    --ink-700: #42526b;
    --ink-600: #66758c;
    --ink-500: #8491a5;
    --ink-400: #a4afbf;
    --line: #dfe6ef;
    --line-soft: #edf1f6;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --surface-soft: #f6f8fb;
    --canvas: #eef2f7;
    --primary: #496df5;
    --primary-dark: #3454d1;
    --primary-soft: #edf1ff;
    --cyan: #16c7d8;
    --violet: #8b5cf6;
    --orange: #f59e0b;
    --success: #0a9f73;
    --success-soft: #e9f9f3;
    --warning: #c47a0a;
    --warning-soft: #fff7df;
    --danger: #dc4961;
    --danger-soft: #fff0f3;
    --info: #3b82f6;
    --info-soft: #edf5ff;
    --shadow-xs: 0 1px 2px rgba(16, 32, 58, .05);
    --shadow-sm: 0 1px 2px rgba(16, 32, 58, .04), 0 4px 12px rgba(16, 32, 58, .05);
    --shadow-md: 0 6px 16px rgba(16, 32, 58, .06), 0 16px 40px rgba(16, 32, 58, .09);
    --shadow-lg: 0 12px 30px rgba(16, 32, 58, .1), 0 28px 64px rgba(16, 32, 58, .1);
    --shadow-focus: 0 0 0 3px rgba(73, 109, 245, .2);
    --radius-sm: 9px;
    --radius: 13px;
    --radius-lg: 18px;
    --sidebar-width: 278px;
    font-family: 'InterVariable', 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

body {
    font-size: 16px;
    letter-spacing: -.011em;
}

::selection {
    color: #fff;
    background: rgba(73, 109, 245, .9);
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.skip-link {
    position: fixed;
    z-index: 1000;
    top: 12px;
    left: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    color: #fff;
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-160%);
    transition: transform .2s ease;
}

.skip-link:focus {
    color: #fff;
    transform: translateY(0);
}

/* Authentication — confident, spacious and product-specific. */
.guest-body {
    color: var(--ink-950);
    background: var(--navy-950);
}

.guest-shell {
    grid-template-columns: minmax(520px, 1.12fr) minmax(440px, .88fr);
}

.guest-brand {
    isolation: isolate;
    padding: clamp(36px, 5vw, 76px);
    background:
        radial-gradient(circle at 74% 18%, rgba(22, 199, 216, .17), transparent 27%),
        radial-gradient(circle at 8% 82%, rgba(73, 109, 245, .24), transparent 34%),
        linear-gradient(145deg, #050b18 0%, #0a1930 52%, #0b2340 100%);
}

.guest-brand::before {
    opacity: .13;
    background-image:
        linear-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .12) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(circle at 35% 45%, #000, transparent 72%);
}

.guest-brand::after {
    position: absolute;
    z-index: 0;
    right: -16%;
    bottom: -22%;
    width: min(48vw, 650px);
    aspect-ratio: 1;
    border: 1px solid rgba(107, 151, 255, .16);
    border-radius: 50%;
    box-shadow:
        0 0 0 70px rgba(73, 109, 245, .035),
        0 0 0 140px rgba(22, 199, 216, .025);
    content: "";
}

.guest-ambient {
    position: absolute;
    z-index: 0;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.guest-ambient span {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #71e6ee;
    box-shadow: 0 0 18px rgba(113, 230, 238, .9);
    animation: guest-float 7s ease-in-out infinite;
}

.guest-ambient span:nth-child(1) { top: 22%; left: 64%; }
.guest-ambient span:nth-child(2) { top: 66%; left: 16%; width: 5px; height: 5px; animation-delay: -2.4s; }
.guest-ambient span:nth-child(3) { top: 78%; left: 72%; width: 6px; height: 6px; animation-delay: -4.8s; }

@keyframes guest-float {
    0%, 100% { opacity: .45; transform: translateY(0) scale(.85); }
    50% { opacity: 1; transform: translateY(-18px) scale(1); }
}

.brand-mark {
    width: 36px;
    height: 36px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 12px;
    background: linear-gradient(145deg, #5a7cff, #12c6d6);
    box-shadow: 0 12px 28px rgba(29, 111, 238, .3), inset 0 1px 0 rgba(255, 255, 255, .3);
}

.brand-lockup { gap: 13px; }
.brand-lockup strong { font-size: 15px; font-weight: 750; letter-spacing: -.025em; }
.brand-lockup small { margin-top: 2px; color: #8299b5; font-size: 11px; letter-spacing: .14em; }
.brand-lockup-large strong { font-size: 17px; }

.guest-brand-copy {
    max-width: 700px;
    margin: auto 0 0;
    padding: clamp(64px, 9vh, 104px) 0 42px;
}

.guest-kicker {
    gap: 8px;
    padding: 8px 12px;
    border-color: rgba(101, 222, 231, .23);
    color: #91ecf1;
    background: rgba(22, 199, 216, .08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
    font-size: 12px;
}

.guest-kicker::before {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #5ce1e9;
    box-shadow: 0 0 0 4px rgba(92, 225, 233, .1);
    content: "";
}

.guest-brand-copy h1 {
    max-width: 760px;
    margin: 25px 0 22px;
    font-size: clamp(38px, 5vw, 66px);
    font-weight: 720;
    line-height: 1.05;
    letter-spacing: -.03em;
    text-wrap: balance;
}

.guest-brand-copy p {
    max-width: 620px;
    margin-bottom: 0;
    color: #aebed1;
    font-size: clamp(16px, 1.45vw, 19px);
    line-height: 1.7;
}

.guest-capabilities {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    max-width: 720px;
    margin-bottom: clamp(34px, 7vh, 72px);
}

.guest-capability {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 11px;
    padding: 13px;
    border: 1px solid rgba(160, 191, 225, .13);
    border-radius: 14px;
    background: rgba(255, 255, 255, .045);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
    backdrop-filter: blur(12px);
    transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.guest-capability:hover {
    border-color: rgba(111, 212, 230, .26);
    background: rgba(255, 255, 255, .075);
    transform: translateY(-2px);
}

.guest-capability > span {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    color: #8ee8ee;
    background: rgba(22, 199, 216, .11);
}

.guest-capability strong,
.guest-capability small { display: block; }
.guest-capability strong { color: #f6f9ff; font-size: 13px; }
.guest-capability small { margin-top: 2px; overflow: hidden; color: #8297af; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.guest-brand-footer {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.system-ready {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: #aabbd0;
    font-size: 12px;
    font-weight: 650;
}

.system-ready i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #35d59b;
    box-shadow: 0 0 0 5px rgba(53, 213, 155, .09), 0 0 14px rgba(53, 213, 155, .55);
}

.guest-footnote { margin: 0; color: #6f849c; font-size: 12px; }

.guest-content {
    position: relative;
    padding: clamp(28px, 5vw, 76px);
    background:
        radial-gradient(circle at 80% 8%, rgba(73, 109, 245, .08), transparent 24%),
        linear-gradient(145deg, #f8faff, #eef2f8);
}

.guest-content::before {
    position: absolute;
    top: 8%;
    right: 9%;
    width: 110px;
    height: 110px;
    border: 1px solid rgba(73, 109, 245, .1);
    border-radius: 30px;
    content: "";
    transform: rotate(14deg);
}

.guest-card {
    position: relative;
    z-index: 1;
    max-width: 480px;
    padding: clamp(32px, 4.2vw, 52px);
    border-color: rgba(213, 222, 234, .9);
    border-radius: 18px;
    box-shadow: 0 2px 6px rgba(15, 34, 64, .05), 0 18px 48px rgba(15, 34, 64, .12);
}

.guest-card::before {
    position: absolute;
    top: 0;
    right: 32px;
    left: 32px;
    height: 3px;
    border-radius: 0 0 8px 8px;
    background: linear-gradient(90deg, transparent, #5376f6 28%, #19c5d5 72%, transparent);
    content: "";
}

.auth-heading { margin-bottom: 32px; }
.auth-heading h2 { margin: 6px 0 8px; font-size: 29px; font-weight: 740; letter-spacing: -.022em; }
.auth-heading p:last-child { color: var(--ink-600); font-size: 14px; }
.auth-help { margin-top: 26px; padding-top: 22px; color: var(--ink-600); font-size: 12px; line-height: 1.6; }

@media (max-width: 1120px) {
    .guest-shell { grid-template-columns: minmax(440px, 1fr) minmax(410px, .9fr); }
    .guest-capabilities { grid-template-columns: 1fr; max-width: 430px; }
    .guest-brand-copy { padding-top: 58px; }
}

@media (max-width: 980px) {
    .guest-shell { grid-template-columns: 1fr; }
    .guest-brand { display: none; }
    .guest-content { min-height: 100svh; }
}

@media (max-width: 480px) {
    .guest-content { padding: 18px; }
    .guest-card { padding: 30px 23px; border-radius: 16px; }
    .auth-heading h2 { font-size: 27px; }
}

@media (prefers-reduced-motion: reduce) {
    .guest-ambient span { animation: none; }
}

/* Application shell */
.app-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 79% -10%, rgba(73, 109, 245, .095), transparent 28rem),
        radial-gradient(circle at 21% 105%, rgba(22, 199, 216, .055), transparent 30rem),
        var(--canvas);
}

.app-body::before {
    position: fixed;
    z-index: -1;
    inset: 0;
    opacity: .34;
    background-image: linear-gradient(rgba(87, 106, 133, .05) 1px, transparent 1px);
    background-size: 100% 48px;
    pointer-events: none;
    content: "";
    mask-image: linear-gradient(to bottom, #000, transparent 72%);
}

.app-shell {
    margin-left: var(--sidebar-width);
    transition: margin-left .28s cubic-bezier(.2, .8, .2, 1);
}

.sidebar {
    isolation: isolate;
    width: var(--sidebar-width);
    border-right: 1px solid rgba(151, 181, 218, .08);
    background:
        radial-gradient(circle at 42% -4%, rgba(73, 109, 245, .2), transparent 24%),
        linear-gradient(180deg, #050b18 0%, #081528 48%, #091a2e 100%);
    box-shadow: 18px 0 52px rgba(4, 13, 28, .11);
    transition: width .28s cubic-bezier(.2, .8, .2, 1), transform .24s ease;
}

.sidebar::after {
    position: absolute;
    z-index: -1;
    inset: 0;
    opacity: .07;
    background-image:
        linear-gradient(rgba(255, 255, 255, .08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
    content: "";
    mask-image: linear-gradient(to bottom, #000, transparent 64%);
}

.sidebar-glow {
    position: absolute;
    z-index: -1;
    right: -90px;
    bottom: 12%;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(22, 199, 216, .08);
    filter: blur(50px);
    pointer-events: none;
}

.sidebar-head {
    position: relative;
    min-height: 86px;
    padding: 22px 21px;
    border-bottom-color: rgba(255, 255, 255, .075);
}

.sidebar-head-actions { display: flex; align-items: center; gap: 4px; }

.sidebar-collapse {
    position: absolute;
    z-index: 3;
    top: 26px;
    right: -15px;
    display: inline-grid;
    width: 31px;
    height: 31px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink-600);
    background: var(--surface-raised);
    box-shadow: 0 7px 18px rgba(7, 20, 40, .13);
    transition: color .2s ease, transform .28s ease, background .2s ease;
}

.sidebar-collapse:hover {
    color: var(--primary);
    background: var(--surface-raised);
}

.sidebar-nav {
    padding: 18px 13px 28px;
    scrollbar-color: rgba(102, 132, 165, .42) transparent;
}

.nav-section + .nav-section { margin-top: 22px; }
.nav-label { margin: 0 11px 9px; color: #647d99; font-size: 11px; letter-spacing: .14em; }

.nav-link {
    min-height: 46px;
    gap: 11px;
    margin: 3px 0;
    padding: 9px 11px;
    border: 1px solid transparent;
    border-radius: 12px;
    color: #9cafc4;
    font-size: 14px;
    font-weight: 590;
    letter-spacing: -.01em;
    transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease;
}

.nav-link > .icon {
    width: 34px;
    height: 34px;
    padding: 7px;
    border-radius: 10px;
    color: #8fa8c3;
    background: rgba(255, 255, 255, .04);
    transition: color .18s ease, background .18s ease, transform .18s ease;
}

.nav-link:hover {
    color: #f5f8fc;
    border-color: rgba(151, 181, 218, .08);
    background: rgba(255, 255, 255, .055);
    transform: translateX(2px);
}

.nav-link:hover > .icon {
    color: #bfeff1;
    background: rgba(22, 199, 216, .1);
}

.nav-link.is-active {
    color: #fff;
    border-color: rgba(111, 149, 255, .19);
    background: linear-gradient(95deg, rgba(73, 109, 245, .26), rgba(22, 199, 216, .075));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .045), 0 9px 24px rgba(0, 0, 0, .08);
}

.nav-link.is-active::before {
    left: -1px;
    width: 3px;
    height: 25px;
    background: linear-gradient(#6f89ff, #45e0e7);
    box-shadow: 0 0 14px rgba(71, 207, 224, .58);
}

.nav-link.is-active > .icon {
    color: #fff;
    background: linear-gradient(145deg, rgba(94, 124, 255, .75), rgba(22, 199, 216, .44));
    box-shadow: 0 7px 16px rgba(22, 82, 170, .2);
}

.sidebar-foot { padding: 15px; border-top-color: rgba(255, 255, 255, .075); }
.security-note { margin-bottom: 10px; padding: 11px; border-radius: 12px; font-size: 12px; }
.security-note strong { font-size: 12px; }
.security-note small { margin-top: 1px; font-size: 11px; }
.sidebar-user { gap: 11px; padding: 9px; }
.sidebar-user strong { font-size: 13px; }
.sidebar-user small { margin-top: 1px; font-size: 11px; }
.avatar { border-radius: 12px; background: linear-gradient(145deg, #1b4168, #1a3153); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08); }

:root[data-sidebar="collapsed"] { --sidebar-width: 88px; }
:root[data-sidebar="collapsed"] .sidebar-collapse .icon { transform: rotate(180deg); }
:root[data-sidebar="collapsed"] .sidebar-head { justify-content: center; padding-inline: 18px; }
:root[data-sidebar="collapsed"] .brand-lockup > div,
:root[data-sidebar="collapsed"] .nav-label,
:root[data-sidebar="collapsed"] .nav-link > span,
:root[data-sidebar="collapsed"] .security-note > span,
:root[data-sidebar="collapsed"] .sidebar-user > span:last-child { display: none; }
:root[data-sidebar="collapsed"] .sidebar-nav { padding-inline: 12px; overflow-x: visible; }
:root[data-sidebar="collapsed"] .nav-section + .nav-section { margin-top: 13px; padding-top: 13px; border-top: 1px solid rgba(255, 255, 255, .07); }
:root[data-sidebar="collapsed"] .nav-link { justify-content: center; min-height: 48px; padding: 6px; }
:root[data-sidebar="collapsed"] .nav-link:hover { transform: none; }
:root[data-sidebar="collapsed"] .nav-link::after {
    position: absolute;
    z-index: 20;
    left: calc(100% + 14px);
    padding: 8px 10px;
    border: 1px solid rgba(129, 157, 190, .18);
    border-radius: 9px;
    color: #edf5ff;
    background: #101d30;
    box-shadow: 0 12px 30px rgba(2, 9, 20, .24);
    content: attr(data-nav-label);
    font-size: 12px;
    font-weight: 650;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-5px);
    transition: opacity .16s ease, transform .16s ease;
    white-space: nowrap;
}
:root[data-sidebar="collapsed"] .nav-link:hover::after,
:root[data-sidebar="collapsed"] .nav-link:focus-visible::after { opacity: 1; transform: translateX(0); }
:root[data-sidebar="collapsed"] .sidebar-foot { padding-inline: 12px; }
:root[data-sidebar="collapsed"] .security-note,
:root[data-sidebar="collapsed"] .sidebar-user { justify-content: center; padding-inline: 6px; }

/* Top bar, search, menus and navigation feedback */
.topbar {
    height: 82px;
    padding: 0 32px;
    border-bottom: 1px solid rgba(208, 218, 230, .78);
    background: rgba(248, 250, 253, .78);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .7);
    backdrop-filter: blur(20px) saturate(150%);
}

.topbar-left, .topbar-actions { gap: 11px; }

.global-search {
    width: min(43vw, 560px);
    height: 46px;
    padding: 0 14px;
    border-color: rgba(207, 216, 229, .9);
    border-radius: 14px;
    background: rgba(255, 255, 255, .86);
    box-shadow: 0 1px 2px rgba(15, 31, 54, .025), inset 0 1px 0 rgba(255, 255, 255, .8);
}

.global-search:focus-within {
    border-color: rgba(73, 109, 245, .52);
    box-shadow: var(--shadow-focus), 0 8px 22px rgba(25, 45, 78, .06);
}

.global-search input { font-size: 14px; }
.global-search kbd { width: auto; min-width: 42px; padding: 0 7px; border-radius: 7px; font-size: 10px; }

.today-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid rgba(215, 223, 233, .7);
    border-radius: 10px;
    color: var(--ink-600);
    background: rgba(255, 255, 255, .52);
    font-size: 12px;
}

.icon-button {
    border-radius: 11px;
    transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease;
}

.icon-button:active { transform: scale(.94); }
.theme-toggle, .notification-button { width: 40px; height: 40px; border: 1px solid var(--line); background: rgba(255, 255, 255, .88); box-shadow: 0 2px 8px rgba(14, 30, 52, .035); }
.theme-toggle:hover { color: var(--primary); border-color: rgba(73, 109, 245, .25); background: var(--primary-soft); }
.theme-icon { display: grid; place-items: center; }
.theme-icon-sun { display: none; }
[data-theme="dark"] .theme-icon-moon { display: none; }
[data-theme="dark"] .theme-icon-sun { display: grid; }

.profile-button { min-height: 48px; padding: 6px 9px 6px 7px; border-radius: 14px; }
.profile-copy strong { max-width: 150px; font-size: 13px; }
.profile-copy small { margin-top: 1px; font-size: 11px; }

.dropdown-menu {
    display: block;
    padding: 8px;
    border-color: rgba(210, 219, 231, .9);
    border-radius: 13px;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-7px) scale(.98);
    transform-origin: top right;
    transition: opacity .16s ease, transform .16s ease, visibility .16s;
}

.dropdown.is-open .dropdown-menu {
    display: block;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    animation: none;
    transform: translateY(0) scale(1);
}

.dropdown-menu a, .dropdown-menu button { min-height: 39px; border-radius: 10px; font-size: 13px; }
.notification-menu { padding: 0; }
.notification-item { padding: 13px 15px !important; }
.notification-item strong { font-size: 13px; }
.notification-item small { font-size: 12px; }
.dropdown-empty { font-size: 13px; }

.page-progress {
    position: fixed;
    z-index: 1000;
    top: 0;
    right: 0;
    left: 0;
    height: 3px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
}

.page-progress span {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: 0 10px 10px 0;
    background: linear-gradient(90deg, var(--primary), var(--cyan));
    box-shadow: 0 0 14px rgba(22, 199, 216, .6);
    transform: translateX(-105%);
}

.is-navigating .page-progress { opacity: 1; }
.is-navigating .page-progress span { animation: page-progress 1.1s ease-in-out infinite; }
@keyframes page-progress { 0% { transform: translateX(-105%); } 100% { transform: translateX(340%); } }

.ui-toast {
    position: fixed;
    z-index: 1001;
    right: 24px;
    bottom: 24px;
    max-width: min(340px, calc(100vw - 32px));
    padding: 12px 16px 12px 40px;
    border: 1px solid rgba(139, 163, 193, .22);
    border-radius: 13px;
    color: #edf6ff;
    background: rgba(10, 23, 42, .94);
    box-shadow: 0 18px 46px rgba(3, 10, 23, .28);
    font-size: 13px;
    font-weight: 650;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px) scale(.98);
    transition: opacity .2s ease, transform .2s ease;
    backdrop-filter: blur(16px);
}

.ui-toast::before {
    position: absolute;
    top: 50%;
    left: 17px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3bd4b0;
    box-shadow: 0 0 0 5px rgba(59, 212, 176, .12);
    content: "";
    transform: translateY(-50%);
}

.ui-toast.is-visible { opacity: 1; transform: translateY(0) scale(1); }

/* Page hierarchy */
.main-content { max-width: 1660px; padding: 32px 34px 64px; }

.page-header { align-items: center; min-height: 72px; margin-bottom: 25px; }
.page-header h1 { font-size: clamp(27px, 2.3vw, 34px); font-weight: 730; letter-spacing: -.022em; }
.page-header p:not(.eyebrow) { margin-top: 8px; color: var(--ink-600); font-size: 14px; line-height: 1.6; }
.eyebrow { margin-bottom: 6px; color: var(--primary-dark); font-size: 11px; letter-spacing: .13em; }

.dashboard-header {
    position: relative;
    isolation: isolate;
    min-height: 126px;
    padding: 24px 27px;
    overflow: hidden;
    border: 1px solid rgba(97, 131, 211, .24);
    border-radius: 18px;
    color: #fff;
    background:
        radial-gradient(circle at 82% -40%, rgba(64, 223, 226, .22), transparent 38%),
        linear-gradient(118deg, #0b1830 0%, #132c50 58%, #163c58 100%);
    box-shadow: 0 12px 32px rgba(15, 39, 72, .14);
}

.dashboard-header::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    opacity: .05;
    background-image:
        linear-gradient(rgba(255, 255, 255, .18) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .16) 1px, transparent 1px);
    background-size: 46px 46px;
    content: "";
    mask-image: linear-gradient(90deg, transparent, #000 58%, #000);
}

.dashboard-header::after {
    position: absolute;
    z-index: -1;
    top: -95px;
    right: 5%;
    width: 250px;
    height: 250px;
    border: 1px solid rgba(121, 227, 235, .15);
    border-radius: 50%;
    box-shadow: 0 0 0 42px rgba(68, 135, 225, .035), 0 0 0 88px rgba(68, 135, 225, .025);
    content: "";
}

.dashboard-header h1 { color: #fff; }
.dashboard-header .eyebrow { color: #70e0e6; }
.dashboard-header p:not(.eyebrow) { color: #b5c8db; }
.dashboard-header .page-actions { position: relative; z-index: 1; }
.dashboard-header input[type="month"] { border-color: rgba(176, 202, 230, .2); color: #e9f2fa; background: rgba(255, 255, 255, .08); color-scheme: dark; }
.dashboard-header .btn-secondary { border-color: rgba(176, 202, 230, .22); color: #eef6ff; background: rgba(255, 255, 255, .09); }
.dashboard-header .btn-secondary:hover { border-color: rgba(139, 230, 237, .36); color: #fff; background: rgba(255, 255, 255, .14); }

.freshness-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 11px;
    border: 1px solid rgba(142, 207, 224, .16);
    border-radius: 11px;
    color: #b8cddd;
    background: rgba(4, 15, 31, .17);
    font-size: 12px;
    white-space: nowrap;
}

.freshness-indicator i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #3ed5ae;
    box-shadow: 0 0 0 5px rgba(62, 213, 174, .1), 0 0 14px rgba(62, 213, 174, .5);
    animation: status-pulse 2.6s ease-in-out infinite;
}

@keyframes status-pulse { 50% { box-shadow: 0 0 0 8px rgba(62, 213, 174, 0), 0 0 17px rgba(62, 213, 174, .65); } }

/* Buttons and feedback */
.btn {
    min-height: 43px;
    padding: 10px 16px;
    border-radius: 11px;
    font-size: 13px;
    letter-spacing: -.005em;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease, color .16s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #4f72f6, #3557d6);
    box-shadow: 0 5px 14px rgba(53, 87, 214, .18), inset 0 1px 0 rgba(255, 255, 255, .16);
}

.btn-primary:hover { background: linear-gradient(135deg, #5b7cf7, #3a5ddc); box-shadow: 0 8px 20px rgba(53, 87, 214, .24), inset 0 1px 0 rgba(255, 255, 255, .16); }
.btn-secondary { border-color: var(--line); background: rgba(255, 255, 255, .86); box-shadow: 0 1px 2px rgba(15, 31, 54, .03); }

/* Keep the press lift for prominent buttons only; secondary/small buttons stay put. */
.btn:hover { transform: none; }
.btn-primary:hover, .btn-danger:hover, .btn-lg:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.985); }
.btn-sm { min-height: 36px; padding: 8px 11px; font-size: 12px; }
.btn-lg { min-height: 50px; font-size: 14px; }
.btn.is-loading { position: relative; cursor: wait; opacity: .82; }
.btn.is-loading::before { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; content: ""; animation: button-spin .7s linear infinite; }
@keyframes button-spin { to { transform: rotate(360deg); } }

.alert { padding: 15px 46px 15px 15px; border-radius: 14px; font-size: 13px; box-shadow: 0 8px 22px rgba(20, 36, 60, .045); }
.alert-icon { width: 31px; height: 31px; border-radius: 10px; }

/* Layered data surfaces */
.panel {
    position: relative;
    margin-bottom: 20px;
    border-color: rgba(216, 225, 235, .92);
    border-radius: 14px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 1px 2px rgba(16, 32, 58, .04), 0 6px 20px rgba(16, 32, 58, .05);
    transition: border-color .2s ease, box-shadow .2s ease;
}

.panel > * { position: relative; z-index: 1; }
.panel:hover { border-color: rgba(198, 211, 227, .95); box-shadow: 0 2px 6px rgba(16, 32, 58, .04), 0 10px 26px rgba(16, 32, 58, .06); }
.panel-header { min-height: 73px; padding: 18px 21px; border-bottom-color: var(--line-soft); background: linear-gradient(180deg, rgba(250, 252, 255, .7), rgba(255, 255, 255, .18)); border-radius: 14px 14px 0 0; }
.panel-header h2 { display: flex; align-items: center; gap: 9px; font-size: 15.5px; font-weight: 700; letter-spacing: -.017em; }
.panel-header h2::before { display: inline-block; width: 4px; height: 16px; border-radius: 8px; background: linear-gradient(var(--primary), var(--cyan)); content: ""; }
.panel-header p { margin-top: 5px; font-size: 12px; }
.panel-body { padding: 21px; }
.panel-flush > .panel-body { padding: 0; }

.grid { gap: 20px; }
.grid-main-side { grid-template-columns: minmax(0, 1.7fr) minmax(300px, .78fr); }

.kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.kpi-grid:has(> .kpi-card:nth-child(6)) { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.kpi-card {
    --kpi-accent: var(--primary);
    --kpi-soft: rgba(73, 109, 245, .1);
    position: relative;
    min-height: 154px;
    padding: 19px;
    overflow: hidden;
    border-color: rgba(216, 225, 235, .95);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(255, 255, 255, .98), rgba(248, 250, 254, .94));
    box-shadow: 0 1px 2px rgba(16, 32, 58, .04), 0 6px 18px rgba(16, 32, 58, .05);
    transition: transform .2s cubic-bezier(.2, .8, .2, 1), box-shadow .2s ease, border-color .2s ease;
}

.kpi-card::before {
    position: absolute;
    top: 0;
    right: 18px;
    left: 18px;
    height: 3px;
    border-radius: 0 0 7px 7px;
    background: linear-gradient(90deg, transparent, var(--kpi-accent), transparent);
    content: "";
    opacity: .8;
}

.kpi-card::after {
    position: absolute;
    right: -50px;
    bottom: -70px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--kpi-soft), transparent 68%);
    content: "";
    pointer-events: none;
    transition: transform .24s ease, opacity .24s ease;
}

a.kpi-card:hover {
    border-color: color-mix(in srgb, var(--kpi-accent) 26%, var(--line));
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(18, 38, 68, .09);
}
a.kpi-card:hover::after { opacity: 1; transform: scale(1.15); }
.kpi-document { --kpi-accent: #4f73f6; --kpi-soft: rgba(79, 115, 246, .13); }
.kpi-invoice { --kpi-accent: #8b5cf6; --kpi-soft: rgba(139, 92, 246, .13); }
.kpi-target { --kpi-accent: #f29a21; --kpi-soft: rgba(242, 154, 33, .14); }
.kpi-wallet { --kpi-accent: #0db6a0; --kpi-soft: rgba(13, 182, 160, .14); }
.kpi-chart { --kpi-accent: #17a8db; --kpi-soft: rgba(23, 168, 219, .13); }
.kpi-clock, .kpi-alert { --kpi-accent: #e05268; --kpi-soft: rgba(224, 82, 104, .13); }
.kpi-calendar { --kpi-accent: #4f73f6; --kpi-soft: rgba(79, 115, 246, .13); }
.kpi-wrench { --kpi-accent: #f29a21; --kpi-soft: rgba(242, 154, 33, .14); }
.kpi-check { --kpi-accent: #0a9f73; --kpi-soft: rgba(10, 159, 115, .14); }

.kpi-head { position: relative; z-index: 1; }
.kpi-label { color: var(--ink-600); font-size: 13px; font-weight: 650; }
.kpi-visual { display: flex; align-items: center; gap: 5px; }
.kpi-icon { width: 37px; height: 37px; border-radius: 11px; color: var(--kpi-accent); background: var(--kpi-soft); }
.kpi-arrow { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; color: var(--ink-400); transition: color .18s ease, transform .18s ease; }
a.kpi-card:hover .kpi-arrow { color: var(--kpi-accent); transform: translateX(3px); }
.kpi-value { position: relative; z-index: 1; margin-top: 14px; font-size: clamp(23px, 2vw, 29px); font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.025em; }
.kpi-foot { position: relative; z-index: 1; margin-top: 9px; font-size: 12px; }
.metric-change { padding: 3px 7px; border-radius: 7px; }
.kpi-meta { display: block; margin-top: 7px; color: var(--ink-500); font-size: 12px; }

/* Charts and interactive metrics */
.bar-chart { min-height: 250px; gap: 9px; padding-top: 26px; }
.bar-item { gap: 10px; }
.bar-item .bar { min-height: 5px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, #627ffa, #3d66eb 58%, #16b7ce); box-shadow: 0 8px 18px rgba(57, 96, 220, .16); transform-origin: bottom; animation: bar-grow .75s cubic-bezier(.2, .8, .2, 1) both; }
.bar-item:nth-child(2n) .bar { background: linear-gradient(180deg, #6d8bff, #496ff2 55%, #27cbd4); }
.bar-item span { color: var(--ink-500); font-size: 11px; }
.bar:focus-visible { outline: 3px solid rgba(73, 109, 245, .36); outline-offset: 3px; }
@keyframes bar-grow { from { transform: scaleY(.02); opacity: .3; } }

.funnel-row { min-height: 38px; font-size: 13px; }
.funnel-bar { height: 11px; background: linear-gradient(90deg, var(--primary), var(--cyan)); box-shadow: 0 5px 12px rgba(73, 109, 245, .12); }
.progress, .metric-track { height: 8px; background: #e8edf4; }
.progress span, .metric-fill { background: linear-gradient(90deg, var(--primary), var(--cyan)); transition: width .7s cubic-bezier(.2, .8, .2, 1); }
.metric-line { min-height: 32px; font-size: 13px; }
.metric-line strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.stat-row { padding: 13px 0; font-size: 13px; }
.stat-row strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.health-item, .schedule-item, .quick-action { border-radius: 12px; transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease; }
.health-item { min-height: 58px; padding: 11px 12px; }
.health-item:hover, .schedule-item:hover, .quick-action:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(17, 37, 65, .06); }
.health-item strong, .schedule-copy strong { font-size: 13px; }
.health-item small, .schedule-copy small { font-size: 12px; }
.quick-action { min-height: 48px; padding: 12px; font-size: 13px; }

/* Reveal motion is progressive enhancement; content remains visible without JS. */
.will-reveal {
    opacity: 0;
    transform: translateY(12px);
}

.will-reveal.is-revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity .46s ease var(--reveal-delay, 0ms), transform .46s cubic-bezier(.2, .8, .2, 1) var(--reveal-delay, 0ms);
}

/* Tables, filters and forms */
.toolbar { gap: 12px; margin-bottom: 16px; }
.toolbar-group { gap: 9px; }
.filter-form {
    gap: 12px;
    padding: 17px 19px;
    border-bottom: 1px solid var(--line-soft);
    background: linear-gradient(180deg, rgba(247, 249, 252, .9), rgba(251, 252, 254, .7));
}

.table-wrap {
    position: relative;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: #becbdc transparent;
}

.table-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
.table-wrap::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 10px; background: #becbdc; background-clip: padding-box; }
.data-table { font-size: 14px; }
.data-table th {
    position: sticky;
    z-index: 2;
    top: 0;
    padding: 12px 15px;
    border-top: 0;
    border-bottom-color: var(--line);
    color: var(--ink-500);
    background: rgba(247, 249, 252, .96);
    font-size: 11px;
    font-weight: 760;
    letter-spacing: .075em;
    text-transform: uppercase;
    backdrop-filter: blur(10px);
}

.data-table td {
    padding: 15px;
    color: var(--ink-700);
    font-size: 13px;
    transition: background .16s ease, color .16s ease;
}

.data-table tbody tr:hover td,
.data-table tbody tr:focus-within td { background: rgba(73, 109, 245, .045); }
.data-table tbody tr:focus-within td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.data-table a { font-weight: 680; }
.cell-title { color: var(--ink-950); font-size: 13px; font-weight: 700; }
.cell-subtitle { margin-top: 3px; color: var(--ink-500); font-size: 12px; }
.amount { color: var(--ink-950); font-variant-numeric: tabular-nums; font-weight: 690; }
.cell-actions { gap: 6px; }
.pagination-wrap { padding: 16px 19px; border-top-color: var(--line-soft); font-size: 13px; }

.field-group { gap: 7px; }
.field-group label, .label-row label { color: var(--ink-800); font-size: 13px; font-weight: 700; }
.label-row a { font-size: 12px; }
.required { color: var(--danger); }
.field-hint { color: var(--ink-500); font-size: 12px; line-height: 1.5; }
.field-error { margin-top: 6px; font-size: 12px; }

.field-group input,
.field-group select,
.field-group textarea,
.search-input,
.toolbar input,
.toolbar select,
.toolbar-group input,
.toolbar-group select,
.filter-form input,
.filter-form select {
    min-height: 44px;
    border-color: #d5deea;
    border-radius: 11px;
    color: var(--ink-950);
    background: rgba(255, 255, 255, .92);
    font-size: 14px;
    transition: border-color .17s ease, box-shadow .17s ease, background .17s ease;
}

.field-group input:hover,
.field-group select:hover,
.field-group textarea:hover,
.filter-form input:hover,
.filter-form select:hover { border-color: #bdcada; }

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus,
.filter-form input:focus,
.filter-form select:focus,
.search-input:focus {
    border-color: rgba(73, 109, 245, .65);
    background: #fff;
    box-shadow: var(--shadow-focus);
}

.input-with-icon { border-radius: 12px; }
.input-with-icon input { min-height: 46px; padding-left: 43px; }
.input-with-icon > .icon { left: 14px; }
.password-toggle { right: 5px; width: 38px; height: 36px; border-radius: 9px; transition: color .18s, background .18s, transform .18s; }
.password-toggle:hover, .password-toggle.is-visible { color: var(--primary); background: var(--primary-soft); }
.password-toggle span { display: grid; place-items: center; }
.password-toggle .password-icon-hide { display: none; }
.password-toggle.is-visible .password-icon-show { display: none; }
.password-toggle.is-visible .password-icon-hide { display: grid; }
.checkbox-row { gap: 10px; color: var(--ink-700); font-size: 13px; }
.checkbox-row input { width: 17px; height: 17px; accent-color: var(--primary); }
.form-grid { gap: 17px 16px; }
.form-stack { gap: 18px; }
.form-section + .form-section { margin-top: 28px; padding-top: 28px; }
.section-heading h3 { font-size: 16px; }
.section-heading p { font-size: 13px; }
.form-actions { padding: 15px 20px; border-color: var(--line); background: rgba(255, 255, 255, .9); }
.line-item { padding: 13px; border-radius: 13px; background: rgba(247, 249, 252, .8); transition: border-color .18s, box-shadow .18s, transform .18s; }
.line-item:focus-within { border-color: rgba(73, 109, 245, .35); box-shadow: 0 8px 22px rgba(33, 56, 91, .055); }
.line-total { font-size: 13px; font-variant-numeric: tabular-nums; }
.totals-box { padding: 17px; border-radius: 14px; background: linear-gradient(145deg, #f8faff, #f3f6fb); }
.total-row { padding: 7px 0; font-size: 13px; }
.total-row.grand-total { font-size: 15px; }
.total-row.grand-total strong { color: var(--primary-dark); font-size: 20px; }
.file-drop { min-height: 165px; border-radius: 14px; font-size: 13px; background: rgba(248, 250, 253, .82); transition: border-color .18s, background .18s, transform .18s; }
.file-drop:hover, .file-drop.is-dragging { transform: translateY(-2px); }
.input-prefix > span { border-color: #d5deea; border-radius: 11px 0 0 11px; font-size: 13px; }
.input-prefix input { border-radius: 0 11px 11px 0; }
.align-right { text-align: right; }
.input-compact { min-height: 36px !important; padding-block: 6px !important; }

/* Detail, navigation and supporting components */
.detail-hero {
    padding: 22px;
    border-color: rgba(211, 222, 234, .95);
    border-radius: 14px;
    background:
        radial-gradient(circle at 94% 18%, rgba(73, 109, 245, .06), transparent 26%),
        linear-gradient(135deg, #fff, #f7f9fd);
    box-shadow: 0 1px 2px rgba(16, 32, 58, .04), 0 8px 24px rgba(16, 32, 58, .05);
}
.detail-icon { width: 46px; height: 46px; border-radius: 13px; }
.detail-title h1 { font-size: 24px; letter-spacing: -.02em; }
.detail-title p { font-size: 13px; }
.summary-item span { font-size: 11px; }
.summary-item strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.description-list > div { padding: 12px 0; }
.description-list dt { font-size: 12px; }
.description-list dd { font-size: 13px; }
.tabs { padding: 5px; border-radius: 13px; background: #f3f6fa; }
.tab-button { min-height: 38px; padding: 8px 14px; border-radius: 9px; font-size: 13px; }
.tab-button.is-active { color: var(--primary-dark); box-shadow: 0 5px 14px rgba(15, 31, 54, .07); }
.status-badge { gap: 6px; min-height: 27px; padding: 5px 9px; border-radius: 8px; font-size: 11px; font-weight: 740; letter-spacing: .02em; }
.status-dot { width: 6px; height: 6px; box-shadow: 0 0 0 3px currentColor; opacity: .84; }
.empty-state { min-height: 230px; padding: 34px; }
.empty-icon { width: 54px; height: 54px; border-radius: 15px; }
.empty-state h3 { font-size: 16px; }
.empty-state p { font-size: 13px; line-height: 1.6; }
.callout { padding: 15px; border-radius: 13px; font-size: 13px; }
.activity-row { padding: 12px; border-radius: 12px; }
.activity-row strong { font-size: 13px; }
.activity-row small { font-size: 12px; }
.contact-card { padding: 15px; border-radius: 13px; }
.contact-card strong { font-size: 13px; }
.contact-card span { font-size: 12px; }
.timeline-content strong { font-size: 13px; }
.timeline-content p { font-size: 12px; }
.timeline-content time { font-size: 11px; }
.report-grid { gap: 16px; }
.report-card { min-height: 130px; padding: 18px; border-radius: 14px; transition: border-color .18s, transform .18s, box-shadow .18s; }
.report-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(17, 37, 65, .07); }
.report-card strong { font-size: 14px; }
.report-card p { font-size: 12px; line-height: 1.55; }
.report-card small { font-size: 12px; }
.settings-nav { padding: 7px; border-radius: 14px; }
.settings-nav button, .settings-nav a { display: flex; align-items: center; width: 100%; min-height: 42px; gap: 9px; padding: 10px 11px; border: 0; border-radius: 10px; color: var(--ink-600); background: transparent; font-size: 13px; font-weight: 680; text-align: left; cursor: pointer; }
.settings-nav button.is-active, .settings-nav a.is-active { color: var(--primary-dark); background: var(--primary-soft); }
.search-result { padding: 15px; }
.search-result strong { font-size: 13px; }
.search-result small { font-size: 12px; }
.step { font-size: 12px; }
.step-index { width: 28px; height: 28px; }
.code-block { font-size: 12px; }
.score-ring { width: 86px; }
.score-ring strong { font-size: 18px; }
.bar:focus-visible::after {
    position: absolute;
    z-index: 4;
    bottom: calc(100% + 8px);
    left: 50%;
    padding: 6px 8px;
    border-radius: 7px;
    color: #fff;
    background: var(--navy-900);
    box-shadow: 0 8px 20px rgba(3, 12, 27, .2);
    content: attr(data-label);
    font-size: 11px;
    white-space: nowrap;
    transform: translateX(-50%);
}

/* Compact identity is retained on tablet and mobile login. */
.mobile-brand { display: none; width: min(100%, 480px); align-items: center; gap: 12px; margin-bottom: 18px; }
.mobile-brand strong, .mobile-brand small { display: block; }
.mobile-brand strong { color: var(--ink-950); font-size: 15px; }
.mobile-brand small { margin-top: 1px; color: var(--ink-500); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }

/* Dark workspace theme */
[data-theme="dark"] {
    color-scheme: dark;
    --ink-950: #f4f7fb;
    --ink-800: #d9e1ec;
    --ink-700: #b8c4d4;
    --ink-600: #8fa0b6;
    --ink-500: #73859e;
    --ink-400: #60728a;
    --line: #27364d;
    --line-soft: #1d2a3e;
    --surface: #101b2d;
    --surface-raised: #142136;
    --surface-soft: #152238;
    --canvas: #081120;
    --primary: #7892ff;
    --primary-dark: #9bafff;
    --primary-soft: rgba(99, 126, 246, .14);
    --success-soft: rgba(24, 184, 133, .12);
    --warning-soft: rgba(234, 166, 52, .13);
    --danger-soft: rgba(224, 82, 104, .13);
    --info-soft: rgba(61, 133, 246, .14);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .2);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .18), 0 4px 14px rgba(0, 0, 0, .16);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, .24), 0 18px 44px rgba(0, 0, 0, .28);
    --shadow-lg: 0 14px 36px rgba(0, 0, 0, .32), 0 32px 72px rgba(0, 0, 0, .3);
    --shadow-focus: 0 0 0 3px rgba(120, 146, 255, .28);
}

[data-theme="dark"] .app-body {
    background:
        radial-gradient(circle at 78% -8%, rgba(85, 111, 239, .12), transparent 28rem),
        radial-gradient(circle at 18% 108%, rgba(22, 199, 216, .055), transparent 30rem),
        var(--canvas);
}

[data-theme="dark"] .app-body::before { opacity: .15; }
[data-theme="dark"] .topbar { border-bottom-color: rgba(42, 59, 83, .8); background: rgba(8, 17, 32, .76); box-shadow: 0 1px 0 rgba(255, 255, 255, .02); }
[data-theme="dark"] .global-search,
[data-theme="dark"] .theme-toggle,
[data-theme="dark"] .notification-button,
[data-theme="dark"] .today-label { border-color: #27364d; background: rgba(19, 32, 52, .86); }
[data-theme="dark"] .global-search:focus-within { border-color: rgba(120, 146, 255, .52); background: #142136; }
[data-theme="dark"] kbd { border-color: #34445d; color: #91a1b7; background: #17253a; }
[data-theme="dark"] .profile-button:hover { border-color: var(--line); background: var(--surface-soft); }
[data-theme="dark"] .dropdown-menu { border-color: #2a3a52; background: #111d30; }
[data-theme="dark"] .dropdown-menu a:hover,
[data-theme="dark"] .dropdown-menu button:hover { background: #19273c; }
[data-theme="dark"] .notification-item { border-bottom-color: var(--line-soft) !important; }
[data-theme="dark"] .sidebar-collapse { border-color: #30415a; color: #a9b8ca; background: #132136; }

[data-theme="dark"] .panel {
    border-color: rgba(39, 54, 77, .92);
    background: rgba(16, 27, 45, .93);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .16), 0 12px 34px rgba(0, 0, 0, .12);
}
[data-theme="dark"] .panel-header { background: linear-gradient(180deg, rgba(21, 35, 56, .82), rgba(16, 27, 45, .42)); }
[data-theme="dark"] .kpi-card { border-color: rgba(42, 58, 81, .95); background: linear-gradient(145deg, rgba(19, 32, 52, .98), rgba(14, 24, 41, .96)); box-shadow: 0 1px 2px rgba(0, 0, 0, .16), 0 10px 29px rgba(0, 0, 0, .13); }
[data-theme="dark"] a.kpi-card:hover { border-color: color-mix(in srgb, var(--kpi-accent) 32%, #27364d); box-shadow: 0 14px 32px rgba(0, 0, 0, .2); }
[data-theme="dark"] .filter-form,
[data-theme="dark"] .data-table th { background: rgba(20, 33, 53, .95); }
[data-theme="dark"] .data-table tbody tr:hover td,
[data-theme="dark"] .data-table tbody tr:focus-within td { background: rgba(120, 146, 255, .055); }
[data-theme="dark"] .field-group input,
[data-theme="dark"] .field-group select,
[data-theme="dark"] .field-group textarea,
[data-theme="dark"] .search-input,
[data-theme="dark"] .toolbar input,
[data-theme="dark"] .toolbar select,
[data-theme="dark"] .toolbar-group input,
[data-theme="dark"] .toolbar-group select,
[data-theme="dark"] .filter-form input,
[data-theme="dark"] .filter-form select { border-color: #30405a; color: var(--ink-950); background: #111e31; }
[data-theme="dark"] .field-group input:focus,
[data-theme="dark"] .field-group select:focus,
[data-theme="dark"] .field-group textarea:focus,
[data-theme="dark"] .filter-form input:focus,
[data-theme="dark"] .filter-form select:focus,
[data-theme="dark"] .search-input:focus { background: #142238; }
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: #657790; }
[data-theme="dark"] .btn-secondary { border-color: #30405a; color: var(--ink-800); background: #142136; }
[data-theme="dark"] .btn-secondary:hover { border-color: #405470; color: var(--ink-950); background: #19283f; }
[data-theme="dark"] .form-actions { background: rgba(16, 27, 45, .92); }
[data-theme="dark"] .line-item,
[data-theme="dark"] .file-drop,
[data-theme="dark"] .totals-box,
[data-theme="dark"] .activity-row,
[data-theme="dark"] .check-grid .checkbox-row { border-color: var(--line-soft); background: rgba(20, 33, 53, .75); }
[data-theme="dark"] .input-prefix > span { border-color: #30405a; background: #18263b; }
[data-theme="dark"] .detail-hero { border-color: #2a3a52; background: radial-gradient(circle at 92% 20%, rgba(120, 146, 255, .08), transparent 24%), linear-gradient(135deg, #111d30, #0d1829); }
[data-theme="dark"] .tabs { border-color: var(--line); background: #0d1829; }
[data-theme="dark"] .tab-button.is-active { color: #c8d3ff; background: #19273d; }
[data-theme="dark"] .settings-nav { border-color: var(--line); background: #101b2d; }
[data-theme="dark"] .search-result:hover { background: #142136; }
[data-theme="dark"] .step-index { border-color: var(--line); background: #101b2d; }
[data-theme="dark"] .score-ring::before { background: #101b2d; }
[data-theme="dark"] .donut { background: conic-gradient(var(--primary) calc(var(--p)*1%), #26354b 0); }
[data-theme="dark"] .donut::before { background: #101b2d; }
[data-theme="dark"] .health-item { border-color: var(--line-soft); background: rgba(20, 33, 53, .55); }
[data-theme="dark"] .status-neutral { color: #aab8ca; background: #1d2b40; }
[data-theme="dark"] .empty-icon,
[data-theme="dark"] .quick-action,
[data-theme="dark"] .contact-card,
[data-theme="dark"] .schedule-item { border-color: var(--line-soft); background-color: rgba(20, 33, 53, .55); }

/* Responsive refinements */
@media (max-width: 1240px) {
    .kpi-grid:has(> .kpi-card:nth-child(6)) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-main-side { grid-template-columns: minmax(0, 1.35fr) minmax(280px, .82fr); }
}

@media (max-width: 980px) {
    :root, :root[data-sidebar="collapsed"] { --sidebar-width: 278px; }
    .sidebar-collapse { display: none; }
    :root[data-sidebar="collapsed"] .brand-lockup > div,
    :root[data-sidebar="collapsed"] .nav-label,
    :root[data-sidebar="collapsed"] .nav-link > span,
    :root[data-sidebar="collapsed"] .security-note > span,
    :root[data-sidebar="collapsed"] .sidebar-user > span:last-child { display: initial; }
    :root[data-sidebar="collapsed"] .sidebar-head { justify-content: space-between; padding-inline: 21px; }
    :root[data-sidebar="collapsed"] .sidebar-nav { padding: 18px 13px 28px; }
    :root[data-sidebar="collapsed"] .nav-section + .nav-section { margin-top: 22px; padding-top: 0; border-top: 0; }
    :root[data-sidebar="collapsed"] .nav-link { justify-content: flex-start; padding: 9px 11px; }
    :root[data-sidebar="collapsed"] .nav-link::after { display: none; }
    :root[data-sidebar="collapsed"] .security-note,
    :root[data-sidebar="collapsed"] .sidebar-user { justify-content: flex-start; padding: 9px; }
    .topbar { padding-inline: 20px; }
    .main-content { padding: 27px 21px 52px; }
    .grid-main-side { grid-template-columns: 1fr; }
    .guest-content { display: flex; flex-direction: column; align-items: center; justify-content: center; }
    .mobile-brand { display: flex; }
}

@media (max-width: 760px) {
    .topbar { height: 70px; padding-inline: 14px; }
    .main-content { padding: 21px 14px 44px; }
    .global-search { width: min(55vw, 390px); height: 42px; }
    .global-search kbd, .today-label, .profile-copy, .profile-button > .icon { display: none; }
    .dashboard-header { align-items: flex-start; min-height: 0; padding: 22px; }
    .dashboard-header .page-actions { width: 100%; }
    .freshness-indicator { display: none; }
    .kpi-grid,
    .kpi-grid:has(> .kpi-card:nth-child(6)),
    .grid-2,
    .grid-3,
    .grid-4,
    .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpi-card { min-height: 145px; }
    .panel-header { min-height: 0; }
    .data-table th { position: static; }
}

@media (max-width: 520px) {
    .global-search { width: calc(100vw - 176px); }
    .global-search input::placeholder { color: transparent; }
    .theme-toggle, .notification-button { width: 38px; height: 38px; }
    .page-header h1 { font-size: 28px; }
    .dashboard-header { border-radius: 16px; }
    .dashboard-header .toolbar-group { display: grid; grid-template-columns: 1fr auto; width: 100%; }
    .dashboard-header .toolbar-group .btn { width: auto; }
    .kpi-grid,
    .kpi-grid:has(> .kpi-card:nth-child(6)),
    .grid-2,
    .grid-3,
    .grid-4,
    .report-grid,
    .check-grid { grid-template-columns: 1fr; }
    .kpi-card { min-height: 138px; }
    .panel { border-radius: 13px; }
    .panel-header { border-radius: 13px 13px 0 0; }
    .panel-body { padding: 17px; }
    .filter-form { padding: 15px; }
    .data-table td { padding: 13px; }
    .ui-toast { right: 16px; bottom: 16px; left: 16px; max-width: none; }
    .mobile-brand { margin-bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .freshness-indicator i,
    .page-progress span,
    .bar-item .bar { animation: none; }
    .will-reveal { opacity: 1; transform: none; }
}

@media print {
    .theme-toggle, .sidebar-collapse, .page-progress, .ui-toast { display: none !important; }
    .dashboard-header { color: #111; border: 1px solid #bbb; background: #fff; box-shadow: none; }
    .dashboard-header h1, .dashboard-header .eyebrow, .dashboard-header p:not(.eyebrow) { color: #111; }
}

/* Layout corrections after real-world content review */
.sidebar .brand-lockup { max-width: 205px; }
.sidebar .brand-lockup > div { min-width: 0; }
.sidebar .brand-lockup strong { max-width: 150px; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .brand-lockup small { max-width: 155px; overflow: hidden; font-size: 10px; letter-spacing: .11em; text-overflow: ellipsis; white-space: nowrap; }

/* Filters use their content width instead of creating empty grid columns. */
.filter-form {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-form > .field-group {
    flex: 0 1 300px;
    min-width: 210px;
}

.filter-form > .search-input {
    flex: 1 1 300px;
    max-width: 440px;
}

.filter-form > input,
.filter-form > select {
    flex: 0 1 260px;
    width: min(100%, 260px);
}

.filter-form > .btn {
    flex: 0 0 auto;
    min-width: 106px;
}

/* Target KPI */
.target-period-filter {
    padding: 0;
    border: 0;
    background: transparent;
}

.target-period-filter > .field-group { width: min(100%, 310px); }
.targets-form { gap: 20px; }
.targets-form > .panel { margin-bottom: 0; }
.target-panel .panel-header { min-height: 78px; }
.target-table { table-layout: fixed; }
.target-table th:nth-child(1) { width: 20%; }
.target-table th:nth-child(2) { width: 17%; }
.target-table th:nth-child(3) { width: 26%; }
.target-table th:nth-child(4) { width: 18%; }
.target-table th:nth-child(5) { width: 19%; }
.target-sales-table th { width: 25% !important; }
.target-table td { height: 68px; }
.target-table td strong { color: var(--ink-800); font-variant-numeric: tabular-nums; }

.target-input-wrap {
    display: inline-flex;
    align-items: stretch;
    width: min(100%, 240px);
    height: 43px;
    overflow: hidden;
    border: 1px solid #d5deea;
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 31, 54, .025);
    transition: border-color .17s ease, box-shadow .17s ease, background .17s ease;
}

.target-input-wrap:hover { border-color: #bdcada; }
.target-input-wrap:focus-within { border-color: rgba(73, 109, 245, .65); box-shadow: var(--shadow-focus); }
.target-input-wrap > span {
    display: inline-flex;
    align-items: center;
    padding: 0 11px;
    border-right: 1px solid #e0e6ee;
    color: var(--ink-500);
    background: #f6f8fb;
    font-size: 12px;
    font-weight: 750;
}

.target-input {
    min-width: 0;
    width: 100%;
    height: 100%;
    padding: 0 12px;
    border: 0;
    outline: 0;
    color: var(--ink-950);
    background: transparent;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.target-input::placeholder { color: var(--ink-400); }
.target-panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 76px;
    padding: 15px 20px;
    border-top: 1px solid var(--line-soft);
    background: linear-gradient(180deg, rgba(249, 251, 254, .72), rgba(246, 249, 252, .96));
}

.target-panel-footer p {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    color: var(--ink-600);
    font-size: 13px;
}

.target-panel-footer p .icon { color: var(--primary); }
.target-panel-footer .btn { min-width: 190px; }

/* Receivables aging cards have their own content rhythm. */
.summary-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.aging-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.aging-card {
    --aging-accent: #496df5;
    --aging-soft: rgba(73, 109, 245, .1);
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    min-height: 145px;
    padding: 18px;
    overflow: hidden;
    border: 1px solid rgba(216, 225, 235, .95);
    border-radius: 14px;
    color: var(--ink-950);
    background: linear-gradient(145deg, rgba(255, 255, 255, .98), rgba(248, 250, 254, .94));
    box-shadow: 0 1px 2px rgba(16, 32, 58, .04), 0 6px 18px rgba(16, 32, 58, .05);
    transition: color .18s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.aging-card::before {
    position: absolute;
    z-index: -1;
    top: 0;
    right: 15px;
    left: 15px;
    height: 3px;
    border-radius: 0 0 7px 7px;
    background: linear-gradient(90deg, transparent, var(--aging-accent), transparent);
    content: "";
}

.aging-card::after {
    position: absolute;
    z-index: -1;
    right: -60px;
    bottom: -85px;
    width: 170px;
    height: 170px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--aging-soft), transparent 68%);
    content: "";
    transition: transform .2s ease;
}

.aging-tone-1 { --aging-accent: #10b8a5; --aging-soft: rgba(16, 184, 165, .14); }
.aging-tone-2 { --aging-accent: #4d78f6; --aging-soft: rgba(77, 120, 246, .13); }
.aging-tone-3 { --aging-accent: #8b5cf6; --aging-soft: rgba(139, 92, 246, .13); }
.aging-tone-4 { --aging-accent: #f59e0b; --aging-soft: rgba(245, 158, 11, .14); }
.aging-tone-5 { --aging-accent: #e05268; --aging-soft: rgba(224, 82, 104, .14); }
.aging-card:hover { color: var(--ink-950); border-color: color-mix(in srgb, var(--aging-accent) 32%, var(--line)); box-shadow: 0 12px 26px rgba(18, 38, 68, .09); transform: translateY(-2px); }
.aging-card:hover::after { transform: scale(1.13); }
.aging-card.is-active { border-color: color-mix(in srgb, var(--aging-accent) 58%, var(--line)); box-shadow: 0 0 0 3px var(--aging-soft), 0 14px 32px rgba(18, 38, 68, .08); }

.aging-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
}

.aging-label {
    min-width: 0;
    overflow: hidden;
    color: var(--ink-600);
    font-size: 12px;
    font-weight: 720;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aging-arrow {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 25px;
    height: 25px;
    border-radius: 8px;
    color: var(--aging-accent);
    background: var(--aging-soft);
    transition: transform .18s ease;
}

.aging-card:hover .aging-arrow { transform: translateX(2px); }
.aging-value {
    display: block;
    width: 100%;
    margin-top: 15px;
    overflow: hidden;
    color: var(--ink-950);
    font-size: clamp(22px, 1.55vw, 26px);
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.025em;
    line-height: 1.12;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aging-meta { margin-top: auto; padding-top: 11px; color: var(--ink-500); font-size: 12px; }
.collection-filter { min-height: 74px; }
.collection-filter > select { width: min(100%, 290px); }
.collection-panel .table-wrap { border-top: 1px solid var(--line-soft); }

[data-theme="dark"] .target-input-wrap { border-color: #30405a; background: #111e31; }
[data-theme="dark"] .target-input-wrap > span { border-right-color: #30405a; background: #18263b; }
[data-theme="dark"] .target-panel-footer { background: linear-gradient(180deg, rgba(20, 33, 53, .72), rgba(17, 29, 48, .96)); }
[data-theme="dark"] .aging-card { border-color: rgba(42, 58, 81, .95); background: linear-gradient(145deg, rgba(19, 32, 52, .98), rgba(14, 24, 41, .96)); box-shadow: 0 1px 2px rgba(0, 0, 0, .16), 0 10px 29px rgba(0, 0, 0, .13); }
[data-theme="dark"] .aging-card:hover { border-color: color-mix(in srgb, var(--aging-accent) 38%, #27364d); box-shadow: 0 14px 32px rgba(0, 0, 0, .2); }

@media (max-width: 1400px) {
    .aging-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .aging-card { grid-column: span 2; }
    .aging-card:nth-last-child(-n + 2) { grid-column: span 3; }
}

@media (max-width: 900px) {
    .summary-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .aging-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .aging-card, .aging-card:nth-last-child(-n + 2) { grid-column: auto; }
    .target-table { min-width: 820px; }
}

@media (max-width: 620px) {
    .summary-kpi-grid { grid-template-columns: 1fr; }
    .aging-grid { grid-template-columns: 1fr; }
    .aging-card { min-height: 132px; }
    .target-panel-footer { align-items: stretch; flex-direction: column; }
    .target-panel-footer .btn { width: 100%; }
    .filter-form > .field-group,
    .filter-form > .search-input,
    .filter-form > input,
    .filter-form > select,
    .filter-form > .btn { flex-basis: 100%; width: 100%; max-width: none; }
}

/* ------------------------------------------------------------------ *
 * Refinement pass — 2026-09
 * Calmer decoration, tighter typography, consistent radii/shadows.
 * ------------------------------------------------------------------ */

/* Eyebrows and column headers: less shouty tracking, still legible. */
.eyebrow { letter-spacing: .09em; }
.data-table th { font-weight: 700; letter-spacing: .05em; }

/* Panel titles get a slimmer accent tick. */
.panel-header h2::before { width: 3px; height: 14px; }

/* Card top-accent bars: thinner, so a grid of cards reads calmer. */
.kpi-card::before,
.aging-card::before { height: 2px; opacity: .7; }

/* Sidebar active item: keep the emphasis, drop the heavy inner glow. */
.nav-link.is-active { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04); }

/* Inputs and controls settle on the shared radius scale. */
.field-group input,
.field-group select,
.field-group textarea,
.search-input,
.filter-form input,
.filter-form select,
.toolbar input,
.toolbar select,
.btn { border-radius: var(--radius-sm); }

.global-search { border-radius: 12px; }

/* Dropdown/menu motion: shorter, no scale pop. */
.dropdown-menu { transform: translateY(-6px); }
.dropdown.is-open .dropdown-menu { transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
    .nav-link:hover,
    a.kpi-card:hover,
    .aging-card:hover,
    .report-card:hover,
    .guest-capability:hover { transform: none; }
}

/* ------------------------------------------------------------------ *
 * Form refinement pass — 2026-09
 * Reliable 12-column grid, aligned toggles, tidy footers & line items.
 * ------------------------------------------------------------------ */

/* Complete the column set. Anything without a col-* class spans the
   full row instead of collapsing to a single 1/12 track. */
.form-grid > * { grid-column: span 12; }
.form-grid > .col-1 { grid-column: span 1; }
.form-grid > .col-2 { grid-column: span 2; }
.form-grid > .col-3 { grid-column: span 3; }
.form-grid > .col-4 { grid-column: span 4; }
.form-grid > .col-5 { grid-column: span 5; }
.form-grid > .col-6 { grid-column: span 6; }
.form-grid > .col-7 { grid-column: span 7; }
.form-grid > .col-8 { grid-column: span 8; }
.form-grid > .col-9 { grid-column: span 9; }
.form-grid > .col-10 { grid-column: span 10; }
.form-grid > .col-11 { grid-column: span 11; }
.form-grid > .col-12 { grid-column: span 12; }

@media (max-width: 720px) {
    .form-grid > * { grid-column: 1 / -1 !important; }
}

/* Field internals: steadier label rhythm, hints and errors that read
   as one stack under the control. */
.field-group { display: flex; flex-direction: column; }
.field-group > label,
.label-row { margin-bottom: 6px; }
.field-group > .field-hint { margin-top: 6px; }
.field-group > .field-error { margin-top: 6px; }
.field-group textarea { min-height: 88px; }

/* A checkbox that stands in the grid as its own control gets a real
   field box: input height, vertically centred, aligned with siblings. */
.form-grid > .checkbox-row,
.form-grid > .field-group > .checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin: 0;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    font-weight: 600;
}
.form-grid > .field-group > .checkbox-row:only-child { height: 100%; }
.form-grid > .checkbox-row:hover,
.form-grid > .field-group > .checkbox-row:hover { border-color: #c2cfe0; }
.form-grid > .checkbox-row:has(input:checked),
.form-grid > .field-group > .checkbox-row:has(input:checked) {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
    background: var(--primary-soft);
}

/* Repeating sub-rows (invoice custom payment terms). */
.term-rows > .field-hint { margin-bottom: 10px; }
.term-rows > .form-grid + .form-grid { margin-top: 10px; }

/* Footer action bar — works both as a flow child and as a grid child,
   and only bleeds to the edge when it actually sits inside a panel. */
.form-actions {
    margin: 20px 0 0;
    padding: 14px 0;
    border-radius: 0;
    gap: 10px;
}
.form-grid > .form-actions { grid-column: 1 / -1; }
.panel-body .form-actions,
.panel .form-actions {
    margin: 20px -21px -21px;
    padding: 14px 21px;
    border-radius: 0 0 14px 14px;
}
@media (max-width: 520px) {
    .panel-body .form-actions,
    .panel .form-actions { margin: 18px -17px -17px; padding: 13px 17px; }
    .form-actions .btn { flex: 1; }
}

/* Line items: seven real tracks (handle · item · qty · price · desc ·
   total · remove), so nothing wraps, and col-* spans are ignored here. */
.line-items { gap: 10px; }
.line-item {
    grid-template-columns: 22px minmax(178px, 2.4fr) 72px 118px minmax(130px, 1.5fr) 104px 34px;
    align-items: end;
    gap: 6px 10px;
    padding: 12px;
    border-radius: var(--radius-sm);
}
.line-item > .field-group { grid-column: auto; min-width: 0; }
.line-item .field-group > label {
    margin-bottom: 4px;
    color: var(--ink-500);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.line-item ~ .line-item .field-group > label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.line-item ~ .line-item { padding-top: 15px; }
.drag-handle { align-self: end; height: 42px; }
.line-total { align-self: end; height: 42px; font-variant-numeric: tabular-nums; }
.remove-line { align-self: end; width: 34px; height: 42px; }

@media (max-width: 860px) {
    .line-item {
        grid-template-columns: 1fr 1fr 40px;
        align-items: stretch;
        gap: 12px;
        padding: 14px;
    }
    .line-item ~ .line-item { padding-top: 14px; }
    .line-item > .field-group { grid-column: 1 / 3; }
    .line-item > .field-group:nth-of-type(2),
    .line-item > .field-group:nth-of-type(3) { grid-column: auto; }
    .line-item ~ .line-item .field-group > label {
        position: static;
        width: auto;
        height: auto;
        margin: 0 0 4px;
        overflow: visible;
        clip: auto;
    }
    .drag-handle { display: none; }
    .line-total {
        grid-column: 1 / -1;
        align-self: center;
        justify-content: flex-start;
        height: auto;
        font-size: 14px;
        font-weight: 750;
    }
    .remove-line { grid-column: 3; grid-row: 1; align-self: start; }
}

[data-theme="dark"] .form-grid > .checkbox-row,
[data-theme="dark"] .form-grid > .field-group > .checkbox-row {
    border-color: var(--line);
    background: rgba(20, 33, 53, .6);
}
[data-theme="dark"] .form-grid > .checkbox-row:has(input:checked),
[data-theme="dark"] .form-grid > .field-group > .checkbox-row:has(input:checked) {
    border-color: color-mix(in srgb, var(--primary) 40%, var(--line));
    background: var(--primary-soft);
}

/* Access-credential detail: value + reveal/copy row. */
.cred-field {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.cred-label {
    flex: 0 0 84px;
    color: var(--ink-500);
    font-size: 12px;
    font-weight: 700;
}
.cred-value {
    flex: 1 1 160px;
    min-width: 0;
    overflow-x: auto;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    color: var(--ink-950);
    font: 500 13px/1.5 ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    white-space: nowrap;
}
.cred-field .btn { flex: 0 0 auto; }
@media (max-width: 640px) {
    .cred-label { flex-basis: 100%; }
}
