:root {
  color-scheme: light;
  --navy: #122643;
  --ink: #142840;
  --muted: #4b6076;
  --teal: #006d65;
  --line: #dae4ec;
  font: 16px/1.45 "Inter", "Segoe UI", sans-serif;
  color: var(--ink);
  background: #f4f8fa;
}
* { box-sizing: border-box; }
body { margin: 0; display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: 100vh; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -1000px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 2; padding: .5rem; background: white; }
:focus-visible { outline: 3px solid #b65e12; outline-offset: 3px; }
.sidebar { background: var(--navy); color: white; padding: 28px 16px 18px; display: flex; flex-direction: column; gap: 30px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 5px; }
.monogram { background: #c8f1e9; color: #00584f; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; }
small { display: block; color: #b6c6d8; font-size: .8rem; }
nav { display: grid; gap: 4px; }
button { font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 8px; cursor: pointer; padding: .65rem .95rem; }
nav button { background: transparent; color: #d9e4f0; text-align: left; }
nav button:hover { background: #233957; }
nav button[aria-current] { background: #164d57; color: #e0fff7; }
.demo { margin-top: auto; background: #203653; border-radius: 10px; padding: 12px; }
.topbar { min-height: 66px; background: white; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px 20px; flex-wrap: wrap; padding: 12px clamp(16px, 4vw, 42px); }
.topbar span, p, label { color: var(--muted); }
.topbar span { font-size: .85rem; }
.workspace { max-width: 1480px; margin: auto; padding: clamp(18px, 4vw, 42px); }
.heading, .panel-header, .follow { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.75rem, 3vw, 2.55rem); letter-spacing: -.035em; line-height: 1.1; margin-bottom: 8px; }
h2 { font-size: 1.18rem; }
.primary { background: var(--teal); color: white; }
.primary:hover { background: #00564f; }
.secondary { color: var(--teal); background: white; border-color: #a3c7c4; }
.secondary:hover { background: #eaf8f5; }
.metrics { margin-top: 28px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 14px; }
.metric, .panel { background: white; border: 1px solid var(--line); border-radius: 14px; }
.metric { padding: 18px; }
.metric p { font-size: .88rem; }
.metric strong { display: block; font-size: 1.75rem; margin-top: 6px; }
.panel { margin-top: 20px; }
.panel-header, .follow { padding: 18px 20px; }
.panel-header p, .follow p { font-size: .9rem; margin-top: 4px; }
label { font-size: .83rem; display: grid; gap: 5px; }
input, select { border: 1px solid #a9bbcb; border-radius: 7px; background: white; font: inherit; color: var(--ink); padding: .55rem .65rem; }
.scroll { overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { border-top: 1px solid var(--line); padding: 13px 18px; }
th { background: #f0f6f9; color: var(--muted); font-size: .8rem; }
td { font-size: .9rem; }
.status { display: inline-block; padding: 3px 10px; border-radius: 16px; background: #e4f5ee; color: #125c49; font-size: .8rem; font-weight: 600; }
.status.attention { background: #fff1db; color: #794608; }
#result { padding: 12px 18px; font-size: .85rem; }
#show-rx { margin-top: 20px; }
.workflow-form { display: grid; align-self: flex-start; gap: 10px; flex: 1 1 220px; max-width: 420px; min-width: 0; }
.workflow-form input, .workflow-form select, .workflow-form textarea { width: 100%; }
.workflow-form textarea { min-height: 70px; border: 1px solid #a9bbcb; border-radius: 7px; font: inherit; padding: .55rem .65rem; }
#rows td { overflow-wrap: anywhere; white-space: pre-line; }
button:disabled { opacity: .65; cursor: wait; }
dialog { width: min(92vw, 530px); border: 1px solid var(--line); border-radius: 16px; padding: 25px; color: var(--ink); }
dialog::backdrop { background: #0a1e39a8; }
dialog form { display: grid; gap: 14px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.notice { color: #8b3713; font-weight: 700; margin-top: 16px; }
dt { font-weight: 600; }
dd { margin: 0 0 12px; }
@media (max-width: 760px) {
  body { grid-template-columns: minmax(0, 1fr); }
  .sidebar { gap: 12px; padding: 14px; }
  nav { grid-template-columns: repeat(auto-fit, minmax(115px, 1fr)); }
  .demo { padding: 8px 12px; }
}
@page { size: A4; margin: 18mm; }
@media print {
  body > :not(#rx-dialog), #rx-dialog .actions { display: none !important; }
  body { display: block; background: white; }
  #rx-dialog[open] { position: static; max-width: none; width: 100%; padding: 0; border: 0; }
  #rx-dialog::backdrop { display: none; }
}
