/* TarikLot dashboard — tema terang. Token warna diwarisi dari versi sebelumnya. */
:root {
  --ink: #17253d;
  --ink-soft: #243a5a;
  --text: #263746;
  --paper: #f7f7f7;
  --white: #ffffff;
  --surface: #f4f8fc;
  --border: #c5d7e7;
  --signal: #d13438;
  --signal-deep: #a4262c;
  --authority: #0078d4;
  --authority-deep: #004275;
  --evidence: #ffca28;
  --warning: #fff8e8;
  --warning-ink: #8a5a00;
  --resolved: #107c41;
  --success: #edf7f0;
  --success-ink: #155d35;
  --muted: #5f6b7a;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-data: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-ui); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--authority); }
a:hover { color: var(--authority-deep); }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
dl { margin: 0; }
button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.mono { font-family: var(--font-data); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; padding: 8px 12px; background: var(--ink); color: var(--white); border-radius: 6px; }
.skip-link:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--authority); outline-offset: 2px; }

/* ---------- Shell ---------- */
.workspace { max-width: 1440px; margin: 0 auto; }
.sidebar { display: flex; flex-direction: column; gap: 18px; min-width: 0; padding: 18px 16px; border-right: 1px solid var(--border); background: var(--white); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--authority-deep); color: var(--white); font-weight: 800; font-size: 13px; }
.brand-copy { display: flex; flex-direction: column; }
.brand-copy strong { font-size: 16px; font-weight: 800; }
.brand-copy small { font-size: 11px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border: 1px solid transparent; border-radius: 8px; color: var(--text); font-size: 14px; font-weight: 500; text-decoration: none; }
.nav-item svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { background: var(--surface); color: var(--ink); }
.nav-item[aria-current="page"] { border-color: var(--border); background: var(--surface); color: var(--authority-deep); font-weight: 700; }
.sidebar-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 6px; }
.cases { display: flex; flex-direction: column; gap: 8px; }
.recall-select { width: 100%; max-width: 100%; min-width: 0; min-height: 40px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--white); color: var(--ink); font: inherit; font-size: 13px; }
.case-list { display: flex; flex-direction: column; gap: 6px; }
.case-item { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--white); color: inherit; text-align: left; font: inherit; }
.case-item[aria-pressed="true"] { border-color: var(--authority); box-shadow: inset 3px 0 0 var(--authority); }
.case-item:hover { background: var(--surface); }
.case-item-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.case-item-row strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case-item small { font-family: var(--font-data); font-size: 11px; color: var(--muted); }
.pill { font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 2px 6px; border-radius: 4px; white-space: nowrap; background: var(--surface); color: var(--muted); }
.pill[data-tone="ok"] { background: var(--success); color: var(--success-ink); }
.pill[data-tone="held"] { background: var(--warning); color: var(--warning-ink); }
.pill[data-tone="run"] { background: var(--surface); color: var(--authority-deep); }
.pill[data-tone="conflict"] { background: var(--warning); color: var(--signal); }
.pill[data-tone="clear"] { background: var(--paper); color: var(--muted); }
.sidebar-details { border-top: 1px solid var(--border); padding-top: 8px; font-size: 13px; color: var(--text); }
.sidebar-details summary { min-height: 36px; display: flex; align-items: center; padding: 0 6px; font-weight: 600; cursor: pointer; }
.sidebar-details p { display: flex; justify-content: space-between; gap: 8px; padding: 4px 6px; }
.sidebar-details p span { color: var(--muted); }
.sidebar-details > p:has(strong) { display: block; }
.sidebar-details a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 6px; font-size: 13px; }
.terms div { padding: 4px 6px; }
.terms dt { font-weight: 700; }
.terms dd { margin: 0; color: var(--muted); font-size: 12px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }

/* ---------- Workspace ---------- */
.workspace { display: flex; flex-direction: column; gap: 16px; padding: 18px 24px 24px; min-width: 0; }
.topbar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 20px; }
.topbar .brand { padding-top: 2px; }
.topbar-copy { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { display: inline-flex; gap: 4px; align-items: center; font-family: var(--font-data); font-size: 10px; font-weight: 700; letter-spacing: .08em; padding: 3px 7px; border: 1px solid var(--border); border-radius: 4px; }
.tag-real { background: var(--surface); color: var(--authority-deep); }
.tag-sim { background: var(--warning); color: var(--warning-ink); }
.tag-policy { background: var(--white); color: var(--muted); font-family: var(--font-ui); letter-spacing: 0; font-weight: 600; }
.tag-policy[data-active="true"] { background: var(--success); color: var(--success-ink); border-color: var(--success-ink); }
.topbar h1 { font-size: 22px; font-weight: 800; letter-spacing: -.015em; line-height: 1.25; }
.topbar-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.topbar-reason { font-size: 13px; color: var(--text); }
.topbar-reason > span:first-child { color: var(--muted); }
.topbar-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }
.monitor { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 20px; background: var(--white); }
.monitor-copy { display: flex; flex-direction: column; line-height: 1.2; }
.monitor-copy strong { font-size: 12px; }
.monitor-copy small { font-size: 11px; color: var(--muted); }
.monitor-beacon, .state-beacon { width: 9px; height: 9px; border-radius: 50%; background: var(--resolved); box-shadow: 0 0 0 3px rgba(16, 124, 65, .14); }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--success); color: var(--success-ink); font-size: 12px; font-weight: 800; }

/* ---------- Buttons ---------- */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border: 1px solid var(--authority-deep); border-radius: 8px; background: var(--white); color: var(--authority-deep); font-size: 14px; font-weight: 700; line-height: 1.1; transition: background 120ms, opacity 120ms; }
.button:hover { background: var(--surface); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button-primary { background: var(--authority-deep); color: var(--white); }
.button-primary:hover { background: #003357; }
.button-approve { background: var(--success-ink); border-color: var(--success-ink); color: var(--white); }
.button-approve:hover { background: #0f4a2a; }
.button-quiet { border-color: var(--border); color: var(--text); }
.button-outline { background: var(--white); }
.text-action { border-color: transparent; background: transparent; color: var(--signal); }
.text-action:hover { background: #fbeaea; }
.button-wide { width: 100%; }
.decision-actions { display: flex; flex-direction: column; gap: 8px; }
.decision-actions-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

/* ---------- KPI ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kpi { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); }
.kpi > span { font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--muted); }
.kpi strong { font-family: var(--font-data); font-size: 30px; font-weight: 700; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi small { font-size: 12px; color: var(--muted); }
.kpi-total { background: var(--success); }
.kpi-total strong, .kpi-total > span, .kpi-total small { color: var(--success-ink); }
.kpi-unresolved { background: var(--warning); }
.kpi-unresolved strong, .kpi-unresolved > span, .kpi-unresolved small { color: var(--warning-ink); }

/* ---------- Cards ---------- */
.card { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head h2 { font-size: 14px; font-weight: 800; }
.card-meta { font-size: 12px; color: var(--muted); }
.kicker { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.board { display: grid; grid-template-columns: 320px minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
.board-main, .board-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.workspace-log { max-height: 560px; }
.workspace-log .audit-list { overflow-y: auto; min-height: 0; padding-right: 4px; }

/* ---------- Loop agen ---------- */
.agent-loop { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.agent-loop li { min-width: 0; border: 1px solid var(--border); border-top: 3px solid var(--border); border-radius: 6px; background: var(--white); color: var(--muted); }
.agent-loop li a { display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 10px; align-items: center; min-height: 60px; padding: 8px 12px; color: inherit; text-decoration: none; }
.agent-loop .stage-index { grid-row: 1 / span 2; display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid #9fa8bb; border-radius: 50%; background: var(--white); font: 700 12px var(--font-data); }
.agent-loop li strong { font-size: 13px; line-height: 1.3; color: var(--ink); overflow-wrap: anywhere; }
.agent-loop li small { font: 700 10px var(--font-ui); letter-spacing: .06em; text-transform: uppercase; }
.agent-loop li[data-status="running"] { border-top-color: var(--authority); background: var(--surface); }
.agent-loop li[data-status="running"] .stage-index { border-color: var(--authority); background: var(--authority); color: var(--white); animation: agent-loop-pulse 1.2s ease-in-out infinite; }
.agent-loop li[data-status="running"] small { color: var(--authority-deep); }
.agent-loop li[data-status="done"] { border-top-color: var(--success-ink); }
.agent-loop li[data-status="done"] .stage-index { border-color: var(--success-ink); background: var(--success-ink); color: var(--white); }
.agent-loop li[data-status="done"] small { color: var(--success-ink); }
.agent-loop li[data-status="held"] { border-top-color: var(--signal); background: var(--warning); }
.agent-loop li[data-status="held"] .stage-index { border-color: var(--signal); background: var(--signal); color: var(--white); }
.agent-loop li[data-status="held"] small { color: var(--signal); }
.agent-loop li[data-status="skipped"] { border-style: dashed; }
@keyframes agent-loop-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(0, 120, 212, .35); } 50% { box-shadow: 0 0 0 6px rgba(0, 120, 212, 0); } }
.agent-state { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.agent-state[data-state="analyzing"] .state-beacon { background: var(--authority); box-shadow: 0 0 0 3px rgba(0, 120, 212, .16); animation: beacon-pulse 1.1s ease-in-out infinite; }
.agent-state[data-state="awaiting"] .state-beacon { background: var(--evidence); box-shadow: 0 0 0 3px rgba(255, 202, 40, .25); }
.agent-state[data-state="ready"] .state-beacon, .agent-state[data-state="approved"] .state-beacon { background: var(--resolved); }
.agent-state[data-state="rejected"] .state-beacon { background: var(--signal); }
.agent-state[data-state="idle"] .state-beacon { background: var(--muted); box-shadow: none; }
@keyframes beacon-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.35); } }

/* ---------- Panel keputusan agen ---------- */
.agent-decision { border-left: 5px solid var(--authority); gap: 8px; }
.agent-decision[data-mode="held"] { border-left-color: var(--signal); background: var(--warning); }
.agent-decision[data-mode="handoff"] { border-left-color: var(--success-ink); background: var(--success); }
.agent-decision[data-mode="human"] { border-left-color: var(--ink); }
.agent-decision-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.agent-decision-step { font: 700 11px var(--font-data); color: var(--muted); }
.agent-decision h3 { font-size: 17px; font-weight: 800; line-height: 1.3; }
.agent-decision dl { display: grid; gap: 0; }
.agent-decision dl div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; padding: 6px 0; border-top: 1px dashed var(--border); }
.agent-decision dt { font-size: 12px; color: var(--muted); }
.agent-decision dd { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text); overflow-wrap: anywhere; }
.agent-decision-boundary { padding-top: 8px; border-top: 1px solid var(--border); font: 700 11px / 1.5 var(--font-ui); color: var(--muted); }

/* ---------- Panduan, bukti, APJ ---------- */
.guidance h3 { font-size: 18px; line-height: 1.3; }
.guidance p { font-size: 15px; line-height: 1.55; color: var(--text); }
#guidance-next { font-weight: 600; color: var(--ink); }
.evidence-question { background: var(--warning); gap: 10px; }
.evidence-question h3, .evidence-receipt h3, .apj-card h3 { font-size: 15px; font-weight: 800; }
.evidence-question > p, .evidence-receipt > p { font-size: 13px; line-height: 1.5; color: var(--text); }
.document-preview { display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 1px dashed var(--border); border-radius: 6px; background: var(--white); }
.document-preview > span { font: 700 10px var(--font-ui); letter-spacing: .06em; color: var(--muted); }
.document-preview strong { font-size: 15px; }
.document-preview p { font-size: 13px; }
.evidence-receipt { background: var(--success); }
.evidence-receipt dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.evidence-receipt dt { font-size: 11px; color: var(--muted); }
.evidence-receipt dd { margin: 2px 0 0; font-size: 18px; font-weight: 700; color: var(--success-ink); }
.packet-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
#packet-status { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 4px; background: var(--warning); color: var(--warning-ink); }
#packet-status[data-ready="true"] { background: var(--success); color: var(--success-ink); }
.decision-packet dl div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 6px 0; border-top: 1px dashed var(--border); }
.decision-packet dt { font-size: 12px; color: var(--muted); }
.decision-packet dd { margin: 0; font-size: 13px; font-weight: 700; text-align: right; }
.plain-help, .packet-boundary { font-size: 12px; line-height: 1.45; color: var(--muted); }
.approval-stamp { display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 1px solid var(--success-ink); border-radius: 6px; background: var(--success); color: var(--success-ink); font-size: 12px; font-weight: 700; }

/* ---------- Details cards ---------- */
.details-card { gap: 0; padding: 0; }
.details-card > summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 44px; padding: 10px 16px; font-size: 14px; font-weight: 700; cursor: pointer; list-style: none; }
.details-card > summary::-webkit-details-marker { display: none; }
.details-card > summary > span:last-child { font: 600 12px var(--font-ui); color: var(--muted); }
.details-card[open] > summary { border-bottom: 1px solid var(--border); }
.details-card > :not(summary) { margin: 10px 16px 0; }
.details-card > :last-child { margin-bottom: 14px; }
#agent-trace { padding: 0 0 0 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text); }
#agent-trace li[data-status="active"] { color: var(--authority-deep); font-weight: 600; }
#agent-trace li[data-status="blocked"] { color: var(--signal); font-weight: 600; }
#agent-trace li[data-status="done"] { color: var(--muted); }
.feedback-suggestion, #policy-proposal-copy, .policy-guard { font-size: 13px; line-height: 1.5; color: var(--text); }
.policy-proposal { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.policy-proposal-heading { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }

/* ---------- Peta ---------- */
.network-frame { position: relative; min-height: 380px; overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; background: linear-gradient(#e6ebf1 1px, transparent 1px), linear-gradient(90deg, #e6ebf1 1px, transparent 1px), var(--white); background-size: 28px 28px, 28px 28px, auto; }
#network-canvas { display: block; width: 100%; height: auto; min-height: 380px; min-width: 600px; }
.network-empty { position: absolute; inset: 0; display: grid; place-content: center; padding: 28px; text-align: center; color: var(--muted); }
.network-empty strong { color: var(--ink); }
.network-edge { fill: none; stroke: currentColor; stroke-width: 3; }
.network-edge.status-affected { color: var(--signal); }
.network-edge.status-unresolved { color: #a87c00; stroke-dasharray: 8 7; }
.network-edge.status-conflict { color: var(--signal); stroke-dasharray: 3 4; }
.network-edge.status-clear { color: #8390a5; stroke-dasharray: 3 7; opacity: .48; }
.network-frame[data-phase="analyzing"] .network-edge { animation: flow-dash 1s linear infinite; stroke-dasharray: 10 8; }
@keyframes flow-dash { to { stroke-dashoffset: -36; } }
.network-node rect, .network-node circle, .network-node polygon { stroke: var(--ink); stroke-width: 2; vector-effect: non-scaling-stroke; }
.network-node .node-surface { fill: var(--white); }
.network-node.status-affected .node-surface { fill: #ffe1da; }
.network-node.status-unresolved .node-surface { fill: url(#hatch-yellow); }
.network-node.status-conflict .node-surface { fill: url(#hatch-yellow); stroke: var(--signal); stroke-width: 3; }
.network-node.status-clear .node-surface { fill: #e8ebf0; opacity: .7; }
.network-node.source .node-surface { fill: var(--authority-deep); }
.network-node.matcher .node-surface { fill: var(--ink); }
.network-node text { pointer-events: none; fill: var(--ink); font-family: var(--font-data); }
.network-node.source text, .network-node.matcher text { fill: var(--white); }
.node-label { font-size: 12px; font-weight: 800; }
.node-meta { font-size: 9px; font-weight: 700; }
.node-status { font-size: 9px; font-weight: 800; letter-spacing: .04em; }

/* ---------- Tabel catatan ---------- */
.table-scroll { overflow-x: auto; min-width: 0; max-width: 100%; }
.workspace > * { min-width: 0; max-width: 100%; }
.record-table { min-width: 640px; }
.record-head, .record-chip { display: grid; grid-template-columns: 90px 120px minmax(0, 1fr) 90px 150px 130px; gap: 12px; align-items: center; padding: 8px 10px; font-size: 13px; }
.record-head { background: var(--surface); border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.num { text-align: right; }
.record-chip { border-top: 1px solid var(--border); color: var(--text); }
.record-chip > span:first-child { color: var(--muted); }
.record-chip .record-id { font-family: var(--font-data); font-weight: 600; color: var(--ink); }
.record-chip .record-qty { font-family: var(--font-data); text-align: right; }
.record-chip .record-qty small { color: var(--muted); font-size: 11px; }
.record-chip .record-batch { font-family: var(--font-data); }
.record-chip[data-status="conflict"] .record-batch { color: var(--signal); }
.record-chip[data-status="clear"] { opacity: .65; }

/* ---------- Aktivitas ---------- */
.audit-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.audit-list li { display: grid; grid-template-columns: 44px 10px minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px 0; border-top: 1px solid var(--border); }
.audit-list time { font: 11px var(--font-data); color: var(--muted); }
.audit-marker { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--authority); }
.audit-list li[data-kind="human"] .audit-marker { background: var(--ink); }
.audit-list li[data-kind="public"] .audit-marker { background: var(--success-ink); }
.audit-list li[data-kind="system"] .audit-marker { background: var(--muted); }
.audit-list p { display: flex; flex-direction: column; gap: 2px; font-size: 12px; line-height: 1.45; color: var(--text); }
.audit-list strong { font-size: 13px; color: var(--ink); }

/* ---------- Footer, error ---------- */
.truth-boundary { display: flex; flex-wrap: wrap; gap: 6px 18px; padding-top: 4px; font-size: 11px; color: var(--muted); }
.truth-boundary strong { color: var(--ink); }
#load-error { display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px solid var(--signal); border-radius: var(--radius); background: #fbeaea; }
#load-error h2 { font-size: 16px; }
.noscript-message { padding: 16px; text-align: center; }

/* ---------- Responsif ---------- */
@media (max-width: 1280px) {
  .board { grid-template-columns: minmax(0, 1fr) 380px; }
  .watcher { grid-column: 1 / -1; }
}
@media (max-width: 1180px) {
  .board { grid-template-columns: 1fr; }
  .board-side { order: -1; }
}
@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr; }
  .topbar-actions { justify-content: flex-start; }
  .agent-loop { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .workspace { padding: 16px; }
}
@media (max-width: 600px) {
  .kpi-row { grid-template-columns: 1fr; }
  .agent-loop { grid-template-columns: 1fr; gap: 4px; }
  .agent-loop li a { min-height: 48px; }
  .agent-decision dl div, .evidence-receipt dl, .decision-actions-row { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 19px; }
  .kpi strong { font-size: 28px; }
  .workspace { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Pemantau BPOM ---------- */
.watcher { padding: 0; gap: 0; overflow: hidden; }
.watcher-head { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
.watch-state { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: var(--success-ink); }
.watch-state[data-state="reading"] { color: var(--authority-deep); }
.watch-state[data-state="reading"] .state-beacon { background: var(--authority); animation: beacon-pulse 1.1s ease-in-out infinite; }
.watch-counters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.watch-counters > div { display: flex; flex-direction: column; padding: 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--white); }
.watch-counters span { font-size: 10px; color: var(--muted); }
.watch-counters strong { font-size: 18px; font-weight: 700; }
.watch-counters .watch-pending { background: var(--warning); }
.watch-counters .watch-pending span, .watch-counters .watch-pending strong { color: var(--warning-ink); }
.watch-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 0; }
.chip { font-size: 11px; font-weight: 700; padding: 4px 10px; border: 1px solid var(--border); border-radius: 14px; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--authority-deep); border-color: var(--authority-deep); color: var(--white); }
.watcher .case-list { padding: 10px 14px 0; }
.watcher .case-item small { display: block; }
.watch-hidden { margin: 8px 14px 0; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 8px; font-size: 11px; line-height: 1.45; color: var(--muted); }
.watch-sync { display: flex; flex-direction: column; margin: 12px 14px 14px; padding-top: 4px; border-top: 1px solid var(--border); }
.watch-sync div { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-top: 1px dashed var(--border); font-size: 11px; }
.watch-sync div:first-child { border-top: 0; }
.watch-sync dt { color: var(--muted); white-space: nowrap; }
.watch-sync dd { margin: 0; text-align: right; color: var(--ink); overflow-wrap: anywhere; }
.watch-sync a { font-size: 11px; }

/* ---------- Ruang kerja agen (log) ---------- */
.workspace-log { min-height: 0; }
.audit-list li { grid-template-columns: 44px 10px 76px minmax(0, 1fr); }
.audit-who { font-size: 10px; font-weight: 800; letter-spacing: .06em; color: var(--authority-deep); padding-top: 2px; }
.audit-list li[data-kind="program"] .audit-who, .audit-list li[data-kind="program"] .audit-marker { color: var(--muted); background: var(--muted); }
.audit-list li[data-kind="program"] .audit-who { background: transparent; }
.audit-list li[data-kind="system"] .audit-who, .audit-list li[data-kind="public"] .audit-who { color: var(--success-ink); }
.audit-list li[data-kind="public"] .audit-marker { background: var(--success-ink); }
.audit-list li[data-kind="human"] .audit-who { color: var(--ink); }
.audit-tool { align-self: flex-start; margin-top: 2px; padding: 2px 6px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); font: 11px var(--font-data); color: var(--authority-deep); }
@media (max-width: 600px) {
  .audit-list li { grid-template-columns: 44px 10px minmax(0, 1fr); }
  .audit-who { grid-column: 3; }
  .audit-list li p { grid-column: 3; }
  .watch-counters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Gerak: transisi dan animasi ringan ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes flash { 0% { box-shadow: inset 0 0 0 999px rgba(0, 120, 212, .12); } 100% { box-shadow: inset 0 0 0 999px rgba(0, 120, 212, 0); } }
@keyframes number-pop { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes node-flash { 0% { opacity: .35; } 100% { opacity: 1; } }
.agent-loop li { transition: background-color .35s ease, border-color .35s ease, color .35s ease; }
.agent-loop .stage-index { transition: background-color .35s ease, border-color .35s ease, color .35s ease; }
.agent-loop li.is-changed { animation: flash .7s ease-out; }
.pill { transition: background-color .3s ease, color .3s ease; }
.kpi strong { display: inline-block; transition: color .3s ease; }
.kpi strong.is-changed { animation: number-pop .45s ease-out; }
.kpi { transition: background-color .35s ease; }
.agent-decision { transition: background-color .35s ease, border-color .35s ease; }
.agent-decision.is-updating > h3, .agent-decision.is-updating > dl, .agent-decision.is-updating > .agent-decision-heading { animation: rise .32s ease-out; }
.guidance.is-updating > * { animation: rise .32s ease-out; }
.evidence-question, .evidence-receipt, .decision-actions, .approval-stamp, #retry-case-button, .policy-proposal { animation: rise .32s ease-out; }
.record-chip { transition: opacity .35s ease, background-color .35s ease; }
.record-chip.is-changed { animation: flash .8s ease-out; }
.audit-list li.is-new { animation: rise .35s ease-out; }
.network-node .node-surface { transition: fill .45s ease, stroke .45s ease, opacity .45s ease; }
.network-edge { transition: color .45s ease, opacity .45s ease; }
.network-node.is-changed { animation: node-flash .6s ease-out; }
.network-frame.is-entering #network-canvas { animation: rise .4s ease-out; }
.watch-state, .case-item { transition: background-color .3s ease, border-color .3s ease, color .3s ease, box-shadow .3s ease; }
#packet-status { transition: background-color .3s ease, color .3s ease; }

/* ---------- Panduan (spotlight + popover) ---------- */
.tour-spotlight { position: absolute; z-index: 60; pointer-events: none; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(23, 37, 61, .45), 0 0 0 3px var(--authority); transition: top .35s ease, left .35s ease, width .35s ease, height .35s ease; }
.tour-popover { position: absolute; z-index: 61; display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 10px; background: var(--white); box-shadow: 0 12px 32px rgba(23, 37, 61, .18); transition: top .35s ease, left .35s ease; animation: rise .3s ease-out; }
.tour-popover:focus { outline: none; }
.tour-popover::before { content: ""; position: absolute; left: 22px; width: 14px; height: 14px; background: var(--white); border-left: 1px solid var(--border); border-top: 1px solid var(--border); transform: rotate(45deg); }
.tour-popover[data-side="below"]::before { top: -8px; }
.tour-popover[data-side="above"]::before { bottom: -8px; transform: rotate(225deg); }
.tour-popover[data-side="floating"]::before { display: none; }
.tour-kicker { font: 700 11px var(--font-data); letter-spacing: .06em; color: var(--authority-deep); }
.tour-title { font-size: 16px; font-weight: 800; line-height: 1.3; }
.tour-body { font-size: 14px; line-height: 1.5; color: var(--text); }
.tour-actions { display: flex; align-items: center; gap: 8px; padding-top: 4px; }
.tour-actions .button { min-height: 40px; padding: 0 12px; font-size: 13px; }
.tour-spacer { flex: 1; }
#tour-button[aria-pressed="true"] { background: var(--authority-deep); color: var(--white); }

/* ---------- Blok untuk juri teknis ---------- */
.technical-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; }
.technical-grid h3 { font-size: 14px; font-weight: 800; margin: 0 0 8px; }
.technical-grid h3 + h3, .trace-console h3:not(:first-child) { margin-top: 14px; }
.technical-grid p { font-size: 13px; line-height: 1.5; color: var(--text); }
.terms div { padding: 4px 0; }
.terms dt { font-weight: 700; font-size: 13px; }
.terms dd { margin: 0; color: var(--muted); font-size: 12px; }
.technical-grid > section { min-width: 0; }
.network-frame { min-width: 0; }
@media (max-width: 900px) { .technical-grid { grid-template-columns: minmax(0, 1fr); } }
