:root {
  --accent: #047857;
  --accent-dark: #065f46;
  --accent-soft: #ecfdf5;
  --ink: #1f2933;
  --muted: #62756d;
  --line: #e2ebe6;
  --surface: #fff;
  --canvas: #f3f4f6;
  --field-background: #f1f5f3;
  --field-border: #879b90;
  --green: #047857;
  --orange: #b27a25;
  accent-color: var(--accent);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
button { color: inherit; }
:focus-visible { outline: 3px solid #059669; outline-offset: 3px; }
::selection { background: #a7f3d0; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 29px; line-height: 1.25; letter-spacing: -1px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 650; letter-spacing: -.2px; }
small { display: block; font-size: 11px; color: var(--muted); line-height: 1.6; }
strong { font-weight: 600; }
.icon { width: 19px; height: 19px; flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--muted); }
.sidebar {
  width: 236px;
  position: fixed;
  inset: 0 auto 0 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 28px 18px 16px;
  z-index: 10;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 720; }
.brand { letter-spacing: -1.1px; padding: 0 12px; }
.brand-accent { color: var(--accent); }
.brand-symbol {
  background: var(--accent); color: #fff; width: 33px; height: 33px;
  border-radius: 10px; display: grid; place-items: center; box-shadow: 0 3px 8px #04785724;
}
.brand-symbol .icon { width: 27px; height: 27px; stroke-width: 3.2; }
.clinic {
  margin: 32px 0 27px; display: flex; gap: 11px; align-items: center;
  padding: 12px; border: 1px solid var(--line); border-radius: 9px;
}
.clinic strong { font-size: 12px; }
.clinic small { font-size: 9px; }
.clinic-icon { color: var(--accent); background: var(--accent-soft); padding: 8px;
  border-radius: 8px; }
.nav-label {
  font-size: 9px; letter-spacing: 1.35px; font-weight: 650;
  color: #a3a4af; display: block; margin: 23px 14px 11px;
}
.nav-label:first-child { margin-top: 0; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px;
  border-radius: 7px; color: #777989; font-size: 12px; margin-bottom: 3px;
}
.nav-item:hover { background: #f0fdf4; color: var(--accent); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item .icon { width: 17px; height: 17px; }
.nav-count {
  font-size: 10px; margin-left: auto; background: #d1fae5;
  padding: 1px 6px; border-radius: 4px;
}
.sidebar-bottom { margin-top: auto; padding-top: 30px; }
.clinic-status { color: #898b98; font-size: 10px; padding: 14px; }
.status-dot { display: inline-block; background: #40ad87; width: 6px; height: 6px; }
.status-dot { border-radius: 50%; margin-right: 8px; }
.user-card { display: flex; gap: 10px; align-items: center; padding: 16px 8px 0; }
.user-card { border-top: 1px solid var(--line); }
.user-card strong { font-size: 11px; }
.user-card small { font-size: 9px; }
.user-card > .icon { margin-left: auto; width: 13px; color: #9fa1ad; }
.avatar {
  width: 35px; height: 35px; display: grid; place-items: center; border-radius: 50%;
  background: #d1fae5; color: var(--accent); font-size: 11px; font-weight: 650; flex-shrink: 0;
}
.workspace { margin-left: 236px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 73px; border-bottom: 1px solid var(--line); background: #fff;
  display: flex; align-items: center; justify-content: space-between; padding: 0 34px;
}
.breadcrumb { display: flex; align-items: center; gap: 16px; font-size: 11px; color: #90929f; }
.breadcrumb strong { color: #565867; font-weight: 500; }
.breadcrumb span { color: #c2c3cc; }
.topbar-right { display: flex; align-items: center; gap: 20px; }
main { padding: 34px; flex: 1; min-width: 0; }
.eyebrow { font-size: 9px; color: #a09bac; font-weight: 650; letter-spacing: 1.6px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.page-heading { margin-bottom: 28px; }
.page-heading h1 { margin: 8px 0; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--accent); background: var(--accent); border-radius: 7px;
  padding: 11px 17px; color: #fff; font-size: 12px; font-weight: 550;
  line-height: 1.3; cursor: pointer; white-space: nowrap; transition: background .15s;
}
.button:hover { background: var(--accent-dark); }
.button .icon { width: 16px; height: 16px; }
.button.secondary { background: #fff; border-color: #e5e5ee; color: #686a79; }
.button.secondary:hover { background: #ecfdf5; border-color: #a7d8c4; }
.button.small { padding: 7px 11px; font-size: 11px; }
.button:disabled { opacity: .42; cursor: default; }
.htmx-request { cursor: progress; }
.button.danger { background: #fff4f4; color: #b85050; border-color: #ebcccc; }
.button.danger:hover { background: #ffe4e4; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 19px; margin-bottom: 28px; }
.metric-card { border: 1px solid var(--line); border-radius: 10px; padding: 20px 23px 19px; }
.metric-card { background: #fff; box-shadow: 0 3px 7px #23263902; }
.metric-top { display: flex; align-items: center; justify-content: space-between; }
.metric-top > span:first-child { color: #858593; font-size: 11px; }
.metric-icon { display: grid; place-items: center; height: 33px; width: 33px; border-radius: 8px; }
.accent { color: var(--accent); background: var(--accent-soft); }
.green { color: var(--green); background: #eaf6f1; }
.orange { color: var(--orange); background: #fbf3e6; }
.metric-icon .icon { width: 17px; height: 17px; }
.metric-value { display: block; font-size: 27px; font-weight: 640; letter-spacing: -.7px; }
.metric-value { margin: 10px 0 12px; font-variant-numeric: tabular-nums; }
.metric-card p { font-size: 10px; color: #8e8f9b; display: flex; align-items: center; gap: 7px; }
.metric-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.panel-heading { padding: 21px 22px; display: flex; align-items: center;
  justify-content: space-between; }
.panel-heading > div { display: flex; align-items: center; gap: 11px; }
.panel-heading h2 { font-size: 13px; }
.count-badge { background: #f0f6f3; color: #9596a2; font-size: 9px; padding: 3px 8px; }
.count-badge { border-radius: 5px; }
.icon-button {
  display: inline-flex; align-items: center; justify-content: center; width: 29px; height: 29px;
  border: 1px solid transparent; border-radius: 5px; color: #9b9caa; background: transparent;
  padding: 5px; cursor: pointer;
}
.icon-button:hover { color: var(--accent); background: var(--accent-soft); }
.icon-button .icon { width: 15px; height: 15px; }
.delete-button:hover { background: #fff0f0; color: #bf5d5d; }
.filters {
  display: flex; align-items: center; flex-wrap: wrap; gap: 9px;
  padding: 0 22px 20px; border-bottom: 1px solid var(--line);
}
.filters input, .filters select { font-size: 11px; height: 35px; padding: 7px 10px; }
.filters select { width: auto; max-width: 170px; }
.search-field { position: relative; flex: 1 1 230px; }
.search-field input { width: 100%; padding-left: 34px; }
.search-field .icon { position: absolute; left: 10px; top: 10px; color: #a8a9b4; }
.search-field .icon { width: 15px; height: 15px; }
.date-filter, .page-size, .sort-order { display: flex; align-items: center; gap: 5px;
  font-size: 10px; }
.date-filter input { width: 125px; }
.page-size select { width: 56px; min-height: 32px; padding: 5px 7px; font-size: 11px; }
.sort-order select { min-width: 105px; }
.table-scroll { width: 100%; overflow-x: auto; scrollbar-width: thin; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 11px; }
.payments-table { min-width: 1110px; }
th { background: transparent; color: var(--ink); font-size: 13px; font-weight: 550; }
th { letter-spacing: .1px; white-space: nowrap; padding: 13px 12px;
  border-top: 2px solid var(--line); border-bottom: 2px solid var(--line); }
th a { display: flex; align-items: center; gap: 5px; }
th a:hover { color: var(--accent); }
.sort-icon { color: #9aafa4; }
td { padding: 10px 12px; border-bottom: 1px solid #edf3ef; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 22px; }
th:last-child, td:last-child { padding-right: 18px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #ecfdf5; }
td strong { font-size: 11px; font-weight: 550; }
td small { font-size: 9px; }
.date-cell { white-space: nowrap; color: #838492; font-size: 10px; }
.procedure-cell { min-width: 180px; max-width: 220px; }
.code { letter-spacing: .4px; color: #a4a1b1; margin-top: 2px; font-variant-numeric: tabular-nums; }
.patient-cell { display: flex; align-items: center; gap: 8px; min-width: 145px; max-width: 190px; }
.small-avatar { height: 27px; width: 27px; background: #ecfdf5; font-size: 8px; }
.patient-cell > span:last-child { font-size: 10px; }
.payer { white-space: nowrap; }
.team-cell { min-width: 138px; }
.team-cell > span { font-size: 10px; }
.team-cell small { font-size: 8px; }
.money { white-space: nowrap; font-size: 10px; font-weight: 600;
  font-variant-numeric: tabular-nums; }
.received { color: var(--green); }
.received small { font-weight: 400; }
.status-badge {
  border-radius: 5px; padding: 4px 7px; display: inline-flex; align-items: center;
  gap: 5px; font-size: 9px; white-space: nowrap;
}
.status-badge > span { background: currentColor; height: 4px; width: 4px; border-radius: 50%; }
.status-badge.paid { color: #047857; background: #ecfdf5; }
.status-badge.pending { color: #b88b3a; background: #fbf5e9; }
.status-badge.partial { color: #0f766e; background: #f0fdfa; }
.status-badge.overpaid { color: #4e85b6; background: #eef5fb; }
.row-actions { display: flex; align-items: center; }
.row-actions .icon-button { width: 25px; height: 26px; }
.row-notes { font-size: 9px; color: #73877c; }
.row-notes summary { cursor: pointer; }
.row-notes p { max-width: 210px; white-space: normal; padding-top: 5px; }
.notes-cell { max-width: 300px; overflow-wrap: anywhere; }
.pagination { padding: 17px 22px; border-top: 1px solid var(--line); display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.pagination { align-items: center; gap: 12px; }
.pagination p, .pagination > span { font-size: 10px; color: #a1a1af; }
.pagination strong { color: #727280; font-weight: 500; }
.pagination-controls { justify-self: end; display: flex; align-items: center; flex-wrap: wrap; gap: 11px; }
.pagination nav { display: flex; align-items: center; gap: 11px; }
.pagination nav > span { font-size: 10px; color: #8c8c9a; }
.table-hint { display: flex; align-items: center; gap: 8px; color: #a2a1af; }
.table-hint { font-size: 10px; padding: 16px 2px; }
.table-hint .icon { width: 13px; height: 13px; color: #8ca397; }
.page-footer { display: flex; justify-content: space-between; padding: 20px 34px; }
.page-footer { color: #b0aebc; font-size: 9px; }
.empty-state { display: grid; justify-items: center; padding: 60px 15px; gap: 12px;
  color: #75897e; }
.empty-state .icon { width: 30px; height: 30px; }
.empty-state h3 { font-size: 14px; color: #52665b; }
.empty-state p { font-size: 12px; }
.notice { background: #edf7f2; border: 1px solid #d9eee1; color: #3c8966; }
.notice { border-radius: 7px; padding: 13px 17px; font-size: 12px; margin-bottom: 20px; }
.notice .icon { width: 15px; height: 15px; margin-right: 8px; }
.notice a { text-decoration: underline; margin-left: 8px; }
.error-notice { background: #fff0f0; color: #b85151; border-color: #f0d3d3; }
.form-panel { padding: 28px; width: 100%; max-width: 760px; min-width: 0; margin: 0 auto 22px; }
.form-panel h2 { margin-bottom: 14px; }
.form-panel p { margin-bottom: 20px; font-size: 12px; }
.form-panel label { display: block; margin-bottom: 18px; color: var(--ink); font-size: 12px; }
.form-panel .field-label { display: block; margin-bottom: 6px; font-weight: 550; }
input, textarea, select, .readonly-output {
  width: 100%; padding: 10px 12px; border: 1px solid var(--field-border); border-radius: 6px;
  color: #374b40; background: var(--field-background); min-height: 40px;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; }
.readonly-output { display: block; background: #f3f8f5; color: #75897e; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr);
  gap: 0 22px; align-items: start; }
.form-grid label { min-width: 0; }
.form-grid input, .form-grid select { margin-top: 0; }
.required { color: var(--accent); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px;
  border-top: 1px solid var(--line); }
.form-actions { padding-top: 22px; margin-top: 20px; }
.text-link { color: var(--accent); font-size: 11px; text-decoration: underline; }
.danger-panel { border-color: #efdddd; }
.inline-form { display: inline-block; margin: 3px; }
.checkbox-label { display: flex !important; gap: 8px; align-items: center; }
.checkbox-label input { width: auto; min-height: auto; }
.skip-link { position: fixed; top: -50px; left: 10px; padding: 8px; background: #fff;
  z-index: 100; }
.skip-link:focus { top: 8px; }
.login-body { min-height: 100vh; background: var(--canvas); display: flex; flex-direction: column; }
.login-body { align-items: center; justify-content: center; padding: 35px 20px; }
.login-brand { margin-bottom: 32px; }
.login-panel { background: #fff; padding: 40px; width: 100%; max-width: 450px;
  border-radius: 16px; }
.login-panel { border: 1px solid #dcebe2; box-shadow: 0 20px 50px #065f4609; flex: none; }
.login-panel h1 { font-size: 30px; margin: 14px 0; }
.login-panel p { font-size: 13px; margin-bottom: 22px; }
.login-panel .eyebrow { font-size: 9px; margin: 20px 0 0; }
.login-icon { background: var(--accent-soft); color: var(--accent); display: inline-flex; }
.login-icon { padding: 13px; border-radius: 13px; }
.login-icon .icon { width: 25px; height: 25px; }
.login-panel label { display: block; margin: 15px 0; font-size: 12px; color: #62756d; }
.login-panel input { margin-top: 6px; }
.full-width { width: 100%; margin: 10px 0 20px; }
.login-footer { text-align: center; font-size: 10px; color: #7f9689; margin-top: 25px; }
.error-page { margin: 60px auto; max-width: 700px; padding: 25px; font-family: sans-serif; }
.error-page p { margin: 20px 0; }
/* Form sections keep related fields together within the compact panel. */
.form-section + .form-section { border-top: 1px solid var(--line); padding-top: 24px;
  margin-top: 8px; }
.form-section-heading { margin-bottom: 20px; }
.form-section-heading h2 { margin-bottom: 6px; }
.form-section-heading p { color: var(--muted); margin-bottom: 0; }
.account-grid { display: grid; grid-template-columns: minmax(0, 1fr); max-width: 760px; margin-inline: auto;
  gap: 22px; align-items: start; }
.account-grid .form-panel { margin-bottom: 0; }
.account-grid .danger-panel { grid-column: 1 / -1; }
.account-grid form + form { border-top: 1px solid var(--line); margin-top: 24px;
  padding-top: 24px; }
.invitation-form { display: grid; gap: 0 20px; }
.invitation-form .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.invitation-form > .button { justify-self: start; }
.invitation-form > p { margin: 12px 0 0; }
.import-layout { display: grid; grid-template-columns: minmax(0, 1fr);
  gap: 32px; align-items: start; }
.import-layout textarea { margin-top: 8px; min-height: 320px; font-family: monospace; }
@media (max-width: 1000px) {
  .account-grid, .import-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 1800px) { main { padding: 40px 48px; } }
@media (max-width: 1180px) {
  .sidebar { width: 210px; padding-inline: 12px; }
  .workspace { margin-left: 210px; }
  main { padding: 26px; }
  .topbar { padding-inline: 26px; }
  .metrics { gap: 12px; }
  .metric-card { padding: 17px; }
  .metric-value { font-size: 24px; }
}
@media (max-width: 780px) {
  .sidebar { position: static; width: 100%; padding: 14px 18px; border-right: 0; }
  .sidebar { border-bottom: 1px solid var(--line); }
  .brand { font-size: 23px; padding: 0; }
  .brand-symbol { width: 30px; height: 30px; }
  .clinic, .sidebar-bottom, .nav-label, .nav-count { display: none; }
  .sidebar nav { display: flex; overflow-x: auto; gap: 6px; margin-top: 14px; }
  .nav-item { flex-shrink: 0; font-size: 11px; padding: 8px 10px; margin: 0; }
  .nav-item .icon { width: 15px; height: 15px; }
  .workspace { margin-left: 0; }
  .topbar { padding: 12px 20px; min-height: 52px; height: auto; gap: 10px; }
  .breadcrumb { font-size: 10px; gap: 8px; }
  .topbar-right { gap: 8px; }
  main { padding: 25px 18px; }
  h1 { font-size: 25px; }
  .page-heading { align-items: flex-start; flex-wrap: wrap; gap: 16px; }
  .page-heading .button { padding: 10px 13px; font-size: 11px; }
  .metrics { grid-template-columns: 1fr; gap: 10px; margin-bottom: 22px; }
  .metric-card { position: relative; padding: 16px 19px; }
  .metric-top { justify-content: flex-start; }
  .metric-icon { position: absolute; right: 18px; top: 18px; }
  .metric-value { margin: 4px 0 7px; font-size: 26px; }
  .panel-heading { padding: 17px; }
  .panel-heading > div { gap: 7px; }
  .filters { padding: 0 16px 16px; }
  .search-field { flex-basis: 100%; }
  .filters select { max-width: 155px; }
  .date-filter input { width: 125px; }
  .pagination { padding: 14px 16px; grid-template-columns: minmax(0, 1fr) auto; }
  .pagination > nav { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .table-hint { align-items: flex-start; font-size: 9px; }
  .page-footer { padding: 16px 18px; font-size: 8px; }
  .form-panel { padding: 21px 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-actions { flex-wrap: wrap; }
  .invitation-form .form-grid { grid-template-columns: minmax(0, 1fr); }
  .invitation-form > .button { justify-self: start; }
  .login-panel { padding: 30px 25px; }
  .login-panel h1 { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto; transition: none !important;
  } }
.character-count { display: block; font-size: 10px; color: var(--muted); text-align: right; }


/* Each variant defines one grid for its headings and expandable summaries. */
.expandable-table { overflow-x: auto; scrollbar-width: thin; }
.expandable-columns, .expandable-summary {
  display: grid; grid-template-columns: var(--summary-columns);
  gap: 14px; align-items: center; padding: 10px 22px;
}
.procedure-ledger {
  --summary-columns: 18px .85fr 1.7fr 1.6fr 1.4fr repeat(3, 1fr);
  --table-min-width: 1080px; --summary-rows: 4;
}
.insurer-table {
  --summary-columns: 18px minmax(0, 2fr) minmax(0, 1fr) minmax(0, .7fr);
  --table-min-width: 580px; --summary-rows: 2;
}
.patient-table {
  --summary-columns: 18px minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, .7fr);
  --table-min-width: 720px; --summary-rows: 2;
}
.patient-coverages { min-width: 580px; }
.expandable-columns, .expandable-row { min-width: var(--table-min-width); }
.expandable-columns { background: transparent; color: var(--ink); font-size: 13px;
  font-weight: 550; border-top: 2px solid var(--line);
  border-bottom: 2px solid var(--line); }
.expandable-columns + .expandable-row { border-top: 0; }
.expandable-columns a { display: inline-flex; align-items: center; gap: 5px; }
.expandable-columns a:hover { color: var(--accent); }
.expandable-row { border-top: 1px solid var(--line); }
.expandable-row > summary, .procedure-entry > summary { list-style: none; cursor: pointer; }
.expandable-row > summary::-webkit-details-marker,
.procedure-entry > summary::-webkit-details-marker { display: none; }
.expandable-row:hover:not(:has(.nested-table:hover)) { background: #ecfdf5; }
.expandable-summary { font-size: 12px; }
.expandable-summary > span { min-width: 0; overflow-wrap: anywhere; }
.expandable-summary small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.expandable-toggle .icon { width: 15px; height: 15px; color: var(--accent);
  transition: transform .24s ease; }
.expandable-row[open] > summary .expandable-toggle .icon,
.procedure-entry[open] > summary .expandable-toggle .icon { transform: rotate(90deg); }
@supports (interpolate-size: allow-keywords) {
  .expandable-row, .procedure-entry { interpolate-size: allow-keywords; }
  .expandable-row::details-content, .procedure-entry::details-content { block-size: 0; padding-block-end: 0; overflow: clip;
    transition: block-size .24s ease, padding-block-end .24s ease,
      content-visibility .24s allow-discrete; }
  .expandable-row[open]::details-content, .procedure-entry[open]::details-content { block-size: auto; padding-block-end: 20px; }
  .expandable-row .expandable-body, .procedure-entry > .procedure-entry-body { margin-block-end: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .expandable-row::details-content, .procedure-entry::details-content { transition: none !important; }
}
.expandable-body {
  margin: 0 22px 20px 54px;
}
.expandable-toolbar { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; }
.expandable-body .table-scroll { border: 1px solid #cfe5d8; border-radius: 6px; background: #fff; }
.nested-table { font-size: 10px; }
.procedure-rows { min-width: 1000px; }
.insurer-plans { min-width: 340px; }
.insurer-plans td:first-child { width: 100%; overflow-wrap: anywhere; }
.nested-table th { padding: 12px; }
.nested-table td { padding: 8px 12px; }
.nested-table td strong { font-size: 10px; }
.procedure-rows .notes-cell { min-width: 160px; max-width: 260px; white-space: pre-wrap; }
.button.refresh-button { color: var(--accent-dark); border-color: #a7d8c4;
  background: var(--accent-soft); }
.button.refresh-button:hover { color: #fff; background: var(--accent-dark); }
.page-heading:has(+ .form-panel), .page-heading:has(+ .account-grid) {
  max-width: 760px; margin-inline: auto;
}
.procedure-entry-table { min-width: 0; margin-bottom: 16px; }
.procedure-entry { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 16px; }
.procedure-entry-summary { display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  border-radius: 8px; }
.procedure-entry-summary:hover { background: var(--accent-soft); }
.procedure-entry-summary > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.procedure-entry-summary strong { font-size: 12px; }
.procedure-entry-summary small { display: block; margin-top: 4px; color: var(--muted); }
.procedure-entry-body { margin: 0 16px 20px; }
.procedure-entry-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.procedure-entry-fields > div { min-width: 0; }
.procedure-entry label { position: relative; margin-bottom: 0; }
.doctor-entry { margin-top: 20px; }
.compound-entry-fields { display: grid; gap: 16px; }
.procedure-entry .entry-actions { margin-top: 18px; margin-bottom: 0; }
.tuss-description { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; }
.entry-actions { display: flex; gap: 18px; margin-bottom: 10px; }
.entry-actions button { background: none; border: 0; padding: 0; cursor: pointer; }
.entry-payment summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.entry-payment .form-grid { max-width: 560px; margin-top: 12px; }
.group-form-total { margin-top: 18px; font-weight: 600; text-align: right; }
@media (max-width: 700px) {
  .expandable-columns { display: none; }
  .expandable-row { min-width: 0; }
  .expandable-summary { grid-template-columns: 18px repeat(2, minmax(0, 1fr)); gap: 14px 12px;
    align-items: start; padding: 12px 14px; }
  .expandable-toggle { grid-row: 1 / span var(--summary-rows); }
  .expandable-summary > [data-label]::before { content: attr(data-label); display: block;
    margin-bottom: 4px; color: var(--muted); font-size: 10px; font-weight: 400; }
  .expandable-body { margin: 0 12px 16px; }
  @supports (interpolate-size: allow-keywords) {
    .expandable-row[open]::details-content, .procedure-entry[open]::details-content { padding-block-end: 16px; }
  }
  .expandable-toolbar { flex-wrap: wrap; }
  .procedure-entry-fields { grid-template-columns: minmax(0, 1fr); }

}

/* Form requests preserve draft values while Rust prepares the next editor. */
.record-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
.request-status { display: none; color: var(--muted); }
.request-status.htmx-request { display: inline; }
.record-fields:disabled { opacity: .7; }

/* Highlight every field and the padding inside the procedure's border together. */
.procedure-entry-table tbody:hover { background: #ecfdf5; }
.procedure-entry-table tbody tr:hover { background: transparent; }
.patient-picker { position: relative; }
.patient-picker .text-link, .patient-picker small { display: block; margin-top: 6px; }
#patient-results:empty { display: none; }
#patient-results { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); }
.patient-option { display: block; width: 100%; text-align: left; padding: 10px;
  border: 0; background: white; cursor: pointer; }
.patient-option:hover, .patient-option:focus { background: var(--accent-soft); }
.form-panel .patient-picker > label { margin-bottom: 0; }
.form-grid > .patient-picker { margin-bottom: 18px; }

/* Shared record dialog, including the wider grouped procedure editor. */
#record-modal {
  width: min(56rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  overflow: auto;
  border: 0;
  border-radius: 1rem;
  box-shadow: 0 24px 64px rgb(15 23 42 / 35%);
  padding: 1.25rem;
}
#record-modal::backdrop { background: rgb(15 23 42 / 55%); backdrop-filter: blur(5px); }
.modal-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
#record-modal .form-panel { max-width: none; margin: 1rem 0 0; }
#record-modal-status { color: #b42318; }
