/* ContentGuard AI - web portal styles */
:root {
  --navy: #0b1f4d;
  --navy-2: #13306e;
  --blue: #1e5eff;
  --blue-600: #1a4fd6;
  --blue-50: #eef3ff;
  --teal: #12b5c8;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --border: #e3e8f0;
  --border-strong: #cfd7e4;
  --text: #0f1b33;
  --text-2: #4a5873;
  --text-3: #7a879e;
  --good: #0ca30c;
  --good-ink: #067a06;
  --good-bg: #e8f7e8;
  --warn: #fab219;
  --warn-ink: #8a5a00;
  --warn-bg: #fff5dc;
  --crit: #d03b3b;
  --crit-ink: #b42323;
  --crit-bg: #fdeaea;
  --serious: #ec835a;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 27, 51, 0.05), 0 2px 8px rgba(15, 27, 51, 0.04);
  --shadow-lg: 0 10px 40px rgba(15, 27, 51, 0.18);
  --sidebar-w: 248px;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Inter, Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  color-scheme: light;
}

* { box-sizing: border-box; }
/* Default size for inline icons; components below override where needed. */
svg[aria-hidden='true'] { width: 16px; height: 16px; flex-shrink: 0; vertical-align: -3px; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--text); }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
h4 { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
p { margin: 0 0 8px; }
small, .muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
code, .mono { font-family: Consolas, 'SF Mono', Menlo, monospace; font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
:focus-visible { outline: 3px solid rgba(30, 94, 255, .35); outline-offset: 2px; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--navy); color: #c9d4ee;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; }
.brand svg { width: 34px; height: 34px; flex-shrink: 0; }
.brand-name { font-weight: 750; font-size: 16px; letter-spacing: -.01em; }
.brand-name span { background: linear-gradient(90deg, #39c6ff, var(--teal)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-org { font-size: 11.5px; color: #8fa1c9; }
.nav { padding: 6px 10px 16px; flex: 1; }
.nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #6f82ad; padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #c9d4ee;
  font-weight: 500; text-decoration: none; margin-bottom: 1px;
}
.nav a svg { width: 18px; height: 18px; opacity: .85; flex-shrink: 0; }
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a.active { background: rgba(57, 198, 255, .14); color: #fff; box-shadow: inset 3px 0 0 #39c6ff; }
.nav .count { margin-left: auto; background: #39c6ff; color: var(--navy); font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px; }
.sidebar-foot { padding: 12px 18px 16px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 12px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 24px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30;
}
.topbar .menu-btn { display: none; }
.topbar .search { flex: 1; max-width: 420px; position: relative; }
.topbar .search input { padding-left: 34px; background: var(--surface-2); }
.topbar .search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); }
.topbar .spacer { flex: 1; }
.agent-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); padding: 5px 10px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); cursor: default; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--text-3); flex-shrink: 0; }
.dot.on { background: var(--good); box-shadow: 0 0 0 3px rgba(12, 163, 12, .15); }
.dot.off { background: var(--crit); }
.dot.idle { background: var(--warn); }
.user-btn { display: flex; align-items: center; gap: 9px; background: none; border: 0; cursor: pointer; padding: 4px 6px; border-radius: 8px; font: inherit; color: var(--text); }
.user-btn:hover { background: var(--surface-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--blue), var(--teal)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex-shrink: 0; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.user-meta { text-align: left; line-height: 1.2; }
.user-meta b { font-size: 13px; display: block; }
.user-meta small { font-size: 11.5px; }
.content { padding: 24px; max-width: 1440px; width: 100%; margin: 0 auto; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { color: var(--text-2); margin: 4px 0 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; }
.crumbs a { color: var(--text-3); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.ml-auto { margin-left: auto; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; }
.hidden { display: none !important; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head .sub { font-size: 12.5px; color: var(--text-3); font-weight: 400; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card.sticky { position: sticky; top: 76px; }

.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.kpi .label { font-size: 12.5px; color: var(--text-2); font-weight: 550; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 28px; font-weight: 750; letter-spacing: -.02em; color: var(--text); line-height: 1.1; }
.kpi .hint { font-size: 12px; color: var(--text-3); }
.kpi a.stretched::after { content: ''; position: absolute; inset: 0; }
.kpi:hover { border-color: var(--border-strong); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-2); border-color: #b9c3d4; }
.btn:disabled, .btn[aria-disabled='true'] { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-600); }
.btn.success { background: var(--good-ink); border-color: var(--good-ink); color: #fff; }
.btn.success:hover { background: #056505; }
.btn.danger { background: var(--crit-ink); border-color: var(--crit-ink); color: #fff; }
.btn.danger:hover { background: #961c1c; }
.btn.warn { background: #fff; border-color: #e7b54a; color: var(--warn-ink); }
.btn.warn:hover { background: var(--warn-bg); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.lg { height: 42px; padding: 0 18px; font-size: 14.5px; }
.btn.block { width: 100%; }
.btn.icon { width: 36px; padding: 0; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
label.field, div.field { display: block; font-weight: 600; font-size: 13px; color: var(--text); }
label.field > :is(input, select, textarea) { display: block; margin-top: 6px; }
label.field > :is(.help, .char-count) { display: block; margin-top: 4px; }
label.field > .row, div.field > .checks, div.field > .radio-cards, div.field > .row { margin-top: 8px; }
div.field > .help { display: block; margin-top: 6px; }
label.field .help, .help { font-weight: 400; font-size: 12px; color: var(--text-3); }
.req { color: var(--crit-ink); }
input[type='text'], input[type='email'], input[type='password'], input[type='search'], input[type='number'], input[type='date'],
input[type='datetime-local'], input[type='url'], select, textarea {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); font: inherit; color: var(--text); transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; min-height: 96px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(30, 94, 255, .15); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text-2); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.char-count { font-size: 11.5px; color: var(--text-3); text-align: right; font-weight: 400; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check-chip { position: relative; }
.check-chip input { position: absolute; opacity: 0; pointer-events: none; }
.check-chip span {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 20px;
  font-weight: 550; font-size: 12.5px; cursor: pointer; background: var(--surface); color: var(--text-2); user-select: none;
}
.check-chip input:checked + span { background: var(--blue-50); border-color: var(--blue); color: var(--blue-600); }
.check-chip input:focus-visible + span { outline: 3px solid rgba(30, 94, 255, .35); }
.toggle { display: flex; align-items: flex-start; gap: 10px; font-weight: 550; cursor: pointer; }
.toggle input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--blue); }
.radio-cards { display: grid; gap: 10px; }
.radio-card { display: flex; gap: 12px; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--blue); background: var(--blue-50); }
.radio-card input { accent-color: var(--blue); margin-top: 3px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters > * { width: auto; }
.filters input[type='search'] { min-width: 240px; }
.filters select { min-width: 150px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: #f6f9ff; }
.table .title-cell { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.table .title-cell b { display: block; font-weight: 600; }
.thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--border); flex-shrink: 0; display: grid; place-items: center; color: var(--text-3); }
.thumb svg { width: 18px; height: 18px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #eef1f6; color: var(--text-2); }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.s-draft { background: #eef1f6; color: #55627a; }
.pill.s-screening { background: #e9f2ff; color: #1a56c4; }
.pill.s-changes_required { background: var(--warn-bg); color: var(--warn-ink); }
.pill.s-in_review { background: #f1ecff; color: #5b3fc4; }
.pill.s-approved { background: var(--good-bg); color: var(--good-ink); }
.pill.s-scheduled { background: #e6f7f9; color: #0b7d8b; }
.pill.s-publishing { background: #e6f7f9; color: #0b7d8b; }
.pill.s-published { background: #0b1f4d; color: #fff; }
.pill.s-publish_failed, .pill.s-rejected { background: var(--crit-bg); color: var(--crit-ink); }
.risk { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 7px; border-radius: 6px; font-size: 12px; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.risk svg { width: 13px; height: 13px; }
.risk.low { background: var(--good-bg); color: var(--good-ink); border-color: #bfe6bf; }
.risk.medium { background: var(--warn-bg); color: var(--warn-ink); border-color: #f6dc9c; }
.risk.high { background: var(--crit-bg); color: var(--crit-ink); border-color: #f3c0c0; }
.risk.none { background: #eef1f6; color: var(--text-3); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; background: #eef1f6; color: var(--text-2); white-space: nowrap; }
.tag.blue { background: var(--blue-50); color: var(--blue-600); }
.tag.ai { background: linear-gradient(90deg, #e9f6ff, #e6fbfd); color: #0b6f8a; }
.tag.rule { background: #f1ecff; color: #5b3fc4; }
.tag.fp { background: #eef1f6; color: var(--text-3); text-decoration: line-through; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid; font-size: 13.5px; align-items: flex-start; }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert.info { background: var(--blue-50); border-color: #c9d8ff; color: #1b3f9e; }
.alert.warn { background: var(--warn-bg); border-color: #f3d58f; color: #6e4800; }
.alert.danger { background: var(--crit-bg); border-color: #f1bcbc; color: #8f1d1d; }
.alert.success { background: var(--good-bg); border-color: #bde3bd; color: #0b5e0b; }
.alert b { display: block; margin-bottom: 2px; }
.alert .btn { margin-top: 8px; }

/* ---------- Empty / loading ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--text-2); }
.empty svg { width: 44px; height: 44px; color: #b8c3d6; margin-bottom: 10px; }
.empty h3 { margin-bottom: 4px; }
.empty p { color: var(--text-3); max-width: 420px; margin: 0 auto 14px; }
.skeleton { background: linear-gradient(90deg, #edf1f7 25%, #f6f8fb 37%, #edf1f7 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.loading-page { display: grid; gap: 14px; }
.loading-page .skeleton { height: 90px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button, .tabs a {
  background: none; border: 0; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--text-2); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; text-decoration: none;
}
.tabs button:hover, .tabs a:hover { color: var(--text); }
.tabs .active { color: var(--blue); border-bottom-color: var(--blue); }
.tabs .count { background: #eef1f6; color: var(--text-2); font-size: 11px; padding: 0 7px; border-radius: 10px; }
.tabs .active .count { background: var(--blue-50); color: var(--blue-600); }

/* ---------- Workflow stepper ---------- */
.stepper { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; padding: 4px 2px 2px; }
.step { flex: 1; min-width: 92px; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.step::before { content: ''; position: absolute; top: 13px; left: -50%; right: 50%; height: 2px; background: var(--border); z-index: 0; }
.step:first-child::before { display: none; }
.step .circle { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border-strong); background: #fff; display: grid; place-items: center; z-index: 1; margin-bottom: 6px; font-size: 12px; }
.step .circle svg { width: 14px; height: 14px; }
.step.done { color: var(--text-2); }
.step.done .circle { background: var(--good-ink); border-color: var(--good-ink); color: #fff; }
.step.done::before, .step.current::before { background: var(--good-ink); }
.step.current { color: var(--blue); }
.step.current .circle { border-color: var(--blue); color: var(--blue); box-shadow: 0 0 0 4px rgba(30, 94, 255, .14); }
.step.warn .circle { border-color: #e2a21b; color: var(--warn-ink); background: var(--warn-bg); }
.step.warn { color: var(--warn-ink); }
.step.bad .circle { border-color: var(--crit-ink); color: #fff; background: var(--crit-ink); }
.step.bad { color: var(--crit-ink); }

/* ---------- Findings ---------- */
.finding { border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface); }
.finding + .finding { margin-top: 10px; }
.finding.high { border-left-color: var(--crit); }
.finding.medium { border-left-color: var(--warn); }
.finding.low { border-left-color: var(--good); }
.finding.fp { opacity: .65; }
.finding-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.finding-head b { font-size: 13.5px; }
.finding .evidence { background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 6px; padding: 7px 10px; font-size: 13px; color: var(--text); margin: 6px 0; white-space: pre-wrap; word-break: break-word; }
.finding .rec { font-size: 13px; color: var(--text-2); }
.finding .rec b { color: var(--text); }
.finding .loc { font-size: 12px; color: var(--text-3); }
.summary-box { display: flex; gap: 18px; align-items: center; padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); }
.gauge { width: 86px; height: 86px; flex-shrink: 0; position: relative; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge .g-val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 800; font-size: 20px; line-height: 1; }
.gauge .g-val small { display: block; font-size: 10px; font-weight: 600; color: var(--text-3); margin-top: 2px; }
mark { padding: 0 2px; border-radius: 3px; }
mark.high { background: #fbd0d0; color: #7d1010; }
mark.medium { background: #ffe7a8; color: #5e3d00; }
mark.low { background: #cdeecd; color: #0b4d0b; }
.content-text { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; line-height: 1.6; }
.content-text.empty-text { color: var(--text-3); font-style: italic; }

/* ---------- Assets ---------- */
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.asset { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.asset .preview { aspect-ratio: 4 / 3; background: #0f1b33; display: grid; place-items: center; color: #9fb0cf; overflow: hidden; cursor: pointer; position: relative; }
.asset .preview img, .asset .preview video { width: 100%; height: 100%; object-fit: cover; }
.asset .preview svg { width: 34px; height: 34px; }
.asset .preview .badge-kind { position: absolute; top: 6px; left: 6px; background: rgba(11, 31, 77, .8); color: #fff; font-size: 10.5px; font-weight: 700; padding: 2px 6px; border-radius: 4px; text-transform: uppercase; }
.asset .meta { padding: 8px 10px; font-size: 12px; display: flex; gap: 6px; align-items: center; }
.asset .meta .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--text); }
.viewer { display: flex; flex-direction: column; gap: 12px; }
.viewer img, .viewer video { max-width: 100%; max-height: 70vh; border-radius: 8px; background: #000; display: block; margin: 0 auto; }
.viewer audio { width: 100%; }
.viewer iframe { width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: 8px; }

/* ---------- Dropzone ---------- */
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 26px; text-align: center; background: var(--surface-2); transition: border-color .15s, background .15s; cursor: pointer; }
.dropzone:hover, .dropzone.over { border-color: var(--blue); background: var(--blue-50); }
.dropzone svg { width: 38px; height: 38px; color: var(--blue); margin-bottom: 6px; }
.dropzone b { display: block; font-size: 14.5px; }
.file-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.file-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.file-item .fi-icon { width: 34px; height: 34px; border-radius: 8px; background: var(--blue-50); color: var(--blue); display: grid; place-items: center; flex-shrink: 0; }
.file-item .fi-icon svg { width: 17px; height: 17px; }
.file-item .fi-main { flex: 1; min-width: 0; }
.file-item .fi-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .fi-sub { font-size: 12px; color: var(--text-3); }
.progress { height: 6px; background: #e7ecf4; border-radius: 4px; overflow: hidden; margin-top: 5px; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--blue), var(--teal)); width: 0; transition: width .2s; }
.or-divider { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12px; margin: 14px 0; }
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ---------- Lists / timeline / comments ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none !important; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: #f6f9ff; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .li-sub { font-size: 12px; color: var(--text-3); }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 14px; }
.tl-item::before { content: ''; position: absolute; left: -20px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--blue); }
.tl-item.agent::before { border-color: var(--teal); }
.tl-item.system::before { border-color: var(--text-3); }
.tl-item .tl-sum { font-weight: 550; font-size: 13px; }
.tl-item .tl-meta { font-size: 12px; color: var(--text-3); }
.comment { display: flex; gap: 10px; padding: 10px 0; }
.comment + .comment { border-top: 1px solid var(--border); }
.comment .c-body { flex: 1; min-width: 0; }
.comment .c-head { font-size: 12.5px; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.comment .c-text { white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.comment.system .c-text { color: var(--warn-ink); }
.stage-list { display: flex; flex-direction: column; gap: 8px; }
.stage-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.stage-row .si { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: #eef1f6; color: var(--text-3); flex-shrink: 0; }
.stage-row .si svg { width: 12px; height: 12px; }
.stage-row.done .si { background: var(--good-ink); color: #fff; }
.stage-row.current { border-color: var(--blue); background: var(--blue-50); }
.stage-row.current .si { background: var(--blue); color: #fff; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; word-break: break-word; }

/* ---------- Diff ---------- */
.diff ins { background: #d6f5d6; text-decoration: none; border-radius: 3px; padding: 0 1px; }
.diff del { background: #fbd6d6; color: #8b1a1a; border-radius: 3px; padding: 0 1px; }

/* ---------- Charts ---------- */
.chart { position: relative; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding: 8px 4px 0; border-bottom: 1px solid var(--border-strong); }
.bar-group { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; height: 100%; position: relative; min-width: 14px; cursor: default; }
.bar-group:hover { background: rgba(30, 94, 255, .04); }
.bar { width: 100%; max-width: 22px; border-radius: 4px 4px 0 0; min-height: 0; }
.bar.s1 { background: var(--series-1); }
.bar.s2 { background: var(--series-2); }
.bar-labels { display: flex; gap: 10px; padding: 6px 4px 0; }
.bar-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 14px; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-2); margin-bottom: 10px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar { display: grid; grid-template-columns: 150px 1fr 48px; gap: 10px; align-items: center; font-size: 13px; }
.hbar .hb-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.hbar .hb-track { height: 14px; background: #eef2f8; border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar .hb-fill { height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .hb-fill.good { background: var(--good); } .hbar .hb-fill.warn { background: var(--warn); } .hbar .hb-fill.crit { background: var(--crit); }
.hbar .hb-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.tooltip { position: fixed; z-index: 200; pointer-events: none; background: var(--navy); color: #fff; padding: 8px 10px; border-radius: 8px; font-size: 12px; box-shadow: var(--shadow-lg); line-height: 1.5; max-width: 260px; }
.tooltip b { display: block; }
.tooltip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.dist { display: flex; height: 10px; border-radius: 6px; overflow: hidden; gap: 2px; background: var(--surface); }
.dist > div { height: 100%; }

/* ---------- Calendar ---------- */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.calendar .dow { font-size: 11px; font-weight: 650; color: var(--text-3); text-transform: uppercase; padding: 8px; background: var(--surface-2); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.calendar .day { min-height: 104px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; font-size: 12px; background: var(--surface); }
.calendar .day.other { background: var(--surface-2); color: var(--text-3); }
.calendar .day.today .dnum { background: var(--blue); color: #fff; border-radius: 10px; padding: 0 7px; }
.calendar .dnum { font-weight: 650; display: inline-block; margin-bottom: 4px; }
.cal-item { display: block; padding: 3px 6px; border-radius: 5px; margin-bottom: 3px; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #e6f7f9; color: #0b6f7c; text-decoration: none !important; }
.cal-item.published { background: #e3e8f3; color: var(--navy); }
.cal-item.failed { background: var(--crit-bg); color: var(--crit-ink); }
.cal-item.cancelled { background: #f1f3f7; color: var(--text-3); text-decoration: line-through !important; }

/* ---------- Modal & toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(11, 22, 45, .45); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .12s ease; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: pop .15s ease; }
.modal.wide { max-width: 860px; }
.modal.xl { max-width: 1100px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 300; }
.toast { min-width: 280px; max-width: 420px; background: var(--navy); color: #fff; padding: 12px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: flex-start; animation: pop .18s ease; font-size: 13.5px; }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.toast.success svg { color: #6ee26e; } .toast.error svg { color: #ff8a8a; } .toast.info svg { color: #7ad7ff; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 200px; padding: 6px; z-index: 50; }
.menu a, .menu button { display: flex; width: 100%; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-decoration: none !important; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }

/* ---------- Auth screens ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-hero { background: radial-gradient(circle at 20% 20%, #1b3f8f 0, var(--navy) 55%); color: #dbe5fb; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-hero h1 { color: #fff; font-size: 38px; letter-spacing: -.02em; margin: 26px 0 10px; }
.auth-hero h1 span { background: linear-gradient(90deg, #39c6ff, var(--teal)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-hero .points { display: grid; gap: 14px; margin-top: 28px; max-width: 460px; }
.auth-hero .point { display: flex; gap: 12px; align-items: flex-start; }
.auth-hero .point svg { width: 22px; height: 22px; color: #39c6ff; flex-shrink: 0; }
.auth-hero .shield { position: absolute; right: -60px; bottom: -40px; width: 380px; opacity: .14; }
.auth-hero .shield svg { width: 100%; height: auto; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-form .box { width: 100%; max-width: 380px; }
.auth-form h2 { font-size: 24px; margin-bottom: 6px; }
.auth-form .stack { gap: 14px; }

/* ---------- Misc ---------- */
.token-box { display: flex; gap: 8px; align-items: center; background: var(--navy); color: #fff; padding: 10px 12px; border-radius: 8px; font-family: Consolas, Menlo, monospace; font-size: 13px; word-break: break-all; }
.token-box code { flex: 1; color: #8de7ff; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; }
.pager { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 12px 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.drop-overlay { position: fixed; inset: 0; background: rgba(30, 94, 255, .08); border: 3px dashed var(--blue); z-index: 90; pointer-events: none; }
.code-block { background: #0f1b33; color: #d7e3ff; padding: 12px 14px; border-radius: 8px; font-family: Consolas, Menlo, monospace; font-size: 12.5px; white-space: pre-wrap; word-break: break-all; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .split { grid-template-columns: 1fr; }
  .card.sticky { position: static; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .topbar { padding: 0 14px; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar .user-meta, .agent-chip .label { display: none; }
  .content { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .hbar { grid-template-columns: 100px 1fr 40px; }
}
@media (max-width: 560px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .kpi .value { font-size: 22px; }
  .topbar .search { display: none; }
}
@media print {
  .sidebar, .topbar, .actions, .btn { display: none !important; }
  .content { padding: 0; }
  .card { box-shadow: none; }
}
