/* ============================================================
   OTI Deal Jacket — modern theme (revamped 2026-07, design
   language modeled on OTI.Web.Reports). Brand identity (navy +
   gold) retained; layered surfaces, soft shadows, rounded cards,
   focus rings and hover motion adopted from the reports app.
   All existing class names preserved — no markup changes.
   ============================================================ */
:root {
    /* ---- accent (indigo) — modeled on OTI.Web.Reports ---- */
    --brand:        #6366F1;   /* indigo (primary accent) */
    --brand-d:      #4F46E5;   /* darker — hovers/gradients */
    --brand-l:      #818CF8;
    --brand-ink:    #ffffff;
    --accent:       #6366F1;
    --accent-d:     #4F46E5;
    --accent-l:     #818CF8;
    --accent-soft:  rgba(99,102,241,.10);
    --accent-soft-2:rgba(99,102,241,.16);

    /* ---- surfaces (light, layered) ---- */
    --bg:           #f5f5f7;
    --surface:      #ffffff;
    --panel:        #ffffff;
    --surface-2:    #f4f4f6;
    --sidebar-bg:   #fbfbfd;
    --border:       #e6e6eb;
    --line:         #e6e6eb;
    --line-2:       #ededf1;
    --ink:          #1d1d1f;
    --muted:        #6e6e73;
    --muted-2:      #86868b;

    /* ---- status ---- */
    --ok:           #15803D;  --ok-bg:      #E7F6EC;
    --warn:         #B45309;  --warn-bg:    #FBF3E2;
    --alert:        #DC2626;  --alert-bg:   #FBEAEA;
    --neutral:      #475569;  --neutral-bg: #eef1f6;

    /* ---- misc ---- */
    --radius:       14px;
    --radius-sm:    9px;
    --ring:         rgba(99,102,241,.35);
    --ease:         cubic-bezier(.4,0,.2,1);
    --sh-1:         0 1px 2px rgba(17,24,39,.04), 0 1px 3px rgba(17,24,39,.05);
    --sh-2:         0 2px 8px rgba(17,24,39,.05), 0 8px 24px rgba(17,24,39,.05);
    --sh-3:         0 6px 16px rgba(17,24,39,.08), 0 16px 40px rgba(17,24,39,.10);
    --shadow:       var(--sh-1);
    --font:         system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

.loading-shell {
    display: flex; align-items: center; justify-content: center;
    height: 100vh; color: var(--muted);
}

/* ---------------- Shell + sidebar ---------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 236px; flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--ink);
    display: flex; flex-direction: column;
    padding: 18px 12px;
    position: sticky; top: 0; height: 100vh;
    border-right: 1px solid var(--line);
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; padding: 4px 6px 18px; border-bottom: 1px solid var(--line); }
.brand-mark {
    width: 40px; height: 40px; border-radius: 11px;
    background: linear-gradient(135deg, var(--accent), var(--accent-d)); color: #fff;
    display: grid; place-items: center; font-weight: 800; font-size: 15px;
    box-shadow: 0 4px 12px var(--ring);
}
.brand-name { font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
.brand-sub { font-size: 11px; color: var(--muted-2); margin-top: 1px; }

.nav-items { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; border-radius: var(--radius-sm);
    color: var(--ink); font-weight: 500;
    transition: background .14s var(--ease), color .14s var(--ease), transform .1s var(--ease), box-shadow .14s var(--ease);
}
.nav-item:hover { background: var(--accent-soft-2); color: var(--accent-d); }
.nav-item:active { transform: translateY(.5px); }
.nav-item.active { background: var(--accent); color: #fff; font-weight: 600; box-shadow: 0 2px 8px var(--ring); }
.nav-item.active:hover { background: var(--accent-d); color: #fff; }
.nav-ico { width: 18px; text-align: center; opacity: .9; }
.nav-badge {
    margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 10px; font-size: 11px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent-soft); color: var(--accent-d);
}
.nav-item.active .nav-badge { background: rgba(255,255,255,.22); color: #fff; }

.sidebar-foot { padding: 6px; }
.env-pill {
    font-size: 11px; padding: 5px 11px; border-radius: 20px;
    background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
    display: inline-block; font-weight: 500;
}

.content { flex: 1; overflow-x: auto; min-width: 0; }
.content-inner { max-width: 1200px; margin: 0 auto; padding: 28px 32px 64px; }

/* ---------------- Top bar (dealership filter) ---------------- */
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 10px;
    padding: 11px 32px; border-bottom: 1px solid var(--line); z-index: 5;
    background: rgba(255,255,255,.8); backdrop-filter: saturate(1.8) blur(20px);
    -webkit-backdrop-filter: saturate(1.8) blur(20px);
    position: sticky; top: 0; box-shadow: var(--sh-1); }
.rooftop-filter { display: flex; align-items: center; gap: 8px; }
.rooftop-label { font-size: 11px; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: .05em; }
.rooftop-select, .auth-select { font: inherit; font-size: 13.5px; color: var(--ink); min-width: 200px; cursor: pointer;
    appearance: none; -webkit-appearance: none;
    border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 32px 7px 12px; box-shadow: var(--sh-1);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
    background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%2394a2b5' stroke-width='1.5'><path d='M3 4.5 6 7.5 9 4.5'/></svg>") no-repeat right 11px center; }
.rooftop-select:hover, .auth-select:hover { border-color: #c7cdd8; }
.rooftop-select:focus-visible, .auth-select:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }

/* ---------------- DMS validation ---------------- */
.dms-lookup { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dms-label { font-size: 11px; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: .05em; }
.dms-input { font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 11px; width: 160px; box-shadow: var(--sh-1);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.dms-input:hover { border-color: #c7cdd8; }
.dms-input:focus, .dms-input:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.dms-facts { display: grid; gap: 4px; font-size: 14px; }
.dms-facts .dms-k { display: inline-block; min-width: 74px; color: var(--muted);
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }

/* ---------------- Headings ---------------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
h1 { font-size: 25px; margin: 4px 0 2px; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 15px; margin: 0; font-weight: 600; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.back { color: var(--muted); font-size: 13px; transition: color .15s var(--ease); }
.back:hover { color: var(--brand); }
.pad { padding: 16px 18px; }

.head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.deliver-gate { font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 8px; }
.deliver-gate.ok { background: var(--ok-bg); color: var(--ok); }
.deliver-gate.blocked { background: var(--alert-bg); color: var(--alert); }

/* ---------------- KPI cards ---------------- */
.kpi-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 14px; margin-bottom: 24px;
}
.kpi {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--sh-2);
    padding: 16px 18px; position: relative; overflow: hidden;
    transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.kpi::before { content:''; position:absolute; left:0; top:0; bottom:0; width:4px; background: var(--stripe, var(--neutral)); }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--sh-3); }
.kpi-val { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi-label { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.kpi-ok    { --stripe: var(--ok); }
.kpi-warn  { --stripe: var(--warn); }
.kpi-alert { --stripe: var(--alert); }

/* ---------------- Panels ---------------- */
.panel {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--sh-2);
    margin-bottom: 18px; overflow: hidden;
}
.panel-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 18px; border-bottom: 1px solid var(--line); gap: 12px;
}
.panel-head.clickable { transition: background .15s var(--ease); }
.panel-head.clickable:hover { background: var(--surface-2); }

/* ---------------- Jacket layout ---------------- */
.jacket-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.jacket-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 860px) { .jacket-grid { grid-template-columns: 1fr; } }

/* ---------------- Tables ---------------- */
.grid { width: 100%; border-collapse: collapse; }
.grid th {
    text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); font-weight: 600; padding: 11px 18px; border-bottom: 1px solid var(--line);
}
.grid td { padding: 13px 18px; border-bottom: 1px solid var(--line-2); }
.grid.tight td, .grid.tight th { padding: 9px 18px; }
.grid tbody tr:last-child td { border-bottom: none; }
.grid tbody tr { transition: background .12s var(--ease); }
.clickable { cursor: pointer; }
.grid tbody tr.clickable:hover { background: var(--surface-2); }
.chev { color: var(--muted-2); text-align: right; font-size: 18px; }

.bar { display: inline-block; width: 80px; height: 6px; background: var(--neutral-bg); border-radius: 4px; overflow: hidden; vertical-align: middle; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-d)); }
.bar-label { font-size: 12px; color: var(--muted); margin-left: 8px; }

/* ---------------- Toolbar ---------------- */
.toolbar { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.search {
    flex: 1; min-width: 220px; padding: 9px 14px;
    border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 14px; background: var(--surface);
    box-shadow: var(--sh-1); transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.search:hover { border-color: #c7cdd8; }
.search:focus, .search:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter {
    border: 1px solid var(--line); background: var(--surface);
    padding: 7px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-weight: 500;
    box-shadow: var(--sh-1); transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .1s var(--ease);
}
.filter:hover { border-color: #c7cdd8; background: #fafbfc; }
.filter:active { transform: translateY(.5px); }
.filter.on { border-color: var(--brand); background: var(--brand); color: #fff; box-shadow: var(--sh-2); }
.filter.on .badge { background: rgba(255,255,255,.18); color: #fff; }

/* ---------------- Badges ---------------- */
.badge {
    display: inline-block; font-size: 11px; font-weight: 600;
    padding: 3px 10px; border-radius: 20px; white-space: nowrap;
}
.badge.ok      { background: var(--ok-bg);      color: var(--ok); }
.badge.warn    { background: var(--warn-bg);    color: var(--warn); }
.badge.alert   { background: var(--alert-bg);   color: var(--alert); }
.badge.neutral { background: var(--neutral-bg); color: var(--neutral); }

/* ---------------- Checklist ---------------- */
.checklist, .compliance { list-style: none; margin: 0; padding: 8px 0; }
.checklist li {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 18px;
}
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.check .done { color: var(--muted); text-decoration: line-through; }
.gate-tag { font-size: 11px; color: var(--alert); background: var(--alert-bg); padding: 2px 8px; border-radius: 12px; }

/* ---------------- Compliance list ---------------- */
.compliance li { display: flex; gap: 12px; align-items: flex-start; padding: 11px 18px; }

/* ---------------- Documents ---------------- */
.doc-group { padding: 6px 0; }
.doc-group-head {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted-2); font-weight: 600; padding: 10px 18px 4px;
}
.doc-row {
    display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
    padding: 10px 18px; border-top: 1px solid var(--line-2);
    transition: background .12s var(--ease);
}
.doc-row:hover { background: var(--surface-2); }
.doc-name { display: flex; flex-direction: column; gap: 4px; }
.doc-name > span:first-child { display: flex; align-items: center; gap: 10px; }
.sig-tag { font-size: 11px; color: var(--warn); background: var(--warn-bg); padding: 2px 8px; border-radius: 12px; }
.stored-meta { font-size: 12px; color: var(--muted); }
.doc-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.upload-btn { cursor: pointer; }
.upload-btn input[type=file] { display: none; }

/* ---------------- Buttons ---------------- */
.btn-sm {
    border: 1px solid var(--line); background: var(--surface);
    padding: 7px 13px; border-radius: var(--radius-sm); font-size: 12.5px; cursor: pointer; white-space: nowrap;
    font-weight: 500; color: var(--ink); box-shadow: var(--sh-1);
    transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease), transform .1s var(--ease);
}
.btn-sm:hover { background: #fafbfc; border-color: #c7cdd8; box-shadow: var(--sh-2); }
.btn-sm:active { transform: translateY(.5px); box-shadow: var(--sh-1); }
.btn-sm:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.btn-sm:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm.primary { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }
.btn-sm.primary:hover { background: var(--brand-d); border-color: var(--brand-d); }
.btn-sm.danger { color: var(--alert); border-color: var(--alert); background: var(--surface); }
.btn-sm.danger:hover { background: var(--alert); color: #fff; }

/* ---------------- Records retention & legal hold ---------------- */
.records-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--line-2); }
.records-actions .search { min-width: 280px; flex: 1; }

/* ---------------- Product cancellation / refunds ---------------- */
.strike { text-decoration: line-through; }
.refund-amt { width: 90px; padding: 5px 8px; font-size: 12.5px; }

/* ---------------- Trade-in / title blocks ---------------- */
.title-block { padding: 15px 18px; border-top: 1px solid var(--line-2); }
.title-block:first-of-type { border-top: none; }
.title-block-head {
    display: flex; justify-content: space-between; align-items: center;
    font-weight: 600; margin-bottom: 10px;
}
.kv-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px 24px; margin-bottom: 10px;
}
.kv-grid > div { display: flex; flex-direction: column; }
.kv-k { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kv-v { font-size: 13.5px; }
.kv-v.neg { color: var(--alert); font-weight: 600; }
.trade-status { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; border-top: 1px dashed var(--line); }
.trade-status-row { display: flex; align-items: center; gap: 10px; }
.trade-status-row .kv-k { min-width: 130px; }
.title-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- Batch scan import ---------------- */
.batch-bar { display: flex; align-items: center; gap: 12px; padding: 14px 18px; flex-wrap: wrap; }
.batch-review { border-top: 1px solid var(--line); }
.batch-assign { min-width: 240px; padding: 7px 11px; font-size: 13px;
    border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--sh-1);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.batch-assign:hover { border-color: #c7cdd8; }
.batch-assign:focus, .batch-assign:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.batch-actions { display: flex; gap: 8px; padding: 14px 18px; }

/* ---------------- Forms (create / edit deal) ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.form-input {
    padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    font-size: 14px; background: var(--surface); width: 100%; box-shadow: var(--sh-1);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.form-input:hover { border-color: #c7cdd8; }
.form-input:focus, .form-input:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.form-input:disabled { background: var(--surface-2); color: var(--muted); }
.check-field { justify-content: flex-end; }
.trade-edit { padding: 15px 18px; border-top: 1px solid var(--line-2); }
.trade-edit .btn-sm { margin-top: 10px; }
.form-actions { display: flex; gap: 10px; margin: 18px 0 40px; }
.form-error {
    background: var(--alert-bg); color: var(--alert); border: 1px solid var(--alert);
    padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px;
}

/* ---------------- Auth / login ---------------- */
.auth-shell { min-height: 100vh; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--brand), var(--brand-d)); padding: 20px; }
.auth-card {
    width: 100%; max-width: 380px; background: var(--surface);
    border-radius: 16px; box-shadow: var(--sh-3); padding: 30px;
}
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.auth-title { font-size: 20px; margin: 0 0 18px; font-weight: 700; letter-spacing: -.01em; }
.auth-card .field { margin-bottom: 14px; }
.auth-submit { width: 100%; justify-content: center; padding: 11px; margin-top: 4px; }
.auth-hint { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.auth-hint ul { margin: 8px 0 0; padding-left: 16px; }
.auth-hint li { margin: 2px 0; }

/* ---------------- Sidebar user ---------------- */
.user-box { padding: 10px 6px; border-top: 1px solid var(--line); margin-top: 4px; }
.user-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.user-role { font-size: 11px; color: var(--muted); }
.signout {
    width: 100%; text-align: left; background: var(--surface); color: var(--ink);
    border: 1px solid var(--line); padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px;
    box-shadow: var(--sh-1); transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.signout:hover { background: var(--accent-soft); color: var(--accent-d); border-color: transparent; }

/* ---------------- Activity / audit ---------------- */
.activity { list-style: none; margin: 0; padding: 6px 0; }
.activity li { padding: 11px 18px; border-top: 1px solid var(--line-2); }
.activity li:first-child { border-top: none; }
.activity-action { font-weight: 600; }

/* ---------------- Document viewer modal ---------------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.55);
    backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 24px;
    animation: modal-in .14s var(--ease) both;
}
@keyframes modal-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: #fff; width: 88%; height: 90%; max-width: 1100px;
    border-radius: 14px; box-shadow: var(--sh-3);
    display: flex; flex-direction: column; overflow: hidden;
}
.modal-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; border-bottom: 1px solid var(--line); gap: 12px;
}
.modal-title { font-weight: 600; font-size: 14px; }
.modal-actions { display: flex; gap: 8px; }
.modal-frame { flex: 1; width: 100%; border: none; background: var(--surface-2); }

/* ---------------- Misc ---------------- */
.not-found { text-align: center; padding: 80px 20px; }

#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--alert-bg); color: var(--alert); border-top: 1px solid var(--alert);
    padding: 10px 16px; box-shadow: 0 -1px 3px rgba(0,0,0,.1); z-index: 1000;
}
#blazor-error-ui .reload { text-decoration: underline; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }

/* ---------------- Scrollbars ---------------- */
.content, .grid { scrollbar-width: thin; scrollbar-color: var(--muted-2) transparent; }

/* ---------------- Mobile / responsive ---------------- */
@media (max-width: 640px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: auto; height: auto; position: static; flex-direction: row; align-items: center; gap: 8px; padding: 8px 10px; overflow-x: auto; }
    .brand { margin-bottom: 0; flex-shrink: 0; padding: 0 6px; border-bottom: none; }
    .brand-sub { display: none; }
    .nav-items { flex-direction: row; flex: 0 1 auto; gap: 2px; }
    .nav-item { padding: 8px 10px; white-space: nowrap; }
    .nav-item.active { box-shadow: inset 0 -3px 0 var(--accent); }
    .sidebar-foot { margin-left: auto; flex-shrink: 0; padding: 0; }
    .user-box { display: none; }

    .content-inner { padding: 16px 14px 48px; }
    .topbar { padding: 10px 14px; }
    .page-head { flex-direction: column; align-items: stretch; gap: 10px; }
    .head-right { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
    .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
    .grid { display: block; overflow-x: auto; white-space: nowrap; }
    .modal { width: 96vw; height: 92vh; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
    .kpi:hover { transform: none; }
}

.rollup-total td { font-weight: 700; border-top: 2px solid var(--line); }

/* ---------------- Scan-import progress (non-blocking, estimated) ---------------- */
.scan-loader {
    position: fixed; right: 22px; bottom: 22px; z-index: 900; width: 306px;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--sh-3); padding: 14px 16px; animation: modal-in .15s var(--ease) both;
}
.scan-loader-top { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--ink); }
.scan-loader-top strong { font-variant-numeric: tabular-nums; color: var(--accent-d); }
.scan-loader-top .sp { width: 16px; height: 16px; flex: 0 0 auto; border: 2.5px solid var(--line);
    border-top-color: var(--accent); border-radius: 50%; animation: oti-spin .7s linear infinite; }
.scan-loader-track { margin-top: 11px; height: 7px; background: var(--surface-2); border-radius: 7px; overflow: hidden; }
.scan-loader-fill { height: 100%; border-radius: 7px; background: linear-gradient(90deg, var(--accent), var(--accent-l));
    transition: width .2s var(--ease); }
.scan-loader-note { margin-top: 9px; font-size: 11px; color: var(--muted); line-height: 1.4; }
@keyframes oti-spin { to { transform: rotate(360deg); } }
