:root {
  color-scheme: light;
  --paper: #fefef7;
  --ink: #09090b;
  --muted: #565650;
  --line: #deded3;
  --soft: #f2f2e9;
  --panel: #fff;
  --accent: #264a38;
  --accent-bg: #e8f1eb;
  --alert: #9c3622;
  --alert-bg: #fdf0e8;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 300px; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled, select:disabled { cursor: not-allowed; opacity: .55; }
select, input[type="search"], textarea {
  min-height: 44px;
  border: 1px solid #d0d0c5;
  background: var(--panel);
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
}
textarea { resize: vertical; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { overflow-wrap: anywhere; }
:focus-visible { outline: 2px solid #375caa; outline-offset: 3px; }
[v-cloak] { display: none; }

.skip-link { position: absolute; z-index: 5; left: -1000px; top: 8px; }
.skip-link:focus { left: 10px; background: white; padding: 12px; }

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px clamp(16px, 3.8vw, 56px);
  border-bottom: 1px solid var(--line);
}
.wordmark { display: flex; align-items: center; gap: 17px; white-space: nowrap; }
.wordmark strong { font: 700 37px/1 Georgia, "Times New Roman", serif; letter-spacing: -.115em; }
.wordmark strong span { margin-left: .08em; }
.wordmark-title { color: var(--muted); border-left: 1px solid var(--line); padding-left: 16px; letter-spacing: -.025em; font-size: 15px; }
.topbar-actions, .role-select { display: flex; align-items: center; gap: 12px; }
.role-select span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.role-select select { min-width: 146px; }
.demo-badge {
  color: #494539;
  border: 1px solid #d9d5c3;
  background: #f4f0df;
  border-radius: 50px;
  padding: 6px 10px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}

.app-layout { margin: auto; max-width: 1640px; display: grid; grid-template-columns: clamp(172px, 16vw, 232px) minmax(0, 1fr); }
.sidebar { padding: 28px 14px; border-right: 1px solid var(--line); }
.role-nav { display: grid; gap: 4px; }
.role-link {
  border: 1px solid transparent;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  min-height: 45px;
  text-align: left;
  font-size: 14px;
  font-weight: 550;
  color: #30302b;
  background: transparent;
}
.role-link:hover { background: var(--soft); }
.role-link.selected { background: var(--ink); color: var(--paper); }
.role-mark { width: 16px; font-size: 17px; text-align: center; }
.sandbox-note { margin: 24px 11px 0; font-size: 12px; color: var(--muted); line-height: 1.5; }

.workspace { min-width: 0; padding: 38px clamp(17px, 3.4vw, 54px) 40px; min-height: 75vh; }
.page-title, .panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 18px; }
.page-title { align-items: center; padding-bottom: 24px; border-bottom: 1px solid var(--line); margin-bottom: 23px; }
.page-title h1 { font-size: clamp(29px, 3.7vw, 53px); letter-spacing: -.064em; font-weight: 630; line-height: 1.03; }
.page-title p { margin-top: 10px; font-size: 15px; line-height: 1.5; color: var(--muted); }
.button {
  border: 1px solid #cfcfc4;
  border-radius: 8px;
  min-height: 44px;
  padding: 10px 14px;
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
  font-weight: 610;
  text-align: left;
  line-height: 1.35;
}
.button span { margin-left: 8px; }
.button:hover { border-color: var(--ink); }
.button.primary { border-color: var(--ink); color: var(--paper); background: var(--ink); }
.button.primary:hover { background: #33332a; }
.button.secondary:hover { background: var(--soft); }
.reset-button { white-space: nowrap; }
.notice, .inline-callout {
  border: 1px solid #cddfd1;
  background: var(--accent-bg);
  color: #183828;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.5;
}
.notice.error { background: var(--alert-bg); color: var(--alert); border-color: #f1cfc0; }

.scenario-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.scenario-card {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 11px;
  min-width: 0;
  padding: 13px;
  text-align: left;
  display: grid;
  gap: 10px;
  grid-template-rows: auto 1fr auto;
}
.scenario-card:hover { border-color: #7a7a70; }
.scenario-card.selected { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: #f5f5eb; }
.scenario-card strong { font-size: 15px; line-height: 1.33; overflow-wrap: anywhere; }
.scenario-time, .scenario-bottom { display: flex; justify-content: space-between; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.scenario-time time { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.phase-dot { flex: 0 0 8px; height: 8px; border-radius: 100%; background: #bbbbae; }
.phase-dot.active { background: #b98433; }
.phase-dot.completed { background: #347454; }

.case-layout { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(225px, 1fr); gap: 16px; align-items: start; }
.panel { padding: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.panel h2 { font-size: 25px; letter-spacing: -.045em; line-height: 1.12; }
.role-queue { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; padding: 13px; }
.queue-actor { flex: 0 0 185px; }
.queue-actor label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.queue-items h2 { font-size: 16px; margin-bottom: 6px; }
.panel h3 { margin: 0 0 8px; font-size: 19px; letter-spacing: -.026em; }
.code-label { color: var(--muted); font-size: 12px; font-weight: 620; margin-bottom: 7px; }
.state-pill {
  display: inline-block;
  color: #45453f;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 630;
  line-height: 1.4;
}
.state-pill.active { background: #faf1dc; color: #65501f; border-color: #ebdfc0; }
.state-pill.completed { background: var(--accent-bg); color: var(--accent); border-color: #def0e1; }
.case-facts {
  display: grid;
  grid-template-columns: minmax(58px, .54fr) minmax(81px, 1fr) minmax(112px, 1.2fr);
  gap: 12px;
  padding: 14px 0;
  margin: 16px 0 20px;
  border-block: 1px solid var(--line);
}
.case-facts dt { color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.case-facts dd { margin: 0; font-size: 14px; line-height: 1.4; font-weight: 550; overflow-wrap: anywhere; }
.case-facts.receipt { border: 0; background: var(--soft); border-radius: 8px; padding-inline: 12px; }
.helper, .choice-area small { color: var(--muted); font-size: 14px; line-height: 1.5; }
.choice-area { margin-top: 16px; display: grid; gap: 7px; }
.choice-area label { font-size: 14px; font-weight: 630; }
.choice-area small { font-size: 12px; }
.required { font-size: 12px; color: var(--muted); font-weight: 500; }
.field-row { display: grid; grid-template-columns: minmax(92px, .5fr) auto; gap: 8px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choices { display: flex; flex-wrap: wrap; gap: 7px; }
.choice-chip {
  padding: 8px 12px;
  min-height: 44px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid #d0d0c5;
  border-radius: 8px;
  font-size: 14px;
}
.choice-chip:hover { border-color: var(--ink); }
.choice-chip[aria-pressed="true"] { color: white; background: var(--ink); border-color: var(--ink); }
.auto-choice { padding: 10px 12px; background: var(--soft); border-radius: 8px; font-size: 14px; }
.auto-choice small { display: block; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.case-panel .inline-callout { margin-top: 10px; }
.handover p { color: var(--muted); font-size: 14px; line-height: 1.5; margin-bottom: 14px; }
.doctor-summary { margin: 12px 0; padding: 12px; display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--soft); border-radius: 8px; }
.doctor-summary strong { font-size: 13px; }
.doctor-summary p, .history p { margin-top: 5px; font-size: 14px; color: var(--muted); line-height: 1.45; }
.history { border: 1px solid var(--line); border-radius: 8px; padding: 11px; }
.history summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.history ul { display: grid; gap: 10px; margin: 10px 0 0; padding-left: 20px; }
.history li strong { font-size: 13px; }

.case-aside { display: grid; gap: 14px; }
.compact-panel { padding: 17px; }
.compact-panel h2 { margin-bottom: 10px; font-size: 19px; letter-spacing: -.035em; }
.step-list, .event-list { margin: 0; padding: 0; list-style: none; }
.step-list li, .event-list li { display: grid; grid-template-columns: 31px minmax(0, 1fr); gap: 9px; align-items: start; padding: 9px 0; }
.step-list li + li, .event-list li + li { border-top: 1px solid var(--line); }
.step-list strong, .event-list li { font-size: 13px; line-height: 1.4; }
.step-list small, .event-list small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.step-index { display: grid; place-items: center; height: 26px; width: 26px; font-size: 12px; border-radius: 5px; background: var(--soft); color: var(--muted); }
.step-list li.current .step-index { background: var(--ink); color: white; }
.step-list li.done .step-index { color: var(--accent); background: var(--accent-bg); }
.event-list li { grid-template-columns: 38px minmax(0, 1fr); }
.event-list time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.manager-detail, .run-panel { margin-top: 16px; }
.run-panel { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.run-panel p { color: var(--muted); margin-top: 8px; line-height: 1.5; font-size: 14px; }
.page-footer { margin: 0; padding: 17px clamp(16px, 3.8vw, 56px); border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

@media (max-width: 1080px) {
  .case-layout { grid-template-columns: minmax(0, 1.7fr) minmax(200px, 1fr); }
  .scenario-card { padding: 10px; }
  .scenario-card strong { font-size: 14px; }
}

@media (max-width: 850px) {
  .app-layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { padding: 9px 12px; background: var(--paper); border-right: 0; border-bottom: 1px solid var(--line); }
  .role-nav { display: flex; overflow-x: auto; gap: 5px; padding: 2px; }
  .role-link { flex: 0 0 auto; white-space: nowrap; padding: 8px 10px; }
  .sandbox-note { display: none; }
  .workspace { min-height: 0; padding-top: 25px; }
}

@media (max-width: 625px) {
  .topbar { min-height: 66px; gap: 9px; }
  .wordmark { gap: 8px; }
  .wordmark strong { font-size: 30px; }
  .wordmark-title { padding-left: 7px; font-size: 12px; }
  .topbar-actions { gap: 7px; }
  .role-select span { display: none; }
  .role-select select { min-width: 0; max-width: 134px; font-size: 13px; }
  .demo-badge { white-space: normal; font-size: 11px; text-align: center; padding: 5px 7px; }
  .workspace { padding: 21px 13px 25px; }
  .page-title { margin-bottom: 15px; padding-bottom: 15px; gap: 10px; align-items: start; }
  .page-title p { font-size: 14px; }
  .reset-button { font-size: 12px; padding-inline: 8px; }
  .scenario-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .case-layout { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 15px; }
  .panel-heading { flex-wrap: wrap; gap: 10px; }
  .panel h2 { font-size: 22px; }
  .role-queue { flex-direction: column; align-items: stretch; gap: 10px; }
  .queue-actor { flex-basis: auto; }
  .queue-items h2 { font-size: 16px; }
  .compact-panel h2 { font-size: 18px; }
  .run-panel { align-items: flex-start; flex-direction: column; }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .role-link, .button, .choice-chip { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
