:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #61717c;
  --line: #d8e0e4;
  --surface: #f7faf9;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-2: #8a4f14;
  --mark: #fff2a8;
  --danger: #a33d3d;
  font-family: "Segoe UI", "Noto Sans TC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #eef5f2;
  padding: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.site-description {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.hub-nav {
  display: grid;
  gap: 8px;
  margin: 0 0 20px;
}

.hub-link {
  display: block;
  border: 1px solid #9ec6be;
  border-radius: 6px;
  color: #1e5e56;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  padding: 9px 10px;
  text-decoration: none;
}

.hub-link:hover,
.hub-link:focus-visible {
  border-color: var(--accent);
  background: #e4f2ee;
  outline: none;
}

.hub-link.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

.panel {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.stats {
  display: grid;
  gap: 8px;
  margin: 0;
}

.stats div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.stats dt {
  color: var(--muted);
}

.stats dd {
  margin: 0;
  font-weight: 700;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

select,
input[type="text"],
.searchbar input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

select {
  height: 40px;
  padding: 0 10px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid #bdd4ce;
  border-radius: 999px;
  background: #fff;
  color: #275b54;
  padding: 7px 10px;
  cursor: pointer;
  line-height: 1;
}

.workspace {
  padding: 18px clamp(16px, 3vw, 34px);
}

.command-center {
  position: sticky;
  top: 0;
  z-index: 10;
  max-width: 1280px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 250, 249, 0.96);
  padding-bottom: 12px;
  backdrop-filter: blur(8px);
}

.status-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #ead3bf;
  border-radius: 8px;
  background: #fff8ef;
  color: #74420f;
  padding: 10px 12px;
  margin-bottom: 12px;
  line-height: 1.45;
}

/* Review state remains enforced in the application; this operational view omits the banner. */
.status-strip,
.clinical-note {
  display: none;
}

.status-strip strong {
  flex-shrink: 0;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 18px;
  max-width: 1280px;
  padding-top: 16px;
}

.quick-index {
  align-self: start;
}

.section-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin: 0;
  font-size: 20px;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 13px;
}

#quickIndex {
  display: grid;
  gap: 12px;
}

.index-group {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.index-group h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.index-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.index-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px;
  text-align: left;
  cursor: pointer;
}

.index-card:hover,
.index-card:focus-visible {
  border-color: #94b9b2;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.index-card strong {
  font-size: 14px;
  line-height: 1.35;
}

.index-card small {
  align-self: start;
  border-radius: 999px;
  background: #edf5f3;
  color: #2b635b;
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 700;
}

.index-card em {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.index-tags {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.index-tags span {
  border-radius: 999px;
  background: #f5eadf;
  color: var(--accent-2);
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 700;
}

.searchbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 10px;
  max-width: 1280px;
}

.searchbar input {
  height: 48px;
  padding: 0 14px;
  font-size: 16px;
}

.searchbar button,
.ghost {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.searchbar button {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.ghost {
  background: transparent;
  color: var(--muted);
  padding: 8px 0;
}

.assist-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  min-height: 38px;
  max-width: 1280px;
  padding-top: 10px;
}

.concepts {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.concepts > span {
  flex-shrink: 0;
  padding-top: 5px;
  font-weight: 700;
}

#expandedTerms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.term {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: #fff;
}

.answer-pane {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.expert-summary {
  border: 1px solid #cbd9df;
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.summary-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.summary-top h2 {
  margin: 0;
  font-size: 22px;
}

.summary-nav {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
}

.summary-nav a {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 9px;
  text-decoration: none;
}

.summary-nav a:hover,
.summary-nav a:focus-visible {
  background: #edf5f3;
  border-color: #94b9b2;
  outline: 0;
}

.review-pill {
  align-self: start;
  border-radius: 999px;
  background: #fff0df;
  color: #8a4f14;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.review-pill.approved {
  background: #e5f6ea;
  color: #1d6b39;
}

.review-pill.revision {
  background: #fff3d8;
  color: #8a4f14;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.summary-grid section {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.summary-grid .summary-criteria {
  grid-column: 1 / -1;
}

.summary-grid h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.summary-grid p,
.summary-grid ul {
  margin: 0;
  color: #34444c;
  line-height: 1.55;
  font-size: 14px;
}

.summary-grid ul {
  padding-left: 18px;
}

.pending-text {
  color: #74420f !important;
}

.review-link {
  margin-top: 10px !important;
}

.review-link a {
  display: inline-flex;
  align-items: center;
  border: 1px solid #8fb0b8;
  border-radius: 6px;
  background: #eef7f6;
  color: #1d4b57;
  padding: 8px 10px;
  font-weight: 800;
  text-decoration: none;
}

.review-link a:hover,
.review-link a:focus-visible {
  border-color: #3f747f;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(49, 84, 122, 0.12);
}

.draft-warning {
  margin-top: 8px !important;
  color: #8a4f14 !important;
  font-weight: 800;
}

.tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 12px;
}

.tool-button {
  border: 1px solid #b7cbd2;
  border-radius: 6px;
  background: #f8fbfb;
  color: #23454e;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 700;
}

.tool-button:hover,
.tool-button:focus-visible {
  border-color: #6e99a3;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(49, 84, 122, 0.12);
}

.signoff-panel {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 14px;
  display: grid;
  gap: 10px;
}

.signoff-panel h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.signoff-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.signoff-fields {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(220px, 1.6fr);
  gap: 10px;
}

.signoff-fields input,
.signoff-fields textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}

.signoff-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.signoff-button {
  border: 1px solid #b7cbd2;
  border-radius: 6px;
  background: #fff;
  color: #23454e;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 800;
}

.signoff-button.approve {
  border-color: #7db28b;
  background: #e9f7ed;
  color: #195f32;
}

.signoff-button.revise {
  border-color: #d2aa6c;
  background: #fff6e4;
  color: #814c12;
}

.signoff-button.export {
  border-color: #759baa;
  background: #eef7f8;
  color: #1c4f5d;
}

.signoff-button:hover,
.signoff-button:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(49, 84, 122, 0.12);
}

.signoff-status {
  font-weight: 800;
}

.med-note,
.med-source {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.med-source a {
  color: #1c5b68;
  font-weight: 800;
}

.med-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.med-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
  background: #fff;
}

.med-table th,
.med-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  line-height: 1.45;
}

.med-table th {
  background: #eef4f5;
  color: #23454e;
  font-weight: 800;
}

.med-table tr:last-child td {
  border-bottom: 0;
}

.tool-dialog {
  width: min(720px, calc(100vw - 28px));
  border: 1px solid #bfd0d6;
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
}

.result-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.source-reader-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 9px;
}

.source-reader-button:hover,
.source-reader-button:focus-visible {
  border-color: #94b9b2;
  background: #edf5f3;
  outline: 0;
}

.source-reader-intro {
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.source-reader-intro p {
  color: var(--muted);
  line-height: 1.5;
  margin: 6px 0;
}

.source-reader {
  max-height: min(68vh, 720px);
  overflow: auto;
  padding: 0 16px 16px;
}

.source-page {
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.source-page:last-child {
  border-bottom: 0;
}

.source-page-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin: 0 0 7px;
}

.source-page p:last-child {
  line-height: 1.65;
  margin: 0;
  white-space: pre-wrap;
}

.tool-dialog::backdrop {
  background: rgba(23, 32, 38, 0.36);
}

.tool-dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.tool-dialog-head h2 {
  margin: 0;
  font-size: 20px;
}

.icon-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

#toolBody {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.locked-tool {
  border: 1px solid #ead3bf;
  border-radius: 8px;
  background: #fff8ef;
  color: #74420f;
  padding: 12px;
}

.locked-tool p,
.tool-section p {
  margin: 6px 0 0;
  line-height: 1.6;
}

.tool-section {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.tool-section h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.tool-section ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}

.widget-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.calc-card {
  border: 1px solid #cfe0e2;
  border-radius: 8px;
  background: #f8fbfb;
  padding: 12px;
}

.calc-card.wide {
  grid-column: 1 / -1;
}

.calc-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.calc-card label {
  display: grid;
  gap: 5px;
  color: #33484f;
  font-size: 13px;
  font-weight: 700;
}

.calc-card input,
.calc-card select {
  width: 100%;
  min-height: 36px;
  border: 1px solid #b9ccd1;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 6px 8px;
  font: inherit;
}

.calc-card input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

.calc-grid,
.scale-grid,
.check-grid {
  display: grid;
  gap: 8px;
}

.calc-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.scale-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.check-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.check-grid label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
}

.calc-output {
  display: block;
  border-left: 4px solid #487b83;
  background: #eef6f4;
  color: #193b42;
  margin-top: 10px;
  padding: 9px 10px;
  font-weight: 800;
  line-height: 1.45;
}

.calc-note {
  color: #5b6e74;
  font-size: 12px;
}

.results-head {
  margin: 0 0 2px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.results-head h2 {
  margin-bottom: 4px;
  font-size: 22px;
}

.results-head p {
  margin: 0;
  color: var(--muted);
}

.results {
  display: grid;
  gap: 12px;
}

.result {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.result-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.result h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.badge {
  border-radius: 999px;
  background: #e8f3ef;
  color: #276158;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.badge.year {
  background: #f5eadf;
  color: var(--accent-2);
}

.badge.latest {
  background: #f2e8e8;
  color: var(--danger);
}

.badge.relevance {
  background: #e8edf5;
  color: #31547a;
}

.snippet {
  margin: 0 0 12px;
  color: #28363d;
  line-height: 1.7;
}

mark {
  background: var(--mark);
  padding: 0 2px;
}

.source {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 13px;
}

.empty {
  border: 1px dashed #b8c5ca;
  border-radius: 8px;
  padding: 28px;
  color: var(--muted);
  background: #fff;
}

.more-results {
  width: 100%;
  min-height: 44px;
  border: 1px solid #9ec6be;
  border-radius: 6px;
  background: #fff;
  color: #1e5e56;
  cursor: pointer;
  font-weight: 800;
}

.more-results:hover,
.more-results:focus-visible {
  border-color: var(--accent);
  background: #e7f2f1;
  outline: none;
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .command-center {
    position: static;
  }

  .workbench {
    grid-template-columns: 1fr;
  }

  .searchbar {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .widget-grid,
  .calc-grid,
  .scale-grid,
  .check-grid {
    grid-template-columns: 1fr;
  }

  .searchbar button {
    height: 44px;
  }

  .result-top {
    display: grid;
  }

  .badges {
    justify-content: flex-start;
  }
}

/* Clinical workbench refinement */
:root {
  --ink: #152026;
  --muted: #5f6f78;
  --line: #d7dee2;
  --surface: #f3f6f6;
  --panel: #ffffff;
  --accent: #0b6f6a;
  --accent-soft: #e7f2f1;
  --review: #1f7a43;
  --warn: #94600d;
  --danger: #a33d3d;
}

body {
  background: var(--surface);
}

.app-shell {
  grid-template-columns: 292px minmax(0, 1fr);
}

.site-header {
  grid-column: 1 / -1;
  padding: 28px 24px 24px;
  border-bottom: 1px solid var(--line);
  background: #eef5f2;
}

.site-header__inner {
  width: min(1160px, calc(100% - 40px));
  margin: auto;
}

.site-header .eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.site-header h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.2;
}

.site-header .lede {
  max-width: 660px;
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.site-header .hub-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.site-header .hub-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 11px;
}

.site-header .summary {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-header .summary strong {
  color: var(--accent);
  font-size: 1.1rem;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: #fbfcfc;
  padding: 18px 16px;
}

.sidebar h1 {
  margin-bottom: 16px;
  font-size: 22px;
}

.panel {
  padding: 12px 0;
}

.panel h2 {
  color: #2c3b42;
  font-size: 13px;
  text-transform: uppercase;
}

.stats {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.stats div {
  min-height: 28px;
  align-items: center;
}

.chip {
  border-radius: 6px;
  padding: 8px 9px;
  background: #fff;
  color: #25474c;
  font-size: 13px;
  line-height: 1.2;
}

.workspace {
  padding: 0;
}

.command-center {
  max-width: none;
  border-bottom: 1px solid #cfd8dc;
  background: rgba(243, 246, 246, 0.98);
  padding: 14px 22px 12px;
}

.status-strip {
  border-color: #bdd6cc;
  border-radius: 6px;
  background: #f7fbf9;
  color: #304a50;
  margin-bottom: 10px;
  padding: 8px 10px;
}

.status-strip strong {
  min-width: 94px;
  color: var(--review);
  font-size: 13px;
  text-transform: uppercase;
}

body:not(.review-mode) .status-strip {
  border-color: #dfc8a4;
  background: #fffaf1;
}

body:not(.review-mode) .status-strip strong {
  color: var(--warn);
}

.searchbar {
  max-width: none;
  grid-template-columns: minmax(0, 1fr) 96px;
}

.searchbar input {
  height: 44px;
  border-radius: 6px;
  font-size: 15px;
}

.searchbar button {
  border-radius: 6px;
  background: #0b6f6a;
}

.assist-row {
  max-width: none;
  min-height: 30px;
  padding-top: 8px;
}

.term {
  border-radius: 6px;
  background: #fff;
}

.workbench {
  max-width: none;
  grid-template-columns: minmax(300px, 348px) minmax(0, 1fr);
  gap: 0;
  padding-top: 0;
}

.quick-index {
  position: sticky;
  top: 107px;
  height: calc(100vh - 107px);
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 16px;
}

.section-heading {
  margin-bottom: 12px;
}

.section-heading h2 {
  font-size: 18px;
}

.section-heading p {
  display: none;
}

#quickIndex {
  gap: 14px;
}

.index-group {
  border-top: 0;
  padding-top: 0;
}

.index-group h3 {
  margin-bottom: 7px;
  color: #51636b;
  font-size: 13px;
  text-transform: uppercase;
}

.index-grid {
  gap: 6px;
}

.index-card {
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  border-radius: 6px;
  border-color: #e1e6e9;
  padding: 9px 10px;
}

.index-card:hover,
.index-card:focus-visible {
  border-color: #5f9c97;
  box-shadow: inset 3px 0 0 #0b6f6a;
}

.index-card strong {
  font-size: 14px;
}

.index-card small,
.index-card em,
.index-tags {
  display: none;
}

.answer-pane {
  gap: 14px;
  padding: 16px 22px 28px;
}

.expert-summary,
.result,
.empty,
.tool-dialog {
  border-radius: 6px;
}

.expert-summary {
  border-color: #bacbd1;
  box-shadow: 0 1px 0 rgba(20, 32, 38, 0.04);
}

.summary-top {
  align-items: start;
  margin-bottom: 10px;
}

.summary-top h2 {
  font-size: 21px;
}

.review-pill {
  border-radius: 6px;
  background: #edf7f0;
  color: var(--review);
}

.summary-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 12px 16px;
}

.summary-grid section {
  border-top-color: #e4eaed;
}

.summary-grid h3 {
  color: #43545c;
  font-size: 13px;
  text-transform: uppercase;
}

.tool-row {
  gap: 6px;
}

.tool-button,
.signoff-button {
  border-radius: 6px;
  padding: 8px 9px;
  background: #fff;
  color: #24484f;
}

.tool-button:hover,
.tool-button:focus-visible {
  border-color: #0b6f6a;
}

.signoff-panel {
  border: 1px solid #dce6e8;
  border-radius: 6px;
  background: #fbfdfd;
  margin-top: 12px;
  padding: 12px;
}

.results-head {
  border-top: 0;
  padding-top: 0;
}

.results-head h2 {
  font-size: 18px;
}

.clinical-note {
  margin-top: 6px !important;
  border-left: 3px solid #d6b370;
  background: #fffaf0;
  padding: 8px 10px;
  color: #6f4a12 !important;
  font-size: 13px;
}

.results {
  gap: 8px;
}

.result {
  border-color: #dce3e6;
  padding: 13px 14px;
}

.result-top {
  margin-bottom: 8px;
}

.result h3 {
  font-size: 16px;
}

.snippet {
  max-width: 86ch;
  margin-bottom: 9px;
  color: #26363c;
  font-size: 14px;
  line-height: 1.62;
}

.badge {
  border-radius: 6px;
}

.source {
  font-size: 12px;
}

.tool-dialog {
  width: min(920px, calc(100vw - 28px));
}

.tool-dialog-head {
  padding: 14px 16px;
}

#toolBody {
  max-height: min(74vh, 760px);
  overflow-y: auto;
}

.med-table th,
.med-table td {
  font-size: 12.5px;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workbench {
    grid-template-columns: 1fr;
  }

  .quick-index {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .index-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    display: flex;
    flex-direction: column;
  }

  .sidebar {
    order: 3;
    display: block;
    padding: 12px 14px;
    border: 0;
    border-top: 1px solid var(--line);
    background: #fbfcfc;
  }

  .workspace {
    order: 2;
  }

  .site-header {
    order: 1;
    padding: 24px 12px 20px;
  }

  .site-header__inner {
    width: min(100%, 1160px);
  }

  .sidebar .panel {
    margin: 0;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  .workbench {
    display: flex;
    flex-direction: column;
  }

  .answer-pane {
    order: 1;
  }

  .quick-index {
    order: 2;
  }

  .command-center,
  .answer-pane,
  .quick-index {
    padding-left: 14px;
    padding-right: 14px;
  }

  .status-strip,
  .assist-row {
    display: grid;
  }

  .index-grid,
  .summary-grid,
  .signoff-fields {
    grid-template-columns: 1fr;
  }

  .sidebar .panel:nth-of-type(3),
  .sidebar .panel:nth-of-type(4) {
    display: none;
  }

  .summary-top h2 {
    font-size: 19px;
  }

  .summary-grid {
    gap: 8px;
  }

  .summary-grid #summary-source {
    display: none;
  }

  .draft-warning {
    display: none;
  }

  .summary-grid section {
    padding-top: 8px;
  }

  .tool-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .tool-button {
    white-space: nowrap;
  }

  .quick-index {
    max-height: 420px;
    overflow-y: auto;
  }

  .answer-pane,
  .expert-summary,
  .summary-grid,
  .summary-grid section,
  .signoff-panel,
  .tool-row {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .signoff-panel summary {
    min-width: 0;
  }

  .signoff-panel summary span,
  .signoff-panel summary strong {
    min-width: 0;
    overflow-wrap: anywhere;
  }

.signoff-panel summary strong {
  text-align: right;
}
}

/* Rapid index: a first-line clinical shortcut, not a secondary side list. */
.command-center > .quick-index {
  margin-top: 18px;
  border-top: 1px solid #dce6e8;
  padding-top: 16px;
}

.command-center > .quick-index .section-heading {
  align-items: end;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.command-center > .quick-index .section-heading h2 {
  font-size: 18px;
}

.command-center > .quick-index .section-heading p:last-child {
  max-width: 360px;
  text-align: right;
}

.command-center > .quick-index #quickIndex {
  display: grid;
  gap: 12px;
}

.command-center > .quick-index .index-group {
  border: 0;
  display: grid;
  gap: 7px;
  padding: 0;
}

.command-center > .quick-index .index-group h3 {
  color: #51636c;
  font-size: 12px;
  letter-spacing: 0;
  margin: 0;
}

.command-center > .quick-index .index-grid {
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 7px;
}

.command-center > .quick-index .index-card {
  align-items: center;
  display: flex;
  justify-content: flex-start;
  min-height: 42px;
  padding: 8px 10px;
}

.command-center > .quick-index .index-card strong {
  font-size: 13px;
  line-height: 1.25;
}

@media (max-width: 720px) {
  .command-center > .quick-index {
    margin-top: 14px;
    padding-top: 14px;
  }

  .command-center > .quick-index .section-heading {
    align-items: start;
    display: grid;
    gap: 3px;
  }

  .command-center > .quick-index .section-heading p:last-child {
    max-width: none;
    text-align: left;
  }

  .command-center > .quick-index .index-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .command-center > .quick-index .index-card {
    min-height: 46px;
  }
}

.signoff-panel {
  display: block;
  border: 1px solid #dce6e8;
  border-radius: 6px;
  background: #fbfdfd;
  margin-top: 12px;
  padding: 0;
}

.signoff-panel summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 9px 12px;
  cursor: pointer;
  color: #29454c;
  font-weight: 800;
}

.signoff-panel summary::-webkit-details-marker {
  display: none;
}

.signoff-panel summary::after {
  content: "展開";
  border: 1px solid #b9cdd2;
  border-radius: 6px;
  padding: 4px 8px;
  color: #46636a;
  font-size: 12px;
  font-weight: 800;
}

.signoff-panel[open] summary::after {
  content: "收合";
}

.signoff-panel summary strong {
  color: var(--review);
  font-size: 12px;
}

.signoff-panel > div,
.signoff-panel > p,
.signoff-panel .signoff-actions {
  margin: 0 12px 10px;
}

/* Keep non-actionable review/status banners out of the operational interface. */
.status-strip,
.clinical-note {
  display: none !important;
}
