/* =====================================================================
 *  TRUE VISION LOGISTICS  |  CRM Design System
 * =====================================================================
 *  A single source of truth for colour, type, spacing and components.
 *  Tune the brand here and every screen follows.
 * ===================================================================== */

/* ---------------------------------------------------------------------
 *  TOKENS
 * ------------------------------------------------------------------- */
:root {
    /* Brand palette — deep logistics navy + signal cyan */
    --brand-900: #0a1f3d;
    --brand-800: #0d2a52;
    --brand-700: #12376b;
    --brand-600: #175099;
    --brand-500: #1e6fd9;
    --brand-400: #4a94f0;
    --brand-300: #86b8f7;
    --brand-200: #bcd8fc;
    --brand-100: #e3eefe;
    --brand-50:  #f2f8ff;

    --accent-600: #0891b2;
    --accent-500: #06b6d4;
    --accent-400: #22d3ee;
    --accent-100: #cdfafe;

    /* Status */
    --violet-500: #7c3aed;
    --violet-100: #ede9fe;
    --amber-600:  #d97706;
    --amber-100:  #fef3c7;
    --green-600:  #059669;
    --green-100:  #d1fae5;
    --red-600:    #dc2626;
    --red-100:    #fee2e2;
    --blue-600:   #2563eb;
    --blue-100:   #dbeafe;
    --slate-600:  #475569;
    --slate-100:  #f1f5f9;

    /* Neutrals */
    --ink-900: #0b1220;
    --ink-800: #16203a;
    --ink-700: #1e2a45;
    --ink-600: #33415c;
    --ink-500: #55627a;
    --ink-400: #8492a8;
    --ink-300: #b4c0d1;
    --ink-200: #d9e0ea;
    --ink-100: #eaeff6;
    --ink-50:  #f6f8fc;
    --white:   #ffffff;

    /* Semantics */
    --bg:          #f3f6fb;
    --surface:     #ffffff;
    --border:      #e4eaf3;
    --border-strong:#cfd8e6;
    --text:        #0f1a2e;
    --text-muted:  #66748c;

    --primary:      var(--brand-500);
    --primary-hover:var(--brand-600);
    --ring:         rgba(30, 111, 217, .18);

    /* Shape & depth */
    --radius-sm: 8px;
    --radius:    12px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --radius-pill: 999px;

    --shadow-xs: 0 1px 2px rgba(11, 18, 32, .06);
    --shadow-sm: 0 1px 3px rgba(11, 18, 32, .08), 0 1px 2px rgba(11, 18, 32, .04);
    --shadow:    0 4px 14px rgba(11, 18, 32, .08);
    --shadow-md: 0 8px 28px rgba(11, 18, 32, .10);
    --shadow-lg: 0 20px 50px rgba(11, 18, 32, .16);

    /* Layout metrics */
    --sidebar-w: 272px;
    --sidebar-w-collapsed: 78px;
    --topbar-h: 68px;

    /* Type */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
            'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

    --ease: cubic-bezier(.4, 0, .2, 1);
}

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

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

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

h1, h2, h3, h4, h5 { margin: 0; font-weight: 650; line-height: 1.25; letter-spacing: -.011em; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; }
code { font-family: var(--font-mono); font-size: .9em; background: var(--ink-100); padding: 2px 6px; border-radius: 5px; }

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

/* Focus visibility — keyboard users get a real ring everywhere. */
:focus-visible {
    outline: 3px solid var(--ring);
    outline-offset: 2px;
    border-radius: 4px;
}

/* =====================================================================
 *  LOGIN
 * =================================================================== */
.page-auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    background: var(--surface);
}

/* --- Brand panel ---------------------------------------------------- */
.auth-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 46px 54px;
    color: #fff;
    background:
        radial-gradient(1100px 620px at 12% 8%,  rgba(34, 211, 238, .22), transparent 60%),
        radial-gradient(900px 700px at 92% 92%,  rgba(74, 148, 240, .30), transparent 62%),
        linear-gradient(155deg, var(--brand-900) 0%, var(--brand-800) 45%, #071a34 100%);
    isolation: isolate;
}

/* Faint animated route grid, evoking a live network. */
.auth-brand::before {
    content: '';
    position: absolute;
    inset: -10%;
    background-image:
        linear-gradient(rgba(255,255,255,.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.055) 1px, transparent 1px);
    background-size: 54px 54px;
    transform: perspective(600px) rotateX(58deg) scale(1.5) translateY(12%);
    mask-image: radial-gradient(ellipse at 50% 45%, #000 15%, transparent 72%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 45%, #000 15%, transparent 72%);
    z-index: -1;
    animation: gridDrift 26s linear infinite;
}

@keyframes gridDrift {
    from { background-position: 0 0, 0 0; }
    to   { background-position: 0 54px, 54px 0; }
}

/* Floating "shipment" orbs */
.auth-brand::after {
    content: '';
    position: absolute;
    width: 340px; height: 340px;
    right: -90px; top: 26%;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 30%, rgba(34,211,238,.42), transparent 66%);
    filter: blur(14px);
    z-index: -1;
    animation: orbFloat 13s ease-in-out infinite alternate;
}

@keyframes orbFloat {
    from { transform: translate3d(0,0,0) scale(1); }
    to   { transform: translate3d(-34px, 40px, 0) scale(1.09); }
}

.auth-logo { display: flex; align-items: center; gap: 13px; }

.auth-logo-mark {
    width: 46px; height: 46px;
    flex: 0 0 46px;
    display: grid; place-items: center;
    border-radius: 13px;
    background: linear-gradient(140deg, var(--accent-500), var(--brand-400));
    box-shadow: 0 8px 22px rgba(6, 182, 212, .38);
}
.auth-logo-mark svg { width: 25px; height: 25px; stroke: #fff; }

.auth-logo-text strong {
    display: block;
    font-size: 16.5px;
    font-weight: 750;
    letter-spacing: -.02em;
}
.auth-logo-text span {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .16em;
    color: rgba(255,255,255,.62);
    margin-top: 1px;
}

.auth-hero { max-width: 470px; margin: auto 0; padding: 46px 0; }

.auth-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--accent-400);
    background: rgba(34, 211, 238, .12);
    border: 1px solid rgba(34, 211, 238, .26);
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    margin-bottom: 22px;
}
.auth-eyebrow::before {
    content: '';
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--accent-400);
    box-shadow: 0 0 0 4px rgba(34,211,238,.22);
    animation: pulse 2.1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(34,211,238,.22); }
    50%      { box-shadow: 0 0 0 8px rgba(34,211,238,0); }
}

.auth-hero h1 {
    font-size: clamp(30px, 3.4vw, 43px);
    font-weight: 780;
    line-height: 1.1;
    letter-spacing: -.03em;
    margin-bottom: 17px;
}
.auth-hero h1 em {
    font-style: normal;
    background: linear-gradient(100deg, var(--accent-400), var(--brand-300));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.auth-hero p {
    font-size: 15.5px;
    line-height: 1.65;
    color: rgba(255,255,255,.76);
}

.auth-roles { margin-top: 30px; display: grid; gap: 11px; }

.auth-role {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    padding: 13px 15px;
    border-radius: var(--radius);
    background: rgba(255,255,255,.055);
    border: 1px solid rgba(255,255,255,.09);
    backdrop-filter: blur(8px);
    transition: background .2s var(--ease), transform .2s var(--ease);
}
.auth-role:hover { background: rgba(255,255,255,.1); transform: translateX(4px); }

.auth-role-icon {
    width: 34px; height: 34px;
    flex: 0 0 34px;
    display: grid; place-items: center;
    border-radius: 9px;
    background: rgba(34,211,238,.16);
}
.auth-role-icon svg { width: 17px; height: 17px; stroke: var(--accent-400); }

.auth-role strong { display: block; font-size: 13.5px; font-weight: 650; }
.auth-role span   { display: block; font-size: 12.5px; color: rgba(255,255,255,.6); margin-top: 2px; }

.auth-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: rgba(255,255,255,.48);
    border-top: 1px solid rgba(255,255,255,.1);
    padding-top: 20px;
}
.auth-foot .env {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 5px 11px;
    border-radius: var(--radius-pill);
    background: rgba(5, 150, 105, .18);
    border: 1px solid rgba(5, 150, 105, .34);
    color: #6ee7b7;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: .04em;
}
.auth-foot .env::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%; background: #34d399;
}

/* --- Form panel ----------------------------------------------------- */
.auth-form-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 44px 40px;
    background:
        radial-gradient(760px 420px at 84% -6%, var(--brand-50), transparent 62%),
        var(--white);
}

.auth-card { width: 100%; max-width: 414px; }

.auth-mobile-logo { display: none; margin-bottom: 30px; }

.auth-card-head { margin-bottom: 26px; }
.auth-card-head h2 { font-size: 27px; font-weight: 730; letter-spacing: -.025em; }
.auth-card-head p  { color: var(--text-muted); margin-top: 7px; font-size: 14.5px; }

.auth-greeting {
    font-size: 13px;
    font-weight: 620;
    color: var(--accent-600);
    background: var(--accent-100);
    display: inline-block;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    margin-bottom: 13px;
}

/* --- Alerts --------------------------------------------------------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 13.5px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    animation: alertIn .3s var(--ease);
}
@keyframes alertIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.alert svg { width: 17px; height: 17px; flex: 0 0 17px; margin-top: 1px; }
.alert-error   { background: var(--red-100);   border-color: #fecaca; color: #991b1b; }
.alert-error svg   { stroke: var(--red-600); }
.alert-success { background: var(--green-100); border-color: #a7f3d0; color: #065f46; }
.alert-success svg { stroke: var(--green-600); }
.alert-info    { background: var(--blue-100);  border-color: #bfdbfe; color: #1e40af; }
.alert-info svg    { stroke: var(--blue-600); }
.alert-warning { background: var(--amber-100); border-color: #fde68a; color: #92400e; }
.alert-warning svg { stroke: var(--amber-600); }

/* --- Fields --------------------------------------------------------- */
.field { margin-bottom: 17px; }

.field label {
    display: block;
    font-size: 12.5px;
    font-weight: 620;
    color: var(--ink-600);
    margin-bottom: 7px;
    letter-spacing: .01em;
}
.field label .req { color: var(--red-600); margin-left: 2px; }

.input-shell { position: relative; display: flex; align-items: center; }

.input-shell > svg.lead {
    position: absolute;
    left: 14px;
    width: 17px; height: 17px;
    stroke: var(--ink-400);
    pointer-events: none;
    transition: stroke .18s var(--ease);
}

.input-shell input,
.input-shell select,
.input-shell textarea {
    width: 100%;
    font-family: inherit;
    font-size: 14.5px;
    color: var(--text);
    padding: 12px 14px;
    padding-left: 42px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--white);
    transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
    appearance: none;
    -webkit-appearance: none;
}

.input-shell.no-lead input,
.input-shell.no-lead select { padding-left: 14px; }

.input-shell textarea { min-height: 96px; resize: vertical; padding-left: 14px; line-height: 1.6; }

.input-shell input::placeholder,
.input-shell textarea::placeholder { color: var(--ink-400); }

.input-shell input:hover, .input-shell select:hover { border-color: var(--ink-300); }

.input-shell input:focus,
.input-shell select:focus,
.input-shell textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--ring);
    background: var(--white);
}
.input-shell:focus-within > svg.lead { stroke: var(--primary); }

.input-shell select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238492a8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
    cursor: pointer;
}

.input-shell.has-error input,
.input-shell.has-error select { border-color: var(--red-600); }
.input-shell.has-error input:focus { box-shadow: 0 0 0 4px rgba(220,38,38,.14); }

.field-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.field-error { font-size: 12.5px; color: var(--red-600); margin-top: 6px; font-weight: 550; }

/* Password reveal */
.btn-reveal {
    position: absolute;
    right: 6px;
    display: grid; place-items: center;
    width: 34px; height: 34px;
    border: 0;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: background .16s var(--ease);
}
.btn-reveal:hover { background: var(--ink-100); }
.btn-reveal svg { width: 17px; height: 17px; stroke: var(--ink-400); }
.btn-reveal:hover svg { stroke: var(--ink-600); }

/* --- Row helpers ---------------------------------------------------- */
.field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 4px 0 22px;
    flex-wrap: wrap;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 13.5px;
    color: var(--ink-600);
    cursor: pointer;
    user-select: none;
}
.checkbox input {
    width: 17px; height: 17px;
    accent-color: var(--primary);
    cursor: pointer;
    margin: 0;
}

/* =====================================================================
 *  BUTTONS
 * =================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 620;
    line-height: 1;
    padding: 12px 20px;
    border: 1.5px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    white-space: nowrap;
    transition: all .17s var(--ease);
    text-decoration: none;
    letter-spacing: .005em;
}
.btn svg { width: 16px; height: 16px; flex: 0 0 16px; }

.btn-primary {
    background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
    color: #fff;
    box-shadow: 0 4px 14px rgba(23, 80, 153, .30);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 7px 20px rgba(23, 80, 153, .36);
}
.btn-primary:active { transform: translateY(0); }

.btn-accent {
    background: linear-gradient(135deg, var(--accent-500), var(--accent-600));
    color: #fff;
    box-shadow: 0 4px 14px rgba(8, 145, 178, .30);
}
.btn-accent:hover { filter: brightness(1.06); color: #fff; transform: translateY(-1px); }

.btn-secondary {
    background: var(--white);
    color: var(--ink-700);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--ink-50); border-color: var(--ink-300); color: var(--ink-900); }

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

.btn-danger { background: var(--red-600); color: #fff; box-shadow: 0 4px 14px rgba(220,38,38,.26); }
.btn-danger:hover { background: #b91c1c; color: #fff; transform: translateY(-1px); }

.btn-block { width: 100%; }
.btn-lg { padding: 14px 24px; font-size: 15px; }
.btn-sm { padding: 8px 13px; font-size: 13px; border-radius: 9px; }
.btn-xs { padding: 5px 10px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn-xs svg { width: 13px; height: 13px; flex: 0 0 13px; }

.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.btn-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .65s linear infinite;
}
.btn-secondary.btn-loading::after { border-color: rgba(0,0,0,.15); border-top-color: var(--ink-600); }

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

/* =====================================================================
 *  APP SHELL
 * =================================================================== */
.app { display: flex; min-height: 100vh; }

/* --- Sidebar -------------------------------------------------------- */
.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--brand-900) 0%, #071730 100%);
    color: #fff;
    z-index: 60;
    transition: transform .3s var(--ease);
    overflow: hidden;
}
.sidebar::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(500px 260px at 10% 0%, rgba(34,211,238,.12), transparent 65%),
        radial-gradient(420px 320px at 100% 100%, rgba(74,148,240,.12), transparent 65%);
    pointer-events: none;
}

.sidebar-head {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    min-height: var(--topbar-h);
}
.sidebar-logo {
    width: 38px; height: 38px; flex: 0 0 38px;
    display: grid; place-items: center;
    border-radius: 11px;
    background: linear-gradient(140deg, var(--accent-500), var(--brand-400));
    box-shadow: 0 6px 16px rgba(6,182,212,.34);
}
.sidebar-logo svg { width: 21px; height: 21px; stroke: #fff; }
.sidebar-brand strong { display: block; font-size: 14.5px; font-weight: 720; letter-spacing: -.015em; }
.sidebar-brand span {
    display: block; font-size: 9.5px; text-transform: uppercase;
    letter-spacing: .15em; color: rgba(255,255,255,.5); margin-top: 1px;
}

.sidebar-nav {
    position: relative;
    flex: 1;
    overflow-y: auto;
    padding: 16px 13px 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.16) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 4px; }

.nav-group { margin-bottom: 6px; }

.nav-group-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: rgba(255,255,255,.34);
    padding: 15px 13px 8px;
}

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 13px;
    margin-bottom: 2px;
    border-radius: 10px;
    color: rgba(255,255,255,.72);
    font-size: 13.8px;
    font-weight: 520;
    transition: all .16s var(--ease);
}
.nav-link svg { width: 18px; height: 18px; flex: 0 0 18px; stroke-width: 1.9; opacity: .82; transition: all .16s var(--ease); }
.nav-link span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link:hover svg { opacity: 1; }

.nav-link.active {
    background: linear-gradient(90deg, rgba(34,211,238,.20), rgba(34,211,238,.06));
    color: #fff;
    font-weight: 620;
    box-shadow: inset 0 0 0 1px rgba(34,211,238,.22);
}
.nav-link.active::before {
    content: '';
    position: absolute;
    left: -13px;
    top: 50%;
    transform: translateY(-50%);
    width: 3.5px;
    height: 22px;
    border-radius: 0 4px 4px 0;
    background: var(--accent-400);
    box-shadow: 0 0 12px var(--accent-500);
}
.nav-link.active svg { opacity: 1; stroke: var(--accent-400); }

.nav-add {
    display: grid;
    place-items: center;
    width: 21px; height: 21px;
    flex: 0 0 21px;
    border-radius: 6px;
    background: rgba(255,255,255,.10);
    transition: all .16s var(--ease);
}
.nav-add svg { width: 13px; height: 13px; stroke-width: 2.6; opacity: .9; }
.nav-add:hover { background: var(--accent-500); }
.nav-add:hover svg { stroke: #fff; }

/* --- Sidebar user card --------------------------------------------- */
.sidebar-user {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 15px 17px;
    border-top: 1px solid rgba(255,255,255,.09);
    background: rgba(0,0,0,.20);
}
.avatar {
    width: 36px; height: 36px; flex: 0 0 36px;
    display: grid; place-items: center;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--brand-400), var(--accent-500));
    letter-spacing: .02em;
}
.avatar-sm { width: 30px; height: 30px; flex: 0 0 30px; font-size: 11px; border-radius: 8px; }
.avatar-lg { width: 56px; height: 56px; flex: 0 0 56px; font-size: 19px; border-radius: 15px; }

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info strong {
    display: block; font-size: 13px; font-weight: 620;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user-info span {
    display: block; font-size: 11px; color: rgba(255,255,255,.5);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user .btn-signout {
    display: grid; place-items: center;
    width: 31px; height: 31px;
    flex: 0 0 31px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,.13);
    background: rgba(255,255,255,.05);
    transition: all .16s var(--ease);
}
.sidebar-user .btn-signout:hover { background: rgba(220,38,38,.28); border-color: rgba(220,38,38,.5); }
.sidebar-user .btn-signout svg { width: 15px; height: 15px; stroke: rgba(255,255,255,.75); }

/* --- Main column ---------------------------------------------------- */
.main {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
}

/* --- Topbar --------------------------------------------------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 26px;
    background: rgba(255,255,255,.86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.hamburger {
    display: none;
    place-items: center;
    width: 38px; height: 38px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 10px;
    cursor: pointer;
}
.hamburger svg { width: 19px; height: 19px; stroke: var(--ink-700); }

.page-title { flex: 1; min-width: 0; }
.page-title h1 { font-size: 17.5px; font-weight: 690; letter-spacing: -.02em; }
.page-title p  { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }

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

.topbar-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border-radius: var(--radius-pill);
    background: var(--ink-50);
    border: 1px solid var(--border);
    font-size: 12.5px;
    font-weight: 570;
    color: var(--ink-600);
}
.topbar-chip svg { width: 14px; height: 14px; stroke: var(--ink-400); }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px 5px 5px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: var(--radius-pill);
    cursor: default;
}
.topbar-user .who strong { display: block; font-size: 13px; font-weight: 640; line-height: 1.2; }
.topbar-user .who span   { display: block; font-size: 11px; color: var(--text-muted); line-height: 1.3; }

/* --- Account shortcuts (topbar + sidebar user -> My Profile) ------- */
a.user-profile-link { text-decoration: none; color: inherit; }
a.topbar-user {
    cursor: pointer;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
a.topbar-user:hover {
    border-color: var(--brand-300);
    box-shadow: 0 2px 8px rgba(10, 31, 61, .07);
}
.sidebar-user-info.user-profile-link {
    display: block;
    border-radius: 8px;
    padding: 3px 5px;
    margin: -3px 0 -3px -5px;
}
.sidebar-user-info.user-profile-link:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.sidebar-user-info.user-profile-link:focus-visible { outline: 2px solid rgba(255,255,255,.5); outline-offset: 2px; }

/* --- Content -------------------------------------------------------- */
.content { flex: 1; padding: 26px; }

.content-narrow { max-width: 960px; }

/* =====================================================================
 *  CARDS
 * =================================================================== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.card-pad { padding: 22px; }

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 15.5px; font-weight: 660; }
.card-head p  { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.card-body { padding: 22px; }

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 680;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--ink-500);
    margin-bottom: 15px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* =====================================================================
 *  STAT TILES
 * =================================================================== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: 17px;
    margin-bottom: 24px;
}

.stat {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 19px;
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.stat::after {
    content: '';
    position: absolute;
    right: -30px; top: -30px;
    width: 105px; height: 105px;
    border-radius: 50%;
    background: var(--stat-tint, var(--brand-100));
    opacity: .55;
}

.stat-top { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.stat-icon {
    width: 42px; height: 42px; flex: 0 0 42px;
    display: grid; place-items: center;
    border-radius: 12px;
    background: var(--stat-tint, var(--brand-100));
}
.stat-icon svg { width: 21px; height: 21px; stroke: var(--stat-color, var(--brand-600)); }

.stat-label { font-size: 12.5px; font-weight: 570; color: var(--text-muted); }

.stat-value {
    position: relative; z-index: 1;
    font-size: 31px;
    font-weight: 740;
    letter-spacing: -.035em;
    margin-top: 13px;
    line-height: 1;
    color: var(--ink-900);
}
.stat-meta { position: relative; z-index: 1; font-size: 12px; color: var(--text-muted); margin-top: 8px; }

.stat.tint-blue   { --stat-tint: var(--blue-100);   --stat-color: var(--blue-600); }
.stat.tint-green  { --stat-tint: var(--green-100);  --stat-color: var(--green-600); }
.stat.tint-amber  { --stat-tint: var(--amber-100);  --stat-color: var(--amber-600); }
.stat.tint-violet { --stat-tint: var(--violet-100); --stat-color: var(--violet-500); }
.stat.tint-cyan   { --stat-tint: var(--accent-100); --stat-color: var(--accent-600); }
.stat.tint-red    { --stat-tint: var(--red-100);    --stat-color: var(--red-600); }
.stat.tint-slate  { --stat-tint: var(--slate-100);  --stat-color: var(--slate-600); }

/* =====================================================================
 *  BADGES
 * =================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 11.5px;
    font-weight: 640;
    letter-spacing: .02em;
    line-height: 1.5;
    white-space: nowrap;
    border: 1px solid transparent;
}
.badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .75;
}
.badge-solid::before { display: none; }

.badge-blue   { background: var(--blue-100);   color: var(--blue-600);   border-color: #bfdbfe; }
.badge-green  { background: var(--green-100);  color: var(--green-600);  border-color: #a7f3d0; }
.badge-amber  { background: var(--amber-100);  color: var(--amber-600);  border-color: #fde68a; }
.badge-red    { background: var(--red-100);    color: var(--red-600);    border-color: #fecaca; }
.badge-violet { background: var(--violet-100); color: var(--violet-500); border-color: #ddd6fe; }
.badge-slate  { background: var(--slate-100);  color: var(--slate-600);  border-color: var(--ink-200); }
.badge-cyan   { background: var(--accent-100); color: var(--accent-600); border-color: #a5f3fc; }

/* =====================================================================
 *  DATA TABLE
 * =================================================================== */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13.7px;
}

.table thead th {
    text-align: left;
    padding: 13px 17px;
    font-size: 11.3px;
    font-weight: 680;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--ink-500);
    background: var(--ink-50);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.table tbody td {
    padding: 14px 17px;
    border-bottom: 1px solid var(--ink-100);
    vertical-align: middle;
    color: var(--ink-700);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .13s var(--ease); }
.table tbody tr:hover { background: var(--brand-50); }

.table .cell-primary { font-weight: 620; color: var(--ink-900); }
.table .cell-sub { font-size: 12.2px; color: var(--text-muted); margin-top: 2px; }

.table .cell-user { display: flex; align-items: center; gap: 11px; }

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

/* Icon action buttons */
.icon-btn {
    display: grid; place-items: center;
    width: 31px; height: 31px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--white);
    cursor: pointer;
    transition: all .15s var(--ease);
}
.icon-btn svg { width: 15px; height: 15px; stroke: var(--ink-500); }
.icon-btn:hover { border-color: var(--brand-300); background: var(--brand-50); }
.icon-btn:hover svg { stroke: var(--brand-600); }
.icon-btn.danger:hover { border-color: #fecaca; background: var(--red-100); }
.icon-btn.danger:hover svg { stroke: var(--red-600); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }

/* =====================================================================
 *  TOOLBAR / FILTERS
 * =================================================================== */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.toolbar .grow { flex: 1; min-width: 190px; }

.search-box { position: relative; display: flex; align-items: center; }
.search-box svg {
    position: absolute; left: 13px;
    width: 16px; height: 16px;
    stroke: var(--ink-400);
    pointer-events: none;
}
.search-box input {
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    padding: 10px 14px 10px 38px;
    border: 1.5px solid var(--border-strong);
    border-radius: 10px;
    background: var(--white);
    transition: all .17s var(--ease);
}
.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--ring);
}

.filter-select {
    font-family: inherit;
    font-size: 13.7px;
    padding: 10px 34px 10px 13px;
    border: 1.5px solid var(--border-strong);
    border-radius: 10px;
    background: var(--white);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238492a8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: all .17s var(--ease);
}
.filter-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }

/* =====================================================================
 *  TABS
 * =================================================================== */
.tabs {
    display: flex;
    gap: 3px;
    background: var(--ink-100);
    padding: 4px;
    border-radius: 11px;
    margin-bottom: 20px;
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
}
.tab {
    font-family: inherit;
    font-size: 13.4px;
    font-weight: 580;
    padding: 8px 17px;
    border: 0;
    background: transparent;
    color: var(--ink-500);
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: all .16s var(--ease);
}
.tab:hover { color: var(--ink-800); }
.tab.active {
    background: var(--white);
    color: var(--brand-600);
    font-weight: 650;
    box-shadow: var(--shadow-xs);
}

/* =====================================================================
 *  EMPTY STATE
 * =================================================================== */
.empty {
    text-align: center;
    padding: 56px 26px;
}
.empty-icon {
    width: 68px; height: 68px;
    margin: 0 auto 18px;
    display: grid; place-items: center;
    border-radius: 20px;
    background: var(--ink-100);
    border: 1px dashed var(--border-strong);
}
.empty-icon svg { width: 30px; height: 30px; stroke: var(--ink-400); }
.empty h3 { font-size: 16.5px; font-weight: 660; margin-bottom: 7px; }
.empty p  { font-size: 14px; color: var(--text-muted); max-width: 400px; margin: 0 auto 20px; }

/* =====================================================================
 *  MODAL
 * =================================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 14, 28, .58);
    backdrop-filter: blur(3px);
    display: grid;
    place-items: center;
    padding: 24px;
    z-index: 200;
    animation: fadeIn .2s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: modalIn .26s var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }

.modal-head { padding: 22px 24px 0; }
.modal-icon {
    width: 46px; height: 46px;
    display: grid; place-items: center;
    border-radius: 13px;
    background: var(--red-100);
    margin-bottom: 14px;
}
.modal-icon svg { width: 23px; height: 23px; stroke: var(--red-600); }
.modal-icon.confirm { background: var(--blue-100); }
.modal-icon.confirm svg { stroke: var(--blue-600); }
.modal-head h3 { font-size: 17.5px; font-weight: 680; }
.modal-head p { font-size: 13.8px; color: var(--text-muted); margin-top: 7px; line-height: 1.6; }
.modal-body { padding: 20px 24px 4px; }
.modal-foot {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 20px 24px 22px;
}

/* =====================================================================
 *  TOASTS
 * =================================================================== */
.toast-stack {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 372px;
    width: calc(100% - 40px);
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 14px 15px;
    border-radius: var(--radius);
    background: var(--white);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow-md);
    font-size: 13.6px;
    animation: toastIn .32s var(--ease);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
.toast.out { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(28px); } }

.toast svg { width: 17px; height: 17px; flex: 0 0 17px; margin-top: 1px; }
.toast strong { display: block; font-weight: 640; margin-bottom: 1px; }
.toast span { color: var(--text-muted); font-size: 13px; }
.toast-close {
    margin-left: auto;
    border: 0; background: transparent;
    cursor: pointer; padding: 2px;
    color: var(--ink-400); font-size: 17px; line-height: 1;
}
.toast-close:hover { color: var(--ink-700); }

.toast.success { border-left-color: var(--green-600); }
.toast.success svg { stroke: var(--green-600); }
.toast.error { border-left-color: var(--red-600); }
.toast.error svg { stroke: var(--red-600); }
.toast.warning { border-left-color: var(--amber-600); }
.toast.warning svg { stroke: var(--amber-600); }
.toast.info { border-left-color: var(--blue-600); }
.toast.info svg { stroke: var(--blue-600); }

/* =====================================================================
 *  PAGINATION
 * =================================================================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding: 16px 18px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
}
.pager { display: flex; gap: 5px; }
.pager a, .pager span {
    display: grid; place-items: center;
    min-width: 33px; height: 33px;
    padding: 0 9px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--white);
    font-size: 13px;
    font-weight: 560;
    color: var(--ink-600);
    transition: all .15s var(--ease);
}
.pager a:hover { border-color: var(--brand-300); background: var(--brand-50); color: var(--brand-600); }
.pager .current { background: var(--brand-500); border-color: var(--brand-500); color: #fff; }
.pager .disabled { opacity: .45; pointer-events: none; }

/* =====================================================================
 *  PERMISSION MATRIX (Users & Roles)
 * =================================================================== */
.perm-grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.perm-grid th, .perm-grid td { padding: 11px 13px; text-align: center; border-bottom: 1px solid var(--ink-100); }
.perm-grid th:first-child, .perm-grid td:first-child { text-align: left; }
.perm-grid thead th {
    font-size: 11.3px; font-weight: 680; text-transform: uppercase;
    letter-spacing: .06em; color: var(--ink-500); background: var(--ink-50);
}
.perm-yes { color: var(--green-600); font-weight: 700; }
.perm-no  { color: var(--ink-300); font-weight: 700; }

/* =====================================================================
 *  ERROR PAGE
 * =================================================================== */
.page-error {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 30px;
    background:
        radial-gradient(700px 400px at 50% 0%, var(--brand-50), transparent 70%),
        var(--bg);
    text-align: center;
}
.error-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: 44px 40px;
    max-width: 460px;
}
.error-code {
    font-size: 62px;
    font-weight: 800;
    letter-spacing: -.05em;
    line-height: 1;
    background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 12px;
}
.error-card h1 { font-size: 22px; margin-bottom: 12px; }
.error-role {
    font-size: 13px;
    background: var(--ink-50);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 7px 15px;
    display: inline-block;
    margin-bottom: 16px;
    color: var(--ink-600);
}
.error-text { color: var(--text-muted); font-size: 14.3px; line-height: 1.65; margin-bottom: 10px; }
.error-detail { font-size: 13px; color: var(--ink-500); margin-bottom: 24px; }

/* =====================================================================
 *  PERMISSION MATRIX BANNER
 * =================================================================== */
.setup-banner {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    padding: 17px 20px;
    margin-bottom: 22px;
    background: linear-gradient(120deg, var(--amber-100), #fffbeb);
    border: 1px solid #fde68a;
    border-left: 4px solid var(--amber-600);
    border-radius: var(--radius);
}
.setup-banner .sb-icon {
    width: 40px; height: 40px; flex: 0 0 40px;
    display: grid; place-items: center;
    border-radius: 11px;
    background: rgba(217, 119, 6, .16);
}
.setup-banner .sb-icon svg { width: 21px; height: 21px; stroke: var(--amber-600); }
.setup-banner .sb-text { flex: 1; min-width: 220px; }
.setup-banner .sb-text strong { display: block; font-size: 14px; color: #92400e; }
.setup-banner .sb-text span   { font-size: 13px; color: #a16207; }

/* =====================================================================
 *  FORM LAYOUT
 * =================================================================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 4px 18px;
}
.form-grid .span-2 { grid-column: 1 / -1; }

.form-section { margin-bottom: 28px; }
.form-section:last-child { margin-bottom: 0; }

.form-actions {
    display: flex;
    gap: 11px;
    flex-wrap: wrap;
    padding-top: 22px;
    margin-top: 24px;
    border-top: 1px solid var(--border);
}

/* Permission preview chips (user form) */
.role-preview {
    display: grid;
    gap: 9px;
    margin-top: 11px;
}
.role-preview-item {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12.8px;
    color: var(--ink-600);
    padding: 9px 13px;
    background: var(--ink-50);
    border: 1px solid var(--border);
    border-radius: 9px;
}
.role-preview-item svg { width: 15px; height: 15px; flex: 0 0 15px; }
.role-preview-item.yes svg { stroke: var(--green-600); }
.role-preview-item.no  svg { stroke: var(--ink-400); }
.role-preview-item.no  { color: var(--ink-400); }

/* =====================================================================
 *  ACTIVITY FEED
 * =================================================================== */
.feed { display: flex; flex-direction: column; }
.feed-item {
    display: flex;
    gap: 13px;
    padding: 14px 0;
    border-bottom: 1px solid var(--ink-100);
}
.feed-item:last-child { border-bottom: 0; }
.feed-dot {
    width: 33px; height: 33px; flex: 0 0 33px;
    display: grid; place-items: center;
    border-radius: 10px;
    background: var(--ink-100);
}
.feed-dot svg { width: 16px; height: 16px; stroke: var(--ink-500); }
.feed-dot.login    { background: var(--green-100); } .feed-dot.login svg    { stroke: var(--green-600); }
.feed-dot.create   { background: var(--blue-100); }  .feed-dot.create svg   { stroke: var(--blue-600); }
.feed-dot.edit     { background: var(--amber-100); } .feed-dot.edit svg     { stroke: var(--amber-600); }
.feed-dot.delete   { background: var(--red-100); }   .feed-dot.delete svg   { stroke: var(--red-600); }
.feed-body { flex: 1; min-width: 0; }
.feed-body p { font-size: 13.7px; color: var(--ink-700); }
.feed-body p strong { font-weight: 640; color: var(--ink-900); }
.feed-body time { font-size: 11.8px; color: var(--ink-400); display: block; margin-top: 3px; }

/* Quick action cards */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(184px, 1fr));
    gap: 15px;
}
.action-card {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 17px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all .18s var(--ease);
    color: var(--ink-700);
}
.action-card:hover {
    border-color: var(--brand-300);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
    color: var(--ink-900);
}
.action-card .ac-icon {
    width: 40px; height: 40px; flex: 0 0 40px;
    display: grid; place-items: center;
    border-radius: 11px;
    background: var(--brand-100);
}
.action-card .ac-icon svg { width: 19px; height: 19px; stroke: var(--brand-600); }
.action-card strong { display: block; font-size: 13.7px; font-weight: 630; }
.action-card span   { display: block; font-size: 12px; color: var(--text-muted); margin-top: 1px; }

/* Role explainer cards on Users screen */
.role-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(238px, 1fr));
    gap: 15px;
    margin-bottom: 24px;
}
.role-card {
    position: relative;
    padding: 19px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.role-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 3.5px;
    background: var(--rc, var(--brand-500));
}
.role-card .rc-icon {
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border-radius: 11px;
    background: var(--rc-tint, var(--brand-100));
    margin-bottom: 13px;
}
.role-card .rc-icon svg { width: 20px; height: 20px; stroke: var(--rc, var(--brand-600)); }
.role-card h4 { font-size: 14.7px; font-weight: 670; margin-bottom: 7px; }
.role-card p  { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.role-card .rc-count {
    display: inline-block;
    margin-top: 13px;
    font-size: 11.7px;
    font-weight: 640;
    color: var(--rc, var(--brand-600));
    background: var(--rc-tint, var(--brand-100));
    padding: 4px 11px;
    border-radius: var(--radius-pill);
}
.role-card.super { --rc: var(--violet-500); --rc-tint: var(--violet-100); }
.role-card.admin { --rc: var(--blue-600);   --rc-tint: var(--blue-100); }
.role-card.staff { --rc: var(--amber-600);  --rc-tint: var(--amber-100); }

/* =====================================================================
 *  RESPONSIVE
 * =================================================================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(8,14,28,.5);
    z-index: 55;
    animation: fadeIn .2s var(--ease);
}

@media (max-width: 1080px) {
    .page-auth { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-mobile-logo {
        display: flex;
        align-items: center;
        gap: 12px;
        color: var(--ink-900);
    }
    .auth-mobile-logo .auth-logo-mark { box-shadow: none; }
    .auth-mobile-logo .auth-logo-text span { color: var(--text-muted); }
    .auth-form-wrap { padding: 34px 24px; align-items: flex-start; padding-top: 46px; }
}

@media (max-width: 940px) {
    .sidebar { transform: translateX(-100%); box-shadow: none; }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .sidebar-overlay.show { display: block; }
    .main { margin-left: 0; }
    .hamburger { display: grid; }
    .content { padding: 19px 16px; }
    .topbar { padding: 0 16px; }
    .topbar-chip.hide-sm { display: none; }
}

@media (max-width: 620px) {
    .topbar-user .who { display: none; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat-value { font-size: 26px; }
    .page-title p { display: none; }
    .modal-foot { flex-direction: column-reverse; }
    .modal-foot .btn { width: 100%; }
    .auth-form-wrap { padding: 28px 18px; }
    .toolbar { gap: 9px; }
    .content { padding: 15px 13px; }
    .card-head, .card-body, .card-pad { padding: 17px; }
}

@media (max-width: 420px) {
    .stat-grid { grid-template-columns: 1fr; }
}

/* =====================================================================
 *  NAV — PLAIN ENTRIES (Dashboard / Settings / Logout)
 * =================================================================== */
.sidebar-nav ul { list-style: none; margin: 0; padding: 0; }

.nav-group-plain { padding-top: 8px; }
.nav-group-plain:not(:first-child) {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,.09);
}

.nav-link.nav-logout svg { stroke: rgba(252,165,165,.92); }
.nav-link.nav-logout:hover { background: rgba(220,38,38,.20); color: #fff; }
.nav-link.nav-logout:hover svg { stroke: #fca5a5; }

/* =====================================================================
 *  INTERACTIVE KPI CARDS  (a card = a filter on the records table)
 * =================================================================== */
a.stat { display: block; color: inherit; text-decoration: none; }
a.stat:hover { border-color: var(--brand-300); }
a.stat:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 3px; }

.stat .stat-flag {
    display: none;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    padding: 4px 9px;
    border-radius: var(--radius-pill);
    background: var(--stat-tint, var(--brand-100));
    color: var(--stat-color, var(--brand-600));
    font-size: 10.3px;
    font-weight: 740;
    letter-spacing: .07em;
    text-transform: uppercase;
    white-space: nowrap;
}
.stat.is-on {
    border-color: var(--stat-color, var(--brand-500));
    box-shadow: 0 0 0 3px var(--stat-tint, var(--brand-100));
}
.stat.is-on .stat-flag { display: inline-flex; }

/* =====================================================================
 *  TABLE — SELECTION (checkboxes, row actions on selection)
 * =================================================================== */
.table .col-check { width: 44px; padding-right: 6px; text-align: center; }
.table tbody td.col-check { text-align: center; }
.table input.row-check {
    width: 16px; height: 16px;
    margin: 0;
    accent-color: var(--brand-500);
    cursor: pointer;
}
.table tbody tr.is-selected { background: var(--brand-50); }
.table tbody tr.is-selected:hover { background: var(--brand-100); }
.table tbody tr.is-selected td.col-check { box-shadow: inset 3px 0 0 var(--brand-500); }

/* "Action" appears on row selection — and on hover/focus so the column
 * is never a mystery.  Visibility (not display) keeps the layout still. */
.table tbody tr .row-actions { visibility: hidden; }
.table tbody tr:hover .row-actions,
.table tbody tr:focus-within .row-actions,
.table tbody tr.is-selected .row-actions { visibility: visible; }
@media (hover: none) {
    .table tbody tr .row-actions { visibility: visible; }
}

/* =====================================================================
 *  BULK ACTION BAR  (appears when records are selected)
 * =================================================================== */
.bulk-bar {
    position: fixed;
    right: 26px;
    bottom: 24px;
    z-index: 120;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 12px 14px 12px 18px;
    background: linear-gradient(120deg, var(--ink-900), #16233d);
    color: #fff;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 16px;
    box-shadow: 0 18px 42px rgba(8,14,28,.38);
    opacity: 0;
    transform: translateY(150%);
    pointer-events: none;
    transition: transform .3s var(--ease), opacity .22s var(--ease);
}
.bulk-bar.show { opacity: 1; transform: none; pointer-events: auto; }

.bulk-count {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    color: rgba(255,255,255,.74);
    white-space: nowrap;
}
.bulk-count strong {
    display: grid;
    place-items: center;
    min-width: 27px;
    height: 27px;
    padding: 0 7px;
    border-radius: 8px;
    background: var(--accent-500);
    color: #04222b;
    font-size: 13.5px;
    font-weight: 780;
}
.bulk-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bulk-actions form { display: contents; }

.bulk-bar .btn { box-shadow: none; }
.bulk-bar .btn-secondary {
    background: rgba(255,255,255,.10);
    border-color: rgba(255,255,255,.20);
    color: #fff;
}
.bulk-bar .btn-secondary:hover { background: rgba(255,255,255,.20); border-color: rgba(255,255,255,.34); color: #fff; }
.bulk-bar .btn-ghost { color: rgba(255,255,255,.72); }
.bulk-bar .btn-ghost:hover { background: rgba(255,255,255,.12); color: #fff; }

/* =====================================================================
 *  UPLOAD DROPZONE
 * =================================================================== */
.dropzone {
    display: block;
    width: 100%;
    text-align: center;
    padding: 36px 24px;
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--ink-50);
    cursor: pointer;
    transition: all .18s var(--ease);
}
.dropzone:hover { border-color: var(--brand-300); background: var(--brand-50); }
.dropzone.dragover {
    border-color: var(--brand-500);
    background: var(--brand-50);
    box-shadow: 0 0 0 4px var(--ring);
}
.dropzone .dz-icon {
    width: 56px; height: 56px;
    margin: 0 auto 15px;
    display: grid; place-items: center;
    border-radius: 17px;
    background: var(--brand-100);
}
.dropzone .dz-icon svg { width: 25px; height: 25px; stroke: var(--brand-600); }
.dropzone strong { display: block; font-size: 15.5px; font-weight: 660; color: var(--ink-900); }
.dropzone span   { display: block; font-size: 13.2px; color: var(--text-muted); margin-top: 7px; }
.dropzone .dz-file {
    display: none;
    margin-top: 15px;
    font-size: 13.2px;
    font-weight: 640;
    color: var(--brand-600);
    word-break: break-all;
}
.dropzone.has-file .dz-file { display: block; }

/* =====================================================================
 *  CELL HELPERS
 * =================================================================== */
.cell-clip {
    display: block;
    max-width: 178px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cell-mono {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12.7px;
    letter-spacing: .01em;
}
.cell-muted  { color: var(--ink-400); }
.cell-center { text-align: center; }
.table a.badge { text-decoration: none; }
.table a.badge:hover { filter: brightness(.96); }

/* =====================================================================
 *  SETTINGS / INFO PANELS
 * =================================================================== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
    gap: 17px;
}
.mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
    gap: 11px;
}
.mini-stat {
    background: var(--ink-50);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 13px 15px;
}
.mini-stat span {
    display: block;
    font-size: 11.3px;
    font-weight: 680;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.mini-stat strong { display: block; font-size: 17px; font-weight: 720; color: var(--ink-900); margin-top: 5px; word-break: break-word; }

.kv {
    display: grid;
    grid-template-columns: minmax(150px, 225px) 1fr;
    gap: 11px 18px;
    font-size: 13.6px;
    align-items: baseline;
}
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; font-weight: 620; color: var(--ink-800); word-break: break-word; }

.code-block {
    display: block;
    margin-top: 10px;
    padding: 11px 14px;
    background: var(--ink-50);
    border: 1px solid var(--border);
    border-radius: 9px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.6px;
    color: var(--ink-700);
    word-break: break-all;
}

.screen-links { display: flex; flex-wrap: wrap; gap: 9px; }

@media (max-width: 620px) {
    .bulk-bar { left: 13px; right: 13px; bottom: 13px; justify-content: space-between; gap: 9px; padding: 11px 13px; }
    .bulk-actions { gap: 6px; }
    .cell-clip { max-width: 120px; }
}

/* =====================================================================
 *  PRINT
 * =================================================================== */
@media print {
    .sidebar, .topbar, .sidebar-overlay, .row-actions, .toolbar { display: none !important; }
    .main { margin-left: 0; }
    .content { padding: 0; }
    body { background: #fff; }
    .card, .table-wrap { box-shadow: none; border-color: #ddd; }
}

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

/* =====================================================================
 *  PACKET GRID — dynamic packet rows (Add / Edit Shipment)
 * =================================================================== */
.pkt-wrap { margin-top: 4px; }

table.pkt-table { min-width: 1010px; }

.pkt-table thead th { padding: 11px 10px; }
.pkt-table tbody td { padding: 8px 9px; }

.pkt-in {
    width: 100%;
    min-width: 58px;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--ink-800);
    font: inherit;
    font-size: 13px;
    transition: border-color .13s var(--ease), box-shadow .13s var(--ease);
}
.pkt-in::placeholder { color: var(--ink-400, #9aa6bd); }
.pkt-in:focus {
    outline: none;
    border-color: var(--brand-400);
    box-shadow: 0 0 0 3px var(--brand-100);
}
.pkt-inv { min-width: 120px; }
.pkt-invval { min-width: 84px; }

.pkt-table th.pkt-idx,
.pkt-idx {
    width: 34px;
    text-align: center;
    color: var(--text-muted);
}

/* auto-calculated cells — quiet, read-only, right aligned */
.pkt-auto {
    background: var(--ink-50);
    text-align: right;
    white-space: nowrap;
}
.pkt-num {
    display: block;
    font-weight: 680;
    color: var(--brand-700);
    font-variant-numeric: tabular-nums;
}
.pkt-sub {
    display: block;
    font-size: 10.8px;
    color: var(--text-muted);
    margin-top: 1px;
}

.pkt-remove-td { width: 36px; text-align: center; }
.pkt-remove {
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--red-600);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: background .13s var(--ease), border-color .13s var(--ease);
}
.pkt-remove:hover { background: var(--red-100); border-color: var(--red-600); }

/* totals bar + "+ New row" */
.pkt-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 13px;
}
.pkt-totals { display: flex; gap: 9px; flex-wrap: wrap; }
.pkt-chip {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--ink-50);
}
.pkt-chip em {
    font-style: normal;
    font-size: 10.4px;
    font-weight: 660;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
}
.pkt-chip strong {
    font-size: 15.5px;
    font-weight: 720;
    color: var(--ink-900);
    font-variant-numeric: tabular-nums;
}
.pkt-chip-accent { background: var(--brand-50); border-color: var(--brand-200); }
.pkt-chip-accent strong { color: var(--brand-700); }
.pkt-add { white-space: nowrap; }
.pkt-note {
    margin-top: 10px;
    font-size: 12.4px;
    color: var(--text-muted);
}

@media (max-width: 720px) {
    .pkt-bar { flex-direction: column; align-items: stretch; }
    .pkt-add { width: 100%; }
}

/* ============================================================
 *  EXPORT DATA page (export_data/index.php)
 * ============================================================ */
.exf-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}
.exf-pill {
    border: 1px solid var(--border, #e3e8f0);
    background: var(--white);
    color: var(--ink-600, #475569);
    font-family: inherit;
    font-size: 12.6px;
    font-weight: 640;
    letter-spacing: .01em;
    padding: 8px 15px;
    border-radius: 999px;
    text-decoration: none;
    transition: all .15s var(--ease, ease);
}
.exf-pill:hover {
    background: var(--ink-50, #f4f6fa);
    border-color: var(--ink-300, #cbd3e1);
    color: var(--ink-800, #1c2740);
}
.exf-pill.is-on {
    background: var(--brand-500, #1e69d9);
    border-color: var(--brand-500, #1e69d9);
    color: #fff;
    box-shadow: 0 4px 12px rgba(30, 111, 217, .28);
}
.exf-group { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.exf-group[hidden] { display: none !important; }   /* [hidden] must beat .exf-group's display:flex */
.exf-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.exf-field > span {
    font-size: 12.2px;
    font-weight: 640;
    color: var(--text-muted, #64748b);
}
.exf-field input,
.exf-field select {
    font-family: inherit;
    font-size: 13.7px;
    padding: 9px 12px;
    border: 1.5px solid var(--border-strong, #d5dce8);
    border-radius: 10px;
    background: var(--white);
    color: var(--ink-800, #1c2740);
    transition: all .17s var(--ease, ease);
}
.exf-field input:focus,
.exf-field select:focus {
    outline: none;
    border-color: var(--primary, #1e69d9);
    box-shadow: 0 0 0 4px var(--ring, rgba(30, 111, 217, .16));
}
.exf-note {
    font-size: 13px;
    color: var(--text-muted, #64748b);
    padding: 9px 2px;
    align-self: center;
}
.exf-err {
    color: var(--red-600, #dc2626);
    font-weight: 640;
    font-size: 12.8px;
    padding-bottom: 9px;
}
.card-head form { margin: 0; }

/* ---- Export Data — checkbox-style filter cards (preview.php) -------- */
.fx-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 9px;
    margin-bottom: 14px;
}
.fx-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 13px;
    border: 1px solid var(--border, #e3e8f0);
    border-radius: 13px;
    background: var(--white, #fff);
    text-decoration: none;
    transition: all .16s var(--ease, ease);
}
.fx-card:hover {
    border-color: var(--brand-300, #86b8f7);
    background: var(--brand-50, #f2f8ff);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 37, 73, .07);
}
.fx-box {
    flex: none;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    display: grid;
    place-items: center;
    border: 1.5px solid var(--ink-300, #cbd3e1);
    border-radius: 6px;
    background: #fff;
    color: #fff;
    transition: all .16s var(--ease, ease);
}
.fx-box svg { opacity: 0; transition: opacity .12s ease; }
.fx-txt { min-width: 0; }
.fx-txt strong {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-800, #1c2740);
    line-height: 1.3;
}
.fx-txt small {
    display: block;
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--text-muted, #66748c);
    line-height: 1.35;
}
.fx-card.is-on {
    border-color: var(--brand-500, #1e6fd9);
    background: var(--brand-50, #f2f8ff);
    box-shadow: 0 0 0 3px rgba(30, 111, 217, .12);
}
.fx-card.is-on:hover { box-shadow: 0 0 0 3px rgba(30, 111, 217, .16); }
.fx-card.is-on .fx-box {
    background: var(--brand-500, #1e6fd9);
    border-color: var(--brand-500, #1e6fd9);
}
.fx-card.is-on .fx-box svg { opacity: 1; }
.fx-card.is-on .fx-txt strong { color: var(--brand-700, #12376b); }
@media (max-width: 620px) {
    .fx-cards { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 7px; }
    .fx-card { padding: 9px 11px; }
}

/* ---- classic Export Shipments form (export_data/index.php) ---------- */
.exp-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}.exp-tips-title {
    font-size: 15px;
    margin: 0 0 12px;
}
.exp-tips {
    margin: 0;
    padding-left: 20px;
    color: var(--ink-600, #64748b);
    font-size: 13.5px;
    line-height: 1.95;
}
.exp-tips li strong { color: var(--ink-800, #1c2740); }
.exp-tips a { color: var(--brand-500, #1e69d9); font-weight: 640; }
.exf-pills .exf-pill { cursor: pointer; font-family: inherit; }

@media (max-width: 620px) {
    .exf-pills { gap: 6px; }
    .exf-pill { flex: 1 1 auto; text-align: center; }
    .exf-field, .exf-field input, .exf-field select { width: 100%; }
}

/* =====================================================================
 *  DOCUMENTATION  (documentation.php)
 * =================================================================== */
.doc-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    background: linear-gradient(135deg, var(--brand-800), var(--brand-600) 62%, var(--accent-600));
    color: var(--white);
    border-radius: var(--radius-xl);
    padding: 26px 28px;
    margin-bottom: 22px;
    box-shadow: var(--shadow);
}
.doc-hero-txt { max-width: 640px; }
.doc-hero h1 { font-size: 21px; font-weight: 750; margin: 8px 0 8px; letter-spacing: -.01em; }
.doc-hero p  { font-size: 13.6px; line-height: 1.6; color: rgba(255, 255, 255, .82); margin: 0; }
.doc-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--accent-400);
}
.doc-hero-side {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 210px;
}
.doc-mini {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: var(--radius);
    padding: 9px 14px;
    font-size: 12.6px;
    backdrop-filter: blur(2px);
}
.doc-mini span   { color: rgba(255, 255, 255, .72); }
.doc-mini strong { font-weight: 650; }

/* Tab bar — icons inside the theme's .tab */
.doc-tabs { width: 100%; }
.doc-tab  { display: inline-flex; align-items: center; gap: 7px; }
.doc-tab svg { opacity: .75; }
.doc-tab.active svg { opacity: 1; }

/* Panes */
.doc-pane .card + .card,
.wdg-card + .wdg-card { margin-top: 20px; }
.doc-pane[hidden] { display: none !important; }

/* Prose inside the panes */
.doc-h {
    font-size: 14.2px;
    font-weight: 680;
    color: var(--ink-800);
    margin: 24px 0 10px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}
.doc-h:first-child { margin-top: 0; }
.doc-h4 { font-size: 13.4px; font-weight: 660; color: var(--ink-700); margin: 18px 0 8px; }
.doc-lead { font-size: 13.6px; line-height: 1.65; color: var(--text-muted); margin: 0 0 12px; }
.doc-list { margin: 0 0 4px; padding-left: 20px; font-size: 13.6px; line-height: 1.7; }
.doc-list li { margin-bottom: 5px; }
.doc-list strong { color: var(--ink-800); }

.doc-steps { margin: 0; padding-left: 22px; font-size: 13.7px; line-height: 1.75; }
.doc-steps li { margin-bottom: 8px; padding-left: 4px; }
.doc-steps li::marker { color: var(--brand-500); font-weight: 700; }

/* Callouts */
.doc-note {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    border: 1px solid;
    border-radius: var(--radius);
    padding: 13px 15px;
    margin: 16px 0 4px;
    font-size: 13.3px;
    line-height: 1.6;
}
.doc-note svg { flex: none; margin-top: 2px; }
.doc-note.note-info { background: var(--blue-100);  border-color: #bfdbfe; color: #1e3a5f; }
.doc-note.note-info svg { stroke: var(--blue-600); }
.doc-note.note-warn { background: var(--amber-100); border-color: #fde68a; color: #78350f; }
.doc-note.note-warn svg { stroke: var(--amber-600); }
.doc-note.note-ok   { background: var(--green-100); border-color: #a7f3d0; color: #064e3b; }
.doc-note.note-ok svg   { stroke: var(--green-600); }
.doc-note strong { display: block; margin-bottom: 2px; }

/* Import column chips (shared look with the importer screens) */
.doc-chips { margin-top: 4px; }

/* Email placeholder tokens */
.doc-placeholders { margin: 0 0 12px; }
.doc-placeholders code {
    display: inline-block;
    background: var(--brand-50);
    border: 1px solid var(--brand-200);
    color: var(--brand-700);
    border-radius: var(--radius-sm);
    padding: 3px 8px;
    margin: 0 5px 6px 0;
    font-size: 12.3px;
}

/* File tree */
.doc-tree {
    background: var(--ink-900);
    color: #cbd5e1;
    border-radius: var(--radius);
    padding: 18px 20px;
    margin: 0;
    font-family: var(--font-mono);
    font-size: 12.1px;
    line-height: 1.65;
    overflow-x: auto;
    white-space: pre;
}

/* =====================================================================
 *  DEVELOPERS TAB  —  WDG
 * =================================================================== */
.wdg-card { scroll-margin-top: 90px; }
.wdg-hero { display: flex; gap: 22px; align-items: center; }
.wdg-logo {
    width: 116px;
    height: 116px;
    object-fit: contain;
    flex: none;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px;
    box-shadow: var(--shadow-xs);
}
.wdg-hero-txt h2 { font-size: 19px; font-weight: 740; margin: 6px 0 4px; color: var(--ink-900); }
.wdg-tag { font-size: 13px; color: var(--text-muted); margin: 0 0 12px; }
.wdg-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.wdg-domain { font-size: 12.6px; color: var(--text-muted); }

.wdg-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.wdg-chip {
    font-size: 12.4px;
    font-weight: 580;
    color: var(--brand-700);
    background: var(--brand-50);
    border: 1px solid var(--brand-200);
    border-radius: var(--radius-pill);
    padding: 5px 13px;
}

.wdg-dev { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.wdg-avatar {
    width: 62px;
    height: 62px;
    flex: none;
    display: grid;
    place-items: center;
    font-size: 30px;
    background: var(--brand-50);
    border: 1px solid var(--brand-200);
    border-radius: var(--radius-lg);
}
.wdg-dev-name { display: block; font-size: 15.5px; font-weight: 680; color: var(--ink-900); }
.wdg-dev-role { display: block; font-size: 12.8px; color: var(--text-muted); margin: 2px 0 8px; }
.wdg-skills { display: flex; flex-wrap: wrap; gap: 6px; }

.wdg-social { display: flex; flex-wrap: wrap; gap: 8px 18px; padding-top: 12px; border-top: 1px solid var(--border); }
.wdg-social a {
    font-size: 12.8px;
    font-weight: 600;
    color: var(--brand-600);
    text-decoration: none;
    display: inline-flex;
    gap: 6px;
    align-items: baseline;
}
.wdg-social a:hover { text-decoration: underline; }
.wdg-social em { font-style: normal; font-weight: 500; color: var(--text-muted); }

.wdg-seo { position: relative; overflow: hidden; }
.wdg-seo::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, var(--brand-500), var(--accent-500), var(--violet-500));
}
.wdg-seo-title { display: block; font-size: 15px; font-weight: 700; color: var(--ink-900); margin-bottom: 8px; }
.wdg-seo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
    margin: 16px 0 18px;
}
.wdg-seo-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: var(--ink-50);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 13px 15px;
}
.wdg-seo-item span  { font-size: 18px; line-height: 1; }
.wdg-seo-item strong { font-size: 13.2px; font-weight: 650; color: var(--ink-800); }
.wdg-seo-item em    { font-style: normal; font-size: 12.2px; color: var(--text-muted); }

/* Responsive */
@media (max-width: 860px) {
    .doc-hero { flex-direction: column; align-items: stretch; }
    .doc-hero-side { min-width: 0; }
    .wdg-hero { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 620px) {
    .doc-hero { padding: 20px; }
    .doc-hero h1 { font-size: 18px; }
    .wdg-dev { flex-direction: column; align-items: flex-start; }
}
