:root {
  --page: #f2f5f3;
  --surface: #ffffff;
  --surface-soft: #f7f9f8;
  --line: #dbe3df;
  --line-strong: #c6d2cc;
  --text: #172b27;
  --muted: #62736e;
  --blue: #176b8f;
  --blue-soft: #e5f0f4;
  --green: #147d68;
  --green-soft: #e4f3ee;
  --amber: #a96816;
  --amber-soft: #fff3df;
  --red: #b14d4d;
  --shadow: 0 5px 18px rgba(25, 53, 73, 0.06);
  --sans: "Aptos", "Microsoft YaHei UI", "PingFang SC", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  color: var(--text);
  font-family: var(--sans);
  background: var(--page);
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(29, 111, 163, 0.28);
  outline-offset: 2px;
}

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

.action-toast {
  position: fixed;
  z-index: 20;
  top: 18px;
  left: 50%;
  transform: translate(-50%, -70px);
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  box-shadow: var(--shadow);
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition:
    transform 180ms ease,
    opacity 180ms ease;
}

.action-toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: #f9fbfa;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
  background: #1d6fa3;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav a {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 8px;
  color: #485d6b;
  font-weight: 700;
}

.side-nav a:hover,
.side-nav a.active {
  color: var(--blue);
  background: var(--blue-soft);
}

.sidebar-card {
  margin-top: auto;
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.sidebar-card span,
.sidebar-card small {
  color: var(--muted);
  font-size: 12px;
}

.sidebar-card strong {
  font-size: 15px;
}

.workspace {
  width: min(100%, 1800px);
  justify-self: start;
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 22px;
}

.file-input {
  position: fixed;
  left: -100vw;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.view-stack {
  display: grid;
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

.dashboard-grid,
.split-grid {
  display: grid;
  gap: 16px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
}

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

.priority-grid,
.queue-list {
  display: grid;
  gap: 12px;
}

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

.priority-card,
.queue-list article {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.priority-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.priority-card strong,
.queue-list strong {
  font-size: 18px;
}

.priority-card p,
.queue-list span {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.priority-card button,
.queue-list button {
  width: fit-content;
  min-height: 34px;
  padding: 0 12px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.topbar > div:first-child {
  flex: 0 0 auto;
}

.topbar p,
.panel-head p {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.topbar h1,
.panel-head h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 30px;
  line-height: 1.1;
  white-space: nowrap;
}

.panel-head h2 {
  font-size: 20px;
}

.topbar-actions {
  display: flex;
  flex: 1 1 680px;
  align-items: end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.doctor-session {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding-left: 4px;
}

.doctor-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.doctor-identity {
  display: grid;
  gap: 2px;
  min-width: 150px;
}

.doctor-identity strong { font-size: 13px; }
.doctor-identity small { color: var(--muted); font-size: 11px; }

.demo-data-badge {
  padding: 5px 8px;
  border: 1px solid #cae5dc;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.logout-button {
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.logout-button:hover { border-color: var(--blue); color: var(--blue); }

.search {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search input {
  width: 260px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
}

.search select {
  width: 190px;
  height: 40px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  cursor: pointer;
}

.scope-select {
  min-width: 190px;
}

.button,
.ghost-button,
.segmented button,
.table-row button,
.task button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  white-space: nowrap;
}

.file-button {
  min-height: 38px;
  cursor: pointer;
}

.button.primary {
  color: #fff;
  border-color: #1d6fa3;
  background: #1d6fa3;
}

.button.secondary,
.ghost-button,
.table-row button,
.task button {
  color: var(--blue);
  background: #fff;
}

.button:hover,
.ghost-button:hover,
.segmented button:hover,
.table-row button:hover,
.task button:hover {
  border-color: var(--blue);
}

[data-clinical-action].clicked {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

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

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 108px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 15px 16px;
  border-left: 4px solid var(--blue);
}

.metric-card.alert {
  border-left-color: var(--amber);
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  font-size: 34px;
  line-height: 1;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(720px, 1fr) clamp(360px, 28vw, 520px);
  gap: 16px;
  align-items: start;
}

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-head.compact {
  margin-bottom: 12px;
}

.segmented {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.segmented button {
  min-height: 32px;
  padding: 0 11px;
  border: 0;
  color: var(--muted);
  background: transparent;
}

.segmented button.active {
  color: var(--blue);
  background: #fff;
  box-shadow: 0 2px 8px rgba(26, 67, 94, 0.08);
}

.patient-table {
  max-height: min(62vh, 680px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.patient-pool-tools {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(160px, 220px) minmax(220px, 1fr);
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(29, 111, 163, 0.05), rgba(29, 139, 114, 0.03)),
    var(--surface-soft);
}

.patient-pool-tools label {
  display: grid;
  gap: 6px;
}

.patient-pool-tools span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.patient-pool-tools select {
  width: 100%;
  min-height: 38px;
  padding: 0 34px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  cursor: pointer;
}

.patient-pool-tools p {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.empty-row {
  display: none;
  padding: 18px 14px;
  color: var(--muted);
  background:
    linear-gradient(135deg, rgba(29, 111, 163, 0.04), rgba(29, 139, 114, 0.025)),
    var(--surface-soft);
  line-height: 1.65;
}

.view-empty:not([hidden]) {
  display: grid;
  gap: 4px;
  min-height: 96px;
  align-content: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
}

.view-empty:not([hidden])::before {
  content: "当前无记录";
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.patient-table.empty .empty-row {
  display: block;
}

.patient-table.empty .table-header {
  display: none;
}

.patient-table.empty .table-row {
  display: none;
}

.plan-grid.empty,
.queue-list.empty,
.priority-grid.empty,
.task-list.empty,
.timeline.empty,
.record-list.empty {
  display: none;
}

.patient-insights {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.patient-detail {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

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

.detail-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.detail-card article {
  display: grid;
  gap: 3px;
}

.detail-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-card strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.55;
}

.reminders-card {
  grid-column: span 2;
}

.reminder-intro,
.reminder-empty,
.reminder-form-status,
.reminder-readonly {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.reminder-list {
  display: grid;
  gap: 8px;
}

.reminder-item {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.reminder-item.is-paused {
  opacity: 0.7;
}

.reminder-item-top,
.reminder-item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.reminder-item-top strong {
  font-size: 14px;
}

.reminder-item-top time {
  color: var(--blue);
  font-size: 16px;
  font-weight: 800;
}

.reminder-meta,
.reminder-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.reminder-item-actions {
  justify-content: flex-start;
  padding-top: 2px;
}

.reminder-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.reminder-toggle input,
.reminder-days input {
  accent-color: var(--green);
}

.reminder-delete {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.reminder-form {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(110px, 0.6fr);
  gap: 10px;
  padding-top: 4px;
}

.reminder-form label,
.reminder-form fieldset {
  display: grid;
  gap: 6px;
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.reminder-form fieldset {
  grid-column: 1 / -1;
  padding: 0;
  border: 0;
}

.reminder-form legend {
  padding: 0;
}

.reminder-form input:not([type='checkbox']),
.reminder-form textarea {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--text);
  background: #fff;
  font: inherit;
  font-weight: 400;
  outline: none;
}

.reminder-form input:not([type='checkbox']):focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 111, 163, .1);
}

.reminder-days {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.reminder-days label {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
}

.reminder-form .button {
  justify-self: start;
}

.binding-card {
  border-color: #cfe1dc;
  background:
    linear-gradient(135deg, rgba(29, 139, 114, 0.08), rgba(29, 111, 163, 0.04)),
    #fff;
}

.binding-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.binding-card button {
  width: fit-content;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--green);
  border-radius: 8px;
  color: var(--green);
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.binding-card button + button {
  margin-top: -4px;
}

.insight-card {
  min-height: 142px;
  display: grid;
  align-content: space-between;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.insight-card span,
.insight-card p {
  color: var(--muted);
}

.insight-card span {
  font-size: 13px;
  font-weight: 800;
}

.insight-card strong {
  font-size: 28px;
  line-height: 1;
}

.insight-card p {
  margin: 0;
  line-height: 1.6;
}

.mini-bars {
  height: 44px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  align-items: end;
}

.mini-bars i {
  display: block;
  min-height: 8px;
  border-radius: 999px 999px 3px 3px;
  background: linear-gradient(180deg, var(--blue), var(--green));
}

.table-header,
.table-row {
  display: grid;
  grid-template-columns: 1fr 0.8fr 1fr 1.2fr 80px;
  gap: 14px;
  align-items: center;
  min-height: 58px;
  padding: 0 14px;
}

.table-header {
  position: sticky;
  z-index: 2;
  top: 0;
  min-height: 42px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: var(--surface-soft);
}

.table-row + .table-row {
  border-top: 1px solid var(--line);
}

.table-row.warning-row {
  background: linear-gradient(90deg, rgba(255, 243, 223, 0.75), rgba(255, 255, 255, 0));
}

.table-row[hidden] {
  display: none;
}

.patient-name {
  font-weight: 800;
}

.patient-name small {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 500;
}

.status {
  display: inline-flex;
  align-items: center;
  min-width: 64px;
  justify-content: center;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.status.good {
  color: var(--green);
  background: var(--green-soft);
}

.status.warn {
  color: var(--amber);
  background: var(--amber-soft);
}

.table-row button,
.task button {
  min-height: 32px;
  padding: 0 10px;
}

.right-column {
  display: grid;
  gap: 16px;
}

.task-list {
  display: grid;
  gap: 10px;
}

.task {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.task.urgent {
  border-color: #edd4ac;
  background: #fffaf1;
}

.task.active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.task span {
  color: var(--muted);
  line-height: 1.55;
}

.timeline {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 10px;
  align-items: start;
}

.timeline span {
  width: 9px;
  height: 9px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--blue);
}

.timeline p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

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

.plan-grid article {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.plan-grid article:hover {
  border-color: var(--blue);
  box-shadow: 0 8px 20px rgba(29, 111, 163, 0.1);
  transform: translateY(-1px);
}

.plan-grid article:focus-visible {
  outline: 3px solid rgba(29, 111, 163, 0.28);
  outline-offset: 2px;
}

.plan-grid article.active {
  border-color: var(--blue);
  border-left-width: 4px;
  background: var(--blue-soft);
  box-shadow: 0 10px 24px rgba(29, 111, 163, 0.12);
}

.clinical-console {
  padding: 16px;
}

.clinical-body {
  min-height: 92px;
  display: grid;
  align-items: center;
  white-space: pre-line;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(29, 111, 163, 0.04), rgba(29, 111, 163, 0.01));
  color: var(--text);
  line-height: 1.7;
}

.plan-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.plan-topline span {
  color: var(--blue);
  font-weight: 800;
}

.plan-grid p {
  min-height: 48px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.plan-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.plan-select-hint {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.plan-source {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 800;
}

.plan-task-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plan-task-list li {
  max-width: 100%;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #fff;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.progress-line {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2eaee;
}

.progress-line span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.queue-list article {
  align-content: start;
}

.queue-list.compact {
  gap: 8px;
}

.queue-list.compact article {
  padding: 10px;
}

.queue-list article button {
  width: fit-content;
}

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

.queue-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.queue-section-head strong {
  font-size: 15px;
}

.prescription-detail {
  display: grid;
  gap: 12px;
}

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

.prescription-summary-grid article,
.prescription-task-detail article {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.prescription-summary-grid span,
.prescription-task-detail span,
.prescription-task-detail small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.prescription-summary-grid strong,
.prescription-task-detail strong,
.prescription-task-detail small {
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.prescription-task-detail {
  max-height: min(46vh, 560px);
  display: grid;
  gap: 8px;
  overflow: auto;
}

.prescription-task-detail h3 {
  position: sticky;
  z-index: 1;
  top: 0;
  margin: 0;
  padding: 2px 0 6px;
  font-size: 15px;
  background: #fff;
}

.prescription-task-detail p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.followup-detail {
  display: grid;
  gap: 12px;
}

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

.followup-summary-grid article,
.followup-context article {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.followup-summary-grid span,
.followup-context span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.followup-summary-grid strong,
.followup-context strong {
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.followup-context {
  display: grid;
  gap: 8px;
}

.followup-context h3 {
  margin: 0;
  font-size: 15px;
}

.followup-reply {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.followup-reply h3 {
  margin: 0;
  font-size: 15px;
}

.followup-reply-form {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.followup-reply-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.followup-reply-form input,
.followup-reply-form textarea {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--text);
  background: #fff;
  font: inherit;
  font-weight: 400;
  outline: none;
  resize: vertical;
}

.followup-reply-form input:focus,
.followup-reply-form textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 111, 163, .1);
}

.followup-reply-form .button {
  justify-self: start;
}

.followup-reply-status {
  margin: 0;
  color: var(--red);
  font-size: 12px;
}

.record-list {
  max-height: min(64vh, 720px);
  display: grid;
  gap: 10px;
  overflow: auto;
}

.record-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.record-card.active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.record-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.record-card-top span,
.record-card p {
  color: var(--muted);
}

.record-card p {
  margin: 0;
  line-height: 1.55;
}

.record-card button {
  width: fit-content;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  background: #fff;
  cursor: pointer;
  font-weight: 700;
}

.record-detail {
  display: grid;
  gap: 12px;
}

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

.record-summary-grid article,
.record-notes,
.record-task-list article {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.record-summary-grid span,
.record-task-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.record-summary-grid strong,
.record-task-list strong {
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.record-notes h3,
.record-task-list h3 {
  margin: 0;
  font-size: 15px;
}

.record-notes p,
.record-task-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.record-task-list {
  display: grid;
  gap: 8px;
}

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

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 12px;
  }

  .side-nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
  }

  .sidebar-card {
    display: none;
  }

  .workspace {
    width: 100%;
  }

  .dashboard-grid,
  .split-grid,
  .priority-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    flex: 0 1 auto;
    width: 100%;
  }

  .doctor-session {
    align-self: flex-start;
  }

  .search input {
    width: 100%;
  }

  .search select,
  .scope-select {
    width: 100%;
  }

  .content-grid,
  .metrics-grid,
  .plan-grid,
  .detail-grid,
  .prescription-summary-grid,
  .followup-summary-grid,
  .patient-insights,
  .patient-pool-tools,
  .priority-grid,
  .split-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .reminders-card {
    grid-column: auto;
  }

  .patient-pool-tools p {
    justify-content: flex-start;
    text-align: left;
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 12px;
  }

  .brand span:last-child {
    min-width: 132px;
  }

  .sidebar {
    gap: 12px;
  }

  .side-nav {
    grid-auto-flow: row;
    width: 100%;
  }

  .side-nav a {
    min-height: 38px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .metrics-grid {
    gap: 10px;
  }

  .table-header {
    display: none;
  }

  .table-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
  }

  .panel-head {
    align-items: start;
    flex-direction: column;
  }

  .segmented {
    width: 100%;
  }

  .segmented button {
    flex: 1;
  }

  .patient-table {
    border-radius: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
