/* ===== Dashboard: one calm surface =====
   The page is a single surface. Sections (today's schedule, practice statistics)
   are separated by whitespace and hairlines, not boxed into cards.
   Spacing rhythm 8/16/24/32; labels 12px muted sentence case; numbers tabular. */

.content:has(> #view-dashboard.active) { background: var(--bg); }

/* --- Header: date nav + day summary, over the schedule column only --- */
#view-dashboard { container: dash / inline-size; }
#view-dashboard .dash-today { gap: 0; margin-bottom: 0; display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
#view-dashboard .ledger-layout { display: contents; }
#view-dashboard .ledger-head {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "date glance";
  align-items: center; gap: 8px 24px; padding-bottom: 24px; min-width: 0;
}
#view-dashboard .ledger-date { grid-area: date; }
/* The 36px nav button draws its chevron 9px in: pull it out so the glyph sits on the panel's left edge */
#view-dashboard .ledger-date > .ledger-icon-btn:first-child { margin-inline-start: -9px; }
#view-dashboard .ledger-icon-btn { width: 36px; height: 36px; border-color: transparent; background: none; }
#view-dashboard .ledger-icon-btn:hover { background: var(--hover-neutral); }
.dash-glance {
  grid-area: glance; margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px;
  font-size: 14px; color: var(--text-secondary); font-variant-numeric: tabular-nums;
}
.dash-glance[hidden] { display: none; }
.dash-glance strong { font-weight: 600; color: var(--text); }

@container dash (max-width: 640px) {
  #view-dashboard .ledger-head { grid-template-columns: minmax(0, 1fr); grid-template-areas: "date" "glance"; }
  .dash-glance { font-size: 13px; }
}

/* --- Schedule panel (the one contained element) + Today column (unboxed) ---
   Wide: the Today column spans the date row and the panel, so it starts level with the date. */
@container dash (min-width: 1100px) {
  #view-dashboard .dash-today { grid-template-columns: minmax(0, 1fr) 320px; column-gap: 24px; }
  #view-dashboard .ledger-head { grid-column: 1; grid-row: 1; }
  #view-dashboard .ledger-card { grid-column: 1; grid-row: 2; }
  #view-dashboard .ledger-rail { grid-column: 2; grid-row: 1 / span 2; padding-top: 7px; }
}
@container dash (max-width: 1099px) {
  #view-dashboard .dash-today { row-gap: 24px; }
  #view-dashboard .ledger-head { padding-bottom: 0; }
  #view-dashboard .ledger-rail.rail-quiet { display: none; }
  #view-dashboard .ledger-rail { border-top: 1px solid var(--line-soft); padding-top: 24px; }
}
@container dash (min-width: 640px) and (max-width: 1099px) {
  #view-dashboard .ledger-rail { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
  #view-dashboard .ledger-rail.rail-quiet { display: none; }
}

/* Panel header: title left, Select / Block times / New booking right; wraps under the title when narrow */
#view-dashboard .ledger-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; padding: 16px 16px 4px; }
#view-dashboard .ledger-card-head .ledger-card-title { padding: 0; }
#view-dashboard .ledger-card-head .ledger-actions { margin-inline-start: auto; align-items: center; }
#view-dashboard .ledger-card-head .ledger-btn,
#view-dashboard .ledger-card-head .schedule-select-toggle-btn { height: 36px; margin: 0; font-size: 13px; }
#view-dashboard .ledger-card-head .ledger-btn { padding: 0 14px; font-weight: 600; }
#view-dashboard .ledger-card-head .schedule-select-toggle-btn { padding: 0 12px; border-style: solid; border-color: var(--border-light); font-weight: 500; }
@container sched (max-width: 560px) {
  #view-dashboard .ledger-card-head .ledger-actions { width: 100%; margin-inline-start: 0; }
  #view-dashboard .ledger-card-head .ledger-btn { flex: 1 1 120px; justify-content: center; }
  #view-dashboard .ledger-card-head .schedule-select-toggle-btn { order: 3; }
}

#view-dashboard .ledger-card {
  container: sched / inline-size; background: var(--surface); border: 1px solid var(--border-light); border-radius: 6px;
}
#view-dashboard .ledger-card-title { margin: 0; padding: 0; font-size: 17px; font-weight: 600; line-height: 1.3; color: var(--text); }
#view-dashboard .ledger-toolbar { padding: 12px 16px; }
#view-dashboard .ledger-card .schedule-prac-bar { padding: 0 16px 12px; }
#view-dashboard .ledger-card .blocked-banner { margin: 0 16px 12px; }
#view-dashboard .ledger-list > .empty-state { padding: 32px 16px; border-top: 1px solid var(--line-soft); }
#view-dashboard .ledger-row.schedule-item { padding: 6px 8px 6px 16px; min-height: 56px; background: transparent; }
[dir="rtl"] #view-dashboard .ledger-row.schedule-item { padding: 6px 16px 6px 8px; }
#view-dashboard .ledger-row.schedule-item-clickable:hover { background: var(--hover-neutral); }
#view-dashboard .ledger-row.ledger-waiting { background: var(--selected); }
#view-dashboard .ledger-row.ledger-next, #view-dashboard .ledger-row.ledger-next.schedule-item-clickable:hover { background: var(--selected); }
#view-dashboard .lr-time { color: var(--text); font-variant-numeric: tabular-nums; }
#view-dashboard .ledger-seen .lr-time, #view-dashboard .ledger-muted .lr-time { color: var(--text); }
#view-dashboard .lr-name { font-size: 15px; font-weight: 600; }
.lr-next-tag {
  margin-inline-end: 8px; font-size: 12px; font-weight: 600; color: var(--primary);
}
#view-dashboard .ledger-now { padding-inline: 16px; }
#view-dashboard .ledger-blocked, [dir="rtl"] #view-dashboard .ledger-blocked { padding: 8px 16px; }

/* Columns: time | name + meta (grows) | status | action | fee | menu. The name column
   takes all spare room, so fee and menu sit on the panel's end edge. */
@container sched (min-width: 700px) {
  #view-dashboard .ledger-row.schedule-item { flex-wrap: nowrap; }
  #view-dashboard .lr-main { flex: 1 1 0; min-width: 140px; }
  #view-dashboard .lr-status { flex: 0 0 150px; }
  #view-dashboard .lr-next { flex: 0 0 124px; }
  #view-dashboard .lr-fee { flex: 0 0 88px; }
}

/* --- Day totals: one summary line, table behind "Details" (dashboard + calendar) --- */
.ledger-totals .dt-head { align-items: center; width: 100%; }
.ledger-totals .dt-table-wrap { display: none; max-width: 100%; overflow-x: auto; }
.ledger-totals.dt-open .dt-table-wrap { display: block; }
.ledger-totals .dt-head { min-width: 0; }
.ledger-totals .ledger-totals-counts { min-width: 0; }
.dt-toggle {
  margin-inline-start: auto; height: 28px; padding: 0 8px; border: 0; border-radius: var(--radius-sm); background: none;
  display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font: 500 13px/1 var(--font); cursor: pointer;
}
.dt-toggle:hover { background: var(--hover-neutral); color: var(--text); }
.dt-toggle svg { transition: transform .15s; }
.dt-open .dt-toggle svg { transform: rotate(180deg); }
#view-dashboard .ledger-totals .dt-toggle { margin-inline-start: auto; margin-inline-end: -8px; }
#view-dashboard .ledger-totals .dt-table { max-width: none; width: 100%; }
#view-dashboard .ledger-totals .dt-table th:first-child, #view-dashboard .ledger-totals .dt-table td:first-child { width: 40%; }
#view-dashboard .ledger-totals.today-stats-bar {
  padding: 10px 16px; background: none; border: 0; border-top: 1px solid var(--line-soft); border-radius: 0; gap: 8px; color: var(--text-secondary);
}
#view-dashboard .ledger-list:empty + .ledger-totals.today-stats-bar { border-top: 0; }

/* --- Today panel: Waiting room + Reminder replies as two plain subsections --- */
.rail-sec + .rail-sec { border-top: 1px solid var(--line-soft); padding-top: 16px; }
@container dash (min-width: 640px) and (max-width: 1099px) {
  .rail-sec + .rail-sec { border-top: 0; padding-top: 0; }
}
#view-dashboard .ledger-rail { gap: 16px; }
#view-dashboard .rail-head { padding: 0; }
#view-dashboard .rail-title { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.3; color: var(--text); }

/* One count style: muted text, no box (tab counts, Waiting room count) */
#view-dashboard .filter-count, #view-dashboard .rail-count {
  padding: 0; background: none; border-radius: 0; font-size: 12px; font-weight: 400; color: var(--text-secondary); font-variant-numeric: tabular-nums;
}
#view-dashboard .filter-count.is-zero { color: var(--text-tertiary); }
#view-dashboard .rail-sub { margin: 2px 0 8px; font-size: 12px; }
#view-dashboard .rail-q-item, [dir="rtl"] #view-dashboard .rail-q-item { padding: 8px 0; }
#view-dashboard .rail-q-item:hover { background: none; }
#view-dashboard .rail-q-item:hover .rail-q-name { text-decoration: underline; }
#view-dashboard .rail-q-btn { width: 32px; height: 32px; border-color: transparent; background: none; }
#view-dashboard .rail-q-btn:hover:not(:disabled) { background: var(--hover-neutral); }
#view-dashboard .rail-stats { padding: 0 0 8px; font-size: 13px; gap: 6px; }
#view-dashboard .rail-rs { padding: 0; gap: 0; }
#view-dashboard .rail-rs-item { padding: 8px 0; border-top: 1px solid var(--line-soft); border-radius: 0; background: none; }

/* --- Practice statistics: a section under a hairline --- */
.dash-block { margin-top: 32px; padding-top: 32px; border-top: 1px solid var(--line-soft); }
#doctor-stats-section { container: stats / inline-size; }
#view-dashboard .doctor-stats-header { margin-bottom: 0; gap: 8px 16px; justify-content: flex-start; }
#view-dashboard .dash-block h3 { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.3; color: var(--text); }
.dash-stats-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
#view-dashboard .period-filter {
  display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; border: 1px solid var(--border-light); border-radius: var(--radius-sm);
}
#view-dashboard .period-btn { height: 28px; padding: 0 10px; border: 0; border-radius: 3px; background: none; font-size: 13px; }
#view-dashboard .period-btn:hover { background: var(--hover-neutral); }
#view-dashboard .period-btn.active { background: var(--pressed); }
#view-dashboard .customize-dashboard-btn {
  height: 32px; padding: 0 8px; border: 0; background: none; color: var(--ink-2); font-size: 13px; font-weight: 500; gap: 6px;
}
#view-dashboard .customize-dashboard-btn:hover { background: var(--hover-neutral); color: var(--text); }
#view-dashboard .custom-date-range { margin: 16px 0 0; }
.custom-date-to { color: var(--text-secondary); font-size: 13px; }
#view-dashboard .custom-date-apply { padding: 6px 14px; font-size: 13px; }

/* Figures: three calm lists (Volume | Money | Attendance). Label at the start, tabular value at the end. */
#view-dashboard .dashboard-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; margin: 16px 0 0; }
.stat-group { min-width: 0; max-width: 100%; }
.stat-group-title { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.stat-group-figs { display: flex; flex-direction: column; }
#view-dashboard .stat-card {
  display: flex; align-items: center; gap: 10px; width: auto; min-width: 0; min-height: 36px; padding: 0;
  background: none; border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0;
}
#view-dashboard .stat-group-figs > :last-child { border-bottom: 0; }
#view-dashboard .stat-label { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 13px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-secondary); }
#view-dashboard .stat-value { flex: none; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; letter-spacing: 0; color: var(--text); text-align: end; }
.stat-bar { flex: none; width: 72px; height: 4px; border-radius: 2px; background: var(--line-soft); overflow: hidden; }
.stat-bar > i { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--primary); transition: width .3s; }
.stat-bar-warn > i { background: var(--warning); }
.stat-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; }
.stat-dot-1, .stk-1 { background: var(--primary); }
.stat-dot-2, .stk-2 { background: color-mix(in srgb, var(--primary) 55%, var(--bg-secondary)); }
.stat-dot-3, .stk-3 { background: color-mix(in srgb, var(--primary) 25%, var(--bg-secondary)); }
.stat-stack { display: flex; height: 6px; margin: 8px 0 4px; border-radius: 3px; overflow: hidden; background: var(--line-soft); }
.stat-stack > i { display: block; height: 100%; }

/* Charts: one block, same header and height for each. */
#view-dashboard .charts-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 24px; margin: 32px 0 0; padding-top: 32px; border-top: 1px solid var(--line-soft);
}
@container stats (max-width: 900px) { #view-dashboard .charts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container stats (max-width: 560px) { #view-dashboard .charts-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; } }
#view-dashboard .charts-grid .dashboard-section { min-width: 0; padding: 0; background: none; border: 0; border-radius: 0; }
#view-dashboard .charts-grid h4 { margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--text); }
.chart-box { position: relative; height: 180px; }
#view-dashboard .chart-empty { height: 180px; display: grid; place-items: center; padding: 0 16px; }
#view-dashboard .chart-empty.hidden { display: none; }
#view-dashboard .heatmap-cell { background: var(--bg-secondary); border-radius: 2px; color: var(--text); font-variant-numeric: tabular-nums; }
#view-dashboard .heatmap-cell-strong { color: var(--on-primary); }

@media (max-width: 720px) {
  #view-dashboard .dashboard-stats { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  #view-dashboard .doctor-stats-header { flex-direction: column; align-items: flex-start; }
  #view-dashboard .dash-stats-controls { width: 100%; justify-content: flex-start; }
}

/* Today column: quiet lines when nothing is waiting */
#view-dashboard .rail-quiet-line { margin: 0; padding: 4px 0 8px; font-size: 13px; color: var(--text-secondary); }
#view-dashboard .rail-quiet-line strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

@media (max-width: 720px) {
  #view-dashboard .ledger-row.schedule-item { padding: 8px 8px 8px 16px; }
  [dir="rtl"] #view-dashboard .ledger-row.schedule-item { padding: 8px 16px 8px 8px; }
}

/* Phone-only parts are hidden elsewhere */
#view-dashboard .ledger-more, #view-dashboard .ledger-title-short, #view-dashboard .lb-short, #view-dashboard .dt-summary { display: none; }

/* ===== Phone (<= 600px): calm, native-feel dashboard =====
   No nested boxes: the schedule is a full-bleed list with hairlines, one primary
   button, Block times / Select behind a menu, chips instead of boxed tabs. */
@media (max-width: 600px) {
  /* Date row: ‹ Sun 11 Oct ▾ ›, Today as a small text button only when away from today */
  #view-dashboard .ledger-head { padding-bottom: 0; gap: 4px; }
  #view-dashboard .ledger-date { flex-wrap: nowrap; gap: 0; }
  #view-dashboard .ledger-date > .ledger-icon-btn:first-child { margin-inline-start: -9px; order: 0; }
  #view-dashboard .ledger-date-title { order: 1; margin-inline: 0; padding: 4px 6px; font-size: 18px; max-width: 100%; }
  #view-dashboard .ledger-date > .ledger-icon-btn:nth-child(2) { order: 2; }
  #view-dashboard .ledger-date-input { order: 3; }
  #view-dashboard .ledger-title-short { display: inline; }
  #view-dashboard #dash-schedule-title { display: none; }
  #view-dashboard .ledger-today {
    order: 4; margin-inline-start: auto; height: 28px; padding: 0 4px; border: 0; background: none;
    color: var(--primary); font-size: 14px; font-weight: 600;
  }
  #view-dashboard .ledger-today:hover { background: none; color: var(--primary-hover); }
  #view-dashboard .ledger-today.is-today { display: none; }
  /* Glance stays on one line */
  #view-dashboard .dash-glance { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
  #view-dashboard .dash-glance > span { display: inline; }
  #view-dashboard .dash-glance .ledger-sep { margin-inline: 6px; }
  #view-dashboard .dash-today { row-gap: 12px; }

  /* Schedule: full-bleed list, no card chrome */
  #view-dashboard .ledger-card { margin-inline: -16px; border: 0; border-radius: 0; background: none; }
  #view-dashboard .ledger-card-head { flex-wrap: nowrap; padding: 8px 16px 4px; gap: 8px; position: relative; }
  #view-dashboard .ledger-card-title { font-size: 16px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #view-dashboard .ledger-card-head .ledger-actions { position: relative; width: auto; flex: none; gap: 4px; flex-wrap: nowrap; }
  #view-dashboard .ledger-card-head .ledger-actions .ledger-btn-primary { order: 2; flex: none; height: 32px; padding: 0 12px; font-size: 14px; gap: 4px; border-radius: 6px; }
  #view-dashboard .lb-full { display: none; }
  #view-dashboard .lb-short { display: inline; }
  #view-dashboard .ledger-more {
    order: 1; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 6px;
    background: none; color: var(--text-secondary); cursor: pointer;
  }
  #view-dashboard .ledger-actions:has(.schedule-select-toggle-btn.active) .ledger-more { color: var(--primary); background: var(--selected); }
  #view-dashboard .ledger-card-head .ledger-actions > .ledger-btn:not(.ledger-btn-primary),
  #view-dashboard .ledger-card-head .ledger-actions > .schedule-select-toggle-btn { display: none; }
  #view-dashboard .ledger-actions.more-open > .ledger-btn:not(.ledger-btn-primary),
  #view-dashboard .ledger-actions.more-open > .schedule-select-toggle-btn {
    display: flex; align-items: center; gap: 8px; position: absolute; inset-inline-end: 0; width: 180px; height: 44px; margin: 0; padding: 0 14px; justify-content: flex-start;
    border: 1px solid var(--border-light); border-radius: 0; background: var(--surface); color: var(--text); font-size: 15px; font-weight: 500;
    z-index: 30; box-shadow: var(--shadow-md);
  }
  #view-dashboard .ledger-actions.more-open > .schedule-select-toggle-btn { top: calc(100% + 4px); border-radius: 8px 8px 0 0; }
  #view-dashboard .ledger-actions.more-open > .ledger-btn:not(.ledger-btn-primary) { top: calc(100% + 47px); border-radius: 0 0 8px 8px; }
  #view-dashboard .ledger-actions.more-open:has(> .ledger-btn:not(.ledger-btn-primary).hidden) > .schedule-select-toggle-btn { border-radius: 8px; }
  #view-dashboard .ledger-actions.more-open > .schedule-select-toggle-btn.active { color: var(--primary); font-weight: 600; }

  /* Status filter: one line of chips, counts muted */
  #view-dashboard .ledger-toolbar { padding: 4px 16px 8px; }
  #view-dashboard .ledger-tabs {
    display: flex; width: 100%; gap: 6px; padding: 0; border: 0; border-radius: 0; flex-wrap: nowrap; overflow-x: auto;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  #view-dashboard .ledger-tabs::-webkit-scrollbar { display: none; }
  #view-dashboard .ledger-tabs .schedule-filter-btn {
    flex: none; height: 30px; padding: 0 12px; gap: 5px; border-radius: 15px; background: none; font-size: 14px; color: var(--text-secondary);
  }
  #view-dashboard .ledger-tabs .schedule-filter-btn.active { background: var(--pressed); color: var(--text); font-weight: 600; }
  #view-dashboard .ledger-tabs .filter-count { font-size: 12px; color: var(--text-tertiary); }

  /* Rows: time (muted, narrow) | name + meta on one line | fee | menu; status (+ next step) on a second line */
  #view-dashboard .ledger-list { border-top: 1px solid var(--line-soft); }
  #view-dashboard .ledger-row.schedule-item, [dir="rtl"] #view-dashboard .ledger-row.schedule-item {
    flex-wrap: wrap; min-height: 0; gap: 0 8px; padding-block: 6px; padding-inline: 16px 4px; align-items: center;
  }
  #view-dashboard .lr-time { width: 58px; font-size: 12px; font-weight: 500; color: var(--text-secondary); }
  #view-dashboard .ledger-seen .lr-time, #view-dashboard .ledger-muted .lr-time { color: var(--text-secondary); }
  #view-dashboard .lr-main { flex: 1 1 0; min-width: 0; flex-direction: row; align-items: baseline; gap: 8px; overflow: hidden; }
  #view-dashboard .lr-name { flex: 0 1 auto; min-width: 0; font-size: 15px; }
  #view-dashboard .lr-meta { flex: 1 1 0; min-width: 0; flex-wrap: nowrap; gap: 0 8px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #view-dashboard .lr-meta > * { flex: none; }
  #view-dashboard .lr-meta > :first-child { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  #view-dashboard .lr-fee { flex: none; width: auto; order: 2; font-size: 13px; color: var(--text-secondary); }
  #view-dashboard .lr-fee .lr-fee-paid { color: var(--text-secondary); }
  #view-dashboard .lr-menu { order: 3; }
  #view-dashboard .lr-menu-btn, #view-dashboard .lr-menu-spacer { width: 32px; height: 36px; }
  #view-dashboard .lr-status { order: 5; flex: 1 1 calc(100% - 120px); padding-inline-start: 66px; font-size: 12px; font-weight: 500; gap: 6px; }
  #view-dashboard .lr-next { order: 6; flex: 0 0 auto; }
  #view-dashboard .ledger-step { height: 30px; width: auto; padding: 0 12px; font-size: 13px; margin-block: 2px 4px; }
  #view-dashboard .ledger-row .schedule-item-check, #view-dashboard .ledger-row .queue-ctrl { flex: none; }

  /* Day totals: one muted summary line with a chevron; breakdown expands below */
  #view-dashboard .ledger-totals.today-stats-bar { padding: 0 16px; gap: 0; }
  #view-dashboard .ledger-totals .dt-summary {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 44px; padding: 0;
    border: 0; background: none; color: var(--text-secondary); font: 400 13px/1.2 var(--font); text-align: start; cursor: pointer;
  }
  #view-dashboard .ledger-totals .dt-summary strong { color: var(--text-secondary); font-weight: 600; }
  #view-dashboard .ledger-totals .dt-summary svg { flex: none; transition: transform .15s; }
  #view-dashboard .ledger-totals.dt-open .dt-summary svg { transform: rotate(180deg); }
  #view-dashboard .ledger-totals .dt-toggle, #view-dashboard .ledger-totals .ledger-totals-label { display: none; }
  #view-dashboard .ledger-totals .ledger-totals-counts { display: none; }
  #view-dashboard .ledger-totals.dt-open .ledger-totals-counts { display: flex; flex-wrap: wrap; width: 100%; padding-bottom: 8px; font-size: 13px; }
  #view-dashboard .ledger-totals .dt-table-wrap { padding-bottom: 12px; }

  /* Practice statistics: title row with a small Customize icon, range chips on one scrollable line */
  .dash-block { margin-top: 24px; padding-top: 24px; }
  #view-dashboard .doctor-stats-header { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
  #view-dashboard .dash-stats-controls { display: contents; }
  #view-dashboard .dash-block h3 { order: 1; }
  #view-dashboard .customize-dashboard-btn { order: 2; width: 32px; height: 32px; padding: 0; justify-content: center; margin-inline-end: -6px; }
  #view-dashboard .customize-dashboard-btn span {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  #view-dashboard .period-filter {
    order: 3; flex: 1 0 100%; max-width: 100%; display: flex; flex-wrap: nowrap; gap: 6px; padding: 0; border: 0; border-radius: 0;
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  #view-dashboard .period-filter::-webkit-scrollbar { display: none; }
  #view-dashboard .period-btn { flex: none; height: 30px; padding: 0 12px; border-radius: 15px; font-size: 14px; color: var(--text-secondary); white-space: nowrap; }
  #view-dashboard .period-btn.active { background: var(--pressed); color: var(--text); font-weight: 600; }
}
@media (max-width: 600px) {
  #view-dashboard .ledger-totals .dt-summary .ledger-sep { margin-inline: 6px; }
}
