@charset "UTF-8";
/* ==========================================================================
   iTRUSH — Design System
   --------------------------------------------------------------------------
   Hand-written. No framework, no utility-class soup, no build step.

   Structure
     01  Tokens
     02  Reset & base
     03  Typography
     04  Layout primitives
     05  Public site shell
     06  Application shell (sidebar + topbar)
     07  Cards & panels
     08  Statistics & metrics
     09  Tables & data
     10  Forms
     11  Buttons
     12  Badges, pills & status
     13  Timeline & steps
     14  Maps
     15  Charts
     16  Modals, drawers & toasts
     17  Empty states & feedback
     18  Utilities
     19  Responsive
     20  Print & motion preferences

   Design intent
     A working tool, not a brochure. Dense where density helps an operator,
     generous where a resident needs reassurance. Colour carries meaning
     (status, tone) and is never decorative. Every interactive element has a
     visible focus state, because an operations console gets driven by
     keyboard far more than its designers expect.
   ========================================================================== */


/* ==========================================================================
   01  TOKENS
   ========================================================================== */

:root {
    /* -- Brand ------------------------------------------------------------ */
    --brand-950: #04120b;
    --brand-900: #062616;
    --brand-800: #0a3b23;
    --brand-700: #0d5231;
    --brand-600: #10784a;
    --brand-500: #16915a;
    --brand-400: #1faf6d;
    --brand-300: #4cc98d;
    --brand-200: #93e0b8;
    --brand-100: #cdf1de;
    --brand-050: #ecfaf2;

    /* -- Neutrals: warm greys, so the greens don't read as clinical ------- */
    --ink-950: #0a0d0c;
    --ink-900: #121716;
    --ink-800: #1b2321;
    --ink-700: #2a3532;
    --ink-600: #3d4a47;
    --ink-500: #566461;
    --ink-400: #74827f;
    --ink-300: #9aa6a3;
    --ink-200: #c3ccca;
    --ink-150: #dbe2e0;
    --ink-100: #e9eeec;
    --ink-050: #f4f7f6;
    --paper:   #ffffff;

    /* -- Semantic --------------------------------------------------------- */
    --success-700: #0f6b3f;
    --success-500: #17954f;
    --success-100: #dcf3e5;

    --warning-700: #8a5606;
    --warning-500: #c07c10;
    --warning-100: #fbeeda;

    --danger-700:  #8c2020;
    --danger-500:  #c2352f;
    --danger-100:  #fbe3e1;

    --info-700:    #114a75;
    --info-500:    #1c6fa8;
    --info-100:    #dbedf9;

    --neutral-700: var(--ink-700);
    --neutral-500: var(--ink-500);
    --neutral-100: var(--ink-100);

    /* -- Surfaces --------------------------------------------------------- */
    --bg-body:     #f2f5f4;
    --bg-surface:  var(--paper);
    --bg-sunken:   #eaefed;
    --bg-inverse:  var(--brand-950);
    --border:      var(--ink-150);
    --border-soft: var(--ink-100);
    --border-strong: var(--ink-200);

    /* -- Type ------------------------------------------------------------- */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", "Noto Sans", Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono",
                 Menlo, Consolas, monospace;

    --text-2xs: 0.6875rem;   /* 11px — table meta, timestamps */
    --text-xs:  0.75rem;     /* 12px */
    --text-sm:  0.8125rem;   /* 13px — dense UI default */
    --text-base:0.9375rem;   /* 15px — reading default */
    --text-md:  1.0625rem;
    --text-lg:  1.25rem;
    --text-xl:  1.5rem;
    --text-2xl: 1.875rem;
    --text-3xl: 2.375rem;
    --text-4xl: 3rem;
    --text-5xl: 3.75rem;

    --leading-tight: 1.2;
    --leading-snug:  1.4;
    --leading-normal:1.6;

    /* -- Space ------------------------------------------------------------ */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.25rem;
    --sp-6: 1.5rem;
    --sp-8: 2rem;
    --sp-10: 2.5rem;
    --sp-12: 3rem;
    --sp-16: 4rem;
    --sp-20: 5rem;
    --sp-24: 6rem;

    /* -- Shape ------------------------------------------------------------ */
    --radius-xs: 3px;
    --radius-sm: 5px;
    --radius:    8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 999px;

    /* -- Elevation: tight and low-contrast; heavy shadows read as toy UI -- */
    --shadow-xs: 0 1px 2px rgba(10, 13, 12, 0.05);
    --shadow-sm: 0 1px 3px rgba(10, 13, 12, 0.07), 0 1px 2px rgba(10, 13, 12, 0.04);
    --shadow:    0 2px 6px rgba(10, 13, 12, 0.07), 0 1px 3px rgba(10, 13, 12, 0.05);
    --shadow-md: 0 6px 16px rgba(10, 13, 12, 0.09), 0 2px 6px rgba(10, 13, 12, 0.05);
    --shadow-lg: 0 16px 40px rgba(10, 13, 12, 0.13), 0 4px 12px rgba(10, 13, 12, 0.07);
    --shadow-inner: inset 0 1px 2px rgba(10, 13, 12, 0.06);

    --ring: 0 0 0 3px rgba(31, 175, 109, 0.28);
    --ring-danger: 0 0 0 3px rgba(194, 53, 47, 0.24);

    /* -- Motion ----------------------------------------------------------- */
    --ease: cubic-bezier(0.32, 0.72, 0, 1);
    --dur-fast: 120ms;
    --dur:      180ms;
    --dur-slow: 320ms;

    /* -- Layout ----------------------------------------------------------- */
    --sidebar-w: 264px;
    --sidebar-w-collapsed: 68px;
    --topbar-h: 60px;
    --container: 1240px;
    --container-narrow: 860px;

    --z-dropdown: 200;
    --z-sticky:   300;
    --z-drawer:   400;
    --z-modal:    500;
    --z-toast:    600;
}


/* ==========================================================================
   02  RESET & BASE
   ========================================================================== */

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    tab-size: 4;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--ink-800);
    background: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; }
img, svg, video, canvas { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
table { border-collapse: collapse; border-spacing: 0; width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-6) 0; }

a {
    color: var(--brand-600);
    text-decoration: none;
    transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--brand-500); text-decoration: underline; text-underline-offset: 2px; }

:focus-visible {
    outline: 2px solid var(--brand-500);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--brand-200); color: var(--brand-900); }

/* Keyboard users must be able to skip the navigation. */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: var(--z-toast);
    padding: var(--sp-3) var(--sp-5);
    background: var(--brand-700);
    color: #fff;
    border-radius: 0 0 var(--radius) 0;
    font-weight: 600;
}
.skip-link:focus { left: 0; }

/* Slim, unobtrusive scrollbars in dense panels */
.scroll-y { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--ink-200) transparent; }
.scroll-y::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll-y::-webkit-scrollbar-track { background: transparent; }
.scroll-y::-webkit-scrollbar-thumb { background: var(--ink-200); border-radius: var(--radius-full); }
.scroll-y::-webkit-scrollbar-thumb:hover { background: var(--ink-300); }


/* ==========================================================================
   03  TYPOGRAPHY
   ========================================================================== */

h1, .h1 { font-size: var(--text-2xl); line-height: var(--leading-tight); font-weight: 680; letter-spacing: -0.021em; color: var(--ink-950); }
h2, .h2 { font-size: var(--text-xl);  line-height: var(--leading-tight); font-weight: 660; letter-spacing: -0.017em; color: var(--ink-900); }
h3, .h3 { font-size: var(--text-lg);  line-height: var(--leading-snug);  font-weight: 640; letter-spacing: -0.012em; color: var(--ink-900); }
h4, .h4 { font-size: var(--text-md);  line-height: var(--leading-snug);  font-weight: 620; color: var(--ink-900); }
h5, .h5 { font-size: var(--text-base);line-height: var(--leading-snug);  font-weight: 620; color: var(--ink-800); }

.display {
    font-size: clamp(2.25rem, 5.2vw, var(--text-5xl));
    line-height: 1.04;
    font-weight: 700;
    letter-spacing: -0.032em;
    color: var(--ink-950);
}

.lede {
    font-size: clamp(var(--text-md), 2vw, var(--text-lg));
    line-height: 1.55;
    color: var(--ink-600);
    font-weight: 400;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--text-xs);
    font-weight: 660;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--brand-600);
}
.eyebrow::before {
    content: "";
    width: 18px;
    height: 1px;
    background: currentColor;
    opacity: 0.55;
}

.muted     { color: var(--ink-500); }
.muted-sm  { color: var(--ink-500); font-size: var(--text-sm); }
.dim       { color: var(--ink-400); }
.tiny      { font-size: var(--text-xs); }
.micro     { font-size: var(--text-2xs); letter-spacing: 0.03em; }
.mono      { font-family: var(--font-mono); font-size: 0.92em; letter-spacing: -0.01em; }
.nowrap    { white-space: nowrap; }
.strong    { font-weight: 620; }
.upper     { text-transform: uppercase; letter-spacing: 0.06em; }

.prose { max-width: 68ch; }
.prose > * + * { margin-top: var(--sp-4); }
.prose h2 { margin-top: var(--sp-10); }
.prose h3 { margin-top: var(--sp-8); }
.prose ul, .prose ol { padding-left: var(--sp-6); }
.prose li + li { margin-top: var(--sp-2); }
.prose li::marker { color: var(--brand-500); }
.prose strong { font-weight: 640; color: var(--ink-900); }
.prose code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--bg-sunken);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-soft);
}

.numeric { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }


/* ==========================================================================
   04  LAYOUT PRIMITIVES
   ========================================================================== */

.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--sp-6);
}
.container-narrow { max-width: var(--container-narrow); }
.container-wide   { max-width: 1480px; }

.section { padding-block: clamp(var(--sp-12), 8vw, var(--sp-24)); }
.section-sm { padding-block: var(--sp-12); }
.section-tint { background: var(--paper); }
.section-sunken { background: var(--bg-sunken); }

.stack > * + * { margin-top: var(--sp-4); }
.stack-sm > * + * { margin-top: var(--sp-2); }
.stack-lg > * + * { margin-top: var(--sp-6); }
.stack-xl > * + * { margin-top: var(--sp-10); }

.row {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); }
.row-start   { align-items: flex-start; }
.row-baseline{ align-items: baseline; }
.row-wrap    { flex-wrap: wrap; }
.row-tight   { gap: var(--sp-2); }
.row-loose   { gap: var(--sp-6); }
.push        { margin-left: auto; }

.grid { display: grid; gap: var(--sp-5); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.grid-auto-sm { grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.grid-auto-lg { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-8); align-items: center; }
.split-wide { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
.split-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.split-aside { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: start; }


/* ==========================================================================
   05  PUBLIC SITE SHELL
   ========================================================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid transparent;
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.site-header.is-stuck {
    border-bottom-color: var(--border);
    box-shadow: var(--shadow-xs);
}
.site-header__inner {
    display: flex;
    align-items: center;
    gap: var(--sp-8);
    height: 68px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-3);
    font-weight: 700;
    font-size: var(--text-md);
    letter-spacing: -0.02em;
    color: var(--ink-950);
    text-decoration: none;
    flex-shrink: 0;
}
.brand:hover { text-decoration: none; color: var(--ink-950); }
.brand__mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(145deg, var(--brand-500), var(--brand-700));
    display: grid;
    place-items: center;
    color: #fff;
    box-shadow: 0 2px 6px rgba(13, 82, 49, 0.28);
    flex-shrink: 0;
}
.brand__mark svg { width: 19px; height: 19px; }
.brand__text { display: flex; flex-direction: column; line-height: 1.05; }
.brand__text small {
    font-size: var(--text-2xs);
    font-weight: 500;
    color: var(--ink-400);
    letter-spacing: 0.02em;
}

.site-nav { display: flex; align-items: center; gap: var(--sp-1); list-style: none; }
.site-nav a {
    display: block;
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 520;
    color: var(--ink-600);
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.site-nav a:hover { background: var(--ink-050); color: var(--ink-900); text-decoration: none; }
.site-nav a.is-active { color: var(--brand-700); background: var(--brand-050); font-weight: 600; }

.nav-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    place-items: center;
    color: var(--ink-700);
}
.nav-toggle:hover { background: var(--ink-050); }

.site-footer {
    background: var(--brand-950);
    color: var(--ink-300);
    padding-block: var(--sp-16) var(--sp-8);
    font-size: var(--text-sm);
}
.site-footer h5 {
    color: #fff;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.09em;
    margin-bottom: var(--sp-4);
    font-weight: 640;
}
.site-footer a { color: var(--ink-300); }
.site-footer a:hover { color: var(--brand-300); text-decoration: none; }
.site-footer ul { list-style: none; }
.site-footer li + li { margin-top: var(--sp-2); }
.site-footer__grid {
    display: grid;
    grid-template-columns: 1.6fr repeat(3, 1fr);
    gap: var(--sp-10);
}
.site-footer__bottom {
    margin-top: var(--sp-12);
    padding-top: var(--sp-6);
    border-top: 1px solid rgba(255, 255, 255, 0.09);
    display: flex;
    justify-content: space-between;
    gap: var(--sp-4);
    flex-wrap: wrap;
    font-size: var(--text-xs);
    color: var(--ink-400);
}

/* -- Hero ---------------------------------------------------------------- */
.hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(1100px 520px at 88% -12%, rgba(31, 175, 109, 0.13), transparent 62%),
        radial-gradient(760px 420px at 4% 8%, rgba(16, 120, 74, 0.09), transparent 60%),
        var(--paper);
    padding-block: clamp(var(--sp-12), 8vw, var(--sp-24));
    border-bottom: 1px solid var(--border-soft);
}
.hero::after {
    /* Faint grid — the visual language of a control panel, not a poster. */
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--ink-100) 1px, transparent 1px),
        linear-gradient(90deg, var(--ink-100) 1px, transparent 1px);
    background-size: 56px 56px;
    opacity: 0.32;
    mask-image: radial-gradient(ellipse 90% 62% at 50% 0%, #000 35%, transparent 78%);
    -webkit-mask-image: radial-gradient(ellipse 90% 62% at 50% 0%, #000 35%, transparent 78%);
    pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero__grid { display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr); gap: var(--sp-12); align-items: center; }


/* ==========================================================================
   06  APPLICATION SHELL
   ========================================================================== */

.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
}
.app.is-collapsed { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }

/* -- Sidebar ------------------------------------------------------------- */
.sidebar {
    background: var(--brand-950);
    color: var(--ink-300);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar__head {
    padding: var(--sp-5) var(--sp-5) var(--sp-4);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}
.sidebar__head .brand { color: #fff; }
.sidebar__head .brand__text small { color: rgba(255, 255, 255, 0.45); }

.sidebar__scroll { flex: 1; overflow-y: auto; padding: var(--sp-4) var(--sp-3); }
.sidebar__scroll::-webkit-scrollbar { width: 6px; }
.sidebar__scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: var(--radius-full); }

.nav-group + .nav-group { margin-top: var(--sp-6); }
.nav-group__label {
    padding: 0 var(--sp-3) var(--sp-2);
    font-size: var(--text-2xs);
    font-weight: 680;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.34);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.72);
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
    position: relative;
}
.nav-item + .nav-item { margin-top: 1px; }
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; text-decoration: none; }
.nav-item.is-active {
    background: rgba(31, 175, 109, 0.16);
    color: #fff;
    font-weight: 580;
}
.nav-item.is-active::before {
    content: "";
    position: absolute;
    left: -var(--sp-3);
    left: calc(var(--sp-3) * -1);
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    border-radius: 0 3px 3px 0;
    background: var(--brand-400);
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.82; }
.nav-item.is-active svg { opacity: 1; color: var(--brand-300); }
.nav-item__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item__count {
    font-size: var(--text-2xs);
    font-weight: 660;
    padding: 1px var(--sp-2);
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    min-width: 20px;
    text-align: center;
}
.nav-item__count.is-alert { background: var(--danger-500); }

.sidebar__foot {
    padding: var(--sp-3);
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2);
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    width: 100%;
    transition: background var(--dur-fast) var(--ease);
}
.sidebar-user:hover { background: rgba(255, 255, 255, 0.07); color: #fff; text-decoration: none; }
.sidebar-user__meta { min-width: 0; flex: 1; line-height: 1.25; }
.sidebar-user__name { font-size: var(--text-sm); font-weight: 580; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user__role { font-size: var(--text-2xs); color: rgba(255, 255, 255, 0.45); }

.app.is-collapsed .sidebar .nav-item__label,
.app.is-collapsed .sidebar .nav-group__label,
.app.is-collapsed .sidebar .brand__text,
.app.is-collapsed .sidebar .sidebar-user__meta,
.app.is-collapsed .sidebar .nav-item__count { display: none; }
.app.is-collapsed .sidebar .nav-item { justify-content: center; padding-inline: 0; }

/* -- Main column --------------------------------------------------------- */
.app__main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding-inline: var(--sp-6);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.topbar__title { font-size: var(--text-md); font-weight: 620; letter-spacing: -0.014em; color: var(--ink-900); }
.topbar__crumb { font-size: var(--text-xs); color: var(--ink-400); }

.icon-btn {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    color: var(--ink-600);
    border: 1px solid transparent;
    position: relative;
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.icon-btn:hover { background: var(--ink-050); color: var(--ink-900); border-color: var(--border-soft); }
.icon-btn svg { width: 18px; height: 18px; }

/* Shown only once the sidebar becomes a drawer — see the 960px breakpoint. */
.sidebar-trigger { display: none; }
.hide-sm { display: inline; }
.icon-btn__dot {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    padding-inline: 3px;
    border-radius: var(--radius-full);
    background: var(--danger-500);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: grid;
    place-items: center;
    border: 2px solid var(--paper);
    line-height: 1;
}

.app__body { flex: 1; padding: var(--sp-6); min-width: 0; }
.app__body > * + * { margin-top: var(--sp-5); }

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-5);
    flex-wrap: wrap;
    margin-bottom: var(--sp-5);
}
.page-head__title { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.page-head__actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

.breadcrumb { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--text-xs); color: var(--ink-400); list-style: none; flex-wrap: wrap; }
.breadcrumb a { color: var(--ink-500); }
.breadcrumb li::after { content: "/"; margin-left: var(--sp-2); color: var(--ink-300); }
.breadcrumb li:last-child::after { display: none; }


/* ==========================================================================
   07  CARDS & PANELS
   ========================================================================== */

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
}
.card__head {
    padding: var(--sp-4) var(--sp-5);
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    flex-wrap: wrap;
}
.card__title { font-size: var(--text-base); font-weight: 620; color: var(--ink-900); letter-spacing: -0.01em; }
.card__sub   { font-size: var(--text-xs); color: var(--ink-500); margin-top: 1px; }
.card__body  { padding: var(--sp-5); }
.card__body--tight { padding: var(--sp-4); }
.card__body--flush { padding: 0; }
.card__foot {
    padding: var(--sp-3) var(--sp-5);
    border-top: 1px solid var(--border-soft);
    background: var(--ink-050);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    flex-wrap: wrap;
    font-size: var(--text-sm);
}

.card-link { display: block; color: inherit; text-decoration: none; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
.card-link:hover { text-decoration: none; color: inherit; border-color: var(--brand-300); box-shadow: var(--shadow-sm); transform: translateY(-1px); }

.panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-4);
}
.panel-sunken { background: var(--bg-sunken); border-color: var(--border-soft); }
.panel-brand  { background: var(--brand-050); border-color: var(--brand-100); }

.feature {
    padding: var(--sp-6);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--paper);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.feature:hover { border-color: var(--brand-200); box-shadow: var(--shadow-sm); }
.feature__icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    background: var(--brand-050);
    color: var(--brand-600);
    margin-bottom: var(--sp-4);
}
.feature__icon svg { width: 21px; height: 21px; }

.definition { display: grid; grid-template-columns: minmax(140px, auto) 1fr; gap: var(--sp-2) var(--sp-5); font-size: var(--text-sm); }
.definition dt { color: var(--ink-500); }
.definition dd { color: var(--ink-900); font-weight: 520; margin: 0; }
.definition--rows { grid-template-columns: 1fr auto; }
.definition--rows dd { text-align: right; }


/* ==========================================================================
   08  STATISTICS & METRICS
   ========================================================================== */

.stat {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--sp-4) var(--sp-5);
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
    position: relative;
    overflow: hidden;
}
.stat__label {
    font-size: var(--text-xs);
    font-weight: 560;
    color: var(--ink-500);
    letter-spacing: 0.015em;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}
.stat__value {
    font-size: var(--text-2xl);
    font-weight: 660;
    letter-spacing: -0.028em;
    color: var(--ink-950);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.stat__value--sm { font-size: var(--text-xl); }
.stat__meta { font-size: var(--text-xs); color: var(--ink-500); display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.stat__accent { position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--brand-400); }
.stat--success .stat__accent { background: var(--success-500); }
.stat--warning .stat__accent { background: var(--warning-500); }
.stat--danger  .stat__accent { background: var(--danger-500); }
.stat--info    .stat__accent { background: var(--info-500); }

.trend {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: var(--text-xs);
    font-weight: 640;
    padding: 1px var(--sp-2);
    border-radius: var(--radius-full);
}
.trend--up   { color: var(--success-700); background: var(--success-100); }
.trend--down { color: var(--danger-700);  background: var(--danger-100); }
.trend--flat { color: var(--ink-500);     background: var(--ink-100); }
.trend svg { width: 11px; height: 11px; }

/* Progress / meter */
.meter {
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--ink-100);
    overflow: hidden;
}
.meter__fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--brand-500);
    transition: width var(--dur-slow) var(--ease);
}
.meter--success .meter__fill { background: var(--success-500); }
.meter--warning .meter__fill { background: var(--warning-500); }
.meter--danger  .meter__fill { background: var(--danger-500); }
.meter--lg { height: 10px; }

/* Segmented distribution bar (rating breakdowns, waste composition) */
.segments { display: flex; height: 10px; border-radius: var(--radius-full); overflow: hidden; background: var(--ink-100); }
.segments__part { height: 100%; transition: width var(--dur-slow) var(--ease); }

.legend { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); font-size: var(--text-xs); }
.legend__item { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--ink-600); }
.legend__swatch { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }


/* ==========================================================================
   09  TABLES & DATA
   ========================================================================== */

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
    scrollbar-width: thin;
}
.table-wrap::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--ink-200); border-radius: var(--radius-full); }

.table { width: 100%; font-size: var(--text-sm); }
.table thead th {
    text-align: left;
    padding: var(--sp-3) var(--sp-4);
    font-size: var(--text-2xs);
    font-weight: 680;
    letter-spacing: 0.075em;
    text-transform: uppercase;
    color: var(--ink-500);
    background: var(--ink-050);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}
.table tbody td {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
    color: var(--ink-800);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--dur-fast) var(--ease); }
.table tbody tr:hover { background: var(--ink-050); }
.table tbody tr.is-selected { background: var(--brand-050); }
.table--compact tbody td, .table--compact thead th { padding: var(--sp-2) var(--sp-3); }
.table--flush thead th:first-child, .table--flush tbody td:first-child { padding-left: var(--sp-5); }
.table--flush thead th:last-child,  .table--flush tbody td:last-child  { padding-right: var(--sp-5); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.actions { text-align: right; white-space: nowrap; }

.th-sort { display: inline-flex; align-items: center; gap: var(--sp-1); color: inherit; text-decoration: none; }
.th-sort:hover { color: var(--ink-800); text-decoration: none; }
.th-sort svg { width: 11px; height: 11px; opacity: 0.4; }
.th-sort.is-active svg { opacity: 1; color: var(--brand-600); }

.cell-primary { font-weight: 580; color: var(--ink-950); }
.cell-sub { font-size: var(--text-xs); color: var(--ink-500); margin-top: 1px; }
.cell-stack { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }

/* Avatar */
.avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: var(--brand-100);
    color: var(--brand-800);
    display: grid;
    place-items: center;
    font-size: var(--text-xs);
    font-weight: 680;
    flex-shrink: 0;
    overflow: hidden;
    letter-spacing: 0.02em;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 26px; height: 26px; font-size: 10px; }
.avatar--lg { width: 52px; height: 52px; font-size: var(--text-base); }
.avatar--xl { width: 76px; height: 76px; font-size: var(--text-lg); }
.avatar--inverse { background: rgba(255, 255, 255, 0.14); color: #fff; }

.avatar-stack { display: flex; }
.avatar-stack .avatar + .avatar { margin-left: -10px; border: 2px solid var(--paper); }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    list-style: none;
    flex-wrap: wrap;
}
.pagination a, .pagination span {
    min-width: 34px;
    height: 34px;
    padding-inline: var(--sp-2);
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--paper);
    font-size: var(--text-sm);
    font-weight: 540;
    color: var(--ink-600);
    text-decoration: none;
    transition: all var(--dur-fast) var(--ease);
}
.pagination a:hover { border-color: var(--brand-300); color: var(--brand-700); background: var(--brand-050); text-decoration: none; }
.pagination .is-current { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.pagination .is-disabled { opacity: 0.42; pointer-events: none; }
.pagination .gap { border: 0; background: none; color: var(--ink-300); }

/* Filter bar */
.filters {
    display: flex;
    align-items: flex-end;
    gap: var(--sp-3);
    flex-wrap: wrap;
    padding: var(--sp-4) var(--sp-5);
    background: var(--ink-050);
    border-bottom: 1px solid var(--border-soft);
}
.filters .field { margin: 0; min-width: 150px; }
.filters .field--grow { flex: 1; min-width: 220px; }

.chip-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-1) var(--sp-3);
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--paper);
    font-size: var(--text-xs);
    font-weight: 560;
    color: var(--ink-600);
    text-decoration: none;
    transition: all var(--dur-fast) var(--ease);
}
.chip:hover { border-color: var(--brand-300); color: var(--brand-700); text-decoration: none; }
.chip.is-active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.chip__count { opacity: 0.7; font-variant-numeric: tabular-nums; }
.chip--brand { background: var(--brand-100); border-color: var(--brand-300); color: var(--brand-700); }
.chip--danger { background: var(--danger-100); border-color: var(--danger-500); color: var(--danger-700); }

/* A repeated, tappable summary row inside a card — payouts, notifications,
   recent activity. Behaves like a list item but is a real anchor, so it is
   keyboard reachable and can be opened in a new tab. */
.link-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    padding: var(--sp-2) 0;
    border-bottom: 1px solid var(--border-soft);
    color: inherit;
    text-decoration: none;
}
.link-row:last-child { border-bottom: 0; }
.link-row:hover { text-decoration: none; }
.link-row:hover .cell-primary { color: var(--brand-700); }

/* A tight ordered list used inside explanatory side panels. The default list
   spacing is tuned for prose; these are procedural steps read at a glance. */
.ol-tight { margin: 0; padding-left: var(--sp-5); }
.ol-tight li { margin-bottom: var(--sp-2); line-height: 1.5; }
.ol-tight li:last-child { margin-bottom: 0; }

/* Compact inline input — sits beside a button inside an alert. */
.input--sm { padding: var(--sp-1) var(--sp-2); font-size: var(--text-xs); height: auto; }

/* A table row carrying an operational warning (expired paperwork, held funds). */
.is-flagged { background: var(--warning-100); }
.is-flagged:hover { background: var(--warning-100); }

/* Attention queue tile — a count, what it is, and where it goes. Used on the
   administrator dashboard, where the first question is always "what needs a
   decision from me right now?" */
.queue-tile {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--paper);
    color: inherit;
    text-decoration: none;
    transition: all var(--dur-fast) var(--ease);
}
.queue-tile:hover {
    border-color: var(--brand-300);
    background: var(--brand-050);
    text-decoration: none;
}
.queue-tile__icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    background: var(--warning-100);
    color: var(--warning-700);
}
.queue-tile__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.queue-tile__count {
    font-size: var(--text-xl);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--ink-950);
}
.queue-tile__label { font-size: var(--text-sm); font-weight: 580; color: var(--ink-700); }
.queue-tile__sub { font-size: var(--text-2xs); color: var(--ink-400); }

/* A row for a record that still exists but is no longer live — a soft-deleted
   account, a retired vehicle. Dimmed rather than hidden, because the reason it
   is here is that somebody went looking for it. */
.is-muted { opacity: 0.55; }
.is-muted:hover { opacity: 1; }


/* ==========================================================================
   10  FORMS
   ========================================================================== */

.field { margin-bottom: var(--sp-4); }
.field:last-child { margin-bottom: 0; }

.label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 580;
    color: var(--ink-800);
    margin-bottom: var(--sp-2);
}
.label .req { color: var(--danger-500); margin-left: 2px; }
.label__hint { font-weight: 400; color: var(--ink-400); font-size: var(--text-xs); margin-left: var(--sp-2); }

.input, .select, .textarea {
    width: 100%;
    padding: var(--sp-2) var(--sp-3);
    min-height: 40px;
    font-size: var(--text-sm);
    color: var(--ink-900);
    background: var(--paper);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
    appearance: none;
    -webkit-appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-300); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-300); }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: var(--ring);
}
.input:disabled, .select:disabled, .textarea:disabled {
    background: var(--ink-050);
    color: var(--ink-400);
    cursor: not-allowed;
    border-color: var(--border);
}
.input[readonly] { background: var(--ink-050); }
.textarea { min-height: 96px; resize: vertical; line-height: var(--leading-snug); padding-top: var(--sp-3); }

.select {
    padding-right: var(--sp-8);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23566461' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6.5 8 10.5 12 6.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--sp-3) center;
    background-size: 15px;
    cursor: pointer;
}

.input-group { display: flex; }
.input-group .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group__addon {
    display: grid;
    place-items: center;
    padding-inline: var(--sp-3);
    background: var(--ink-050);
    border: 1px solid var(--border-strong);
    border-right: 0;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    font-size: var(--text-sm);
    color: var(--ink-500);
    white-space: nowrap;
}
.input-group__addon + .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* Trailing unit — "kg", "%", "km". Same treatment as the leading addon, with
   the border and corners mirrored so the pair reads as one control. */
.input-group__suffix {
    display: grid;
    place-items: center;
    padding-inline: var(--sp-3);
    background: var(--ink-050);
    border: 1px solid var(--border-strong);
    border-left: 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: var(--text-sm);
    color: var(--ink-500);
    white-space: nowrap;
}
.input-group:has(.input-group__suffix) .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }

.hint { font-size: var(--text-xs); color: var(--ink-500); margin-top: var(--sp-2); line-height: 1.45; }
.error {
    font-size: var(--text-xs);
    color: var(--danger-700);
    margin-top: var(--sp-2);
    display: flex;
    align-items: flex-start;
    gap: var(--sp-1);
    font-weight: 520;
}
.error svg { width: 13px; height: 13px; flex-shrink: 0; margin-top: 1px; }
.has-error .input, .has-error .select, .has-error .textarea { border-color: var(--danger-500); }
.has-error .input:focus, .has-error .select:focus, .has-error .textarea:focus { box-shadow: var(--ring-danger); }

/* Checkbox & radio */
.check { display: flex; align-items: flex-start; gap: var(--sp-3); cursor: pointer; font-size: var(--text-sm); line-height: 1.45; }
.check input[type="checkbox"], .check input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border-strong);
    background: var(--paper);
    border-radius: var(--radius-xs);
    flex-shrink: 0;
    margin-top: 1px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all var(--dur-fast) var(--ease);
}
.check input[type="radio"] { border-radius: var(--radius-full); }
.check input:hover { border-color: var(--brand-400); }
.check input:checked { background: var(--brand-600); border-color: var(--brand-600); }
.check input[type="checkbox"]:checked::after {
    content: "";
    width: 10px;
    height: 6px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translate(1px, -1px);
}
.check input[type="radio"]:checked::after {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fff;
}
.check input:focus-visible { box-shadow: var(--ring); outline: none; }
.check__text { min-width: 0; }
.check__title { font-weight: 540; color: var(--ink-900); }
.check__hint { font-size: var(--text-xs); color: var(--ink-500); }

/* Card-style selectable option (waste type, payment channel, urgency) */
.option {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-4);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--paper);
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease);
    position: relative;
}
.option:hover { border-color: var(--brand-300); background: var(--brand-050); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option.is-selected, .option:has(input:checked) {
    border-color: var(--brand-500);
    background: var(--brand-050);
    box-shadow: 0 0 0 1px var(--brand-500);
}
.option:has(input:focus-visible) { box-shadow: var(--ring); }
.option__icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: var(--ink-050);
    color: var(--ink-600);
}
.option__body { flex: 1; min-width: 0; }
.option__title { font-weight: 600; font-size: var(--text-sm); color: var(--ink-900); }
.option__desc  { font-size: var(--text-xs); color: var(--ink-500); margin-top: 2px; line-height: 1.4; }
.option__price { font-weight: 640; font-size: var(--text-sm); color: var(--brand-700); white-space: nowrap; }

/* Toggle */
.switch { display: inline-flex; align-items: center; gap: var(--sp-3); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
    width: 42px;
    height: 24px;
    border-radius: var(--radius-full);
    background: var(--ink-200);
    position: relative;
    transition: background var(--dur) var(--ease);
    flex-shrink: 0;
}
.switch__track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--shadow-sm);
    transition: transform var(--dur) var(--ease);
}
.switch input:checked + .switch__track { background: var(--brand-500); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { box-shadow: var(--ring); }

/* Fieldset */
.fieldset { border: 0; padding: 0; margin: 0 0 var(--sp-6); }
.fieldset__legend {
    font-size: var(--text-sm);
    font-weight: 640;
    color: var(--ink-900);
    padding: 0 0 var(--sp-1);
    display: block;
    width: 100%;
}
.fieldset__hint { font-size: var(--text-xs); color: var(--ink-500); margin-bottom: var(--sp-4); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--sp-4); }
.form-grid .field--full { grid-column: 1 / -1; }

.form-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding-top: var(--sp-5);
    margin-top: var(--sp-5);
    border-top: 1px solid var(--border-soft);
    flex-wrap: wrap;
}

/* Star rating input */
.stars { display: inline-flex; gap: var(--sp-1); direction: rtl; }
.stars input { position: absolute; opacity: 0; }
.stars label { cursor: pointer; color: var(--ink-200); transition: color var(--dur-fast) var(--ease); }
.stars label svg { width: 26px; height: 26px; }
.stars label:hover, .stars label:hover ~ label,
.stars input:checked ~ label { color: var(--warning-500); }
.stars-display { display: inline-flex; gap: 1px; color: var(--warning-500); }
.stars-display svg { width: 14px; height: 14px; }
.stars-display .is-empty { color: var(--ink-200); }


/* ==========================================================================
   11  BUTTONS
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-4);
    min-height: 40px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 580;
    line-height: 1;
    letter-spacing: -0.005em;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
    transition: all var(--dur-fast) var(--ease);
    user-select: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(0.5px); }
.btn:disabled, .btn.is-disabled { opacity: 0.5; pointer-events: none; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
    background: var(--brand-600);
    color: #fff;
    box-shadow: 0 1px 2px rgba(6, 38, 22, 0.2);
}
.btn-primary:hover { background: var(--brand-700); color: #fff; }

.btn-secondary {
    background: var(--paper);
    color: var(--ink-800);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--ink-050); border-color: var(--ink-300); color: var(--ink-900); }

.btn-ghost { background: transparent; color: var(--ink-600); }
.btn-ghost:hover { background: var(--ink-050); color: var(--ink-900); }

.btn-danger { background: var(--danger-500); color: #fff; }
.btn-danger:hover { background: var(--danger-700); color: #fff; }

.btn-danger-soft { background: var(--danger-100); color: var(--danger-700); }
.btn-danger-soft:hover { background: var(--danger-500); color: #fff; }

.btn-success { background: var(--success-500); color: #fff; }
.btn-success:hover { background: var(--success-700); color: #fff; }

.btn-warning { background: var(--warning-500); color: #fff; }
.btn-warning:hover { background: var(--warning-700); color: #fff; }

.btn-inverse { background: var(--brand-950); color: #fff; }
.btn-inverse:hover { background: var(--brand-900); color: #fff; }

.btn-link { background: none; color: var(--brand-600); padding: 0; min-height: 0; }
.btn-link:hover { color: var(--brand-700); text-decoration: underline; }

.btn-sm { padding: var(--sp-1) var(--sp-3); min-height: 32px; font-size: var(--text-xs); border-radius: var(--radius-xs); }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { padding: var(--sp-3) var(--sp-6); min-height: 48px; font-size: var(--text-base); border-radius: var(--radius); }
.btn-lg svg { width: 18px; height: 18px; }
.btn-block { width: 100%; }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group .btn:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.btn.is-loading { pointer-events: none; position: relative; color: transparent !important; }
.btn.is-loading::after {
    content: "";
    position: absolute;
    width: 15px;
    height: 15px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    color: #fff;
}
.btn-secondary.is-loading::after, .btn-ghost.is-loading::after { color: var(--ink-600); }

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


/* ==========================================================================
   12  BADGES, PILLS & STATUS
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: 2px var(--sp-2);
    border-radius: var(--radius-xs);
    font-size: var(--text-2xs);
    font-weight: 660;
    letter-spacing: 0.02em;
    white-space: nowrap;
    line-height: 1.5;
}
.badge svg { width: 11px; height: 11px; }
.badge--success { background: var(--success-100); color: var(--success-700); }
.badge--warning { background: var(--warning-100); color: var(--warning-700); }
.badge--danger  { background: var(--danger-100);  color: var(--danger-700); }
.badge--info    { background: var(--info-100);    color: var(--info-700); }
.badge--neutral { background: var(--ink-100);     color: var(--ink-600); }
.badge--brand   { background: var(--brand-100);   color: var(--brand-800); }
.badge--outline { background: transparent; border: 1px solid var(--border-strong); color: var(--ink-600); }

.pill {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-1) var(--sp-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 580;
    background: var(--ink-100);
    color: var(--ink-700);
}
.pill--success { background: var(--success-100); color: var(--success-700); }
.pill--warning { background: var(--warning-100); color: var(--warning-700); }
.pill--danger  { background: var(--danger-100);  color: var(--danger-700); }
.pill--info    { background: var(--info-100);    color: var(--info-700); }
.pill--brand   { background: var(--brand-100);   color: var(--brand-800); }

.dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--ink-300); }
.dot--success { background: var(--success-500); }
.dot--warning { background: var(--warning-500); }
.dot--danger  { background: var(--danger-500); }
.dot--info    { background: var(--info-500); }
.dot--brand   { background: var(--brand-500); }

.dot--live {
    background: var(--success-500);
    box-shadow: 0 0 0 0 rgba(23, 149, 79, 0.55);
    animation: pulse 2.2s infinite;
}
@keyframes pulse {
    70%  { box-shadow: 0 0 0 7px rgba(23, 149, 79, 0); }
    100% { box-shadow: 0 0 0 0 rgba(23, 149, 79, 0); }
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: 1px var(--sp-2);
    border-radius: var(--radius-xs);
    font-size: var(--text-2xs);
    font-weight: 600;
    border: 1px solid currentColor;
    opacity: 0.9;
}


/* ==========================================================================
   13  TIMELINE & STEPS
   ========================================================================== */

.timeline { position: relative; padding-left: var(--sp-8); }
.timeline::before {
    content: "";
    position: absolute;
    left: 11px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--border);
    border-radius: 1px;
}
.timeline__item { position: relative; padding-bottom: var(--sp-5); }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__marker {
    position: absolute;
    left: calc(var(--sp-8) * -1);
    top: 1px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--paper);
    border: 2px solid var(--border-strong);
    display: grid;
    place-items: center;
    color: var(--ink-400);
    z-index: 1;
}
.timeline__marker svg { width: 12px; height: 12px; }
.timeline__item--done .timeline__marker { border-color: var(--success-500); background: var(--success-500); color: #fff; }
.timeline__item--active .timeline__marker { border-color: var(--brand-500); color: var(--brand-600); box-shadow: 0 0 0 4px var(--brand-050); }
.timeline__item--danger .timeline__marker { border-color: var(--danger-500); background: var(--danger-500); color: #fff; }
/* A step that has not happened yet — visible, so the shape of the whole
   process is legible before it is finished, but plainly not done. */
.timeline__item--pending .timeline__marker { border-color: var(--border-strong); background: var(--paper); color: var(--ink-300); }
.timeline__item--pending .timeline__title { color: var(--ink-400); }
.timeline__title { font-size: var(--text-sm); font-weight: 600; color: var(--ink-900); }
.timeline__meta { font-size: var(--text-xs); color: var(--ink-500); margin-top: 1px; }
.timeline__body { font-size: var(--text-sm); color: var(--ink-600); margin-top: var(--sp-2); }

.steps { display: flex; gap: 0; counter-reset: step; }
.step {
    flex: 1;
    position: relative;
    padding: var(--sp-3) var(--sp-4) var(--sp-3) var(--sp-8);
    font-size: var(--text-sm);
    color: var(--ink-400);
    border-top: 3px solid var(--border);
}
.step::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: var(--sp-3);
    top: var(--sp-3);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--ink-100);
    color: var(--ink-500);
    display: grid;
    place-items: center;
    font-size: var(--text-2xs);
    font-weight: 700;
}
.step.is-done { border-top-color: var(--success-500); color: var(--ink-600); }
.step.is-done::before { background: var(--success-500); color: #fff; }
.step.is-active { border-top-color: var(--brand-500); color: var(--ink-900); font-weight: 580; }
.step.is-active::before { background: var(--brand-600); color: #fff; }


/* ==========================================================================
   14  MAPS
   ========================================================================== */

.map {
    width: 100%;
    height: 420px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-sunken);
    z-index: 0;
}
.map--sm { height: 240px; }
.map--lg { height: 560px; }
.map--full { height: calc(100vh - var(--topbar-h) - var(--sp-12) - 90px); min-height: 460px; }

/* Leaflet overrides — the defaults look like a 2011 mashup. */
.leaflet-container { font-family: var(--font-sans) !important; background: var(--bg-sunken) !important; }
.leaflet-control-attribution {
    font-size: 10px !important;
    background: rgba(255, 255, 255, 0.82) !important;
    color: var(--ink-500) !important;
}
.leaflet-bar {
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-sm) !important;
    overflow: hidden;
}
.leaflet-bar a {
    color: var(--ink-700) !important;
    border-bottom-color: var(--border-soft) !important;
    width: 32px !important;
    height: 32px !important;
    line-height: 32px !important;
}
.leaflet-bar a:hover { background: var(--ink-050) !important; }
.leaflet-popup-content-wrapper {
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-md) !important;
    border: 1px solid var(--border);
    padding: 2px;
}
.leaflet-popup-content { margin: var(--sp-3) var(--sp-4) !important; font-size: var(--text-sm) !important; line-height: 1.45 !important; }
.leaflet-popup-tip { box-shadow: none !important; }

.map-pin {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50% 50% 50% 4px;
    transform: rotate(-45deg);
    border: 2px solid #fff;
    box-shadow: var(--shadow-md);
    background: var(--brand-600);
    color: #fff;
}
.map-pin > * { transform: rotate(45deg); font-size: 11px; font-weight: 700; }
.map-pin--pending    { background: var(--warning-500); }
.map-pin--assigned   { background: var(--info-500); }
.map-pin--en_route   { background: var(--brand-500); }
.map-pin--collecting { background: var(--brand-700); }
.map-pin--completed  { background: var(--success-500); }
.map-pin--danger     { background: var(--danger-500); }

.map-legend {
    position: absolute;
    bottom: var(--sp-4);
    left: var(--sp-4);
    z-index: 500;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--sp-3);
    font-size: var(--text-xs);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(8px);
}
.map-wrap { position: relative; }

.map-toolbar {
    position: absolute;
    top: var(--sp-3);
    right: var(--sp-3);
    z-index: 500;
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
}


/* ==========================================================================
   15  CHARTS
   Rendered as inline SVG by assets/js/chart.js — no external library, so the
   dashboards work on a machine with no internet connection.
   ========================================================================== */

.chart { width: 100%; display: block; overflow: visible; }
.chart__grid line { stroke: var(--border-soft); stroke-width: 1; shape-rendering: crispEdges; }
.chart__axis text { fill: var(--ink-400); font-size: 10px; font-family: var(--font-sans); }
.chart__line { fill: none; stroke: var(--brand-500); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart__line--alt { stroke: var(--info-500); }
.chart__area { fill: url(#chartFade); opacity: 0.85; }
.chart__bar { fill: var(--brand-400); rx: 2; transition: fill var(--dur-fast) var(--ease); }
.chart__bar:hover { fill: var(--brand-600); }
.chart__bar--alt { fill: var(--ink-200); }
.chart__point { fill: var(--paper); stroke: var(--brand-500); stroke-width: 2; }
.chart__hover { fill: transparent; cursor: crosshair; }
.chart__cursor { stroke: var(--ink-300); stroke-width: 1; stroke-dasharray: 3 3; }

.chart-tip {
    position: absolute;
    pointer-events: none;
    background: var(--ink-900);
    color: #fff;
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    line-height: 1.4;
    box-shadow: var(--shadow-md);
    white-space: nowrap;
    z-index: var(--z-dropdown);
    opacity: 0;
    transition: opacity var(--dur-fast) var(--ease);
}
.chart-tip.is-visible { opacity: 1; }
.chart-tip__label { color: rgba(255, 255, 255, 0.6); font-size: var(--text-2xs); }

.chart-wrap { position: relative; }

.sparkline { display: block; width: 100%; height: 32px; }
.sparkline path { fill: none; stroke: var(--brand-500); stroke-width: 1.6; stroke-linecap: round; }


/* ==========================================================================
   16  MODALS, DRAWERS & TOASTS
   ========================================================================== */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 13, 12, 0.45);
    backdrop-filter: blur(3px);
    z-index: var(--z-modal);
    display: grid;
    place-items: center;
    padding: var(--sp-4);
    opacity: 0;
    animation: fade var(--dur) var(--ease) forwards;
}
@keyframes fade { to { opacity: 1; } }

.modal {
    background: var(--paper);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - var(--sp-8));
    display: flex;
    flex-direction: column;
    transform: translateY(10px) scale(0.99);
    animation: rise var(--dur) var(--ease) forwards;
}
@keyframes rise { to { transform: translateY(0) scale(1); } }
.modal--lg { max-width: 760px; }
.modal--sm { max-width: 400px; }
.modal__head {
    padding: var(--sp-5) var(--sp-5) var(--sp-4);
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-4);
}
.modal__body { padding: var(--sp-5); overflow-y: auto; flex: 1; }
.modal__foot {
    padding: var(--sp-4) var(--sp-5);
    border-top: 1px solid var(--border-soft);
    display: flex;
    gap: var(--sp-3);
    justify-content: flex-end;
    background: var(--ink-050);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    flex-wrap: wrap;
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(420px, 100%);
    background: var(--paper);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-drawer);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform var(--dur-slow) var(--ease);
    border-left: 1px solid var(--border);
}
.drawer.is-open { transform: translateX(0); }
.drawer__head { padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.drawer__body { flex: 1; overflow-y: auto; }

.toasts {
    position: fixed;
    top: var(--sp-5);
    right: var(--sp-5);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    max-width: min(400px, calc(100vw - var(--sp-8)));
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    background: var(--paper);
    border: 1px solid var(--border);
    border-left: 3px solid var(--ink-400);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    font-size: var(--text-sm);
    pointer-events: auto;
    animation: slide-in var(--dur-slow) var(--ease);
}
@keyframes slide-in {
    from { transform: translateX(20px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
.toast.is-leaving { animation: slide-out var(--dur) var(--ease) forwards; }
@keyframes slide-out {
    to { transform: translateX(20px); opacity: 0; }
}
.toast--success { border-left-color: var(--success-500); }
.toast--warning { border-left-color: var(--warning-500); }
.toast--danger  { border-left-color: var(--danger-500); }
.toast--info    { border-left-color: var(--info-500); }
.toast__icon { flex-shrink: 0; margin-top: 1px; }
.toast__icon svg { width: 17px; height: 17px; }
.toast--success .toast__icon { color: var(--success-500); }
.toast--warning .toast__icon { color: var(--warning-500); }
.toast--danger  .toast__icon { color: var(--danger-500); }
.toast--info    .toast__icon { color: var(--info-500); }
.toast__body { flex: 1; min-width: 0; line-height: 1.45; }
.toast__close { color: var(--ink-400); flex-shrink: 0; }
.toast__close:hover { color: var(--ink-700); }

/* Inline alert */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-4);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    line-height: 1.5;
    border: 1px solid;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert__title { font-weight: 620; display: block; margin-bottom: 2px; }
.alert--success { background: var(--success-100); border-color: rgba(23, 149, 79, 0.24); color: var(--success-700); }
.alert--warning { background: var(--warning-100); border-color: rgba(192, 124, 16, 0.24); color: var(--warning-700); }
.alert--danger  { background: var(--danger-100);  border-color: rgba(194, 53, 47, 0.24);  color: var(--danger-700); }
.alert--info    { background: var(--info-100);    border-color: rgba(28, 111, 168, 0.24); color: var(--info-700); }
.alert--neutral { background: var(--ink-050);     border-color: var(--border);            color: var(--ink-700); }

/* Dropdown */
.dropdown { position: relative; }
.dropdown__menu {
    position: absolute;
    top: calc(100% + var(--sp-2));
    right: 0;
    min-width: 220px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: var(--sp-1);
    z-index: var(--z-dropdown);
    display: none;
}
.dropdown.is-open .dropdown__menu { display: block; animation: rise var(--dur-fast) var(--ease); }
.dropdown__item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-xs);
    font-size: var(--text-sm);
    color: var(--ink-700);
    text-decoration: none;
    width: 100%;
    text-align: left;
    transition: background var(--dur-fast) var(--ease);
}
.dropdown__item:hover { background: var(--ink-050); color: var(--ink-900); text-decoration: none; }
.dropdown__item svg { width: 15px; height: 15px; color: var(--ink-400); }
.dropdown__item--danger { color: var(--danger-700); }
.dropdown__item--danger:hover { background: var(--danger-100); }
.dropdown__divider { height: 1px; background: var(--border-soft); margin: var(--sp-1) 0; }
.dropdown__label {
    padding: var(--sp-2) var(--sp-3) var(--sp-1);
    font-size: var(--text-2xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-400);
    font-weight: 660;
}

/* Notification list item */
.notice {
    display: flex;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border-soft);
    text-decoration: none;
    color: inherit;
    transition: background var(--dur-fast) var(--ease);
}
.notice:hover { background: var(--ink-050); text-decoration: none; color: inherit; }
.notice.is-unread { background: var(--brand-050); }
.notice.is-unread:hover { background: var(--brand-100); }
.notice__icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: var(--ink-100);
    color: var(--ink-600);
}
.notice__icon--success { background: var(--success-100); color: var(--success-700); }
.notice__icon--warning { background: var(--warning-100); color: var(--warning-700); }
.notice__icon--danger  { background: var(--danger-100);  color: var(--danger-700); }
.notice__icon--info    { background: var(--info-100);    color: var(--info-700); }
.notice__body { flex: 1; min-width: 0; }
.notice__title { font-size: var(--text-sm); font-weight: 580; color: var(--ink-900); }
.notice__text  { font-size: var(--text-xs); color: var(--ink-600); margin-top: 1px; line-height: 1.45; }
.notice__time  { font-size: var(--text-2xs); color: var(--ink-400); margin-top: var(--sp-1); }


/* ==========================================================================
   17  EMPTY STATES & FEEDBACK
   ========================================================================== */

.empty {
    text-align: center;
    padding: var(--sp-12) var(--sp-6);
    color: var(--ink-500);
}
.empty__icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-lg);
    background: var(--ink-050);
    color: var(--ink-300);
    display: grid;
    place-items: center;
    margin: 0 auto var(--sp-4);
}
.empty__icon svg { width: 24px; height: 24px; }
.empty__title { font-size: var(--text-md); font-weight: 620; color: var(--ink-800); margin-bottom: var(--sp-2); }
.empty__text { font-size: var(--text-sm); max-width: 44ch; margin: 0 auto var(--sp-5); line-height: 1.55; }

.skeleton {
    background: linear-gradient(90deg, var(--ink-100) 25%, var(--ink-050) 50%, var(--ink-100) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: var(--radius-xs);
}
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton--text { height: 12px; margin-bottom: var(--sp-2); }
.skeleton--title { height: 20px; width: 42%; margin-bottom: var(--sp-3); }

.credentials-box {
    background: var(--brand-950);
    color: #fff;
    border-radius: var(--radius);
    padding: var(--sp-5);
    font-family: var(--font-mono);
}
.credentials-box dt { color: rgba(255, 255, 255, 0.5); font-size: var(--text-xs); }
.credentials-box dd { color: #fff; font-size: var(--text-md); font-weight: 600; letter-spacing: 0.03em; margin: 0 0 var(--sp-3); }

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    font-size: var(--text-2xs);
    color: var(--brand-300);
    font-family: var(--font-sans);
}
.copy-btn:hover { color: var(--brand-200); }


/* ==========================================================================
   18  UTILITIES
   ========================================================================== */

.hidden { display: none !important; }
.invisible { visibility: hidden; }
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.text-success { color: var(--success-700); }
.text-warning { color: var(--warning-700); }
.text-danger  { color: var(--danger-700); }
.text-info    { color: var(--info-700); }
.text-brand   { color: var(--brand-600); }
.text-white   { color: #fff; }

.bg-surface { background: var(--bg-surface); }
.bg-sunken  { background: var(--bg-sunken); }
.bg-brand   { background: var(--brand-050); }

.w-full { width: 100%; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-5 { margin-bottom: var(--sp-5); }
.mb-6 { margin-bottom: var(--sp-6); }

.rounded { border-radius: var(--radius); }
.border  { border: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border-soft); }
.shadow-sm { box-shadow: var(--shadow-sm); }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.divide > * + * { border-top: 1px solid var(--border-soft); padding-top: var(--sp-3); margin-top: var(--sp-3); }


/* ==========================================================================
   19  RESPONSIVE
   Mobile is the primary surface for residents and collectors: a collector
   accepts a job on a phone, standing next to a truck, on a patchy connection.
   These rules are not an afterthought.
   ========================================================================== */

@media (max-width: 1180px) {
    .split-main, .split-aside { grid-template-columns: minmax(0, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .site-footer__grid { grid-template-columns: 1fr 1fr; gap: var(--sp-8); }
}

@media (max-width: 960px) {
    :root { --sidebar-w: 240px; }

    .app { grid-template-columns: minmax(0, 1fr); }

    .sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        width: var(--sidebar-w);
        z-index: var(--z-drawer);
        transform: translateX(-100%);
        transition: transform var(--dur-slow) var(--ease);
        height: 100dvh;
    }
    .sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow-lg); }

    .sidebar-scrim {
        position: fixed;
        inset: 0;
        background: rgba(10, 13, 12, 0.45);
        z-index: calc(var(--z-drawer) - 1);
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--dur) var(--ease);
    }
    .sidebar-scrim.is-visible { opacity: 1; pointer-events: auto; }

    .sidebar-trigger { display: grid !important; }

    .split, .split-wide, .hero__grid { grid-template-columns: minmax(0, 1fr); gap: var(--sp-8); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .app__body { padding: var(--sp-4); }
    .topbar { padding-inline: var(--sp-4); }
    .site-nav { display: none; }
    .nav-toggle { display: grid; }

    .site-nav.is-open {
        display: flex;
        position: absolute;
        top: 68px;
        left: 0; right: 0;
        flex-direction: column;
        align-items: stretch;
        background: var(--paper);
        border-bottom: 1px solid var(--border);
        padding: var(--sp-3);
        box-shadow: var(--shadow-md);
        gap: 2px;
    }
}

@media (max-width: 700px) {
    :root { --text-base: 0.9375rem; }

    .container { padding-inline: var(--sp-4); }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
    .grid-auto-sm { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .site-footer__grid { grid-template-columns: minmax(0, 1fr); gap: var(--sp-6); }

    .hide-sm { display: none; }

    .page-head { flex-direction: column; align-items: stretch; }
    .page-head__actions { width: 100%; }
    .page-head__actions .btn { flex: 1; }

    .card__body { padding: var(--sp-4); }
    .filters { padding: var(--sp-3) var(--sp-4); }
    .filters .field { min-width: 100%; }

    .steps { flex-direction: column; }
    .step { border-top: 0; border-left: 3px solid var(--border); padding-block: var(--sp-2); }
    .step.is-done { border-left-color: var(--success-500); }
    .step.is-active { border-left-color: var(--brand-500); }
    .step::before { top: var(--sp-2); }

    .toasts { top: auto; bottom: var(--sp-4); left: var(--sp-4); right: var(--sp-4); max-width: none; }
    .modal { max-width: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; margin-top: auto; max-height: 92dvh; }
    .modal-backdrop { place-items: end center; padding: 0; }

    .map { height: 320px; }
    .map--full { height: 66dvh; }

    /* Tables become stacked records. A collector reading a job list on a
       phone should never have to pan horizontally. */
    .table--stack thead { display: none; }
    .table--stack tbody tr {
        display: block;
        padding: var(--sp-3) var(--sp-4);
        border-bottom: 1px solid var(--border-soft);
    }
    .table--stack tbody td {
        display: flex;
        justify-content: space-between;
        gap: var(--sp-4);
        padding: var(--sp-1) 0;
        border: 0;
        text-align: right;
    }
    .table--stack tbody td::before {
        content: attr(data-label);
        font-size: var(--text-2xs);
        font-weight: 660;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--ink-400);
        text-align: left;
        flex-shrink: 0;
    }
    .table--stack tbody td:first-child { padding-bottom: var(--sp-2); }
    .table--stack tbody td.actions { justify-content: flex-end; padding-top: var(--sp-3); }
}

@media (max-width: 420px) {
    .stat__value { font-size: var(--text-xl); }
    .display { font-size: 2rem; }
    .btn { padding-inline: var(--sp-3); }
}


/* ==========================================================================
   20  PRINT & MOTION PREFERENCES
   ========================================================================== */

@media print {
    :root { --bg-body: #fff; }

    body { background: #fff; color: #000; font-size: 11pt; }
    .sidebar, .topbar, .site-header, .site-footer,
    .no-print, .btn, .filters, .pagination, .toasts { display: none !important; }
    .app { grid-template-columns: 1fr; }
    .app__body { padding: 0; }
    .card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
    .table thead th { background: #f0f0f0 !important; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    a { color: #000; text-decoration: none; }
    a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
    .print-only { display: block !important; }
    @page { margin: 16mm; }
}
.print-only { display: none; }

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

/* High-contrast preference: strengthen every boundary rather than relying on
   subtle tonal separation. */
@media (prefers-contrast: more) {
    :root {
        --border: var(--ink-400);
        --border-soft: var(--ink-300);
        --ink-500: var(--ink-700);
    }
    .btn-secondary { border-width: 2px; }
}
