:root {
    --ink: #172033;
    --ink-soft: #334155;
    --paper: #fffdf8;
    --canvas: #ece9e2;
    --panel: #f8f5ed;
    --line: #d8d3c8;
    --muted: #737d8e;
    --accent: #ff6b35;
    --green: #0f8b6d;
    --red: #b42318;
    --blue: #2563eb;
    --shadow: 0 18px 50px rgba(23, 32, 51, .11);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); font: 14px/1.5 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif; }
button, input, select { font: inherit; }
button { color: inherit; }
.admin-shell { display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 24px 17px; background: var(--ink); color: #fff; }
.brand { display: flex; align-items: center; gap: 11px; margin: 0 8px 38px; color: inherit; text-decoration: none; }
.brand > span:last-child { display: flex; flex-direction: column; letter-spacing: .13em; }
.brand strong { font-size: 13px; line-height: 1.1; }
.brand small { margin-top: 4px; color: #9eabba; font-size: 8px; letter-spacing: .2em; }
.brand-mark { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 11px 3px 11px 3px; background: var(--accent); color: #fff; font: 800 18px/1 Georgia, serif; }
.brand-mark.large { width: 46px; height: 46px; margin-bottom: 14px; font-size: 22px; }
nav { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 13px; width: 100%; padding: 11px 12px; border: 0; border-radius: 9px; background: transparent; color: #aeb8c4; cursor: pointer; text-align: left; }
.nav-item span { color: #637083; font: 10px/1 ui-monospace, monospace; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.09); color: #fff; }
.nav-item.active span { color: var(--accent); }
.sidebar-foot { display: grid; gap: 10px; margin-top: auto; padding: 15px 10px 0; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar-foot button { padding: 0; border: 0; background: transparent; color: #9eabba; cursor: pointer; text-align: left; }
.status-dot::before { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--green); content: ""; }
main { min-width: 0; padding: 30px clamp(22px, 4vw, 58px) 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
h1, h2, p { margin: 0; }
h1 { font: 650 clamp(25px, 3vw, 34px)/1.15 Georgia, "Songti SC", serif; }
h2 { font: 650 20px/1.25 Georgia, "Songti SC", serif; }
.eyebrow { margin-bottom: 6px; color: var(--accent); font: 700 10px/1.2 ui-monospace, monospace; letter-spacing: .16em; }
.topbar-actions, .dialog-actions, .row-actions { display: flex; align-items: center; gap: 9px; }
.dark-button, .upload-button { display: inline-flex; align-items: center; justify-content: center; min-height: 39px; padding: 0 16px; border: 1px solid var(--ink); border-radius: 8px; background: var(--ink); color: #fff; cursor: pointer; font-weight: 700; }
.upload-button { border-color: var(--accent); background: var(--accent); }
.upload-button input { display: none; }
.global-message { min-height: 21px; margin: -14px 0 16px; color: var(--green); font-weight: 650; }
.global-message.error { color: var(--red); }
.view { display: none; }
.view.active { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric { position: relative; overflow: hidden; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: 0 8px 24px rgba(23,32,51,.04); }
.metric::after { position: absolute; right: -17px; bottom: -28px; width: 82px; height: 82px; border: 15px solid rgba(255,107,53,.08); border-radius: 50%; content: ""; }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 8px; font: 700 32px/1 Georgia, serif; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 18px; }
.panel { padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: 0 8px 30px rgba(23,32,51,.045); }
.panel-heading, .section-intro { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.panel-heading { margin-bottom: 20px; }
.section-intro { margin-bottom: 18px; }
.section-intro > p { max-width: 520px; color: var(--muted); }
.live-pill, .status-pill { display: inline-flex; align-items: center; min-height: 25px; padding: 0 9px; border-radius: 999px; background: #e2f6ef; color: #08755b; font-size: 11px; font-weight: 750; }
.status-pill.pending, .status-pill.authenticated { background: #fff1db; color: #9a5700; }
.status-pill.rejected, .status-pill.failed, .status-pill.disabled { background: #fee7e5; color: var(--red); }
.status-pill.active, .status-pill.passed { background: #e2f6ef; color: #08755b; }
.pipeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.pipeline li { position: relative; display: grid; grid-template-columns: 36px 1fr; gap: 12px; padding-bottom: 20px; }
.pipeline li:not(:last-child)::before { position: absolute; left: 17px; top: 32px; bottom: 3px; width: 1px; background: var(--line); content: ""; }
.pipeline li > span { position: relative; z-index: 1; display: grid; place-items: center; width: 35px; height: 35px; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); font: 700 10px/1 ui-monospace, monospace; }
.pipeline strong { font-size: 13px; }
.pipeline p, .compact-item p, .form-hint { margin-top: 3px; color: var(--muted); font-size: 12px; }
.compact-list { display: grid; }
.compact-item { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-top: 1px solid #ece8df; }
.compact-item:first-child { padding-top: 0; border-top: 0; }
.compact-item strong { font-size: 13px; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--blue); cursor: pointer; font-weight: 700; }
.submission-list { display: grid; gap: 12px; }
.submission-card { display: grid; grid-template-columns: minmax(220px, 1.1fr) minmax(260px, .9fr) auto; align-items: center; gap: 20px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); }
.submission-title { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.submission-title strong { font-size: 15px; }
.mono { color: var(--muted); font: 11px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.checks { display: flex; flex-wrap: wrap; gap: 7px; }
.check-chip { padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); font-size: 11px; }
.row-actions { justify-content: flex-end; flex-wrap: wrap; }
.row-actions button, .dialog-actions button { padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; cursor: pointer; font-size: 12px; font-weight: 700; }
.row-actions button.primary { border-color: var(--ink); background: var(--ink); color: #fff; }
.row-actions button.danger { color: var(--red); }
.split-layout { display: grid; grid-template-columns: minmax(260px, .7fr) minmax(420px, 1.3fr); gap: 18px; align-items: start; }
.form-panel form { display: grid; gap: 14px; margin-top: 22px; }
label { display: grid; gap: 6px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
input, select { width: 100%; min-height: 41px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); outline: none; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-hint { margin-top: 14px; }
.table-list { display: grid; }
.table-row { display: grid; grid-template-columns: minmax(170px, 1fr) minmax(150px, .8fr) auto; gap: 16px; align-items: center; padding: 14px 0; border-top: 1px solid #ece8df; }
.table-row:first-child { border-top: 0; }
.table-row strong { display: block; margin-bottom: 4px; }
.audit-list { display: grid; }
.audit-row { display: grid; grid-template-columns: 160px 160px 1fr; gap: 18px; padding: 12px 0; border-top: 1px solid #ece8df; }
.audit-row:first-child { border-top: 0; }
.audit-row code { font: 11px/1.5 ui-monospace, monospace; overflow-wrap: anywhere; }
.empty-state { padding: 30px 8px; color: var(--muted); text-align: center; }
.dialog-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(23,32,51,.7); backdrop-filter: blur(6px); }
.dialog-backdrop.hidden { display: none; }
.dialog-card { width: min(430px, 100%); padding: 30px; border-radius: 14px; background: var(--paper); box-shadow: var(--shadow); }
.dialog-card > p:not(.eyebrow) { margin: 9px 0 20px; color: var(--muted); }
.dialog-card label { margin-bottom: 15px; }
.dialog-card > .dark-button { width: 100%; }
.dialog-card > a { display: block; margin-top: 17px; color: var(--muted); text-align: center; }
.token-value { display: block; max-height: 150px; overflow: auto; margin-bottom: 17px; padding: 13px; border-radius: 8px; background: #f0ede5; font: 12px/1.55 ui-monospace, monospace; overflow-wrap: anywhere; user-select: all; }
@media (max-width: 900px) {
    .admin-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; padding: 14px; }
    .brand { margin: 0 0 12px; }
    nav { grid-template-columns: repeat(5, minmax(0,1fr)); overflow-x: auto; }
    .nav-item { justify-content: center; padding: 9px; font-size: 11px; white-space: nowrap; }
    .nav-item span, .sidebar-foot { display: none; }
    main { padding: 24px 18px 50px; }
    .overview-grid, .split-layout { grid-template-columns: 1fr; }
    .submission-card { grid-template-columns: 1fr; }
    .row-actions { justify-content: flex-start; }
}
@media (max-width: 620px) {
    .topbar, .section-intro { align-items: stretch; flex-direction: column; }
    .topbar-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .metric-grid { grid-template-columns: 1fr 1fr; }
    .table-row, .audit-row { grid-template-columns: 1fr; gap: 6px; }
}
