/* ==========================================================================
   Azam CRM — dark solar theme
   Ink black surfaces, solar orange energy. Sora for numbers & headings,
   Manrope for interface text.
   ========================================================================== */

:root {
    --ink: #07080A;
    --surface: #101216;
    --raised: #171A20;
    --raised-2: #1D2128;
    --line: rgba(255, 255, 255, .07);
    --line-strong: rgba(255, 255, 255, .13);

    --sun: #FF7A1A;
    --flare: #FF4D12;
    --amber: #FFB347;
    --sun-soft: rgba(255, 122, 26, .12);
    --sun-glow: rgba(255, 122, 26, .35);

    --text: #F3F1EC;
    --text-2: #C3C5CB;
    --muted: #8C919B;

    --good: #34D399;
    --bad: #FF5C6C;
    --warn: #FFB347;
    --info: #6AB7FF;

    --font-ui: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-display: "Sora", "Manrope", system-ui, sans-serif;

    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 18px;
    --r-xl: 24px;

    --sidebar-w: 268px;
    --sidebar-w-collapsed: 78px;
    --topbar-h: 68px;

    --ease: cubic-bezier(.22, 1, .36, 1);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-ui);
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--text);
    background: var(--ink);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
img, svg { display: block; }

[data-lucide], .lucide { width: 18px; height: 18px; stroke-width: 1.75; flex-shrink: 0; }

:focus-visible {
    outline: 2px solid var(--sun);
    outline-offset: 2px;
    border-radius: 6px;
}

::selection { background: var(--sun); color: #160800; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #262A31; border-radius: 10px; border: 2px solid var(--ink); }
::-webkit-scrollbar-track { background: transparent; }

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

/* --------------------------------------------------------------------------
   Brand mark
   -------------------------------------------------------------------------- */

.brand-mark { width: 38px; height: 38px; display: inline-grid; place-items: center; flex-shrink: 0; }
.brand-mark svg { width: 100%; height: 100%; overflow: visible; }
.brand-core { fill: var(--sun); filter: drop-shadow(0 0 8px var(--sun-glow)); }
.brand-ring {
    fill: none;
    stroke: var(--sun);
    stroke-width: 2;
    stroke-dasharray: 3 5;
    transform-origin: 20px 20px;
    animation: spin 22s linear infinite;
}
.brand-mark.lg { width: 64px; height: 64px; }

@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Buttons, inputs
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 18px;
    border-radius: var(--r-md);
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform .2s var(--ease), box-shadow .25s var(--ease), background .2s, border-color .2s;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(.99); }

.btn-primary {
    position: relative;
    color: #160800;
    background: linear-gradient(135deg, var(--amber) 0%, var(--sun) 45%, var(--flare) 100%);
    box-shadow: 0 8px 24px -8px var(--sun-glow), inset 0 1px 0 rgba(255, 255, 255, .35);
    overflow: hidden;
}
.btn-primary::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%);
    transform: translateX(-120%);
    transition: transform .7s var(--ease);
}
.btn-primary:hover { box-shadow: 0 14px 34px -10px var(--sun-glow), inset 0 1px 0 rgba(255, 255, 255, .35); transform: translateY(-1px); }
.btn-primary:hover::after { transform: translateX(120%); }

.btn-ghost {
    background: var(--raised);
    border-color: var(--line-strong);
    color: var(--text);
}
.btn-ghost:hover { border-color: rgba(255, 122, 26, .45); background: var(--raised-2); }

.btn-block { width: 100%; height: 48px; font-size: 15px; }

.icon-btn {
    position: relative;
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
    transition: border-color .2s, color .2s, background .2s;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); background: var(--raised); }

.link { color: var(--sun); font-weight: 600; font-size: 13px; }
.link:hover { color: var(--amber); }

.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field > span:first-child { font-size: 13px; font-weight: 600; color: var(--text-2); }

.input {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 50px;
    padding: 0 14px;
    border-radius: var(--r-md);
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, .02);
    transition: border-color .2s, box-shadow .25s, background .2s;
}
.input > [data-lucide], .input > .lucide { color: var(--muted); }
.input input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 15px;
}
.input:focus-within {
    border-color: var(--sun);
    background: rgba(255, 122, 26, .04);
    box-shadow: 0 0 0 4px rgba(255, 122, 26, .12);
}
.input:focus-within > .lucide { color: var(--sun); }

.reveal {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin-right: -6px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.reveal:hover { color: var(--text); background: rgba(255, 255, 255, .05); }

.check { display: flex; align-items: center; gap: 10px; margin: 4px 0 24px; color: var(--text-2); font-size: 13.5px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--sun); }

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 20px;
    border-radius: var(--r-md);
    border: 1px solid rgba(255, 92, 108, .35);
    background: rgba(255, 92, 108, .08);
    color: #FFC2C8;
    font-size: 13.5px;
}
.alert .lucide { color: var(--bad); margin-top: 1px; }

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */

.login-body { min-height: 100vh; overflow-x: hidden; }

.login {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(380px, .85fr);
    min-height: 100vh;
}

.login-visual {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    padding: 64px;
    background:
        radial-gradient(120% 80% at 70% 30%, rgba(255, 77, 18, .14), transparent 60%),
        var(--ink);
    border-right: 1px solid var(--line);
}

/* Solar panel grid receding into the horizon */
.grid-floor {
    position: absolute;
    left: -20%;
    right: -20%;
    bottom: -10%;
    height: 60%;
    background-image:
        linear-gradient(rgba(255, 122, 26, .16) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 122, 26, .16) 1px, transparent 1px);
    background-size: 64px 64px;
    transform: perspective(600px) rotateX(62deg);
    transform-origin: center top;
    mask-image: linear-gradient(to bottom, transparent 0%, #000 35%, #000 70%, transparent 100%);
    animation: floor 6s linear infinite;
}
@keyframes floor { to { background-position: 0 64px, 0 0; } }

/* The sun */
.corona {
    position: absolute;
    top: 14%;
    right: 12%;
    width: min(46vw, 560px);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
}
.corona-core {
    width: 34%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #FFE1B8 0%, var(--amber) 22%, var(--sun) 52%, var(--flare) 100%);
    box-shadow:
        0 0 60px 10px rgba(255, 122, 26, .55),
        0 0 160px 40px rgba(255, 77, 18, .28);
    animation: pulse 5s ease-in-out infinite;
}
.corona-ring {
    position: absolute;
    border-radius: 50%;
    inset: 0;
}
.corona-ring.r1 {
    inset: 18%;
    background: conic-gradient(from 0deg, transparent 0 60%, rgba(255, 179, 71, .55) 75%, transparent 90%);
    mask: radial-gradient(circle, transparent 62%, #000 63%, #000 66%, transparent 67%);
    animation: spin 14s linear infinite;
}
.corona-ring.r2 {
    inset: 6%;
    border: 1px dashed rgba(255, 122, 26, .35);
    animation: spin 60s linear infinite reverse;
}
.corona-ring.r3 {
    inset: -4%;
    background: conic-gradient(from 90deg, transparent 0 40%, rgba(255, 77, 18, .35) 55%, transparent 70%);
    mask: radial-gradient(circle, transparent 69%, #000 70%, #000 70.6%, transparent 71%);
    animation: spin 26s linear infinite;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.04); filter: brightness(1.12); }
}

.login-copy { position: relative; z-index: 2; max-width: 520px; }
.login-copy h1 {
    margin: 22px 0 12px;
    font-family: var(--font-display);
    font-size: clamp(40px, 5vw, 64px);
    font-weight: 600;
    letter-spacing: -.035em;
    line-height: 1;
}
.login-copy p { margin: 0; color: var(--text-2); font-size: 16px; max-width: 44ch; }

.flow-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 32px 0 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}
.flow-strip li {
    position: relative;
    padding: 7px 14px 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: rgba(16, 18, 22, .7);
    backdrop-filter: blur(6px);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-2);
}
.flow-strip li:not(:last-child)::after {
    content: "";
    position: absolute;
    right: -9px;
    top: 50%;
    width: 9px;
    height: 1px;
    background: var(--sun);
}

.login-panel {
    display: grid;
    place-items: center;
    padding: 48px 32px;
    background:
        radial-gradient(80% 60% at 100% 0%, rgba(255, 122, 26, .07), transparent 60%),
        var(--surface);
}
.login-card { width: 100%; max-width: 400px; }
.login-card h2 {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 600;
    letter-spacing: -.02em;
}
.login-card > .muted { margin: 0 0 28px; }
.login-foot { margin: 22px 0 0; text-align: center; color: var(--muted); font-size: 12.5px; }

@media (max-width: 960px) {
    .login { grid-template-columns: 1fr; }
    .login-visual { min-height: 340px; padding: 40px 28px; border-right: 0; border-bottom: 1px solid var(--line); }
    .corona { top: -12%; right: -18%; width: 420px; }
    .login-copy p { font-size: 15px; }
}

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

.app-body {
    background:
        radial-gradient(60% 50% at 100% 0%, rgba(255, 122, 26, .07), transparent 60%),
        var(--ink);
    background-attachment: fixed;
}

.shell { display: flex; min-height: 100vh; }

.sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w);
    height: 100vh;
    flex-shrink: 0;
    background: linear-gradient(180deg, #0C0E11 0%, #0A0B0E 100%);
    border-right: 1px solid var(--line);
    transition: width .35s var(--ease), transform .35s var(--ease);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--topbar-h);
    padding: 0 20px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}
.brand-text { display: grid; min-width: 0; }
.brand-text strong { font-family: var(--font-display); font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.brand-text small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav { flex: 1; overflow-y: auto; padding: 14px 12px 20px; }
.nav-group + .nav-group { margin-top: 18px; }
.nav-heading {
    margin: 0 0 6px;
    padding: 0 12px;
    font-size: 11.5px;
    font-weight: 600;
    color: #5E636D;
    white-space: nowrap;
}

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 40px;
    padding: 0 12px;
    margin: 2px 0;
    border-radius: 10px;
    color: var(--text-2);
    font-weight: 500;
    white-space: nowrap;
    transition: background .2s, color .2s;
}
.nav-link .lucide { color: #6C717B; transition: color .2s; }
.nav-link:hover { background: rgba(255, 255, 255, .04); color: var(--text); }
.nav-link:hover .lucide { color: var(--text-2); }

.nav-link.is-active {
    color: var(--text);
    background: linear-gradient(90deg, rgba(255, 122, 26, .16), rgba(255, 122, 26, .02));
}
.nav-link.is-active .lucide { color: var(--sun); }
.nav-link.is-active::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--sun);
    box-shadow: 0 0 12px var(--sun-glow);
}

.nav-badge {
    margin-left: auto;
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--sun);
    color: #160800;
    font-style: normal;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.sidebar-foot { padding: 14px 16px; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 12px; min-width: 0; }
.me-text { display: grid; min-width: 0; }
.me-text strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.avatar {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--sun), var(--flare));
    color: #160800;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13px;
}
.avatar.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 12px; }

/* Collapsed sidebar (desktop) */
.shell.is-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
.shell.is-collapsed .brand { padding: 0 20px; }
.shell.is-collapsed .brand-text,
.shell.is-collapsed .nav-heading,
.shell.is-collapsed .nav-link span,
.shell.is-collapsed .nav-badge,
.shell.is-collapsed .me-text { display: none; }
.shell.is-collapsed .nav-link { justify-content: center; padding: 0; }
.shell.is-collapsed .nav-group + .nav-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.shell.is-collapsed .me { justify-content: center; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* --------------------------------------------------------------------------
   Topbar
   -------------------------------------------------------------------------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 14px;
    height: var(--topbar-h);
    padding: 0 28px;
    background: rgba(7, 8, 10, .72);
    backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--line);
}

.search {
    display: flex;
    align-items: center;
    gap: 10px;
    width: min(420px, 100%);
    height: 42px;
    padding: 0 12px;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    transition: border-color .2s, box-shadow .25s;
}
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.search input::placeholder { color: #666B75; }
.search:focus-within { border-color: rgba(255, 122, 26, .55); box-shadow: 0 0 0 4px rgba(255, 122, 26, .1); }
.search kbd {
    padding: 2px 7px;
    border-radius: 6px;
    border: 1px solid var(--line-strong);
    font-family: var(--font-ui);
    font-size: 11px;
    color: var(--muted);
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.company-switch {
    position: relative;
    display: flex;
    align-items: center;
    height: 42px;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: var(--surface);
    transition: border-color .2s;
}
.company-switch:hover { border-color: var(--line-strong); }
.company-switch > .lucide:first-child { position: absolute; left: 12px; color: var(--sun); pointer-events: none; }
.company-switch .chev { position: absolute; right: 10px; color: var(--muted); pointer-events: none; width: 16px; height: 16px; }
.company-switch select {
    appearance: none;
    height: 100%;
    max-width: 240px;
    padding: 0 34px 0 40px;
    border: 0;
    outline: 0;
    background: transparent;
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
}
.company-switch select option { background: var(--raised); color: var(--text); }

.bell .dot {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--sun);
    color: #160800;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 19px;
    text-align: center;
    box-shadow: 0 0 0 3px var(--ink);
}

.dropdown { position: relative; }
.user-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 42px;
    padding: 0 8px 0 5px;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
}
.user-btn:hover { border-color: var(--line-strong); }
.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: 240px;
    padding: 6px;
    border-radius: var(--r-md);
    border: 1px solid var(--line-strong);
    background: var(--raised);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(.98);
    transform-origin: top right;
    transition: opacity .2s, transform .25s var(--ease), visibility .2s;
}
.dropdown.is-open .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-head { display: grid; padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.dropdown-head small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: var(--text-2);
}
.dropdown-item:hover { background: rgba(255, 255, 255, .05); color: var(--text); }

/* --------------------------------------------------------------------------
   Content
   -------------------------------------------------------------------------- */

.content { flex: 1; width: 100%; max-width: 1480px; margin: 0 auto; padding: 32px 28px 56px; }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}
.page-date { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.page-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(26px, 3vw, 34px);
    font-weight: 600;
    letter-spacing: -.03em;
    line-height: 1.1;
}
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.panel {
    position: relative;
    padding: 24px;
    border-radius: var(--r-lg);
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 40%), var(--surface);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel-head h2 { margin: 0; font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.panel-head p { margin: 4px 0 0; font-size: 13px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 20px; }

/* KPI cards */
.kpis { display: grid; grid-template-columns: 1.3fr repeat(3, 1fr); gap: 20px; margin-bottom: 20px; }

.kpi {
    position: relative;
    padding: 22px;
    border-radius: var(--r-lg);
    border: 1px solid var(--line);
    background: var(--surface);
    overflow: hidden;
    transition: border-color .3s;
}
.kpi:hover { border-color: var(--line-strong); }
.kpi-top { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.kpi-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--sun-soft);
    color: var(--sun);
}
.kpi-label { color: var(--text-2); font-weight: 600; font-size: 13.5px; }
.kpi-value {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(22px, 2.2vw, 28px);
    font-weight: 600;
    letter-spacing: -.03em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.kpi-sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.kpi-sub .up, .kpi-sub .down { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.kpi-sub .up { color: var(--good); }
.kpi-sub .down { color: var(--bad); }
.kpi-sub .lucide { width: 14px; height: 14px; }

/* The hero card carries the sun */
.kpi-hero {
    border-color: rgba(255, 122, 26, .3);
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(255, 122, 26, .22), transparent 55%),
        linear-gradient(160deg, #1A1410 0%, var(--surface) 60%);
}
.kpi-hero::after {
    content: "";
    position: absolute;
    right: -60px;
    top: -60px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 1px dashed rgba(255, 122, 26, .35);
    animation: spin 40s linear infinite;
}
.kpi-hero .kpi-icon { background: var(--sun); color: #160800; box-shadow: 0 0 22px var(--sun-glow); }
.kpi-hero .kpi-value { font-size: clamp(26px, 2.8vw, 36px); }

/* --------------------------------------------------------------------------
   Order flow — the signature element
   -------------------------------------------------------------------------- */

.flow {
    position: relative;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* The energy line running through every stage */
.flow::before,
.flow::after {
    content: "";
    position: absolute;
    left: 10%;
    right: 10%;
    top: 27px;
    height: 2px;
    border-radius: 2px;
}
.flow::before { background: rgba(255, 122, 26, .16); }
.flow::after {
    background: linear-gradient(90deg, transparent 0%, var(--amber) 45%, var(--sun) 50%, transparent 55%);
    background-size: 220% 100%;
    animation: current 3.4s linear infinite;
    filter: drop-shadow(0 0 6px var(--sun-glow));
}
@keyframes current { from { background-position: 120% 0; } to { background-position: -120% 0; } }

.flow-stage { position: relative; z-index: 1; }
.flow-stage a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 6px 6px;
    border-radius: var(--r-md);
}
.flow-node {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin-bottom: 14px;
    border-radius: 50%;
    border: 1px solid rgba(255, 122, 26, .4);
    background: radial-gradient(circle at 50% 30%, #2A1D14, var(--ink));
    color: var(--sun);
    box-shadow: 0 0 0 6px var(--surface);
    transition: transform .35s var(--ease), box-shadow .35s var(--ease), background .3s;
}
.flow-node .lucide { width: 22px; height: 22px; }
.flow-stage a:hover .flow-node {
    transform: translateY(-3px);
    background: radial-gradient(circle at 50% 30%, var(--amber), var(--sun) 60%, var(--flare));
    color: #160800;
    box-shadow: 0 0 0 6px var(--surface), 0 10px 30px -6px var(--sun-glow);
}
.flow-count {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 600;
    letter-spacing: -.03em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.flow-label { margin-top: 6px; font-weight: 700; font-size: 13.5px; }
.flow-hint { margin-top: 2px; font-size: 12px; color: var(--muted); }

/* --------------------------------------------------------------------------
   Lists inside panels
   -------------------------------------------------------------------------- */

.chart-wrap { position: relative; height: 260px; }

.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sw-sun { background: var(--sun); box-shadow: 0 0 8px var(--sun-glow); }
.sw-steel { background: #5B6170; }

.alert-row {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}
.alert-row:first-of-type { border-top: 0; padding-top: 0; }
.alert-row p { margin: 0; font-size: 13.5px; }
.alert-row small { color: var(--muted); font-size: 12px; }
.sev-dot { width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; flex-shrink: 0; background: var(--info); }
.sev-warning .sev-dot { background: var(--warn); box-shadow: 0 0 8px rgba(255, 179, 71, .6); }
.sev-critical .sev-dot { background: var(--bad); box-shadow: 0 0 8px rgba(255, 92, 108, .6); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }

.balance-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}
.balance-row:first-of-type { border-top: 0; padding-top: 0; }
.balance-row .avatar { background: var(--raised-2); color: var(--sun); }
.balance-name { flex: 1; min-width: 0; }
.balance-name p { margin: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.balance-name small { color: var(--muted); font-size: 12px; }
.balance-row strong { font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; display: flex; gap: 14px; padding: 0 0 16px; }
.timeline li:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 14px;
    bottom: 0;
    width: 1px;
    background: var(--line-strong);
}
.timeline p { margin: 0; font-size: 13.5px; }
.timeline small { color: var(--muted); font-size: 12px; }
.tl-dot { width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; flex-shrink: 0; background: #5B6170; }
.tl-dot.act-login { background: var(--good); }
.tl-dot.act-created { background: var(--sun); }
.tl-dot.act-approved { background: var(--amber); }
.tl-dot.act-deleted { background: var(--bad); }
.empty-inline { color: var(--muted); }

.empty { display: grid; justify-items: center; text-align: center; padding: 24px 12px; }
.empty-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin-bottom: 12px;
    border-radius: 16px;
    background: var(--sun-soft);
    color: var(--sun);
}
.empty p { margin: 0; }
.empty p + p { margin-top: 4px; max-width: 38ch; font-size: 13px; }

/* --------------------------------------------------------------------------
   Placeholder module screen
   -------------------------------------------------------------------------- */

.building { display: flex; gap: 32px; align-items: flex-start; padding: 40px; overflow: hidden; }
.building::after {
    content: "";
    position: absolute;
    right: -120px;
    bottom: -120px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    border: 1px dashed rgba(255, 122, 26, .25);
    animation: spin 60s linear infinite;
    pointer-events: none;
}
.building-icon {
    display: grid;
    place-items: center;
    width: 88px;
    height: 88px;
    border-radius: 24px;
    flex-shrink: 0;
    background: radial-gradient(circle at 50% 30%, var(--amber), var(--sun) 55%, var(--flare));
    color: #160800;
    box-shadow: 0 18px 50px -12px var(--sun-glow);
}
.building-icon .lucide { width: 38px; height: 38px; stroke-width: 1.6; }
.building-body h2 { margin: 0 0 8px; font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.lead { margin: 0 0 22px; color: var(--text-2); font-size: 15.5px; max-width: 60ch; }
.feature-list { display: grid; gap: 10px; margin: 0 0 28px; padding: 0; list-style: none; }
.feature-list li { display: flex; align-items: center; gap: 10px; color: var(--text-2); }
.feature-list .lucide { color: var(--sun); }

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--r-md);
    border: 1px solid rgba(255, 122, 26, .4);
    background: var(--raised);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
    font-weight: 600;
    font-size: 13.5px;
}
.toast .lucide { color: var(--sun); }

.scrim {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s, visibility .3s;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1280px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        box-shadow: 30px 0 60px rgba(0, 0, 0, .5);
    }
    .shell.is-open .sidebar { transform: none; }
    .shell.is-open ~ .scrim { opacity: 1; visibility: visible; }
    .shell.is-collapsed .sidebar { width: var(--sidebar-w); }
    .shell.is-collapsed .brand-text,
    .shell.is-collapsed .nav-heading,
    .shell.is-collapsed .nav-link span,
    .shell.is-collapsed .me-text { display: revert; }
    .shell.is-collapsed .nav-link { justify-content: flex-start; padding: 0 12px; }
    .grid-2 { grid-template-columns: 1fr; }
    .flow { grid-template-columns: repeat(5, minmax(120px, 1fr)); overflow-x: auto; padding-bottom: 6px; }
}

@media (max-width: 720px) {
    .topbar { padding: 0 16px; gap: 10px; }
    .search { display: none; }
    .company-switch select { max-width: 150px; }
    .content { padding: 24px 16px 48px; }
    .kpis { grid-template-columns: 1fr; }
    .panel { padding: 20px; }
    .building { flex-direction: column; padding: 28px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* ==========================================================================
   Phase 2 — lists, forms, badges, documents
   ========================================================================== */

/* ---------- Summary strip above lists */
.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
    padding: 16px 18px;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: var(--surface);
}
.stat span { display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stat strong { display: block; margin-top: 4px; font-family: var(--font-display); font-size: 21px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); font-size: 12px; }
.stat.is-sun { border-color: rgba(255, 122, 26, .3); background: radial-gradient(120% 120% at 100% 0%, rgba(255, 122, 26, .14), transparent 60%), var(--surface); }
.stat.is-sun strong { color: var(--amber); }

/* ---------- Toolbar: search + filters */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.toolbar .search { width: min(340px, 100%); display: flex; }
.toolbar .spacer { flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
    transition: border-color .2s, color .2s, background .2s;
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip.is-active { color: #160800; background: var(--sun); border-color: var(--sun); }
.chip em { font-style: normal; opacity: .7; }

.select, .control {
    height: 42px;
    padding: 0 12px;
    border-radius: var(--r-md);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--text);
    outline: 0;
    transition: border-color .2s, box-shadow .25s;
}
.select:focus, .control:focus { border-color: var(--sun); box-shadow: 0 0 0 4px rgba(255, 122, 26, .12); }
.select option { background: var(--raised); }
textarea.control { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.55; resize: vertical; }

/* ---------- Data table */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    position: sticky;
    top: 0;
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    background: #0D0F12;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: rgba(255, 255, 255, .025); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .strong { font-weight: 700; color: var(--text); }
.table .sub { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.table a.row-link { font-weight: 700; color: var(--text); }
.table a.row-link:hover { color: var(--sun); }
.table .mono { font-family: var(--font-display); font-size: 12.5px; font-weight: 600; letter-spacing: -.01em; color: var(--amber); white-space: nowrap; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.row-actions .icon-btn { width: 34px; height: 34px; border-radius: 9px; }

/* ---------- Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
    background: rgba(255, 255, 255, .06);
    color: var(--text-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.b-draft { color: #A9AEB8; }
.badge.b-sent { color: var(--info); background: rgba(106, 183, 255, .1); }
.badge.b-accepted, .badge.b-paid, .badge.b-active { color: var(--good); background: rgba(52, 211, 153, .1); }
.badge.b-converted { color: var(--amber); background: rgba(255, 179, 71, .12); }
.badge.b-rejected, .badge.b-overdue, .badge.b-inactive { color: var(--bad); background: rgba(255, 92, 108, .1); }
.badge.b-expired { color: #C9925B; background: rgba(201, 146, 91, .12); }
.badge.b-issued, .badge.b-partially_paid { color: var(--warn); background: rgba(255, 179, 71, .1); }
.badge.b-manufactured { color: var(--sun); background: var(--sun-soft); }
.badge.b-traded { color: var(--info); background: rgba(106, 183, 255, .1); }
.badge.b-service { color: #C79BFF; background: rgba(199, 155, 255, .1); }

/* ---------- Pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; color: var(--muted); font-size: 13px; }
.pager-links { display: flex; gap: 6px; }
.pager-links a, .pager-links span {
    display: inline-grid;
    place-items: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-weight: 600;
    color: var(--text-2);
}
.pager-links a:hover { border-color: var(--line-strong); color: var(--text); }
.pager-links .is-current { background: var(--sun); border-color: var(--sun); color: #160800; }
.pager-links .is-disabled { opacity: .4; }

/* ---------- Forms */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.form-layout.single { grid-template-columns: minmax(0, 880px); }
.form-section + .form-section { margin-top: 20px; }
.form-section h2 { margin: 0 0 4px; font-family: var(--font-display); font-size: 16px; font-weight: 600; }
.form-section > .muted { margin: 0 0 18px; font-size: 13px; }

.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fields .span-2 { grid-column: span 2; }
.fields .span-all { grid-column: 1 / -1; }

.f { display: grid; gap: 7px; min-width: 0; }
.f > label, .f > .label { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.f .hint { font-size: 12px; color: var(--muted); }
.f .control, .f .select { width: 100%; }
.f.has-error .control, .f.has-error .select { border-color: var(--bad); }
.err { color: #FF9AA5; font-size: 12px; }

.form-errors {
    margin-bottom: 20px;
    padding: 14px 16px;
    border-radius: var(--r-md);
    border: 1px solid rgba(255, 92, 108, .35);
    background: rgba(255, 92, 108, .07);
    color: #FFC2C8;
    font-size: 13.5px;
}
.form-errors strong { display: block; margin-bottom: 6px; color: var(--text); }
.form-errors ul { margin: 0; padding-left: 18px; }

.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--text-2); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .track {
    position: relative;
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background: #2A2E36;
    transition: background .25s;
}
.toggle .track::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform .3s var(--ease);
}
.toggle input:checked + .track { background: var(--sun); }
.toggle input:checked + .track::after { transform: translateX(18px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--sun); outline-offset: 2px; }

.segmented { display: inline-flex; padding: 4px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--ink); }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; padding: 8px 14px; border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--muted); transition: background .2s, color .2s; }
.segmented input:checked + span { background: var(--sun); color: #160800; }
.segmented input:focus-visible + span { outline: 2px solid var(--sun); }

.sticky-side { position: sticky; top: calc(var(--topbar-h) + 20px); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.form-actions .btn { flex: 1; }

/* ---------- Repeaters (contacts, line items) */
.repeater { display: grid; gap: 10px; }
.repeat-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr 1.2fr auto auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .015);
}
.radio-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.radio-dot input { accent-color: var(--sun); }
.btn-add {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    border-radius: var(--r-md);
    border: 1px dashed rgba(255, 122, 26, .45);
    background: rgba(255, 122, 26, .04);
    color: var(--sun);
    font-weight: 700;
    cursor: pointer;
}
.btn-add:hover { background: rgba(255, 122, 26, .1); }
.btn-x {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.btn-x:hover { color: var(--bad); border-color: rgba(255, 92, 108, .4); background: rgba(255, 92, 108, .08); }
.btn-x svg { width: 16px; height: 16px; }

.line-items { display: grid; gap: 12px; }
.line {
    position: relative;
    padding: 14px;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .015);
    transition: border-color .2s;
}
.line:focus-within { border-color: rgba(255, 122, 26, .4); }
.line-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.line-no {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: var(--sun-soft);
    color: var(--sun);
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.line-head .select { flex: 1; height: 38px; }
.line-grid { display: grid; grid-template-columns: 2fr 0.7fr 0.6fr 1fr 0.8fr 0.7fr 1fr; gap: 10px; align-items: end; }
.line-grid .f > label { font-size: 11.5px; color: var(--muted); }
.line-grid .control { height: 38px; }
.line-desc { margin-top: 10px; }
.line-desc textarea.control { min-height: 44px; height: 44px; }
.line-total { height: 38px; display: flex; align-items: center; justify-content: flex-end; font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Totals card */
.totals { display: grid; gap: 10px; font-size: 14px; }
.totals div { display: flex; justify-content: space-between; gap: 12px; color: var(--text-2); }
.totals div strong { color: var(--text); font-variant-numeric: tabular-nums; }
.totals .grand {
    margin-top: 6px;
    padding-top: 14px;
    border-top: 1px dashed var(--line-strong);
    font-weight: 700;
    color: var(--text);
}
.totals .grand strong { font-family: var(--font-display); font-size: 24px; letter-spacing: -.02em; color: var(--amber); }
.doc-number { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--amber); letter-spacing: -.01em; }

/* ---------- Detail pages */
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.detail-head .crumbs { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.detail-head .crumbs a:hover { color: var(--sun); }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-sm { height: 38px; padding: 0 14px; font-size: 13px; }
.btn-danger { background: transparent; border-color: rgba(255, 92, 108, .35); color: #FF9AA5; }
.btn-danger:hover { background: rgba(255, 92, 108, .1); }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.kv { display: grid; gap: 12px; margin: 0; }
.kv div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }

.contact-card { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.contact-card:first-of-type { border-top: 0; padding-top: 0; }
.contact-card p { margin: 0; font-weight: 600; }
.contact-card small { display: block; color: var(--muted); font-size: 12.5px; }
.tag-primary { margin-left: 6px; font-size: 11px; color: var(--sun); font-weight: 700; }

.status-steps { display: grid; gap: 8px; }
.status-steps form { margin: 0; }
.status-steps button { width: 100%; justify-content: flex-start; }

.panel + .panel { margin-top: 20px; }
.side-stack > * + * { margin-top: 20px; }

/* ---------- Document preview */
.paper-stage {
    padding: 28px;
    border-radius: var(--r-lg);
    border: 1px solid var(--line);
    background:
        radial-gradient(60% 60% at 50% 0%, rgba(255, 122, 26, .08), transparent 70%),
        #0B0C0F;
    overflow-x: auto;
}

@media (max-width: 1280px) {
    .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .line-grid { grid-template-columns: 1fr 1fr 1fr; }
    .line-grid .f:first-child { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
    .form-layout, .detail-grid { grid-template-columns: 1fr; }
    .sticky-side { position: static; }
}
@media (max-width: 720px) {
    .fields, .fields.three { grid-template-columns: 1fr; }
    .fields .span-2 { grid-column: auto; }
    .repeat-row { grid-template-columns: 1fr 1fr; }
    .stat-strip { grid-template-columns: 1fr 1fr; }
    .paper-stage { padding: 12px; }
}

/* ---------- Receivables ageing */
.aging-total { margin: 0; font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -.03em; color: var(--amber); }
.aging-bar { display: flex; gap: 4px; height: 16px; border-radius: 999px; overflow: hidden; background: var(--raised); }
.aging-bar span { min-width: 6px; border-radius: 4px; transform-origin: left; animation: grow 1.4s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }
.aging-legend { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.aging-legend div { display: grid; gap: 2px; }
.aging-legend span { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.aging-legend i { width: 10px; height: 10px; border-radius: 3px; }
.aging-legend strong { font-family: var(--font-display); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.aging-legend small { color: var(--muted); font-size: 12px; }
.table tfoot td { padding: 14px 16px; border-top: 1px solid var(--line-strong); background: #0D0F12; }

/* ---------- Pending work */
.sev-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.sev-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); transition: border-color .2s; }
.sev-card:hover { border-color: var(--line-strong); }
.sev-card.is-active { border-color: var(--sun); box-shadow: 0 0 0 1px var(--sun) inset; }
.sev-card .sev-ring { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; }
.sev-card strong { display: block; font-family: var(--font-display); font-size: 22px; font-weight: 600; line-height: 1; }
.sev-card span { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.sev-critical-bg { background: rgba(255, 92, 108, .12); color: var(--bad); }
.sev-warning-bg { background: rgba(255, 179, 71, .12); color: var(--warn); }
.sev-info-bg { background: rgba(106, 183, 255, .12); color: var(--info); }
.sev-mine-bg { background: var(--sun-soft); color: var(--sun); }

.work-list { display: grid; gap: 10px; }
.work-item {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 16px 18px 16px 22px;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: var(--surface);
    overflow: hidden;
}
.work-item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--info); }
.work-item.sev-warning::before { background: var(--warn); }
.work-item.sev-critical::before { background: var(--bad); box-shadow: 0 0 14px var(--bad); }
.work-item p { margin: 0; font-weight: 600; }
.work-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; color: var(--muted); font-size: 12.5px; }
.work-meta span { display: inline-flex; align-items: center; gap: 5px; }
.work-meta .lucide { width: 14px; height: 14px; }

@media (max-width: 900px) {
    .aging-legend, .sev-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .work-item { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Phase 4 — themed components
   ========================================================================== */

/* Native controls stay in the page for forms and validation, but out of sight */
.cs, .dp { position: relative; display: block; min-width: 0; }
.toolbar .cs, .toolbar .dp { display: inline-block; }
.cs-native { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; opacity: 0; pointer-events: none; }

/* Hide browser number arrows everywhere */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Select trigger */
.cs-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 150px;
    text-align: left;
    cursor: pointer;
    font-weight: 500;
}
.cs-trigger .cs-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-trigger.is-placeholder .cs-value { color: #6F747E; }
.cs-trigger svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; transition: transform .25s var(--ease); }
.cs.is-open .cs-trigger { border-color: var(--sun); box-shadow: 0 0 0 4px rgba(255, 122, 26, .12); }
.cs.is-open .cs-trigger svg { transform: rotate(180deg); color: var(--sun); }
.cs-trigger:disabled { opacity: .55; cursor: not-allowed; }
.line-head .cs { flex: 1; }
.line-head .cs-trigger { height: 38px; }

/* Popover panels */
.pop {
    position: fixed;
    z-index: 200;
    display: flex;
    flex-direction: column;
    max-height: min(380px, 60vh);
    border-radius: 14px;
    border: 1px solid var(--line-strong);
    background: rgba(23, 26, 32, .98);
    backdrop-filter: blur(16px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 122, 26, .05);
    opacity: 0;
    transform: translateY(-6px) scale(.98);
    transform-origin: top center;
    transition: opacity .18s ease, transform .25s var(--ease);
    outline: none;
}
.pop.is-up { transform-origin: bottom center; transform: translateY(6px) scale(.98); }
.pop.is-in { opacity: 1; transform: none; }
.pop-title { padding: 16px 18px 6px; font-family: var(--font-display); font-weight: 600; font-size: 16px; }

.cs-search {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 8px 4px;
    padding: 0 12px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--ink);
    color: var(--muted);
}
.cs-search svg { width: 16px; height: 16px; flex-shrink: 0; }
.cs-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 14px; }
.cs-search:focus-within { border-color: rgba(255, 122, 26, .5); }

.cs-list { overflow-y: auto; padding: 6px; overscroll-behavior: contain; }
.cs-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 9px;
    color: var(--text-2);
    cursor: pointer;
    font-size: 14px;
    line-height: 1.35;
}
.cs-option span { flex: 1; min-width: 0; }
.cs-option svg { width: 16px; height: 16px; color: var(--sun); opacity: 0; flex-shrink: 0; }
.cs-option.is-active { background: rgba(255, 255, 255, .06); color: var(--text); }
.cs-option.is-selected { color: var(--text); font-weight: 600; }
.cs-option.is-selected svg { opacity: 1; }
.cs-option.is-empty { color: var(--muted); }
.cs-option.is-disabled { opacity: .4; cursor: not-allowed; }
.cs-empty { padding: 18px 12px; text-align: center; color: var(--muted); font-size: 13px; }
.cs-create {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 6px 6px;
    padding: 10px 12px;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0 0 9px 9px;
    background: transparent;
    color: var(--sun);
    font-weight: 700;
    font-size: 13.5px;
    cursor: pointer;
    text-align: left;
}
.cs-create:hover { background: rgba(255, 122, 26, .08); }
.cs-create svg { width: 16px; height: 16px; }

/* Date picker */
.dp-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 150px;
    cursor: pointer;
    text-align: left;
    font-weight: 500;
    white-space: nowrap;
}
.dp-trigger svg { width: 17px; height: 17px; color: var(--sun); flex-shrink: 0; }
.dp-trigger.is-placeholder .dp-value { color: #6F747E; }
.dp.is-open .dp-trigger { border-color: var(--sun); box-shadow: 0 0 0 4px rgba(255, 122, 26, .12); }
.dp-panel { padding: 14px; max-height: none; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dp-head strong { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.dp-nav {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
}
.dp-nav:hover { border-color: var(--line-strong); color: var(--text); }
.dp-nav svg { width: 16px; height: 16px; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dp-dow span { padding: 4px 0 8px; text-align: center; color: #5E636D; font-size: 11.5px; font-weight: 700; }
.dp-day {
    position: relative;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-2);
    font-size: 13.5px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.dp-day:hover:not(:disabled) { background: rgba(255, 255, 255, .07); color: var(--text); }
.dp-day.is-out { color: #4A4F58; }
.dp-day.is-today { color: var(--sun); font-weight: 700; }
.dp-day.is-today::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--sun); }
.dp-day.is-selected { background: linear-gradient(135deg, var(--amber), var(--sun) 55%, var(--flare)); color: #160800; font-weight: 700; box-shadow: 0 6px 18px -6px var(--sun-glow); }
.dp-day.is-selected::after { background: #160800; }
.dp-day:disabled { opacity: .25; cursor: not-allowed; }
.dp-foot { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.dp-foot button { padding: 6px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--sun); font-weight: 700; font-size: 13px; cursor: pointer; }
.dp-foot button:hover { background: rgba(255, 122, 26, .1); }

/* Stepper */
.stepper {
    display: flex;
    align-items: center;
    border-radius: var(--r-md);
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, .02);
    transition: border-color .2s, box-shadow .25s;
}
.stepper:focus-within { border-color: var(--sun); box-shadow: 0 0 0 4px rgba(255, 122, 26, .12); }
.stepper .control { border: 0 !important; box-shadow: none !important; background: transparent; text-align: center; min-width: 0; padding: 0 2px; }
.st-btn {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    margin: 0 3px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, .05);
    color: var(--text-2);
    cursor: pointer;
    flex-shrink: 0;
}
.st-btn:hover { background: var(--sun-soft); color: var(--sun); }
.st-btn svg { width: 14px; height: 14px; }
.line-grid .stepper { height: 38px; }
.line-grid .stepper .st-btn { width: 26px; height: 26px; }

/* Text areas grow with their content */
textarea.control { resize: none; overflow: hidden; min-height: 44px; }

/* Dialog */
.dlg-wrap {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity .2s;
}
.dlg-wrap.is-in { opacity: 1; }
.dlg {
    width: 100%;
    max-width: 420px;
    padding: 24px;
    border-radius: var(--r-lg);
    border: 1px solid var(--line-strong);
    background: var(--raised);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
    transform: translateY(10px) scale(.98);
    transition: transform .3s var(--ease);
}
.dlg-wrap.is-in .dlg { transform: none; }
.dlg h3 { margin: 0 0 8px; font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.dlg > .muted { margin: 0 0 18px; line-height: 1.5; }
.dlg .f { margin-bottom: 18px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; }
.btn-danger-solid { background: var(--bad); color: #1A0306; border-color: var(--bad); }
.btn-danger-solid:hover { filter: brightness(1.08); }

/* Toasts made by the UI layer */
body > .toast:not([data-toast]) { opacity: 0; transform: translateY(16px); transition: opacity .3s, transform .35s var(--ease); }
body > .toast.is-in { opacity: 1; transform: none; }
.toast.is-error { border-color: rgba(255, 92, 108, .5); }

/* Bottom sheet on phones */
.pop-scrim { position: fixed; inset: 0; z-index: 190; background: rgba(0, 0, 0, .55); opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; }
.pop-scrim.is-on { opacity: 1; visibility: visible; }
.pop.is-sheet {
    left: 0 !important;
    right: 0;
    bottom: 0;
    top: auto !important;
    width: auto !important;
    max-height: 75vh;
    border-radius: 20px 20px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(100%);
}
.pop.is-sheet.is-in { transform: none; }
.pop.is-sheet::before { content: ""; display: block; width: 40px; height: 4px; margin: 10px auto 0; border-radius: 4px; background: var(--line-strong); }
.pop.is-sheet .cs-option { padding: 13px 14px; font-size: 15px; }
.pop.is-sheet .dp-day { height: 44px; font-size: 15px; }

/* Live list loading */
body.is-fetching::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    z-index: 400;
    height: 2px;
    width: 40%;
    background: linear-gradient(90deg, transparent, var(--sun), var(--amber));
    animation: loading 1s ease-in-out infinite;
}
@keyframes loading { from { left: -40%; } to { left: 100%; } }
body.is-fetching [data-live-part] { opacity: .55; transition: opacity .2s; }

/* Global search results */
.search { position: relative; }
.search.is-loading::after {
    content: "";
    position: absolute;
    right: 64px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--line-strong);
    border-top-color: var(--sun);
    animation: spin .7s linear infinite;
}
.gs-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    z-index: 60;
    max-height: 70vh;
    overflow-y: auto;
    padding: 6px;
    border-radius: 14px;
    border: 1px solid var(--line-strong);
    background: rgba(23, 26, 32, .98);
    backdrop-filter: blur(16px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
    animation: gsIn .2s var(--ease);
}
@keyframes gsIn { from { opacity: 0; transform: translateY(-6px); } }
.gs-group p { margin: 8px 10px 4px; font-size: 11.5px; font-weight: 700; color: #5E636D; }
.gs-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; }
.gs-item.is-active, .gs-item:hover { background: rgba(255, 255, 255, .06); }
.gs-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--sun-soft); color: var(--sun); flex-shrink: 0; }
.gs-icon .lucide { width: 16px; height: 16px; }
.gs-text { display: grid; min-width: 0; }
.gs-text strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-text small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-empty { padding: 18px; text-align: center; color: var(--muted); }
.search-toggle { display: none; }

/* Company switcher with the themed select */
.company-switch { border: 0; background: transparent; height: auto; }
.company-switch .cs-trigger { height: 42px; min-width: 190px; max-width: 260px; background: var(--surface); border-color: var(--line); font-weight: 600; font-size: 13.5px; }

/* Toolbar sizing so placeholders never get cut */
.toolbar .search { flex: 1 1 280px; width: auto; max-width: 420px; min-width: 220px; }
.toolbar .select, .toolbar .cs-trigger { min-width: 150px; }
.toolbar .dp-trigger { min-width: 156px; }
.chips { flex-wrap: wrap; }

/* ---------- Settings */
.tabs { display: flex; gap: 6px; margin-bottom: 20px; padding: 4px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); width: fit-content; max-width: 100%; overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 10px; color: var(--muted); font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.is-active { background: var(--raised-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.tabs a.is-active .lucide { color: var(--sun); }
.lists-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.list-card { display: flex; flex-direction: column; max-height: 520px; }
.list-card .panel-head { margin-bottom: 12px; }
.list-add { display: flex; gap: 8px; margin-bottom: 12px; }
.list-add .control { flex: 1; height: 40px; min-width: 0; }
.list-add .btn { height: 40px; padding: 0 14px; }
.list-items { overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.list-item { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 8px; border-radius: 10px; }
.list-item:hover { background: rgba(255, 255, 255, .03); }
.list-item .name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .used { color: var(--muted); font-size: 12px; white-space: nowrap; }
.list-item .control { height: 36px; flex: 1; }
.list-item .icon-btn { width: 32px; height: 32px; border-radius: 8px; opacity: 0; transition: opacity .15s; }
.list-item:hover .icon-btn, .list-item:focus-within .icon-btn, .list-item.is-editing .icon-btn { opacity: 1; }
.seq-table .control { height: 38px; }
.seq-preview { font-family: var(--font-display); color: var(--amber); font-weight: 600; white-space: nowrap; }

/* ==========================================================================
   Phones and tablets
   ========================================================================== */
@media (max-width: 1024px) {
    .content { padding: 26px 20px 48px; }
    .topbar { padding: 0 20px; }
    .list-item .icon-btn { opacity: 1; }
}

@media (max-width: 720px) {
    body { font-size: 15px; }
    input, select, textarea, .control { font-size: 16px; } /* stops iPhone zooming into fields */

    .topbar { gap: 8px; padding: 0 12px; }
    .topbar .search { display: none; }
    .search-toggle { display: inline-grid; }
    body.search-open .topbar .search {
        display: flex;
        position: absolute;
        left: 12px;
        right: 12px;
        top: 12px;
        width: auto;
        z-index: 70;
        background: var(--raised);
    }
    .search kbd { display: none; }
    .company-switch .cs-trigger { min-width: 0; max-width: 150px; height: 40px; }
    .user-btn { padding: 0 4px; }
    .user-btn > .lucide { display: none; }

    .page-head { align-items: stretch; margin-bottom: 20px; }
    .page-head > div:first-child { width: 100%; }
    .page-actions, .detail-head .actions { width: 100%; }
    .page-actions .btn, .page-actions form, .detail-head .actions > .btn, .detail-head .actions > form { flex: 1 1 auto; }
    .page-actions form .btn, .detail-head .actions form .btn { width: 100%; }
    .page-title { font-size: 26px; }

    .toolbar { gap: 8px; }
    .toolbar .search { flex: 1 1 100%; max-width: none; min-width: 0; }
    .toolbar .cs, .toolbar .dp, .toolbar > .select { flex: 1 1 calc(50% - 4px); min-width: 0; }
    .toolbar .cs-trigger, .toolbar .dp-trigger { min-width: 0; width: 100%; }
    .toolbar .spacer { display: none; }
    .chips { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; scrollbar-width: none; }
    .chips::-webkit-scrollbar { display: none; }
    .chip { flex-shrink: 0; }

    .stat-strip { gap: 10px; }
    .stat { padding: 14px; }
    .stat strong { font-size: 18px; }
    .kpi { padding: 18px; }

    /* Order flow becomes a vertical timeline */
    .flow { grid-template-columns: 1fr; gap: 0; overflow: visible; }
    .flow::before, .flow::after { left: 27px; right: auto; top: 28px; bottom: 28px; width: 2px; height: auto; }
    .flow::after { background: linear-gradient(180deg, transparent 0%, var(--amber) 45%, var(--sun) 50%, transparent 55%); background-size: 100% 220%; animation: currentY 3.4s linear infinite; }
    @keyframes currentY { from { background-position: 0 120%; } to { background-position: 0 -120%; } }
    .flow-stage a { display: grid; grid-template-columns: 56px auto 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center; text-align: left; padding: 8px 0; }
    .flow-node { grid-row: span 2; margin: 0; }
    .flow-count { grid-row: span 2; font-size: 26px; min-width: 34px; }
    .flow-label { margin: 0; align-self: end; }
    .flow-hint { align-self: start; }

    /* Tables become cards */
    .table-wrap { border: 0; background: transparent; overflow: visible; }
    .table.is-labelled, .table.is-labelled tbody, .table.is-labelled tr, .table.is-labelled td { display: block; width: 100%; }
    .table.is-labelled thead { display: none; }
    .table.is-labelled tbody { display: grid; gap: 10px; }
    .table.is-labelled tbody tr { padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); }
    .table.is-labelled td { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 6px 0; border: 0; text-align: right; }
    .table.is-labelled td::before { content: attr(data-label); flex-shrink: 0; color: var(--muted); font-size: 12.5px; font-weight: 600; text-align: left; }
    .table.is-labelled td[data-label=""]::before { display: none; }
    .table.is-labelled td:first-child { display: block; text-align: left; padding: 0 0 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
    .table.is-labelled td:first-child::before { display: none; }
    .table.is-labelled td[colspan] { display: block; text-align: center; }
    .table.is-labelled td[colspan]::before { display: none; }
    .table.is-labelled td .sub { text-align: right; }
    .table.is-labelled td:first-child .sub { text-align: left; }
    .table.is-labelled .row-actions { justify-content: flex-end; width: 100%; }
    .table.is-labelled tfoot { display: block; margin-top: 10px; }
    .table.is-labelled tfoot tr { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 12px 16px; border-radius: var(--r-md); background: var(--raised); }
    .table.is-labelled tfoot td { display: inline; padding: 0; border: 0; background: transparent; }
    .table.is-labelled tbody tr:hover { background: var(--surface); }

    .panel { padding: 18px; border-radius: var(--r-md); }
    .panel-head { flex-wrap: wrap; }
    .paper-stage { padding: 10px; border-radius: var(--r-md); }

    .line { padding: 12px; }
    .line-grid { grid-template-columns: 1fr 1fr !important; }
    .line-grid .f:first-child { grid-column: 1 / -1; }
    .line-total { justify-content: flex-start; }
    .repeat-row { grid-template-columns: 1fr; }
    .repeat-row .btn-x { justify-self: end; }

    .segmented { width: 100%; }
    .segmented label { flex: 1; text-align: center; }
    .form-actions .btn { width: 100%; }

    .kv div { grid-template-columns: 110px 1fr; }
    .dropdown-menu { width: min(280px, calc(100vw - 24px)); }
    .toast { left: 12px; right: 12px; bottom: 12px; justify-content: center; }
    .lists-grid { grid-template-columns: 1fr; }
    .tabs { width: 100%; }
    .aging-total { font-size: 24px; }
    .work-item .row-actions { justify-content: flex-start; }
}

@media (max-width: 420px) {
    .stat-strip { grid-template-columns: 1fr 1fr; }
    .stat strong { font-size: 16px; }
    .company-switch .cs-trigger { max-width: 120px; }
}
.stat-strip.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 720px) { .stat-strip.three { grid-template-columns: 1fr 1fr; } .stat-strip.three .stat:first-child { grid-column: 1 / -1; } }
