/* ================================================================================================
   Serim Order Agent - Admin Portal
   Brand tokens are carried over from the Serim admin tools (admin/css/admin.css) so the two
   applications read as one product: Serim blue #0073c1 on a graphite sidebar over a light canvas.
   Everything else here is new, and deliberately quieter and more spacious than the older tool.
   ================================================================================================ */

:root {
    /* ---- carried over from the Serim admin tools ---- */
    --bg: #f4f6f8;
    --surface: #ffffff;
    --border: #e5e7eb;
    --text: #1f2937;
    --text-muted: #6b7280;
    --sidebar-bg: #111827;
    --sidebar-text: #cbd5e1;
    --primary: #0073c1;
    --primary-hover: #005d9b;
    --danger: #dc2626;
    --warning: #d97706;
    --success: #059669;

    /* ---- portal additions ---- */
    --primary-bright: #1a90e0;
    --primary-soft: rgba(0, 115, 193, 0.10);
    --primary-softer: rgba(0, 115, 193, 0.05);
    --sidebar-bg-2: #0b1220;
    --surface-sunken: #f9fafb;
    --border-strong: #d3d8de;
    --info: #2563eb;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;

    --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
    --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 8px 24px -6px rgba(16, 24, 40, 0.10);
    --shadow-lg: 0 24px 60px -12px rgba(16, 24, 40, 0.24);

    --sidebar-w: 248px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Inter,
            system-ui, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 10px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; }

p { margin: 0 0 12px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }

.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 4px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Row actions stay on one line: a wrapped "Retire / Edit" pair reads as two unrelated controls. */
.actions { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; justify-content: flex-end; }
.grow { flex: 1 1 auto; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Inline SVG with no intrinsic size falls back to 300x150, so every icon is sized here rather than
   per use site. */
.ico { width: 16px; height: 16px; flex: 0 0 16px; vertical-align: -3px; }

/* ================================================================================================
   Shell
   ================================================================================================ */

.shell { display: flex; min-height: 100vh; position: relative; }

/* The sidebar is sticky and therefore exactly one viewport tall. On a long page that would leave a
   pale strip below it, so the shell paints the same graphite behind the sidebar column. */
.shell::before {
    content: "";
    position: absolute; inset: 0 auto 0 0; width: var(--sidebar-w);
    background: var(--sidebar-bg-2);
    z-index: 0;
}
.shell > * { position: relative; z-index: 1; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 22px 14px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar .brand {
    padding: 0 10px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 8px;
}
.sidebar .brand img {
    display: block;
    max-width: 132px;
    height: auto;
    /* The Serim mark is dark artwork; knocking it out white is how the admin tools present it. */
    filter: brightness(0) invert(1);
    opacity: 0.96;
}
.sidebar .brand .product {
    display: block;
    margin-top: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: rgba(203, 213, 225, 0.62);
}

.nav-group { margin-top: 14px; display: flex; flex-direction: column; gap: 2px; }
.nav-group .nav-label {
    padding: 0 12px 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: rgba(203, 213, 225, 0.45);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 13.5px;
    font-weight: 500;
    transition: background 0.14s ease, color 0.14s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,0.14); }
.nav-item .ico { width: 16px; height: 16px; flex: 0 0 16px; opacity: 0.9; }
.nav-item .count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}
.nav-item.active .count { background: rgba(255, 255, 255, 0.22); }

.sidebar-foot {
    margin-top: auto;
    padding: 14px 12px 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 11.5px;
    color: rgba(203, 213, 225, 0.55);
}
.sidebar-foot a { color: rgba(203, 213, 225, 0.8); }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 12px 28px;
    display: flex;
    align-items: center;
    gap: 18px;
}
.topbar .title { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.topbar .subtitle { font-size: 12.5px; color: var(--text-muted); }
.topbar .spacer { flex: 1 1 auto; }

.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-bright) 100%);
    color: #fff; font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
    display: flex; align-items: center; justify-content: center;
}
.user-chip .who { line-height: 1.2; }
.user-chip .who b { font-size: 13px; font-weight: 600; display: block; }
.user-chip .who span { font-size: 11.5px; color: var(--text-muted); }

.content { padding: 24px 28px 48px; flex: 1 1 auto; min-width: 0; }
.content > .page-head { margin-bottom: 18px; }
.page-head h1 { margin-bottom: 2px; }
.page-head .lede { color: var(--text-muted); font-size: 13.5px; max-width: 78ch; margin: 0; }

/* ================================================================================================
   Cards, grids, metrics
   ================================================================================================ */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 18px; }
.card > header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}
.card > header h2, .card > header h3 { margin: 0; }
.card > header .spacer { flex: 1 1 auto; }
.card > .body { padding: 18px; }
.card > .body.tight { padding: 12px 18px; }
.card > footer {
    padding: 12px 18px; border-top: 1px solid var(--border);
    background: var(--surface-sunken);
    border-radius: 0 0 var(--radius) var(--radius);
}

.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.split { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }

.metric {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 16px 18px;
    position: relative;
    overflow: hidden;
}
.metric::after {
    content: "";
    position: absolute; inset: 0 auto 0 0; width: 3px;
    background: var(--primary);
    opacity: 0.85;
}
.metric.ok::after { background: var(--success); }
.metric.warn::after { background: var(--warning); }
.metric.bad::after { background: var(--danger); }
.metric .label {
    font-size: 11px; font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase;
    color: var(--text-muted);
}
.metric .value {
    font-size: 27px; font-weight: 680; letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums; line-height: 1.15; margin-top: 4px;
}
.metric .hint { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---- 14-day volume chart, drawn with plain divs: no chart library, no external script ---- */
.spark { display: flex; align-items: flex-end; gap: 6px; height: 118px; padding-top: 8px; }
.spark .col { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; height: 100%; }
.spark .bar { border-radius: 3px 3px 0 0; min-height: 2px; background: var(--primary); opacity: 0.9; }
.spark .bar.review { background: var(--warning); }
.spark .bar.empty { background: var(--border); min-height: 2px; }
.spark .tick {
    font-size: 10px; color: var(--text-muted); text-align: center;
    margin-top: 6px; white-space: nowrap;
}
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }

/* ================================================================================================
   Tables
   ================================================================================================ */

.table-wrap { overflow-x: auto; }

table.data { width: 100%; border-collapse: separate; border-spacing: 0; }
table.data thead th {
    position: sticky; top: 0; z-index: 1;
    background: var(--surface-sunken);
    text-align: left;
    font-size: 11px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--text-muted);
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.data tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--primary-softer); }
table.data tbody tr.clickable { cursor: pointer; }
table.data td .sub { display: block; font-size: 12px; color: var(--text-muted); }
table.data td .sub.mono, table.data td .mono { overflow-wrap: anywhere; }

.empty-state { padding: 48px 24px; text-align: center; color: var(--text-muted); }
.empty-state .big { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }

/* ================================================================================================
   Badges, pills, chips
   ================================================================================================ */

.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600; line-height: 1.6;
    border: 1px solid transparent; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.badge.neutral { background: #f1f3f5; color: #4b5563; border-color: #e5e7eb; }
.badge.info    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.badge.brand   { background: var(--primary-soft); color: var(--primary-hover); border-color: rgba(0,115,193,0.22); }
.badge.ok      { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.badge.warn    { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.badge.bad     { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.badge.muted   { background: transparent; color: var(--text-muted); border-color: var(--border); }

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: var(--radius-sm);
    background: var(--surface-sunken); border: 1px solid var(--border);
    font-size: 12px; color: var(--text-muted);
}
.chip b { color: var(--text); font-weight: 600; }

.conf {
    display: inline-flex; align-items: center; gap: 7px;
    font-variant-numeric: tabular-nums; font-size: 12.5px; font-weight: 600;
}
.conf .track { width: 46px; height: 5px; border-radius: 999px; background: var(--border); overflow: hidden; }
.conf.bare .track { display: none; }
.conf .fill { display: block; height: 100%; border-radius: 999px; background: var(--success); }
.conf.mid .fill { background: var(--warning); }
.conf.low .fill { background: var(--danger); }

/* ================================================================================================
   Forms and buttons
   ================================================================================================ */

.field { margin-bottom: 16px; }
.field > label {
    display: block; margin-bottom: 5px;
    font-size: 12.5px; font-weight: 600; color: var(--text);
}
.field .help { margin-top: 5px; font-size: 12px; color: var(--text-muted); }
.field-row { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=search], input[type=date], input[type=datetime-local], select, textarea {
    width: 100%;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 8px 11px;
    transition: border-color 0.14s, box-shadow 0.14s;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 115, 193, 0.14);
}
input::placeholder, textarea::placeholder { color: #9ca3af; }
input[readonly], input:disabled, select:disabled, textarea:disabled {
    background: var(--surface-sunken); color: var(--text-muted); cursor: not-allowed;
}

.check { display: flex; align-items: flex-start; gap: 9px; }
.check input[type=checkbox] { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--primary); }
.check label { font-size: 13.5px; font-weight: 500; }
.check .help { margin-top: 2px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    font: inherit; font-size: 13.5px; font-weight: 600;
    padding: 8px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.14s, border-color 0.14s, color 0.14s, transform 0.04s, box-shadow 0.14s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(0, 115, 193, 0.24); }

.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-xs); }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }

.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-sunken); color: var(--text); }

.btn-quiet { background: transparent; color: var(--text-muted); }
.btn-quiet:hover { background: var(--surface-sunken); color: var(--text); }

.btn-danger { background: var(--surface); color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; color: #991b1b; }

.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }

.toolbar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin-bottom: 16px;
}
.toolbar form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; }
.toolbar input[type=search], .toolbar select { width: auto; min-width: 170px; }
.toolbar .spacer { flex: 1 1 auto; }

.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; }
.seg a {
    padding: 5px 12px; border-radius: 5px; font-size: 12.5px; font-weight: 600;
    color: var(--text-muted);
}
.seg a:hover { color: var(--text); text-decoration: none; background: var(--surface-sunken); }
.seg a.on { background: var(--primary); color: #fff; }

/* ================================================================================================
   Alerts
   ================================================================================================ */

.alert {
    border: 1px solid transparent; border-radius: var(--radius-sm);
    padding: 11px 14px; margin-bottom: 16px; font-size: 13.5px;
    display: flex; gap: 10px; align-items: flex-start;
}
.alert.ok   { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert.bad  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert.info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.alert.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }

/* ================================================================================================
   Sign-in
   ================================================================================================ */

.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    background: var(--bg);
}
.auth-aside {
    background:
        radial-gradient(1200px 500px at 12% 8%, rgba(0, 115, 193, 0.36) 0%, rgba(0, 115, 193, 0) 62%),
        linear-gradient(160deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
    color: #e2e8f0;
    padding: 56px 56px 40px;
    display: flex; flex-direction: column;
}
.auth-aside img { max-width: 148px; filter: brightness(0) invert(1); }
.auth-aside .headline {
    margin-top: auto; font-size: 30px; line-height: 1.22; font-weight: 650;
    letter-spacing: -0.02em; color: #fff; max-width: 16ch;
}
.auth-aside .sub { margin-top: 14px; font-size: 14px; color: rgba(226, 232, 240, 0.72); max-width: 46ch; }
.auth-aside .facts { margin-top: 34px; display: flex; flex-direction: column; gap: 10px; }
.auth-aside .fact { display: flex; gap: 10px; font-size: 13px; color: rgba(226, 232, 240, 0.82); }
.auth-aside .fact .k { color: var(--primary-bright); font-weight: 700; }
.auth-aside .foot { margin-top: 34px; font-size: 12px; color: rgba(226, 232, 240, 0.45); }

.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 396px; }
.auth-card .mark { display: none; }
.auth-card h1 { font-size: 21px; margin-bottom: 4px; }
.auth-card .lede { color: var(--text-muted); font-size: 13.5px; margin-bottom: 24px; }
.auth-card .panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 26px 24px;
}
.auth-card .after { margin-top: 16px; text-align: center; font-size: 12.5px; color: var(--text-muted); }

.code-input {
    letter-spacing: 0.5em; text-align: center; font-size: 22px; font-weight: 600;
    font-variant-numeric: tabular-nums; padding: 12px;
}

.qr {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    padding: 18px; background: var(--surface-sunken);
    border: 1px solid var(--border); border-radius: var(--radius);
    margin-bottom: 18px;
}
.qr img { width: 208px; height: 208px; background: #fff; border-radius: var(--radius-sm); padding: 8px; }
.secret {
    font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.06em;
    background: var(--surface); border: 1px dashed var(--border-strong);
    padding: 7px 11px; border-radius: var(--radius-sm); word-break: break-all; text-align: center;
}

.steps { display: flex; gap: 6px; margin-bottom: 22px; }
.steps .step { flex: 1 1 0; height: 3px; border-radius: 999px; background: var(--border); }
.steps .step.done { background: var(--success); }
.steps .step.now { background: var(--primary); }

/* ================================================================================================
   Order detail: extracted order beside the email it came from
   ================================================================================================ */

.detail-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); align-items: start; }
.detail-grid > * { min-width: 0; }

.kv { display: grid; grid-template-columns: minmax(120px, auto) minmax(0, 1fr); gap: 8px 18px; }
.kv dt { font-size: 12px; color: var(--text-muted); }
.kv dd { margin: 0; font-size: 13.5px; }
.kv dd.mono { font-size: 12.5px; }

.email-head {
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 14px;
}
.email-head .subject { font-weight: 650; font-size: 14px; margin-bottom: 6px; }
.email-head .meta { font-size: 12.5px; color: var(--text-muted); display: grid; gap: 2px; }
.email-head .meta > div { overflow-wrap: anywhere; }

.email-body {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    max-height: 460px;
    overflow: auto;
    background: var(--surface);
    font-size: 13px;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--mono);
}

.attach-list { display: flex; flex-direction: column; gap: 8px; }
.attach {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface);
}
.attach:hover { border-color: var(--border-strong); background: var(--surface-sunken); }
.attach .ext {
    width: 34px; height: 34px; flex: 0 0 34px; border-radius: var(--radius-sm);
    background: var(--primary-soft); color: var(--primary-hover);
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 750; letter-spacing: 0.02em; text-transform: uppercase;
}
.attach .name { font-size: 13px; font-weight: 550; }
.attach .sub { font-size: 11.5px; color: var(--text-muted); }

.timeline { position: relative; padding-left: 22px; }
.timeline::before {
    content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px;
    width: 2px; background: var(--border);
}
.timeline .ev { position: relative; padding-bottom: 16px; }
.timeline .ev:last-child { padding-bottom: 0; }
.timeline .ev::before {
    content: ""; position: absolute; left: -21px; top: 5px;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--surface); border: 2px solid var(--primary);
}
.timeline .ev.bad::before { border-color: var(--danger); }
.timeline .ev.ok::before { border-color: var(--success); }
.timeline .ev .when { font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.timeline .ev .what { font-size: 13px; font-weight: 550; }
.timeline .ev .why { font-size: 12.5px; color: var(--text-muted); }

.issue {
    display: flex; gap: 11px; padding: 11px 13px;
    border: 1px solid var(--border); border-left-width: 3px; border-radius: var(--radius-sm);
    background: var(--surface); margin-bottom: 9px;
}
.issue.blocking { border-left-color: var(--danger); background: #fffafa; }
.issue.warning  { border-left-color: var(--warning); background: #fffdf7; }
.issue.info     { border-left-color: var(--info); background: #f8fbff; }
.issue.resolved { border-left-color: var(--success); background: var(--surface-sunken); opacity: 0.85; }
.issue .code { font-size: 12.5px; font-weight: 650; }
.issue .detail { font-size: 12.5px; color: var(--text-muted); }

pre.json {
    margin: 0; padding: 13px; border-radius: var(--radius-sm);
    background: #0f172a; color: #e2e8f0;
    font-family: var(--mono); font-size: 12px; line-height: 1.55;
    overflow: auto; max-height: 360px;
}

details.disclose { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
details.disclose + details.disclose { margin-top: 9px; }
details.disclose > summary {
    padding: 10px 13px; cursor: pointer; font-size: 13px; font-weight: 600;
    list-style: none; display: flex; align-items: center; gap: 9px;
}
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose > summary::before { content: "\25B8"; color: var(--text-muted); font-size: 11px; }
details.disclose[open] > summary::before { content: "\25BE"; }
details.disclose > .inner { padding: 0 13px 13px; }

/* ================================================================================================
   Pagination
   ================================================================================================ */

.pager { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.pager .links { display: flex; gap: 6px; }
.pager .links a, .pager .links span {
    padding: 5px 11px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); font-size: 12.5px; font-weight: 600;
    background: var(--surface); color: var(--text);
}
.pager .links a:hover { background: var(--surface-sunken); text-decoration: none; }
.pager .links span { color: var(--text-muted); background: var(--surface-sunken); }

/* ================================================================================================
   Responsive
   ================================================================================================ */

@media (max-width: 1180px) {
    .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-grid, .grid.split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
    .auth-page { grid-template-columns: minmax(0, 1fr); }
    .auth-aside { display: none; }
    .auth-card .mark { display: block; margin: 0 auto 20px; max-width: 138px; }
}

@media (max-width: 780px) {
    .shell { flex-direction: column; }
    .shell::before { display: none; }
    .sidebar {
        width: 100%; flex: none; height: auto; position: static;
        padding: 12px; flex-direction: row; flex-wrap: wrap; gap: 8px;
    }
    .sidebar .brand { width: 100%; padding: 0 4px 10px; margin-bottom: 4px; }
    .sidebar .brand .product { display: none; }
    .nav-group { flex-direction: row; flex-wrap: wrap; margin-top: 0; }
    .nav-group .nav-label { display: none; }
    .sidebar-foot { display: none; }
    .content { padding: 16px; }
    .topbar { padding: 10px 16px; }
    .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
    .field-row, .field-row.three { grid-template-columns: minmax(0, 1fr); }
}

@media print {
    .sidebar, .topbar, .toolbar, .btn { display: none !important; }
    .content { padding: 0; }
    .card { box-shadow: none; }
}
