@font-face {
  font-family: "VitaLoop Display";
  src: url("/fonts/vitaloop-display.woff2") format("woff2-variations");
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
}

:root {
  --ink: #17211d;
  --muted: #5d6c65;
  --line: #cbd7d1;
  --line-strong: #9db2a8;
  --surface: #ffffff;
  --canvas: #f5f7f3;
  --canvas-deep: #ebefea;
  --green: #0e5546;
  --green-strong: #0a4237;
  --green-soft: #e7f1ec;
  --blue: #2e6175;
  --red: #ad3d43;
  --red-soft: #f9e8e8;
  --yellow: #815509;
  --yellow-soft: #fff2d5;
  --shadow: 0 16px 36px rgba(28, 48, 40, 0.10);
  --focus: 0 0 0 3px rgba(14, 85, 70, 0.20);
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
h1, h2, h3,
.brand strong,
.modal-header h2,
.title {
  font-family: "VitaLoop Display", "Songti SC", "Noto Serif CJK SC", "STSong", Georgia, serif;
  font-weight: 700;
}
::selection { color: white; background: var(--green); }
* { scrollbar-color: var(--line-strong) var(--canvas-deep); scrollbar-width: thin; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--canvas-deep); }
*::-webkit-scrollbar-thumb { border: 2px solid var(--canvas-deep); border-radius: 999px; background: var(--line-strong); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible,
summary:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

.topbar {
  min-height: 68px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-menu-button {
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}
.topbar-menu-button span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 2px 0;
  border-radius: 99px;
  background: var(--ink);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  min-width: 196px;
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
  background: var(--green);
  box-shadow: 0 8px 18px rgba(14, 85, 70, .20);
}
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: -.01em; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 11px; }
.role-switcher {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--canvas);
}
.role-switcher button {
  padding: 7px 13px;
  color: var(--muted);
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-weight: 650;
}
.role-switcher button.active { color: white; background: var(--green); }
.ghost-button { margin-left: auto; padding: 8px 13px; color: var(--muted); border: 1px solid var(--line); background: white; border-radius: 9px; }
.portal-label { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 700; }
.portal-label:empty { display: none; }

.app-shell { max-width: 1480px; margin: 0 auto; padding: 28px 32px 44px; }
.site-footer {
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 32px 32px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
}
.portal-home { max-width: 1040px; margin: 60px auto; }
.portal-home > div:first-child { max-width: 680px; margin-bottom: 28px; }
.portal-home h1 { margin: 8px 0; font-size: 40px; }
.portal-home p { color: var(--muted); line-height: 1.65; }
.portal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.portal-card { padding: 24px; color: inherit; text-decoration: none; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: none; transition: .2s ease; }
.portal-card:hover { transform: translateY(-2px); border-color: #b9dfcf; }
.portal-card h2 { margin: 18px 0 8px; }
.portal-card p { margin: 0; font-size: 13px; }
.portal-card.subdued { background: transparent; box-shadow: none; }
.login-shell { display: grid; place-items: center; min-height: calc(100vh - 168px); }
.login-card { width: min(440px, 100%); }
.login-card h1 { margin: 10px 0 8px; font-size: 28px; }
.login-card p { margin: 0 0 18px; }
.login-card input { width: 100%; margin: 16px 0 12px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 10px; outline: none; }
.login-card input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.login-card button { width: 100%; }
.login-card .meta { margin-top: 14px; }
.page-header { margin-bottom: 22px; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.page-header h1 { max-width: 22ch; margin: 0 0 6px; font-size: clamp(27px, 3vw, 36px); line-height: 1.15; letter-spacing: -.025em; text-wrap: balance; }
.page-header p { max-width: 72ch; margin: 0; color: var(--muted); line-height: 1.65; }
.advisor-header-actions { display: flex; align-items: center; gap: 10px; }
.eyebrow { display: none; }
.grid { display: grid; gap: 20px; }
.grid.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.grid.two { grid-template-columns: 1.25fr .75fr; }
.grid.two.advisor-layout { grid-template-columns: .75fr 1.25fr; }
.work-menu {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}
.work-menu-card {
  position: relative;
  min-height: 118px;
  padding: 20px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: none;
  transition: .18s ease;
}
.work-menu-card:hover {
  transform: translateY(-1px);
  border-color: #acd8c8;
}
.work-menu-card.active,
.work-menu-card.urgent.active {
  color: white;
  border-color: transparent;
  background: var(--green);
}
.work-menu-card span,
.work-menu-card small {
  display: block;
  color: var(--muted);
  font-weight: 700;
}
.work-menu-card strong {
  display: block;
  margin: 16px 0 12px;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}
.work-menu-card.active span,
.work-menu-card.active strong,
.work-menu-card.active small {
  color: rgba(255,255,255,.88);
}
.work-menu-card .menu-bubble {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  place-items: center;
  color: white;
  border-radius: 999px;
  background: var(--red);
  font-size: 12px;
}
.work-menu-card:not(.active) .menu-bubble {
  box-shadow: 0 0 0 4px white;
}
.card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: none;
  min-width: 0;
  overflow-wrap: anywhere;
}
.card h2 { margin: 0 0 14px; font-size: 18px; line-height: 1.25; letter-spacing: -.012em; }
.card h3 { margin: 0 0 6px; font-size: 15px; }
.card p { color: var(--muted); line-height: 1.65; }
.grid.stats > .card {
  min-height: 108px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
}
.grid.stats > .card:last-child { border-right: 0; }
.stat { min-height: 108px; }
.stat strong { display: block; margin: 9px 0 4px; font-size: 27px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.accent { color: white; background: var(--green); border: 0; }
.stat.accent span { color: rgba(255,255,255,.76); }
.stat.mini { min-height: 88px; padding: 14px; box-shadow: none; }
.stat.mini strong { font-size: 18px; }
.finance-stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; margin: 12px 0 0 !important; gap: 10px !important; }

.banner {
  margin-bottom: 20px;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  border: 1px solid #b9dfcf;
  border-radius: 13px;
  background: var(--green-soft);
}
.banner.warning { border-color: #edd7a0; background: var(--yellow-soft); }
.banner strong { display: block; margin-bottom: 4px; }
.banner p { margin: 0; color: var(--muted); font-size: 13px; }
.primary, .secondary, .danger {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 10px 15px;
  font-weight: 700;
  transition: color .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.primary { color: white; background: var(--green); }
.primary:hover { background: var(--green-strong); transform: translateY(-1px); }
.secondary { color: var(--green); border-color: #b8cec4; background: #f2f7f4; }
.secondary:hover { border-color: var(--green); background: var(--green-soft); }
.danger { color: var(--red); border-color: #e9c4c6; background: var(--red-soft); }
.danger:hover { border-color: var(--red); }
.small { padding: 7px 10px; font-size: 12px; }

.list { display: grid; gap: 12px; }
.list-item {
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  min-width: 0;
  overflow-wrap: anywhere;
}
[hidden] { display: none !important; }
.list-item.row { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.doctor-admin-item { display: grid; gap: 12px; }
.doctor-admin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.doctor-edit-details { padding-top: 10px; border-top: 1px solid var(--line); }
.doctor-edit-details summary { color: var(--green); font-weight: 800; cursor: pointer; }
.doctor-edit-details .form { margin-top: 12px; }
.meta { color: var(--muted); font-size: 12px; line-height: 1.6; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; font-size: 11px; font-weight: 750; border-radius: 999px; white-space: nowrap; }
.badge.green { color: var(--green); background: var(--green-soft); }
.badge.red { color: var(--red); background: var(--red-soft); }
.badge.yellow { color: var(--yellow); background: var(--yellow-soft); }
.badge.gray { color: var(--muted); background: var(--canvas); }
.disease-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.integration-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.metric { padding: 14px; border-radius: 12px; background: var(--canvas); }
.metric strong { display: block; font-size: 22px; margin: 7px 0 3px; }
.metric small { color: var(--muted); }
.consent-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
.consent-row + .consent-row { padding-top: 13px; border-top: 1px solid var(--line); }
.consent-actions { display: flex; gap: 7px; }
.form { display: grid; gap: 10px; }
.form input, .form textarea, .form select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 11px 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: white;
}
.form textarea { min-height: 100px; resize: vertical; }
.form input[type="checkbox"] { width: auto; }
.form input:focus, .form textarea:focus, .form select:focus { border-color: var(--green); box-shadow: var(--focus); }
.compact-form { padding-top: 12px; border-top: 1px solid var(--line); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.empty { padding: 30px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 11px; background: var(--canvas); }
.loading { padding: 80px; text-align: center; color: var(--muted); }
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 13px 17px;
  max-width: 360px;
  color: white;
  background: var(--ink);
  border-radius: 11px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }
.progress { height: 7px; overflow: hidden; border-radius: 99px; background: var(--line); }
.progress > span { height: 100%; display: block; border-radius: inherit; background: var(--green); }
.notice { padding: 12px; color: var(--yellow); font-size: 12px; line-height: 1.6; border-radius: 10px; background: var(--yellow-soft); }
.boundary-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.boundary-columns > div { padding: 14px; border-radius: 12px; background: var(--canvas); }
.boundary-columns ul { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.boundary-title { font-size: 13px; }
.boundary-title.allowed { color: var(--green); }
.boundary-title.prohibited { color: var(--red); }
.patient-search {
  width: 100%;
  margin: 14px 0 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  outline: none;
  background: white;
}
.patient-search:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.patient-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}
.patient-list-row.active { border-color: #9fd6c2; background: #f0fdfa; }
.patient-link { display: block; min-width: 0; color: inherit; text-decoration: none; }
.patient-link:hover h3 { color: var(--green); }
.patient-remark-button { white-space: nowrap; }
.sidebar-heading-actions { display: flex; align-items: center; gap: 8px; }
.sidebar-close-button { display: none; }
.duplicate-warning {
  margin: 8px 0;
  padding: 8px 10px;
  color: var(--yellow);
  font-size: 12px;
  line-height: 1.5;
  border-radius: 10px;
  background: var(--yellow-soft);
}
.compact-empty { padding: 18px; }
.ai-card-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ai-card-heading h2 { margin-top: 6px; }
.quick-prompts { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.ai-answer { margin-top: 16px; padding: 16px; border: 1px solid #b9dfcf; border-radius: 13px; background: var(--green-soft); }
.ai-answer p { color: var(--ink); white-space: pre-wrap; }
.ai-history { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.record-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.record-heading > div { min-width: 0; }
.record-content { margin: 10px 0 0; color: var(--ink) !important; white-space: pre-wrap; }
.record-table-wrap { max-width: 100%; max-height: 420px; overflow: auto; scrollbar-gutter: stable; scrollbar-color: #a9c8bb var(--canvas); scrollbar-width: thin; border: 1px solid var(--line); border-radius: 12px; }
.record-table-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.record-table-wrap::-webkit-scrollbar-track { background: var(--canvas); border-radius: 99px; }
.record-table-wrap::-webkit-scrollbar-thumb { background: #a9c8bb; border: 2px solid var(--canvas); border-radius: 99px; }
.record-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.record-table th, .record-table td { min-width: 132px; padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); white-space: nowrap; background: white; }
.record-table th { position: sticky; top: 0; z-index: 2; color: var(--muted); font-size: 11px; background: var(--canvas); }
.record-table th small { display: block; margin-top: 3px; color: var(--muted); font-weight: 400; }
.record-table .sticky-date { position: sticky; left: 0; z-index: 1; min-width: 138px; border-right: 1px solid #cddbd4; background: white; box-shadow: 5px 0 10px rgba(28, 61, 48, .04); }
.record-table thead .sticky-date { z-index: 3; background: var(--canvas); }
.record-table tr:last-child td { border-bottom: 0; }
.record-table th:last-child, .record-table td:last-child { border-right: 0; }
.metric-missing { color: var(--muted); }
.timeline { display: grid; gap: 0; }
.timeline-item { position: relative; display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding-bottom: 18px; }
.timeline-item:not(:last-child)::before { content: ""; position: absolute; left: 6px; top: 12px; bottom: 0; width: 2px; background: var(--line); }
.timeline-dot { position: relative; z-index: 1; width: 14px; height: 14px; margin-top: 2px; border: 3px solid white; border-radius: 50%; box-shadow: 0 0 0 1px var(--line); background: var(--green); }
.timeline-dot.yellow { background: #d9a52e; }
.timeline-dot.red { background: var(--red); }
.timeline-item p { margin: 5px 0 0; color: var(--ink); font-size: 13px; }
.archive-browser h3 { margin: 18px 0 10px; }
.archive-section { margin-top: 20px; padding-top: 4px; border-top: 1px solid var(--line); }

.doctor-workspace {
  display: grid;
  grid-template-columns: minmax(214px, 250px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.doctor-sidebar {
  position: sticky;
  top: 88px;
  display: grid;
  gap: 12px;
  min-width: 0;
}
.sidebar-backdrop { display: none; }
.navigation-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-color: var(--line-strong);
  background: var(--canvas-deep);
}
.side-menu {
  display: grid;
  gap: 8px;
}
.side-menu-button {
  position: relative;
  width: 100%;
  min-width: 0;
  padding: 11px 36px 11px 12px;
  text-align: left;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  transition: .18s ease;
}
.side-menu-button span,
.side-menu-button small {
  display: block;
  min-width: 0;
}
.side-menu-button span {
  font-size: 14px;
  font-weight: 800;
}
.side-menu-button small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}
.side-menu-button:hover {
  border-color: var(--line-strong);
  background: var(--green-soft);
}
.side-menu-button.active {
  color: white;
  border-color: var(--green);
  background: var(--green);
}
.side-menu-button.active small {
  color: rgba(255,255,255,.78);
}
.side-menu-button .menu-bubble {
  position: absolute;
  top: 9px;
  right: 10px;
  display: grid;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  place-items: center;
  color: white;
  border-radius: 999px;
  background: var(--red);
  font-size: 11px;
  font-weight: 800;
}
.side-menu-button.active .menu-bubble {
  background: rgba(255,255,255,.2);
}
.doctor-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.task-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.focus-section {
  display: grid;
  gap: 12px;
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}
.section-title h2 { margin: 0; font-size: 23px; letter-spacing: -.018em; }
.task-card { padding: 18px; border-color: var(--line-strong); }
.task-card h2 { margin-bottom: 0; font-size: 18px; }
.compact-notice { margin: 0; }
.task-action { margin-top: 10px; }
.task-preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.voice-player {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--canvas);
}
.voice-player audio { display: block; width: 100%; }
.voice-player.missing { display: grid; gap: 8px; }
.finance-rows {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}
.finance-rows.wide { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.finance-rows > div,
.finance-row {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}
.finance-rows > div span,
.finance-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.finance-rows > div strong,
.finance-row strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
  white-space: nowrap;
}
.source-preview {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--canvas);
}
.source-preview summary {
  color: var(--green);
  cursor: pointer;
  font-weight: 700;
}
.draft-review-form { margin-top: 12px; }
.draft-review-form,
.draft-item,
.draft-metrics {
  min-width: 0;
}
.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.draft-metrics {
  display: grid;
  gap: 10px;
}
.draft-metric-row {
  display: grid;
  grid-template-columns: 72px minmax(96px, 1.2fr) minmax(72px, .8fr) minmax(70px, .7fr) minmax(108px, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--canvas);
}
.draft-metric-row input { min-width: 0; }
.metric-include {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.metric-include input { width: auto; }
.compact-empty { padding: 18px; }
.patient-overview-card .metric-grid { margin-top: 10px; }
.patient-empty-card .empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1.7;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 34, 28, .48);
}
.modal-card {
  position: relative;
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: white;
  box-shadow: 0 24px 80px rgba(16, 34, 28, .22);
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: var(--canvas);
  font-size: 22px;
  line-height: 1;
}
.modal-header { padding-right: 40px; margin-bottom: 18px; }
.modal-header h2 { margin: 6px 0; font-size: 22px; }
.modal-header p { margin: 0; color: var(--muted); line-height: 1.6; }
.modal-form { gap: 12px; }
.modal-section { margin-bottom: 14px; }
.large-textarea { min-height: 180px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}
.modal-draft .draft-item {
  padding: 0;
  border: 0;
}
.modal-draft .source-preview { margin-bottom: 12px; }
.patient-detail-modal {
  display: grid;
  gap: 14px;
}
.patient-detail-modal > .card {
  box-shadow: none;
}
.patient-detail-actions {
  position: sticky;
  bottom: -24px;
  margin-top: 10px;
  padding: 14px 0 0;
  background: linear-gradient(to top, white 70%, rgba(255,255,255,0));
}
.checkline {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  color: var(--yellow);
  border-radius: 12px;
  background: var(--yellow-soft);
  font-size: 13px;
  line-height: 1.6;
}
.checkline input { margin-top: 3px; }

.advisor-messaging-shell {
  padding: 0;
  overflow: hidden;
}
.advisor-messaging-shell > .record-heading {
  padding: 20px 20px 0;
}
.advisor-message-boundary {
  margin: 0 20px 18px;
  padding: 10px 12px;
  color: var(--yellow);
  border: 1px solid #e8cf99;
  border-radius: 9px;
  background: var(--yellow-soft);
  font-size: 12px;
  line-height: 1.55;
}
.advisor-messaging-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  min-height: 610px;
  border-top: 1px solid var(--line);
}
.advisor-conversation-list {
  border-right: 1px solid var(--line);
  background: var(--canvas);
}
.advisor-conversation-item {
  position: relative;
  display: grid;
  width: 100%;
  padding: 15px 44px 15px 16px;
  gap: 5px;
  color: var(--ink);
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}
.advisor-conversation-item:hover { background: var(--green-soft); }
.advisor-conversation-item.active {
  color: white;
  background: var(--green);
}
.advisor-conversation-item span { display: grid; gap: 3px; }
.advisor-conversation-item code,
.advisor-conversation-item small { color: var(--muted); font-size: 11px; }
.advisor-conversation-item.active code,
.advisor-conversation-item.active small { color: rgba(255, 255, 255, .74); }
.advisor-conversation-item b {
  position: absolute;
  top: 16px;
  right: 14px;
  display: grid;
  min-width: 23px;
  height: 23px;
  padding: 0 6px;
  place-items: center;
  color: white;
  border-radius: 999px;
  background: var(--red);
  font-size: 11px;
}
.advisor-conversation-pane {
  display: flex;
  min-width: 0;
  flex-direction: column;
  background: white;
}
.advisor-conversation-pane > .empty { margin: auto; max-width: 52ch; }
.advisor-conversation-identity {
  display: flex;
  min-height: 66px;
  padding: 13px 18px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}
.advisor-conversation-identity span { display: block; color: var(--muted); font-size: 11px; }
.advisor-conversation-identity strong { font-size: 16px; }
.advisor-conversation-identity code { color: var(--muted); font-size: 11px; }
.advisor-message-history { margin: 0; }
.advisor-message-scroll {
  height: 400px;
  padding: 20px;
  overflow-y: auto;
  background: var(--canvas);
}
.advisor-load-older {
  display: block;
  margin: 0 auto 18px;
}
.advisor-message-row {
  width: min(78%, 620px);
  margin: 0 0 18px;
}
.advisor-message-row.advisor-message-own { margin-left: auto; }
.advisor-message-meta { margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.advisor-message-own .advisor-message-meta { text-align: right; }
.advisor-message-content {
  padding: 11px 13px;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 3px 13px 13px;
  background: white;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.advisor-message-own .advisor-message-content {
  color: white;
  border-color: var(--green);
  border-radius: 13px 3px 13px 13px;
  background: var(--green);
}
.advisor-message-content.advisor-message-purged {
  color: var(--muted);
  border-style: dashed;
  border-color: var(--line-strong);
  background: var(--canvas-deep);
  font-size: 12px;
}
.advisor-message-state {
  display: flex;
  min-height: 25px;
  margin-top: 6px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}
.advisor-message-state label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.advisor-archive-actions {
  display: flex;
  min-height: 56px;
  padding: 10px 16px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.advisor-archive-actions span { color: var(--muted); font-size: 11px; }
.advisor-message-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 14px 16px;
  align-items: end;
  gap: 10px;
}
.advisor-message-composer textarea {
  min-height: 76px;
  max-height: 160px;
  padding: 10px 12px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
}
.advisor-message-composer textarea:focus { border-color: var(--green); box-shadow: var(--focus); }
.advisor-message-composer button { min-width: 94px; }

@media (max-width: 900px) {
  .topbar { height: auto; min-height: 62px; padding: 10px 14px; gap: 10px; flex-wrap: wrap; }
  body[data-portal="advisor"] .topbar-menu-button { display: grid; }
  .brand { flex: 1; min-width: 0; }
  .brand strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .brand small { display: none; }
  .ghost-button { display: none; }
  .role-switcher { order: 3; width: 100%; }
  .role-switcher button { flex: 1; }
  .app-shell { width: 100%; padding: 16px 14px 22px; overflow-x: hidden; }
  .grid.stats, .grid.two, .grid.two.advisor-layout { grid-template-columns: 1fr; }
  .grid.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .work-menu {
    display: flex;
    gap: 10px;
    margin: 0 -14px 16px;
    padding: 0 14px 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .work-menu-card {
    flex: 0 0 170px;
    min-height: 96px;
    padding: 14px;
    border-radius: 16px;
    scroll-snap-align: start;
    box-shadow: none;
  }
  .work-menu-card strong {
    margin: 10px 0 8px;
    font-size: 24px;
  }
  .work-menu-card span,
  .work-menu-card small { font-size: 12px; }
  .work-menu-card .menu-bubble { top: 10px; right: 10px; }
  .page-header { align-items: flex-start; flex-direction: column; gap: 12px; margin-bottom: 16px; }
  .page-header h1 { font-size: 24px; line-height: 1.25; }
  .page-header p { font-size: 13px; line-height: 1.6; }
  .advisor-header-actions { width: 100%; justify-content: flex-start; }
  .metric-grid { grid-template-columns: 1fr; }
  .integration-grid { grid-template-columns: 1fr; }
  .boundary-columns { grid-template-columns: 1fr; }
  .portal-grid { grid-template-columns: 1fr; }
  .portal-label { display: none; }
  .card { padding: 16px; border-radius: 16px; }
  .doctor-workspace { display: block; }
  .doctor-main { gap: 14px; }
  .doctor-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 35;
    display: block;
    width: min(76vw, 292px);
    padding: 10px;
    overflow-y: auto;
    background: var(--canvas);
    box-shadow: 22px 0 60px rgba(16, 34, 28, .22);
    transform: translateX(-105%);
    transition: transform .22s ease;
    overscroll-behavior: contain;
  }
  .doctor-workspace.sidebar-open .doctor-sidebar { transform: translateX(0); }
  .doctor-workspace.sidebar-open .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 34;
    display: block;
    width: 100%;
    min-height: 100vh;
    padding: 0;
    border: 0;
    background: rgba(16, 34, 28, .36);
  }
  .navigation-card {
    min-height: calc(100vh - 20px);
    padding: 14px;
    gap: 8px;
    box-shadow: none;
  }
  .sidebar-heading { align-items: flex-start; }
  .sidebar-heading-actions { flex-direction: column; align-items: flex-end; }
  .sidebar-close-button { display: inline-flex; }
  .navigation-card .record-heading {
    gap: 6px;
    margin-bottom: 2px;
  }
  .navigation-card h2 {
    margin-bottom: 4px;
    font-size: 16px;
  }
  .navigation-card .eyebrow {
    font-size: 10px;
    letter-spacing: .9px;
  }
  .side-menu { gap: 7px; }
  .side-menu-button {
    padding: 9px 34px 9px 11px;
    border-radius: 11px;
  }
  .side-menu-button span { font-size: 13px; }
  .side-menu-button small { font-size: 10.5px; }
  .side-menu-button .menu-bubble {
    top: 8px;
    right: 9px;
    min-width: 20px;
    height: 20px;
    font-size: 10px;
  }
  .task-grid { grid-template-columns: 1fr; gap: 12px; }
  .task-card { padding: 16px; }
  .list-item.row,
  .record-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .list-item.row { display: flex; }
  .record-heading .badge { align-self: flex-start; }
  .finance-rows.wide,
  .finance-stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .finance-rows > div strong,
  .finance-row strong { font-size: 18px; white-space: normal; }
  .draft-metric-row { grid-template-columns: 1fr; }
  .metric-include { white-space: normal; }
  .record-table-wrap { max-height: 360px; }
  .modal-backdrop { padding: 10px; align-items: end; }
  .modal-card {
    width: 100%;
    max-height: calc(100vh - 20px);
    padding: 18px;
    border-radius: 15px 15px 0 0;
  }
  .patient-detail-modal > .card { padding: 14px; }
  .patient-detail-actions { bottom: -18px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions button { width: 100%; }
  .patient-list-row { grid-template-columns: 1fr; }
  .patient-remark-button { justify-self: start; }
  .card.advisor-messaging-shell { padding: 0; }
  .advisor-messaging-shell > .record-heading { padding: 16px 16px 0; }
  .advisor-message-boundary { margin: 0 16px 14px; }
  .advisor-messaging-layout { grid-template-columns: 1fr; min-height: 0; }
  .advisor-conversation-list {
    display: flex;
    max-height: 180px;
    overflow: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .advisor-conversation-item {
    flex: 0 0 210px;
    min-height: 56px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }
  .advisor-conversation-identity { align-items: flex-start; flex-direction: column; }
  .advisor-message-scroll { height: 42vh; min-height: 300px; padding: 16px; }
  .advisor-message-row { width: 88%; }
  .advisor-archive-actions { align-items: stretch; flex-direction: column; }
  .advisor-message-composer { grid-template-columns: 1fr; }
  .advisor-load-older,
  .advisor-archive-actions button,
  .advisor-message-composer button { min-height: 44px; }
  .advisor-message-state label { min-height: 44px; padding: 6px 0; }
  .advisor-message-composer textarea { font-size: 16px; }
  .advisor-message-composer button { width: 100%; }
  .toast { left: 14px; right: 14px; bottom: 14px; max-width: none; }
}

@media (max-width: 520px) {
  .grid.stats,
  .finance-rows.wide,
  .finance-stats { grid-template-columns: 1fr !important; }
  .work-menu-card { flex-basis: 156px; }
  .doctor-sidebar { width: min(74vw, 276px); }
}

@media (min-width: 901px) and (max-width: 1180px) {
  .doctor-workspace,
  .task-grid,
  .finance-rows.wide {
    grid-template-columns: 1fr;
  }
  .work-menu { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doctor-sidebar { position: static; }
  .draft-metric-row { grid-template-columns: 1fr 1fr; }
  .metric-include { grid-column: 1 / -1; }
}

/* Impeccable direction: care-control ledger */
.patient-console,
.advisor-console,
.admin-console { min-width: 0; }

.advisor-console .page-header,
.admin-console .page-header {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-strong);
}

.advisor-console .page-header h1,
.admin-console .page-header h1 { max-width: none; }

.notice {
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--canvas);
}

.banner.warning,
.checkline,
.duplicate-warning {
  color: var(--yellow);
  border-color: #e8cf99;
  background: var(--yellow-soft);
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: currentColor;
}

.task-card > .list {
  gap: 0;
  margin-top: 12px !important;
  border-top: 1px solid var(--line);
}

.task-card > .list > .list-item {
  padding: 15px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.task-card > .list > .list-item:last-child { border-bottom: 0; }

.task-card > .list > .empty {
  margin-top: 14px;
  border: 0;
}

.patient-list-row.active {
  border-color: var(--green);
  background: var(--green-soft);
}

.patient-overview-card {
  border-color: var(--green);
  background: #fbfdfb;
}

.patient-overview-card .record-heading {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.record-table-wrap {
  border-color: var(--line-strong);
  border-radius: 10px;
  scrollbar-color: var(--line-strong) var(--canvas-deep);
}

.record-table th {
  color: var(--ink);
  background: var(--canvas-deep);
  font-weight: 750;
}

.record-table th,
.record-table td { font-variant-numeric: tabular-nums; }

.metric strong,
.metric-value,
.finance-row strong,
.finance-rows strong { font-variant-numeric: tabular-nums; }

.integration-grid .list-item {
  border-radius: 9px;
  background: var(--canvas);
}

.admin-console > .card,
.admin-console > .grid.two,
.admin-console > .banner { margin-bottom: 18px; }

.admin-overview-ledger {
  display: grid;
  grid-template-columns: minmax(210px, .56fr) minmax(0, 1.44fr);
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid var(--green);
  border-radius: 12px;
  background: var(--surface);
}

.admin-ledger-rail {
  display: flex;
  min-height: 184px;
  padding: 24px;
  flex-direction: column;
  justify-content: flex-end;
  color: white;
  background: var(--green);
}

.admin-ledger-rail span {
  margin-bottom: auto;
  color: rgba(255, 255, 255, .66);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}

.admin-ledger-rail strong {
  margin-bottom: 7px;
  font-family: "VitaLoop Display", "Songti SC", "Noto Serif CJK SC", "STSong", Georgia, serif;
  font-size: 23px;
  line-height: 1.2;
}

.admin-ledger-rail small {
  color: rgba(255, 255, 255, .74);
  line-height: 1.55;
}

.admin-ledger-rows {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.admin-ledger-rows > div {
  display: flex;
  min-width: 0;
  padding: 20px 22px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.admin-ledger-rows > div:nth-last-child(-n + 2) { border-bottom: 0; }
.admin-ledger-rows dt { color: var(--ink); font-weight: 750; }
.admin-ledger-rows dt small { display: block; margin-top: 4px; color: var(--muted); font-weight: 400; }
.admin-ledger-rows dd {
  margin: 0;
  color: var(--green);
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.identity-check {
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 16px 18px;
  color: white;
  border-radius: 9px;
  background: var(--green);
}

.identity-check span {
  grid-column: 1 / -1;
  margin-bottom: 3px;
  color: rgba(255, 255, 255, .7);
  font-size: 11px;
  font-weight: 750;
}

.identity-check strong { font-size: 18px; }
.identity-check code {
  align-self: center;
  color: rgba(255, 255, 255, .82);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.signoff-ledger {
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.signoff-ledger > div {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.signoff-ledger > div:last-child { border-bottom: 0; }
.signoff-ledger span { color: var(--muted); font-size: 12px; }
.signoff-ledger p, .signoff-ledger strong { margin: 0; color: var(--ink); line-height: 1.55; }
.signoff-ledger .danger-text { color: var(--red); }
.signoff-ledger .attention-text { color: var(--yellow); }
.identity-confirmation { margin-top: 2px; }
.signoff-form .field-label { margin-top: 2px; }

.admin-console .grid.two > .card {
  position: sticky;
  top: 88px;
  align-self: start;
}

.modal-close:hover { color: white; background: var(--green); }

.settlement-history-heading {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.settlement-history-heading h3 { margin: 0; font-size: 16px; }
.settlement-history {
  border-top: 1px solid var(--line);
}
.settlement-history-row {
  display: flex;
  padding: 14px 0;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}
.settlement-history-row:last-child { border-bottom: 0; }
.settlement-history-row strong { font-variant-numeric: tabular-nums; }

.finance-account-panel { margin-bottom: 20px; }
.finance-account-list { margin-top: 16px; border-top: 1px solid var(--line); }
.finance-account-row { padding: 18px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.finance-account-row:last-child { border-bottom: 0; }
.finance-account-row .form { margin-top: 13px; }

.finance-console { min-width: 0; }
.finance-identity-bar {
  display: flex;
  min-height: 152px;
  padding: 26px 28px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  color: white;
  border-radius: 12px 12px 0 0;
  background: var(--green);
}
.finance-identity-bar h1 { margin: 0 0 8px; font-size: clamp(27px, 3vw, 36px); letter-spacing: -.025em; }
.finance-identity-bar p { max-width: 74ch; margin: 0; color: rgba(255, 255, 255, .76); }
.finance-identity-bar .badge { color: white; border-color: rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .1); }

.finance-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
  border: 1px solid var(--line-strong);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background: var(--surface);
}
.finance-overview > div {
  min-width: 0;
  padding: 19px 22px;
  border-right: 1px solid var(--line);
}
.finance-overview > div:last-child { border-right: 0; }
.finance-overview span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.finance-overview strong { color: var(--green); font-size: 24px; font-variant-numeric: tabular-nums; }

.finance-ledger { padding: 0; overflow: hidden; }
.finance-ledger-heading,
.finance-settlement-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.finance-ledger-heading { padding: 22px 24px; border-bottom: 1px solid var(--line-strong); }
.finance-ledger-heading h2,
.finance-settlement-heading h3 { margin: 0 0 5px; }
.finance-ledger-heading p,
.finance-settlement-heading p { margin: 0; color: var(--muted); }
.finance-settlement-row { padding: 22px 24px; border-bottom: 1px solid var(--line-strong); }
.finance-settlement-row:last-child { border-bottom: 0; }
.payout-settings { margin: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.payout-method-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 0; }
.payout-method-row + .payout-method-row { border-top: 1px solid var(--line); }
.payout-method-row details { min-width: min(100%, 360px); text-align: right; }
.payout-method-row details[open] { width: min(100%, 420px); }
.payout-method-row summary { display: inline-flex; min-height: 44px; align-items: center; color: var(--green); cursor: pointer; font-weight: 650; }
.payout-method-row form { margin-top: 12px; text-align: left; }
.payout-qr-wrap { display: grid; justify-items: center; gap: 12px; padding: 8px 0 18px; }
.payout-qr-wrap img { width: min(72vw, 320px); aspect-ratio: 1; object-fit: contain; border: 1px solid var(--line); }
.advisor-code-ledger { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.advisor-code-ledger > div { min-width: 0; padding: 18px 20px 18px 0; }
.advisor-code-ledger > div + div { padding-left: 20px; border-left: 1px solid var(--line); }
.advisor-code-ledger span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.advisor-code-ledger code { color: var(--green); font-size: clamp(24px, 4vw, 36px); font-weight: 800; letter-spacing: .04em; overflow-wrap: anywhere; }
.advisor-code-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.advisor-code-modal-value { color: var(--green); font-size: 20px; font-weight: 800; letter-spacing: .04em; }
.advisor-code-download { display: inline-flex; min-height: 44px; align-items: center; text-decoration: none; }
.finance-settlement-closed { background: var(--canvas); }
.finance-settlement-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 17px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.finance-settlement-grid > div { min-width: 0; padding: 13px 15px; border-right: 1px solid var(--line); }
.finance-settlement-grid > div:first-child { padding-left: 0; }
.finance-settlement-grid > div:last-child { padding-right: 0; border-right: 0; }
.finance-settlement-grid span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.finance-settlement-grid strong { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.finance-review-form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.finance-review-form label input { color: var(--ink); font-size: 14px; font-weight: 400; }
.finance-actions { display: flex; justify-content: flex-end; }
.finance-reject-form,
.finance-payment-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-top: 10px; }
.finance-reject-form input,
.finance-payment-form input { width: 100%; }

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

@media (max-width: 900px) {
  body[data-current-role="doctor"] .topbar-menu-button { display: grid; }
  .grid.stats { gap: 0; }
  .grid.stats > .card {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
  .grid.stats > .card:nth-child(2n) { border-right: 0; }
  .grid.stats > .card:nth-last-child(-n + 2) { border-bottom: 0; }
  .advisor-console .page-header,
  .admin-console .page-header { padding-bottom: 14px; }
  .admin-console .grid.two > .card { position: static; }
  .admin-overview-ledger { grid-template-columns: 1fr; }
  .admin-ledger-rail { min-height: 142px; }
  .admin-ledger-rows > div:nth-last-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .admin-ledger-rows > div:nth-child(2n) { border-right: 0; }
  .admin-ledger-rows > div:nth-last-child(-n + 2) { border-bottom: 0; }
  .banner { align-items: stretch; flex-direction: column; }
  .banner > button { width: 100%; }
  .settlement-history-row,
  .finance-identity-bar,
  .finance-ledger-heading,
  .finance-settlement-heading { align-items: flex-start; flex-direction: column; }
  .finance-overview,
  .finance-settlement-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finance-overview > div:nth-child(2) { border-right: 0; }
  .finance-overview > div:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .finance-settlement-grid > div:nth-child(2) { border-right: 0; }
  .finance-settlement-grid > div:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 520px) {
  .grid.stats > .card { border-right: 0; border-bottom: 1px solid var(--line); }
  .grid.stats > .card:nth-last-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .grid.stats > .card:last-child { border-bottom: 0; }
  .admin-ledger-rows { grid-template-columns: 1fr; }
  .admin-ledger-rows > div {
    border-left: 0;
    border-bottom: 1px solid var(--line) !important;
  }
  .admin-ledger-rows > div:last-child { border-bottom: 0 !important; }
  .signoff-ledger > div { grid-template-columns: 1fr; gap: 3px; }
  .finance-identity-bar { min-height: 0; padding: 22px 18px; border-radius: 10px 10px 0 0; }
  .finance-overview,
  .finance-settlement-grid { grid-template-columns: 1fr; }
  .finance-overview > div,
  .finance-overview > div:nth-child(2),
  .finance-settlement-grid > div,
  .finance-settlement-grid > div:nth-child(2) {
    padding: 14px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .finance-overview > div:last-child,
  .finance-settlement-grid > div:last-child { border-bottom: 0; }
  .finance-settlement-row,
  .finance-ledger-heading { padding: 18px 16px; }
  .finance-reject-form,
  .finance-payment-form { grid-template-columns: 1fr; }
  .finance-reject-form button,
  .finance-payment-form button { width: 100%; }
  .payout-method-row { align-items: flex-start; flex-direction: column; }
  .payout-method-row details,
  .payout-method-row details[open] { width: 100%; }
  .advisor-code-ledger { grid-template-columns: 1fr; }
  .advisor-code-ledger > div { padding: 14px 0; }
  .advisor-code-ledger > div + div { padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
  .advisor-code-actions { flex-direction: column; }
  .advisor-code-actions button { width: 100%; min-height: 44px; }
}
