/* AI-SOC v2 — shared styles. Tokens follow ai-soc-legacy/web/DESIGN.md (v1):
   light data surfaces, cool-gray workspace, one blue action colour,
   red/amber for risk and always a text label next to a colour. */
:root {
  font-family: "Segoe UI", "Noto Sans", Arial, sans-serif;
  color: #253044; background: #f4f6f9; font-size: 14px; font-synthesis: none;
  --bg: #f4f6f9; --surface: #fff; --ink: #253044; --muted: #627086; --line: #e0e5ec;
  --blue: #2458ce; --blue-ink: #1746b2; --blue-tint: #eaf0fc;
  --red: #b42335; --amber: #925411; --green: #21714e;
  --sev-critical: #b63846; --sev-high: #c98a2e; --sev-medium: #3d6fd0; --sev-low: #2f8a5b; --sev-info: #7f8ca1;
  --chart-critical: #b63846; --chart-high: #c98a2e; --chart-medium: #3d6fd0; --chart-low: #2f8a5b; --chart-info: #98a2b3;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 360px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; transition: background-color 120ms, border-color 120ms; }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 3px solid #769cf3; outline-offset: 3px; }
svg { flex-shrink: 0; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { font-size: 26px; line-height: 1.25; letter-spacing: -.7px; font-weight: 650; margin-bottom: 8px; }
h2 { font-size: 16px; font-weight: 650; line-height: 1.4; margin: 0; }
h3 { font-size: 16px; line-height: 1.5; margin-bottom: 8px; }
h4 { font-size: 14px; margin-bottom: 6px; }
p { line-height: 1.6; }
a { color: var(--blue); }
code, pre, .mono { font-family: "Cascadia Code", Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.skip-link { position: fixed; top: -80px; left: 20px; padding: 12px; background: #fff; z-index: 100; }
.skip-link:focus { top: 12px; }

/* Shell */
.app-shell { display: grid; grid-template-columns: 216px minmax(0,1fr); min-height: 100vh; }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 24px 14px 16px; display: flex; flex-direction: column; height: 100vh; position: sticky; top: 0; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 11px; padding: 0 8px; }
.brand-mark { display: grid; place-items: center; color: #fff; width: 38px; height: 40px; background: #3569db; border-radius: 9px; }
.brand-mark svg { width: 25px; height: 25px; }
.logo b { font-size: 20px; font-weight: 650; letter-spacing: -.4px; }
.logo small { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); }
.workspace-label { margin: 22px 5px 16px; padding: 14px 0; border-block: 1px solid var(--line); display: flex; align-items: center; gap: 10px; font-size: 13px; }
.workspace-label small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav button, .sidebar nav a { padding: 10px 12px; min-height: 42px; border: 0; background: none; border-radius: 6px; color: #536178; display: flex; align-items: center; gap: 11px; text-align: left; font-size: 13px; text-decoration: none; }
.sidebar nav button:hover, .sidebar nav a:hover { background: #f2f5fa; color: var(--ink); }
.sidebar nav button.active { color: var(--blue-ink); background: var(--blue-tint); font-weight: 650; }
.sidebar nav em { font-style: normal; margin-left: auto; background: #ede3cc; color: #613e10; padding: 2px 7px; border-radius: 4px; font-size: 12px; }
.nav-sep { margin: 14px 8px 4px; font-size: 12px; color: #8b97a8; }
.sidebar footer { margin-top: auto; padding-top: 16px; }
.account { display: flex; gap: 10px; align-items: center; border-top: 1px solid var(--line); padding: 14px 6px 6px; font-size: 13px; }
.account > span { width: 32px; height: 32px; border-radius: 50%; background: #e9eef6; display: grid; place-items: center; font-weight: 650; }
.account small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.logout { display: flex; gap: 10px; align-items: center; padding: 10px 6px; color: #536178; background: none; border: 0; font-size: 13px; width: 100%; }
.logout:hover { color: var(--blue); }
.workspace { min-width: 0; }
.topbar { min-height: 60px; background: #fff; border-bottom: 1px solid var(--line); padding: 12px 32px; display: flex; justify-content: space-between; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 20; }
.breadcrumb { color: var(--muted); display: flex; gap: 10px; align-items: center; font-size: 13px; }
.breadcrumb strong { color: var(--ink); font-weight: 500; }
.sync-controls { display: flex; gap: 16px; align-items: center; }
.sync { display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.sync i { width: 6px; height: 6px; background: var(--green); border-radius: 50%; }
.sync.stale { color: var(--amber); }
.sync.stale i { background: var(--amber); }
.content { padding: 32px; max-width: 1560px; margin: auto; }
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; }
.page-header p { color: var(--muted); margin: 0; }
.content-footer { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 11px; color: var(--muted); margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--line); }

/* Metrics strip */
.metrics { display: grid; grid-template-columns: repeat(4,1fr); border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 20px 0; margin-bottom: 24px; }
.metrics > * { padding: 0 24px; border-right: 1px solid var(--line); }
.metrics > *:last-child { border-right: 0; }
.metrics span { font-size: 13px; color: #546075; }
.metrics strong { display: block; margin: 8px 0 4px; font-size: 28px; font-weight: 600; line-height: 1.3; letter-spacing: -.8px; }
.metrics .hero-metric strong { font-size: 36px; line-height: 1.15; }
.metric-link { background: none; border: 0; border-radius: 0; color: inherit; text-align: left; font: inherit; cursor: pointer; }
.metric-link span i { font-style: normal; color: var(--blue); }
.metric-link:hover span { color: var(--blue); }
.metrics small { font-size: 12px; color: var(--muted); }
.metrics .risk-number { color: var(--red); }
.metrics .warn-number { color: var(--amber); }

/* Panels */
.overview-layout { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 22px; align-items: start; }
.stack { display: grid; gap: 20px; min-width: 0; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px; }
.panel-heading p { color: var(--muted); font-size: 12px; margin: 5px 0 0; }
.panel-body { padding: 0 20px 20px; }
.panel-foot { background: #fcfcfd; color: var(--muted); border-top: 1px solid var(--line); padding: 12px 20px; font-size: 12px; line-height: 1.6; }
.panel-note { color: var(--muted); font-size: 12px; margin: 16px 20px 20px; line-height: 1.6; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head p { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.notice { color: #4c5d76; background: #edf2fa; border-left: 3px solid #7898d3; padding: 12px 16px; margin-bottom: 20px; border-radius: 0 5px 5px 0; font-size: 13px; line-height: 1.6; }
.notice.warning { color: #80501a; background: #fff5e3; border-color: #c99b54; }
.error-box { background: #fff0f1; border: 1px solid #e7bcc3; color: #9c2536; padding: 12px 16px; border-radius: 5px; font-size: 13px; margin-bottom: 20px; }
.empty { padding: 44px 24px; text-align: center; }
.empty h3 { margin: 0 0 6px; font-size: 15px; }
.empty p { max-width: 400px; margin: 0 auto; color: var(--muted); font-size: 13px; }
.loading-line { padding: 22px 20px; color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 10px; }
.spin { width: 15px; height: 15px; border: 2px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Buttons */
.button { border: 1px solid #cbd3df; border-radius: 5px; min-height: 38px; padding: 8px 13px; background: #fff; color: #34425a; font-weight: 600; font-size: 13px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; white-space: nowrap; }
.button:hover { background: #f1f4f9; border-color: #9dabc1; }
.button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.button.primary:hover { background: var(--blue-ink); }
.button.attack { color: #1f6b48; border-color: #b7d9c6; }
.button.attack:hover { background: #edf7f1; }
.button.fp { color: var(--red); border-color: #e3b9bf; }
.button.fp:hover { background: #fceff1; }
.button.investigate { color: var(--blue-ink); border-color: #b8caf1; }
.button.investigate:hover { background: var(--blue-tint); }
.button.small { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.button svg { width: 15px; height: 15px; }
.text-button { color: var(--blue); background: none; border: 0; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 6px 0; }
.text-button:hover { text-decoration: underline; }

/* Tables */
.table-wrap { overflow-x: auto; position: relative; }
table { border-collapse: collapse; width: 100%; font-size: 13px; text-align: left; }
th { font-weight: 500; color: #5c6980; font-size: 12px; white-space: nowrap; background: #f8f9fb; border-block: 1px solid var(--line); padding: 11px 16px; }
td { padding: 13px 16px; border-bottom: 1px solid #edf0f4; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td small { display: block; color: var(--muted); margin-top: 4px; font-size: 12px; line-height: 1.5; }
.row-link { text-align: left; padding: 0; border: 0; background: none; color: var(--ink); font-weight: 600; font-size: 13px; line-height: 1.5; }
.row-link:hover { color: var(--blue); text-decoration: underline; }
.time-cell { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* Badges */
.badge { display: inline-flex; gap: 6px; align-items: center; padding: 3px 8px; border-radius: 4px; background: #f0f2f5; color: #526077; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-critical, .badge-failed, .badge-offline, .badge-error { background: #fcecee; color: #aa2736; }
.badge-high, .badge-pending, .badge-degraded, .badge-recovery_required, .badge-timeout { background: #fcf1de; color: #86510b; }
.badge-medium, .badge-approved, .badge-executing, .badge-planned, .badge-partial { background: var(--blue-tint); color: #315ead; }
.badge-low, .badge-healthy, .badge-dry_run, .badge-dry_run_completed, .badge-completed, .badge-verified { background: #e8f4ed; color: #246342; }
.pill { font-size: 12px; color: #536178; border: 1px solid var(--line); border-radius: 20px; padding: 1px 9px; background: #fff; }
.ip-tag { font-family: "Cascadia Code", Consolas, monospace; font-size: 12px; color: var(--blue-ink); background: #f3f6fd; border: 1px solid #d9e3f7; border-radius: 4px; padding: 3px 8px; }

/* Toast */
#toast-root { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 200; }
.toast { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 6px; padding: 12px 16px; font-size: 13px; line-height: 1.5; box-shadow: 0 6px 20px #15213a1f; max-width: 420px; }
.toast-actions { display: flex; gap: 14px; margin-left: auto; }
.toast-actions .text-button { font-size: 13px; padding: 2px 0; }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }

/* Drawer */
.drawer { position: fixed; inset: 0 0 0 auto; margin: 0; height: 100dvh; max-height: none; width: min(760px,100%); max-width: 100%; background: #fff; border: 0; border-left: 1px solid var(--line); padding: 0; color: var(--ink); box-shadow: -12px 0 40px #15213a1a; }
.drawer::backdrop { background: #16223873; }
.drawer > header { position: sticky; top: 0; background: #fff; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 24px; z-index: 1; }
.icon-button { display: grid; place-items: center; background: #fff; border: 1px solid var(--line); width: 40px; height: 40px; border-radius: 5px; color: #53627a; font-size: 22px; }
.icon-button:hover { background: #f0f3f8; }
.drawer-body { padding: 24px; overflow-y: auto; height: calc(100dvh - 74px); }
.detail-hero { display: flex; gap: 8px 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; font-size: 13px; }
.detail-hero > .muted { margin-left: auto; }
.summary { color: #4a586e; line-height: 1.7; }
dl.facts { display: grid; grid-template-columns: 140px minmax(0,1fr); margin: 16px 0; font-size: 13px; }
.facts dt, .facts dd { margin: 0; padding: 11px 0; border-bottom: 1px solid var(--line); line-height: 1.5; }
.facts dt { color: var(--muted); }
.facts dd { overflow-wrap: anywhere; }
.drawer-section { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 18px; }
pre { margin: 10px 0; background: #f4f6fa; padding: 14px; border: 1px solid var(--line); border-radius: 5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; }
details { margin-top: 8px; }
summary { cursor: pointer; color: var(--blue); font-size: 12px; padding: 5px 0; }
.card { border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; margin: 10px 0; }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; }
input, select, textarea { background: #fff; color: var(--ink); border: 1px solid #bac5d4; border-radius: 5px; padding: 9px 11px; width: 100%; min-width: 0; }
textarea { min-height: 80px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented button { min-height: 34px; border: 1px solid transparent; padding: 6px 11px; background: none; border-radius: 5px; font-size: 12px; color: #5c6980; }
.segmented button:hover { background: #f3f5f8; }
.segmented button.active { background: var(--blue-tint); color: #214fb1; border-color: #d6e1fa; font-weight: 600; }

/* Severity bars + system list */
.severity-bars { padding: 0 20px 4px; display: grid; gap: 16px; }
.severity-bars .row { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 7px; }
.severity-bars .row span { display: flex; align-items: center; gap: 8px; }
.sev-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.bar-track { height: 5px; background: #edf0f5; border-radius: 2px; overflow: hidden; }
.bar-track > span { display: block; height: 100%; }
.bg-critical { background: var(--sev-critical); } .bg-high { background: var(--sev-high); } .bg-medium { background: var(--sev-medium); } .bg-low { background: var(--sev-low); } .bg-info { background: var(--sev-info); }
dl.system-list { display: grid; grid-template-columns: 1fr auto; margin: 0 20px 14px; font-size: 12px; }
.system-list dt, .system-list dd { padding: 10px 0; margin: 0; border-bottom: 1px solid var(--line); }
.system-list dt { color: var(--muted); }
.system-list dd { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.system-list dt:last-of-type, .system-list dd:last-of-type { border: 0; }

@media (max-width: 1250px) {
  .app-shell { grid-template-columns: 206px minmax(0,1fr); }
  .content { padding: 26px; }
  .overview-layout { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 900px) {
  .breadcrumb { display: none; }
  .metrics { grid-template-columns: 1fr 1fr; padding: 0; }
  .metrics > * { padding: 16px 18px; border-bottom: 1px solid var(--line); }
  .metrics > *:nth-child(2n) { border-right: 0; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .app-shell { display: block; }
  .sidebar { position: relative; height: auto; padding: 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .workspace-label, .nav-sep { display: none; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .sidebar nav button, .sidebar nav a { flex: 1 0 auto; min-height: 44px; }
  .topbar { padding: 10px 16px; position: static; }
  .content { padding: 22px 16px; }
  .page-header { display: block; }
  .drawer-body { padding: 18px; }
  dl.facts { grid-template-columns: 1fr; }
  .facts dt { border-bottom: 0; padding-bottom: 0; }
  input, select, textarea { font-size: 16px; }
  .table-wrap table { min-width: 600px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* Shell links (sidebar items are anchors so every page shares one navigation). */
.logo { text-decoration: none; color: var(--ink); }
.sidebar nav a.active { color: var(--blue-ink); background: var(--blue-tint); font-weight: 650; }
.refresh-button svg { width: 15px; height: 15px; }
.section-link { color: var(--blue); background: none; border: 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; padding: 14px 20px; font-size: 12px; font-weight: 600; text-decoration: none; }
.section-link:hover { text-decoration: underline; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 680px) {
  .sidebar .account { display: none; }
  .sidebar footer { padding: 0; margin: 0; }
  .logout { position: absolute; right: 12px; top: 14px; width: 44px; min-height: 44px; padding: 0; font-size: 0; justify-content: center; }
  .logout svg { width: 20px; height: 20px; }
  .sidebar .logo { padding: 0 52px 12px 2px; }
}

/* Login: inset identity panel, quiet form, language in page chrome. */
.login-page { min-width: 0; background: #fafbfd; }
.login-shell { min-height: 100vh; min-height: 100svh; display: grid; grid-template-columns: minmax(0, 46fr) minmax(0, 54fr); padding: 20px; gap: 20px; }
.login-context { background: #202d42; color: #eff3fa; border-radius: 20px; padding: 40px clamp(32px, 4vw, 72px); display: flex; flex-direction: column; }
.login-context .logo { padding: 0; color: #eff3fa; }
.login-context .brand-mark { background: #345d98; border: 1px solid #527bb7; border-radius: 12px; }
.login-intro { margin: auto 0; padding: 48px 0 64px; }
.login-context h1 { max-width: 470px; font-size: 44px; line-height: 1.18; font-weight: 600; letter-spacing: -1.2px; margin-bottom: 24px; text-wrap: balance; }
.login-context p { max-width: 400px; color: #bdcbe0; font-size: 16px; line-height: 1.8; margin: 0; }
.login-signal { max-width: 440px; margin: 0 0 44px; }
.login-signal svg { display: block; width: 100%; }
.signal-line { stroke: #5d789e; stroke-width: 1.3; }
.signal-orbit { stroke: #3e526d; stroke-width: 1; }
.signal-node { fill: #92b5e4; stroke: #202d42; stroke-width: 3; }
.signal-core { fill: #345d98; stroke: #6d96cc; stroke-width: 1; }
.login-form-area { position: relative; display: grid; place-items: center; padding: 96px 40px; }
.login-language { position: absolute; right: 24px; top: 16px; display: flex; align-items: center; gap: 4px; color: var(--muted); }
.login-language svg { width: 16px; height: 16px; }
.login-language select { width: 58px; min-height: 36px; padding: 6px 4px; margin: 0; border: 0; background: transparent; color: var(--ink); font-size: 12px; cursor: pointer; }
.login-card { display: grid; gap: 24px; width: 100%; max-width: 380px; }
.login-card h2 { font-size: 30px; letter-spacing: -.8px; font-weight: 600; line-height: 1.3; }
.login-card .muted { margin: -12px 0 12px; font-size: 14px; line-height: 1.6; }
.login-card form { display: grid; gap: 24px; }
.login-card form label { font-size: 14px; font-weight: 550; }
.login-card form input:not([type="hidden"]) { min-height: 50px; margin-top: 10px; padding: 12px 14px; font-size: 16px; font-weight: 400; border: 1px solid #c4cddd; border-radius: 8px; background: #fff; box-shadow: none; }
.login-card form input:focus { border-color: var(--blue); }
.login-card .error-box { margin: 0; }
.login-card .button { min-height: 50px; width: 100%; font-size: 15px; margin-top: 8px; border-radius: 8px; box-shadow: none; }
@media (max-width: 1000px) {
  .login-context { padding: 32px; }
  .login-context h1 { font-size: 36px; }
  .login-form-area { padding-inline: 24px; }
}
@media (max-width: 680px) {
  .login-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; padding: 0; gap: 0; }
  .login-context { padding: 24px; background: transparent; color: var(--ink); border-radius: 0; }
  .login-context .logo { color: var(--ink); }
  .login-context .brand-mark { width: 34px; height: 36px; }
  .login-intro { display: none; }
  .login-form-area { position: static; padding: 56px 28px 64px; align-items: start; }
  .login-card { max-width: 400px; }
  .login-card h2 { font-size: 28px; }
  .login-language { right: 22px; top: 20px; }
  .login-language select { min-height: 44px; }
}

/* Account page */
.account-layout { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 22px; align-items: start; }
.account-stack { display: grid; gap: 20px; min-width: 0; }
.memory-reset-summary { padding: 16px 20px; }
dl.role-list { grid-template-columns: 110px minmax(0,1fr); margin: 0; }
@media (max-width: 1100px) { .account-layout { grid-template-columns: minmax(0,1fr); } }

/* Review page */
.metrics.three { grid-template-columns: repeat(3,1fr); }
.review-section { margin-bottom: 20px; }
.card textarea { margin-top: 10px; }
.card h4 { margin: 14px 0 0; font-size: 13px; }
.recovery-action { border-top: 1px solid var(--line); margin-top: 10px; }
.recovery-action p { margin: 10px 0 0; font-size: 13px; }
@media (max-width: 900px) { .metrics.three { grid-template-columns: 1fr; } .metrics.three > * { border-right: 0; } }
@media (max-width: 900px) { .topbar.bare { display: none; } }

.rag-group { font-size: 12px; color: var(--muted); margin: 14px 0 4px; text-transform: none; }
.rag-group:first-child { margin-top: 4px; }

/* Donut: part-to-whole of severities; legend rows carry the numbers and are buttons. */
.donut-wrap { display: grid; justify-items: center; gap: 14px; padding: 0 16px 4px; }
.donut { position: relative; width: 168px; height: 168px; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-track { fill: none; stroke: #edf0f5; stroke-width: 14; }
.donut-seg { fill: none; stroke-width: 14; cursor: pointer; transition: opacity 120ms, stroke-width 120ms; }
.donut-seg:hover { stroke-width: 17; }
.donut-seg.dim, .legend-row.dim { opacity: .35; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; pointer-events: none; }
.donut-center strong { font-size: 34px; font-weight: 650; line-height: 1.1; letter-spacing: -1px; }
.donut-center small { max-width: 112px; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.donut-legend { width: 100%; display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.legend-row { width: 100%; display: grid; grid-template-columns: 10px minmax(0,1fr) auto 38px; align-items: center; gap: 10px; padding: 7px 8px; border: 0; border-radius: 6px; background: none; color: var(--ink); font-size: 13px; text-align: left; transition: opacity 120ms; }
.legend-row:hover, .legend-row:focus-visible { background: #f2f5fa; }
.legend-row i { width: 10px; height: 10px; border-radius: 3px; }
.legend-row strong, .legend-row small { font-variant-numeric: tabular-nums; }
.legend-row small { color: var(--muted); text-align: right; font-size: 12px; }
.legend-row.zero { color: #8b97a8; }
.legend-row.zero i { opacity: .4; }
.spin.small { display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -2px; }

/* System: "needs attention" first, technical detail on demand. */
.all-good { margin: 0 20px 18px; padding: 12px 14px; border-radius: 6px; background: #eef7f1; color: #21603f; font-size: 13px; }
.meter { max-width: 220px; height: 5px; margin-top: 8px; overflow: hidden; border-radius: 3px; background: #e4ebf8; }
.meter > span { display: block; height: 100%; background: var(--blue); }
.meter.warn { background: #f7ead3; }
.meter.warn > span { background: var(--sev-high); }
details.tech-details { margin-top: 20px; }
.tech-details > summary { display: grid; gap: 3px; padding: 16px 20px; color: var(--ink); font-size: 14px; font-weight: 650; list-style: none; }
.tech-details > summary::-webkit-details-marker { display: none; }
.tech-details > summary span::after { content: " ▾"; color: var(--blue); }
.tech-details[open] > summary span::after { content: " ▴"; }
.tech-details > summary small { color: var(--muted); font-size: 12px; font-weight: 400; }
.tech-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 4px 28px; padding: 0 20px 20px; border-top: 1px solid var(--line); }
.tech-grid h3 { margin: 16px 0 6px; font-size: 13px; }
.tech-grid section:first-child, .tech-grid .wide { grid-column: 1 / -1; }
.tech-grid dl.system-list { margin: 0; }
.tech-grid .panel-note { margin: 0; }

/* Simulation summary */
.sim-headline { margin: 4px 0 14px; font-size: 15px; font-weight: 600; }
.mini-metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); margin-bottom: 16px; border: 1px solid var(--line); border-radius: 6px; }
.mini-metrics > div { display: grid; gap: 2px; padding: 12px 14px; border-right: 1px solid var(--line); }
.mini-metrics > div:last-child { border-right: 0; }
.mini-metrics strong { font-size: 22px; font-weight: 600; }
.mini-metrics span { color: var(--muted); font-size: 12px; }
details.sim-more { margin-top: 16px; }
details.risk-more { margin: 0 20px 14px; }
details.risk-more .system-list { margin: 8px 0 12px; }
.section-link.standalone { border: 1px solid var(--line); border-radius: 8px; background: #fff; }

@media (max-width: 900px) { .tech-grid { grid-template-columns: minmax(0,1fr); } }
@media (max-width: 680px) {
  .mini-metrics { grid-template-columns: 1fr 1fr; }
  .mini-metrics > div:nth-child(2n) { border-right: 0; }
  .mini-metrics > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  #toast-root { left: 12px; right: 12px; }
  .toast { max-width: none; }
}

/* Tabs (drawer and page level) */
.tabs { display: flex; gap: 2px; margin: 0 0 18px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs [role="tab"] { margin-bottom: -1px; padding: 10px 12px; border: 0; border-bottom: 2px solid transparent; background: none; color: #5c6980; font-size: 13px; white-space: nowrap; }
.tabs [role="tab"]:hover { color: var(--ink); }
.tabs [role="tab"][aria-selected="true"] { color: var(--blue-ink); border-bottom-color: var(--blue); font-weight: 650; }
.page-tabs { margin-bottom: 20px; }
.page-tabs [role="tab"] { padding: 11px 14px; font-size: 14px; }
.tabs em { margin-left: 6px; padding: 1px 7px; border-radius: 4px; background: #ede3cc; color: #613e10; font-size: 12px; font-style: normal; font-weight: 600; }
.tabs em.zero { background: #eef1f5; color: var(--muted); }

/* ── Elevation (01/10): white surfaces lift slightly off a cooler workspace ── */
:root {
  background: #eef1f6; --bg: #eef1f6; --line: #e2e7ef;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .05), 0 2px 6px rgba(16, 24, 40, .05);
  --shadow-2: 0 2px 6px rgba(16, 24, 40, .06), 0 12px 28px rgba(16, 24, 40, .09);
}
.panel, .metrics { border-radius: 12px; box-shadow: var(--shadow-1); }
.sidebar { border-right: 0; box-shadow: 1px 0 0 var(--line), 6px 0 20px rgba(16, 24, 40, .04); z-index: 25; }
.topbar { border-bottom: 0; box-shadow: 0 1px 0 var(--line), 0 6px 16px rgba(16, 24, 40, .04); background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); }
.button { box-shadow: 0 1px 2px rgba(16, 24, 40, .06); }
.button.primary { box-shadow: 0 1px 2px rgba(36, 88, 206, .25), 0 3px 8px rgba(36, 88, 206, .18); }
.button:disabled { box-shadow: none; }
.sidebar nav a.active { box-shadow: inset 3px 0 0 var(--blue); }

/* ── Collapsible sidebar ── */
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.sidebar-menu { display: flex; flex-direction: column; flex: 1; min-height: 0; padding-top: 20px; }
.sidebar nav a { min-height: 44px; }
.sidebar-toggle { display: grid; place-items: center; flex-shrink: 0; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #536178; box-shadow: var(--shadow-1); }
.sidebar-toggle:hover { background: #f2f5fa; color: var(--ink); }
.sidebar-toggle svg { width: 20px; height: 20px; }
.sidebar-toggle { display: none; }
.collapse-btn { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 40px; margin-top: auto; padding: 9px 12px; border: 0; border-radius: 6px; background: none; color: #536178; font-size: 13px; text-align: left; }
.collapse-btn:hover { background: #f2f5fa; color: var(--ink); }
.collapse-btn svg { width: 20px; height: 20px; transition: transform 160ms; }
.sidebar-menu > footer { margin-top: 0; }
.app-shell { transition: grid-template-columns 160ms ease; }
@media (min-width: 681px) {
  .nav-collapsed .app-shell { grid-template-columns: 76px minmax(0,1fr); }
  .nav-collapsed .sidebar { padding: 20px 12px 14px; }
  .nav-collapsed .logo { padding: 0; }
  .nav-collapsed .logo > div, .nav-collapsed .workspace-label, .nav-collapsed .account > div { display: none; }
  .nav-collapsed .collapse-btn svg { transform: scaleX(-1); }
  .nav-collapsed .collapse-btn { justify-content: center; padding: 9px 0; }
  .nav-collapsed .sidebar-menu { margin-top: 0; }
  .nav-collapsed .sidebar nav a { position: relative; justify-content: center; padding: 10px 0; }
  .nav-collapsed .sidebar nav a > span, .nav-collapsed .logout > span, .nav-collapsed .collapse-btn > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
  .nav-collapsed .sidebar nav em { position: absolute; top: 3px; right: 4px; margin: 0; min-width: 16px; padding: 0 4px; font-size: 10px; line-height: 16px; text-align: center; }
  .nav-collapsed .nav-sep { height: 1px; margin: 12px 6px; overflow: hidden; font-size: 0; background: var(--line); }
  .nav-collapsed .account { justify-content: center; padding: 12px 0 6px; }
  .nav-collapsed .logout { justify-content: center; padding: 10px 0; }
}
@media (max-width: 680px) {
  .sidebar-toggle { display: grid; width: 44px; height: 44px; }
  .collapse-btn { display: none; }
  .sidebar .logo { padding: 0; }
  .sidebar-menu { display: none; margin-top: 12px; }
  .nav-open .sidebar-menu { display: flex; }
  .sidebar footer { padding-top: 8px; }
  .logout { position: static; width: auto; min-height: 44px; padding: 10px 6px; font-size: 13px; justify-content: flex-start; }
}

/* ── Overview (TIARC-style layout): numbers · queue · distribution · activity ── */
.ov-header { align-items: flex-end; }
.ov-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.segmented.compact { gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow-1); }
.segmented.compact button { min-height: 30px; padding: 4px 12px; }
.status-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font-size: 13px; box-shadow: var(--shadow-1); }
.status-chip:hover { border-color: #9dabc1; }
.status-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-chip.ok i { background: var(--green); }
.status-chip.warn { color: #80501a; } .status-chip.warn i { background: var(--sev-high); }
.status-chip.down { color: var(--red); } .status-chip.down i { background: var(--red); }

.ov-grid { display: grid; grid-template-columns: minmax(0,1fr) 400px; grid-template-areas: "stats queue" "dist queue" "act queue"; grid-template-rows: auto auto 1fr; gap: 20px; align-items: start; }
.stat-panel { grid-area: stats; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); padding: 22px 0; }
.queue-panel { grid-area: queue; align-self: stretch; display: flex; flex-direction: column; }
.dist-panel { grid-area: dist; }
.activity-panel { grid-area: act; align-self: stretch; display: flex; flex-direction: column; }
#ov-activity { flex: 1; display: flex; flex-direction: column; }
.stat { display: grid; align-content: start; gap: 6px; padding: 0 24px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat > span { color: #546075; font-size: 13px; }
.stat strong { font-size: 34px; font-weight: 650; line-height: 1.1; letter-spacing: -1px; }
.stat.hero strong { font-size: 44px; }
.stat strong .unit { margin-left: 6px; color: var(--muted); font-size: 15px; font-weight: 500; letter-spacing: 0; }
.stat small { color: var(--muted); font-size: 12px; }
.stat .risk-number { color: var(--red); }

.queue-tabs { display: flex; gap: 4px; padding: 0 16px 12px; border-bottom: 1px solid var(--line); }
.queue-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border: 0; border-radius: 6px; background: none; color: #5c6980; font-size: 13px; }
.queue-tabs button:hover { background: #f2f5fa; }
.queue-tabs button.active { background: var(--blue-tint); color: var(--blue-ink); font-weight: 600; }
.queue-tabs em { padding: 0 6px; border-radius: 10px; background: #eef1f5; color: #526077; font-size: 11px; font-style: normal; font-weight: 600; line-height: 18px; }
.queue-tabs button.active em { background: #fff; color: var(--blue-ink); }
.queue-list { flex: 1; display: grid; align-content: start; gap: 10px; padding: 14px 16px; }
.q-item { display: grid; gap: 6px; width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--sev-info); border-radius: 10px; background: #fff; color: var(--ink); text-align: left; box-shadow: var(--shadow-1); transition: box-shadow 140ms, transform 140ms; }
.q-item:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.q-item.sev-critical { border-left-color: var(--sev-critical); } .q-item.sev-high { border-left-color: var(--sev-high); }
.q-item.sev-medium { border-left-color: var(--sev-medium); } .q-item.sev-low { border-left-color: var(--sev-low); }
.q-item.leaving { display: none; }
.q-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tag { padding: 2px 7px; border-radius: 4px; background: #f0f2f6; color: #4a586e; font-size: 11px; font-weight: 600; }
.tag:empty { display: none; }
.tag.warn { background: #fff5e3; color: #80501a; }
.q-title { font-size: 14px; font-weight: 650; line-height: 1.4; }
.q-ai { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: #4a586e; font-size: 12.5px; line-height: 1.5; }
.q-ai b { margin-right: 4px; padding: 0 5px; border-radius: 3px; background: var(--blue-tint); color: var(--blue-ink); font-size: 10.5px; }
.q-meta { color: var(--muted); font-size: 12px; }
.queue-panel .section-link { margin-top: auto; }

.legend-inline { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 0; padding: 0 20px 4px; list-style: none; }
.legend-chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font-size: 12px; transition: opacity 120ms; }
.legend-chip:hover { border-color: #9dabc1; }
.legend-chip i { width: 8px; height: 8px; border-radius: 2px; }
.legend-chip strong { font-variant-numeric: tabular-nums; }
.legend-chip.zero { color: #8b97a8; } .legend-chip.zero i { opacity: .4; }
.legend-chip.dim { opacity: .35; }
.dist-body { display: grid; grid-template-columns: 190px minmax(0,1fr); align-items: center; gap: 28px; padding: 16px 24px 22px; }
.dist-body .donut-wrap { padding: 0; }
.top-sources h3 { margin: 0 0 8px; font-size: 14px; }
.src-row { display: grid; gap: 7px; width: 100%; padding: 8px; border: 0; border-radius: 8px; background: none; color: var(--ink); text-align: left; }
.src-row:hover { background: #f5f7fb; }
.src-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; }
.stack { display: flex; gap: 2px; height: 8px; min-width: 24px; }
.stack i { display: block; height: 100%; }
.stack i:first-child { border-radius: 4px 0 0 4px; } .stack i:last-child { border-radius: 0 4px 4px 0; } .stack i:only-child { border-radius: 4px; }
.src-more { margin: 4px 8px 0; font-size: 12px; }

.activity-panel .panel-heading { align-items: flex-start; }
.activity-total { text-align: right; }
.activity-total strong { display: block; font-size: 24px; font-weight: 650; line-height: 1.1; }
.activity-total small { color: var(--muted); font-size: 12px; }
.act-chart { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 190px; margin: 6px 20px 18px; padding-left: 30px; }
.act-grid { position: absolute; left: 30px; right: 0; top: 0; bottom: 24px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.act-grid span { position: relative; height: 0; border-top: 1px solid #edf0f5; }
.act-grid span:last-child { border-top-color: #d5dbe5; }
.act-grid span::before { content: attr(data-v); position: absolute; right: calc(100% + 6px); top: -8px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.act-bars { position: relative; flex: 1; min-height: 150px; display: flex; align-items: flex-end; gap: 2px; }
.act-col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.act-col i { display: block; width: 100%; max-width: 24px; border-radius: 4px 4px 0 0; background: #9db3e4; }
.act-col.now i { background: var(--blue); }
.act-col:hover i { background: var(--blue-ink); }
.act-axis { display: flex; gap: 2px; height: 18px; margin-top: 6px; }
.act-axis span { flex: 1; color: var(--muted); font-size: 11px; text-align: center; white-space: nowrap; }
.act-tip { position: absolute; top: -4px; transform: translate(-50%, -100%); padding: 5px 9px; border-radius: 6px; background: #1f2a3d; color: #fff; font-size: 12px; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow-2); }

@media (max-width: 1180px) {
  .ov-grid { grid-template-columns: minmax(0,1fr); grid-template-areas: "stats" "queue" "dist" "act"; grid-template-rows: auto; }
}
@media (max-width: 680px) {
  .stat-panel { grid-template-columns: 1fr; padding: 0; }
  .stat { padding: 14px 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .stat:last-child { border-bottom: 0; }
  .stat.hero strong { font-size: 38px; }
  .dist-body { grid-template-columns: 1fr; justify-items: center; padding: 14px 16px 18px; }
  .top-sources { width: 100%; }
  .legend-inline { padding: 0 16px 4px; }
  .act-chart { margin: 6px 12px 16px; }
  .act-axis span { font-size: 10px; }
}

/* ── ⓘ hints (01/10): explanations on demand instead of paragraphs under every heading ── */
.hint { position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 6px; padding: 0; border: 1px solid #c9d2df; border-radius: 50%; background: #fff; color: var(--muted); font: 700 11px/1 "Segoe UI", Arial, sans-serif; letter-spacing: 0; vertical-align: 3px; cursor: help; }
h1 .hint { vertical-align: 7px; }
.hint:hover, .hint:focus-visible { border-color: #9fb8ee; color: var(--blue); }
.hint::after { content: attr(data-tip); display: none; position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%); z-index: 60; width: max-content; max-width: 240px; padding: 8px 10px; border-radius: 6px; background: #1f2a3d; color: #fff; font-size: 12px; font-weight: 400; line-height: 1.5; text-align: left; white-space: normal; box-shadow: var(--shadow-2); }
.hint:hover::after, .hint:focus::after { display: block; }
.stat-panel, .dist-panel, .queue-panel, .activity-panel { overflow: visible; }
.inc-ai > p:first-child { -webkit-line-clamp: 1; }
@media (max-width: 680px) {
  /* On phones the explanation slides up as a bar at the bottom of the screen. */
  .hint::after { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; transform: none; max-width: none; width: auto; font-size: 13px; }
  .hint { width: 22px; height: 22px; }
}

/* DASHBOARD_PROFILE: help text that only applies to one profile (guide.html, notes). */
html[data-profile="demo"] [data-full-only] { display: none !important; }
html:not([data-profile="demo"]) [data-demo-only] { display: none !important; }
/* Demo menu has no "Tài khoản" item; the account block in the sidebar footer links there instead. */
a.account { color: inherit; text-decoration: none; border-radius: 6px; }
a.account:hover { background: #f2f5fa; }
a.account[aria-current="page"] { color: var(--blue-ink); }
@media (max-width: 680px) {
  html[data-profile="demo"] .sidebar a.account { display: flex; border-top: 0; padding: 10px 6px 0; }
}
/* System chip on Tổng quan is informational only when the Hệ thống view is hidden. */
.status-chip:disabled { cursor: default; opacity: 1; }
.status-chip:disabled:hover { border-color: var(--line); }
/* The language choice is global chrome, beside refresh rather than inside a workflow. */
.language-picker { display: inline-flex; align-items: center; gap: 8px; margin: 0; white-space: nowrap; font-size: 12px; color: var(--muted, #627086); }
.language-picker select { width: auto; min-width: 112px; min-height: 38px; padding: 7px 28px 7px 10px; margin: 0; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; color: #24334b; font: inherit; cursor: pointer; }
.language-picker select:focus-visible { outline: 2px solid #3569db; outline-offset: 2px; }
.topbar.bare { display: flex; }
@media (max-width: 700px) {
  .sync-controls { width: 100%; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
  .sync-controls .sync { display: none; }
  .language-picker select { min-height: 44px; }
  .topbar { flex-wrap: wrap; height: auto; min-height: 72px; gap: 8px; }
  .language-picker > span { font-size: 11px; }
  .topbar.bare { display: flex; }
}
/* Human review inbox */
.notice-menu { position: relative; }
.notice-toggle { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink); }
.notice-toggle svg { width: 20px; height: 20px; }
.notice-toggle > span { position: absolute; top: -5px; right: -5px; padding: 1px 5px; border-radius: 9px; background: #b63846; color: white; font-size: 10px; }
.notice-toggle > span[hidden] { display: none; }
.notice-panel { position: absolute; right: 0; top: 50px; width: 380px; max-width: calc(100vw - 32px); max-height: 75dvh; overflow-y: auto; background: white; border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: 0 12px 40px #1c2b4926; }
.notice-panel[hidden] { display: none; }
.notice-panel header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.notice-panel h2 { font-size: 14px; }
.notice-panel .text-button { font-size: 12px; }
#notice-status { margin: 8px 0 16px; font-size: 11px; }
.notice-item { display: grid; justify-items: start; gap: 7px; padding: 14px 10px; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); border-radius: 6px; }
.notice-item.unread { background: #f4f7fe; }
.notice-item:hover { background: #edf2fc; }
.notice-item strong { font-size: 14px; }
.notice-item small { color: var(--muted); overflow-wrap: anywhere; }
.notice-item > span:last-child { font-size: 12px; color: var(--blue); }
.notice-empty { font-size: 13px; padding: 20px 0; color: var(--muted); }
/* Account workspace refinement: quiet navigation and clear operational controls. */
.sidebar-settings { margin-top: auto; padding: 24px 10px 16px; }
.language-switch { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.language-options { display: flex; padding: 3px; gap: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.language-options button { min-width: 44px; min-height: 38px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; }
.language-options button:hover { color: var(--blue-ink); background: var(--blue-tint); }
.language-options button[aria-pressed="true"] { background: #fff; color: var(--blue-ink); box-shadow: 0 1px 4px #15213a14; }
@media (min-width: 681px) {
  .nav-collapsed .language-switch { justify-content: center; }
  .nav-collapsed .language-switch > svg { display: none; }
  .nav-collapsed .language-options { flex-direction: column; }
  .nav-collapsed .language-options button { min-width: 38px; }
}
@media (max-width: 680px) { .language-options button { min-height: 44px; } }
.sidebar-settings .language-picker { display: flex; flex-direction: column; align-items: stretch; gap: 6px; width: 100%; }
.sidebar-settings .language-picker select { width: 100%; min-height: 40px; }
.sidebar-settings + .collapse-btn { margin-top: 0; }
.nav-collapsed .sidebar-settings { padding: 12px 0; }
.nav-collapsed .sidebar-settings .language-picker > span { display: none; }
.nav-collapsed .sidebar-settings select { width: 52px; min-width: 0; padding: 6px 2px; }
.date-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; padding: 0; }
.date-filters #inc-sort { min-width: 190px; }
.date-filters #inc-period { min-width: 150px; }
.date-filters .search { margin-left: auto; width: 280px; max-width: 100%; }
.date-filters .search input { width: 100%; height: 40px; min-height: 40px; }
[data-page="incidents"] .filter-row { margin-bottom: 20px; }
[data-page="incidents"] .filter-scope { margin: 12px 0 24px; }
.target-context { margin-bottom: 16px; color: var(--muted); font-size: 12px; }
.target-context summary { cursor: pointer; padding: 10px 0; }
.target-context small { display: block; padding: 4px 0 8px; overflow-wrap: anywhere; }
@media (min-width: 900px) { .nav-collapsed .target-context { display: none; } }
.date-filters label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.date-filters label[hidden] { display: none; }
.date-filters input, .date-filters select { min-height: 40px; border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; background: #fff; color: var(--ink); font: inherit; font-size: 13px; }
.filter-scope { font-size: 12px; margin: 10px 0 20px; }
.severity-help { display: inline-flex; border-radius: 5px; }
.as-action-head span { font-size: 12px; color: var(--muted); }
@media (max-width: 680px) {
  .sidebar-head { padding-bottom: 0; border-bottom: 0; }
  .sidebar-menu { padding-top: 16px; border-top: 1px solid var(--line); }
  .date-filters .search { flex-basis: 100%; width: 100%; margin-left: 0; }
  .nav-open .sidebar-menu { max-height: calc(100dvh - 90px); overflow-y: auto; }
  .sidebar nav { display: flex; flex-direction: column; width: 100%; gap: 4px; }
  .sidebar nav a { width: 100%; min-height: 44px; padding: 12px; }
  .sidebar-settings { padding: 16px 10px; border-top: 1px solid var(--line); margin-top: 12px; }
  .sidebar-settings .language-picker > span { display: inline; }
  .sidebar-settings .language-picker { flex-direction: row; align-items: center; justify-content: space-between; }
  .sidebar-settings .language-picker select { width: auto; min-height: 44px; padding: 8px 12px; }
  .date-filters label { flex: 1 1 140px; min-width: 0; }
  .date-filters input, .date-filters select { width: 100%; min-width: 0; }
  .sync-controls { width: auto; margin-left: auto; }
  .topbar { flex-wrap: nowrap; min-height: 60px; }
}
