/* ==========================================================================
   Buy or Block design system: shared components.
   Loaded right after app.css on every page (templates/layouts/base.html), so feature
   stylesheets still win where they need to. Tokens only: no raw colours here
   (apps/core/tests_ui.py counts them). Living style guide: /app/design/.
   Docs: docs/design/DESIGN_SYSTEM.md.

   Contents
     1. Base (headings, focus, Bangla)        8. Tables (+ mobile stacking)
     2. Page header                           9. Tabs + segmented control
     3. Buttons                              10. Dropdown menu
     4. Form controls + field help/errors    11. Modal + bottom sheet
     5. Cards + stat cards                   12. Empty state, avatars, skeletons
     6. Badges, pills, chips                 13. Layout helpers
     7. Alerts + toasts                      14. Touch targets + responsive
   ========================================================================== */

/* ---------- 1. Base ---------- */
h1 { font-size: var(--fs-title); line-height: var(--lh-tight); }
h2 { font-size: var(--fs-section); line-height: var(--lh-snug); }
h3 { font-size: var(--fs-lg); line-height: var(--lh-snug); }
h4 { font-size: var(--fs-md); line-height: var(--lh-snug); }
:focus-visible { outline: var(--focus-outline); outline-offset: var(--focus-offset); }
:focus:not(:focus-visible) { outline: none; }
[lang="bn"] { line-height: var(--lh-bn); }
:is(h1, h2, h3, h4, .btn, .badge)[lang="bn"], [lang="bn"] :is(h1, h2, h3, h4, .btn) { line-height: var(--lh-bn-tight); }
.overline { font: var(--fw-semibold) var(--fs-caption)/var(--lh-tight) var(--font-head); color: var(--muted); letter-spacing: var(--tracking-caps); text-transform: uppercase; }
.text-meta { font-size: var(--fs-meta); color: var(--muted); }

/* ---------- 2. Page header: title + subtitle on the left, actions on the right ---------- */
.page-header > :first-child { min-width: 0; }
.page-header h1, .page-title { font-size: var(--fs-title); line-height: var(--lh-tight); letter-spacing: var(--tracking-tight); }
.page-header .page-subtitle, .page-header h1 + p { max-width: 72ch; }
.page-actions { align-items: center; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin: var(--space-6) 0 var(--space-3); }
.section-head h2 { font-size: var(--fs-xl); }
.section-head p { color: var(--muted); margin: 2px 0 0; font-size: var(--fs-base); }

/* ---------- 3. Buttons ---------- */
/* .btn (secondary look) · .btn-primary · .btn-secondary · .btn-ghost · .btn-soft · .btn-danger · .btn-danger-ghost
   sizes .btn-sm · .btn-lg · .btn-block · icon-only .btn-icon (+ aria-label) · states :disabled · .is-loading */
.btn { transition: var(--transition-colors), transform var(--dur-fast) var(--ease-standard); -webkit-tap-highlight-color: transparent; }
.btn:focus-visible { outline: var(--focus-outline); outline-offset: var(--focus-offset); }
.btn:active:not(:disabled):not(.is-loading) { transform: translateY(1px); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger-ghost { background: var(--surface); border-color: var(--bad-line); color: var(--bad); }
.btn-danger-ghost:hover { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.btn-icon { min-width: var(--btn-h); padding-left: var(--space-2); padding-right: var(--space-2); }
.btn-sm.btn-icon { min-width: var(--control-h-sm); }
.btn-lg.btn-icon { min-width: var(--control-h-lg); }
.btn:disabled, .btn.is-disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; box-shadow: none; }
a.btn.is-disabled, a.btn[aria-disabled="true"] { pointer-events: none; }
.btn.is-loading, .btn[aria-busy="true"] { cursor: progress; }
.btn.is-loading::before, .btn[aria-busy="true"]::before { content: ""; width: 1em; height: 1em; flex: none; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: bob-spin .7s linear infinite; }
.btn-group { display: inline-flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.spinner { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: bob-spin .7s linear infinite; vertical-align: middle; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes bob-spin { to { transform: rotate(360deg); } }

/* ---------- 4. Form controls + field help / errors ---------- */
/* <div class="form-group [has-error]"><label for>Label <span class="req">*</span></label><input class="input">
   <span class="helptext">Help</span><ul class="errorlist"><li>Error</li></ul></div>
   .helptext, .form-help and .help are the same thing (one muted line under the control). */
.input, .select, .textarea { min-height: var(--control-h); border-radius: var(--radius-control); }
.input::placeholder, .textarea::placeholder, .form-group input::placeholder, .form-group textarea::placeholder { color: var(--muted); opacity: .85; }
.input:disabled, .select:disabled, .textarea:disabled, .form-group :is(input, select, textarea):disabled { background: var(--surface-2); color: var(--text-disabled); cursor: not-allowed; }
.select, .form-group select { cursor: pointer; }
.input-group { display: flex; align-items: stretch; gap: var(--space-2); }
.input-group > :is(.input, .select, input, select) { flex: 1; min-width: 0; }
.input-icon { position: relative; display: block; }
.input-icon > [data-lucide], .input-icon > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon > .input { padding-left: 42px; }
.req { color: var(--bad); font-weight: var(--fw-bold); }
.optional { color: var(--muted); font-weight: var(--fw-regular); font-size: var(--fs-xs); }
.helptext, .form-help, .field-help { display: block; font-size: var(--fs-meta); line-height: var(--lh-snug); color: var(--muted); margin: 6px 0 0; font-weight: var(--fw-regular); }
.errorlist, .field-error { list-style: none; padding: 0; margin: 6px 0 0; color: var(--bad); font-size: var(--fs-meta); font-weight: var(--fw-semibold); line-height: var(--lh-snug); }
.errorlist li + li { margin-top: 2px; }
.has-error :is(.input, .select, .textarea, input:not([type=checkbox]):not([type=radio]), select, textarea) { border-color: var(--bad); }
.has-error :is(.input, .select, .textarea, input, select, textarea):focus { box-shadow: 0 0 0 4px var(--bad-soft); }
.form-section { padding-top: var(--space-5); margin-top: var(--space-5); border-top: 1px solid var(--border); }
.form-section > h3 { margin-bottom: var(--space-3); }
.form-actions { align-items: center; flex-wrap: wrap; }

/* checkbox + radio: native controls, accent tinted, label beside them */
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
.check, .radio, .form-group .check, .form-group .radio { display: inline-flex; align-items: center; gap: 10px; font-weight: var(--fw-medium); color: var(--text); cursor: pointer; margin: 0; line-height: var(--lh-snug); }
.check input, .radio input { width: 18px; height: 18px; margin: 0; flex: none; }
.check-list { display: grid; gap: var(--space-1); }

/* switch: <label class="toggle"><input type="checkbox" role="switch"><span class="toggle-track"></span><span>Label</span></label> */
.toggle { display: inline-flex; align-items: center; gap: var(--space-3); cursor: pointer; font-weight: var(--fw-medium); min-height: var(--control-h-sm); position: relative; }
.toggle > input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.toggle-track { position: relative; width: 44px; height: 26px; flex: none; border-radius: var(--radius-full); background: var(--border-strong); transition: background-color var(--dur-base) var(--ease-standard); }
.toggle-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-sm); transition: transform var(--dur-base) var(--ease-out); }
.toggle > input:checked + .toggle-track { background: var(--accent); }
.toggle > input:checked + .toggle-track::after { transform: translateX(18px); }
.toggle > input:focus-visible + .toggle-track { outline: var(--focus-outline); outline-offset: var(--focus-offset); }
.toggle > input:disabled + .toggle-track { opacity: .5; }

/* ---------- 5. Cards + stat cards ---------- */
/* cards sitting in a grid or a gap-based column get their spacing from the gap, not from .card + .card */
:is(.grid, .grid-2, .grid-3, .grid-4, .grid-sidebar, .grid-sidebar-left, .stats, .cx-grid, .cx-panels, .t-two, .pf-grid-main, .sq-templates, .ct-col) > .card + .card { margin-top: 0; }
.card-header h2 { font-size: var(--fs-card-title); }
.card-title { font: var(--fw-semibold) var(--fs-card-title)/var(--lh-snug) var(--font-head); color: var(--text); margin: 0; }
.card-subtitle { color: var(--muted); font-size: var(--fs-base); margin: 2px 0 0; }
.card-flat { box-shadow: none; }
.card-muted { background: var(--surface-2); box-shadow: none; }
.card-accent { border-color: var(--accent-line); background: var(--accent-tint); }
a.card, .card-link { color: var(--text); transition: var(--transition-colors); }
a.card:hover, .card-link:hover { border-color: var(--accent-line); box-shadow: var(--elev-3); color: var(--text); }
.stat { min-width: 0; }
.stat-value { font-size: var(--fs-stat); }
.stat-sub, .stat-note { margin-top: var(--space-1); font-size: var(--fs-meta); color: var(--muted); }
.stat.is-bad .stat-value { color: var(--bad); }
.stat.is-warn .stat-value { color: var(--warn); }
.stat.is-ok .stat-value { color: var(--ok); }

/* ---------- 6. Badges, pills, chips ---------- */
/* .badge = small status label (colour + word). Semantic names are preferred over colour names. */
.badge.ok, .badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn, .badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad, .badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge.info, .badge-info { background: var(--info-soft); color: var(--info); }
.badge.accent, .badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge.neutral, .badge-neutral { background: var(--surface-2); color: var(--text-2); }
.badge-line { box-shadow: inset 0 0 0 1px currentColor; background: transparent; }
.badge-solid.ok, .badge-solid.green { background: var(--ok); color: var(--on-status); }
.badge-solid.bad, .badge-solid.red { background: var(--bad); color: var(--on-status); }
.badge-solid.warn, .badge-solid.amber { background: var(--warn); color: var(--on-status); }
.badge-lg { font-size: var(--fs-sm); padding: 4px 12px; }
.count-pill { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--radius-full); font: var(--fw-semibold) var(--fs-xs)/1 var(--font-head); background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.count-pill.is-bad { background: var(--bad); color: var(--on-status); border-color: var(--bad); }
.count-pill.is-accent { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }
.ptag-info { background: var(--info-soft); color: var(--info); border: 1px solid var(--info-line); }
.ptag-accent { background: var(--accent-soft); color: var(--accent-text); border: 1px solid var(--accent-line); }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; transition: var(--transition-colors); }
.chip-btn:hover { border-color: var(--accent); }
.chip-btn:focus-visible { outline: var(--focus-outline); outline-offset: var(--focus-offset); }
.chip-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.ch-badge { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: var(--on-brand); flex: none; }
.ch-badge [data-lucide], .ch-badge svg { width: 13px; height: 13px; }
.ch-badge.wa { background: var(--ch-whatsapp); } .ch-badge.ms { background: var(--ch-messenger); } .ch-badge.ig { background: var(--ig-grad); }
.ch-badge.fb { background: var(--ch-facebook); } .ch-badge.mail { background: var(--ch-email); } .ch-badge.sms { background: var(--ch-sms); } .ch-badge.call { background: var(--ch-call); }

/* ---------- 7. Alerts + toasts ---------- */
.alert { flex-wrap: wrap; line-height: var(--lh-snug); }
.alert > [data-lucide], .alert > svg { margin-top: 2px; }
.alert > div { flex: 1 1 220px; min-width: 0; }
.alert > form { margin: 0 0 0 auto; }
.alert-title { display: block; font-weight: var(--fw-bold); margin-bottom: 2px; }
.alert-neutral { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.alert-info.is-status { background: var(--info-soft); border-color: var(--info-line); color: var(--info); }
.alert .alert-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-2); }
.toast { position: fixed; z-index: var(--z-toast); left: 50%; bottom: 24px; transform: translateX(-50%) translateY(16px); display: flex; align-items: center; gap: var(--space-2); max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: var(--radius-lg); background: var(--inverse-bg); color: var(--inverse-text); box-shadow: var(--elev-4); font-weight: var(--fw-semibold); opacity: 0; pointer-events: none; transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); }
.toast.show { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
.toast.err, .toast.is-bad { background: var(--bad); color: var(--on-status); }
.toast.is-ok { background: var(--ok); color: var(--on-status); }
.toast.is-static { position: static; z-index: auto; transform: none; opacity: 1; pointer-events: auto; display: inline-flex; }

/* ---------- 8. Tables ---------- */
.table th { font-size: var(--fs-sm); line-height: var(--lh-tight); }
.table td { line-height: var(--lh-snug); }
.table .num, .table .text-right { font-variant-numeric: tabular-nums; }
.table-compact td { padding-top: 8px; padding-bottom: 8px; }
.table-wrap { -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.card > .table-wrap:last-child { border-radius: 0 0 var(--radius-card) var(--radius-card); }
/* .table-sticky-end: the last column (row actions) stays visible while a wide table scrolls sideways */
.table-sticky-end th:last-child, .table-sticky-end td:last-child { position: sticky; right: 0; z-index: 1; background: var(--surface); box-shadow: inset 1px 0 0 var(--border); }
.table-sticky-end th:last-child { background: var(--surface-2); }
.table-sticky-end tbody tr:hover td:last-child { background: var(--surface-2); }
.table-sticky-end td:last-child:has(.dropdown.open) { z-index: 3; }
@media (max-width: 1500px) {
  .table th, .table td { padding-left: 12px; padding-right: 12px; }
  .table th:first-child, .table td:first-child { padding-left: 16px; }
  .table th:last-child, .table td:last-child { padding-right: 16px; }
}
/* .table-stack: on phones each row becomes a small card. Cell 1 (checkbox) + cell 2 (the name) + the last
   cell (actions) share the first line; the other cells wrap underneath. Add data-label="Due" to a td to
   print its column name in front of it. */
@media (max-width: 640px) {
  .table.table-stack, .table.table-stack tbody { display: block; width: 100%; }
  .table.table-stack thead tr { display: flex; align-items: center; }
  .table.table-stack thead th { display: none; }
  .table.table-stack thead th:first-child { display: block; flex: 1; }
  .table.table-stack tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table.table-stack tbody tr::after { content: ""; order: 1; flex-basis: 100%; height: 0; }
  .table.table-stack tbody tr:last-child { border-bottom: 0; }
  .table.table-stack td { display: block; padding: 0; border: 0; order: 2; min-width: 0; max-width: 100%; }
  .table.table-stack td:first-child, .table.table-stack td:last-child { order: 0; }
  .table.table-stack td:nth-child(2) { order: 0; flex: 1 1 0; }
  .table.table-stack td:first-child:has(> input[type=checkbox]) { flex: none; }
  .table.table-stack td:first-child:not(:has(> input[type=checkbox])) { flex: 1 1 0; }
  .table.table-stack td:first-child:not(:has(> input[type=checkbox])) + td { order: 2; flex: 0 1 auto; }
  .table.table-stack td:last-child { margin-left: auto; text-align: right; }
  .table.table-stack td:not(:first-child):not(:nth-child(2)):not(:last-child) { font-size: var(--fs-sm); margin-top: 8px; }
  .table.table-stack td:first-child:not(:has(> input[type=checkbox])) + td { margin-top: 8px; }
  .table.table-stack td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-weight: var(--fw-medium); }
  .table.table-stack td:empty { display: none; }
  .table-wrap:has(> .table.table-stack) { overflow: visible; }
  .table.table-stack.table-sticky-end td:last-child { position: static; box-shadow: none; background: transparent; }
}

/* ---------- 9. Tabs + segmented control ---------- */
.tab { display: inline-flex; align-items: center; gap: 6px; transition: color var(--dur-base) var(--ease-standard), border-color var(--dur-base) var(--ease-standard); }
.tab[aria-selected="true"], .tab[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.tab:focus-visible { outline-offset: -3px; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.seg { background: var(--surface); }
.seg a, .seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: calc(var(--btn-h) - 2px); transition: var(--transition-colors); }
.seg a:hover, .seg button:hover { background: var(--surface-2); color: var(--text); }
.seg [aria-pressed="true"], .seg [aria-selected="true"], .seg [aria-current="page"], .seg .active:hover { background: var(--accent-soft); color: var(--accent); }
.seg :focus-visible { outline-offset: -3px; }
/* pill-style segmented control (2–4 options, e.g. Mine / Team) */
.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--border); }
.segmented > a, .segmented > button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 0 14px; border: 0; border-radius: var(--radius); background: none; font: inherit; font-weight: var(--fw-bold); font-size: var(--fs-base); color: var(--muted); cursor: pointer; transition: var(--transition-colors); }
.segmented > :hover { color: var(--text); }
.segmented > .active, .segmented > [aria-pressed="true"], .segmented > [aria-selected="true"], .segmented > [aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

/* ---------- 10. Dropdown menu ---------- */
.dropdown-menu { z-index: var(--z-dropdown); }
.dropdown.open .dropdown-menu { animation: bob-pop var(--dur-base) var(--ease-out); }
.dropdown-menu.align-left { left: 0; right: auto; }
/* laid out against the window by app.js when the menu sits in a scrolling box (tables, cards) */
.dropdown-menu.is-fixed { position: fixed; right: auto; max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); overflow-y: auto; max-width: calc(100vw - 16px); }
.dropdown-label { padding: 8px 10px 4px; font: var(--fw-semibold) var(--fs-xs)/var(--lh-tight) var(--font-head); color: var(--muted); }
.dropdown-item:focus-visible { outline-offset: -2px; }
.dropdown-item.is-danger, .dropdown-item.danger { color: var(--bad); }
.dropdown-item.is-danger:hover, .dropdown-item.danger:hover { background: var(--bad-soft); color: var(--bad); }
.dropdown-item small { color: var(--muted); font-weight: var(--fw-regular); }
@keyframes bob-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- 11. Modal + bottom sheet ---------- */
dialog.modal { max-height: min(88vh, 900px); overflow: auto; }
dialog.modal[open] { animation: bob-pop var(--dur-slow) var(--ease-out); }
.modal-title { font-size: var(--fs-2xl); line-height: var(--lh-snug); margin: 0; }
.modal-header p { color: var(--muted); margin: 4px 0 0; }
.modal-close { flex: none; margin: -8px -10px 0 0; }
dialog.modal.modal-sm { width: min(420px, 94vw); }
dialog.modal.modal-lg { width: min(760px, 94vw); }
.sheet-handle { width: 40px; height: 4px; border-radius: var(--radius-full); background: var(--border-strong); margin: 10px auto 0; }

/* ---------- 12. Empty state, avatars, skeletons ---------- */
.empty p { max-width: 52ch; margin-left: auto; margin-right: auto; }
.empty .empty-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: center; margin-top: var(--space-4); }
.empty-sm { padding: var(--space-6) var(--space-4); }
.empty-sm .empty-icon { width: 44px; height: 44px; border-radius: var(--radius-lg); margin-bottom: var(--space-3); }
.avatar-xs { width: 22px; height: 22px; font-size: 10px; }
.avatar.av1 { background: color-mix(in oklab, var(--av1) 14%, var(--surface)); color: var(--av1); }
.avatar.av2 { background: color-mix(in oklab, var(--av2) 14%, var(--surface)); color: var(--av2); }
.avatar.av3 { background: color-mix(in oklab, var(--av3) 14%, var(--surface)); color: var(--av3); }
.avatar.av4 { background: color-mix(in oklab, var(--av4) 14%, var(--surface)); color: var(--av4); }
.avatar.av5 { background: color-mix(in oklab, var(--av5) 14%, var(--surface)); color: var(--av5); }
.avatar.av6 { background: color-mix(in oklab, var(--av6) 14%, var(--surface)); color: var(--av6); }
.avatar-group { display: inline-flex; }
.avatar-group > .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatar-group > .avatar + .avatar { margin-left: -8px; }
.skeleton { display: block; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: bob-shimmer 1.4s ease-in-out infinite; color: transparent; }
.skeleton-text { height: 12px; margin: 6px 0; }
.skeleton-title { height: 20px; width: 40%; margin-bottom: 10px; }
.skeleton-circle { border-radius: 50%; width: 36px; height: 36px; flex: none; }
.skeleton-block { height: 96px; border-radius: var(--radius-lg); }
@keyframes bob-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- 13. Layout helpers ---------- */
.vstack { display: flex; flex-direction: column; gap: var(--stack-gap); min-width: 0; }
.hstack { display: flex; align-items: center; gap: var(--space-2); min-width: 0; flex-wrap: wrap; }
.container-narrow { max-width: 760px; }
.container-read { max-width: 72ch; }

/* ---------- 14. Touch targets + responsive ---------- */
/* Phones and touch screens: every control is at least 44px tall (WCAG 2.5.5 / Apple HIG). */
@media (pointer: coarse), (max-width: 760px) {
  .btn-sm { min-height: var(--tap); }
  .btn-sm.btn-icon { min-width: var(--tap); }
  .btn-sq { width: var(--tap); height: var(--tap); }
  .tab, .seg a, .seg button, .segmented > a, .segmented > button, .dropdown-item { min-height: var(--tap); }
  .check, .radio, .toggle { min-height: var(--tap); }
}
@media (max-width: 760px) {
  :root { --gutter: var(--space-4); --card-pad: var(--space-4); }
  .content h1, .page-title { font-size: var(--fs-3xl); }
  .page-header { margin-bottom: var(--space-4); gap: var(--space-3); }
  .card-header { padding: 14px 16px; }
  .card-body { padding: var(--card-pad); }
  .card-footer { padding: 12px 16px; }
  .stat { padding: 16px; }
  .stat-value { font-size: 26px; }
  .modal-header { padding: 18px 18px 0; } .modal-body { padding: 16px 18px; } .modal-footer { padding: 14px 18px; }
  .modal-footer .btn { flex: 1; }
  .toast { bottom: calc(92px + env(safe-area-inset-bottom)); }
  .alert { padding: 12px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  .btn.is-loading::before, .btn[aria-busy="true"]::before, .spinner { animation-duration: 1.6s !important; animation-name: bob-spin !important; }
}
