/* Insurance Calendar — navy & teal palette */
:root {
  --bg: #F3F6FA;
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --ink: #142333;
  --muted: #5D6B7B;
  --line: #DCE3EC;
  --primary: #1E5A8A;
  --primary-hover: #184B74;
  --primary-ink: #FFFFFF;
  --primary-soft: #E2ECF6;
  --teal: #1F9C86;
  --teal-soft: #DDF3EE;
  --ochre: #A9741A;
  --ochre-soft: #F8EDD5;
  --danger: #B5402F;
  --danger-soft: #F8E1DC;
  --wa: #1DA851;
  --sidebar: #14324F;
  --sidebar-ink: #D7E3F0;
  --sidebar-active: #22496E;
  --shadow: 0 1px 2px rgba(20, 35, 51, .06), 0 6px 18px rgba(20, 35, 51, .05);
  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 7px;
  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-ar: 'Noto Kufi Arabic', 'Figtree', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1722; --surface: #152231; --surface-2: #192839; --ink: #E3EAF2; --muted: #96A6B8;
    --line: #263749; --primary: #6FA8DA; --primary-hover: #8BBCE6; --primary-ink: #0B1420; --primary-soft: #1C3148;
    --teal: #4FCDB5; --teal-soft: #173A36; --ochre: #E0B055; --ochre-soft: #36291A; --danger: #E5806C; --danger-soft: #3B221D; --wa: #3DCB72;
    --sidebar: #0A121B; --sidebar-ink: #C5D3E2; --sidebar-active: #1A2D41;
    --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1722; --surface: #152231; --surface-2: #192839; --ink: #E3EAF2; --muted: #96A6B8;
  --line: #263749; --primary: #6FA8DA; --primary-hover: #8BBCE6; --primary-ink: #0B1420; --primary-soft: #1C3148;
  --teal: #4FCDB5; --teal-soft: #173A36; --ochre: #E0B055; --ochre-soft: #36291A; --danger: #E5806C; --danger-soft: #3B221D; --wa: #3DCB72;
  --sidebar: #0A121B; --sidebar-ink: #C5D3E2; --sidebar-active: #1A2D41;
  --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
[lang="ar"], [dir="rtl"] { font-family: var(--font-ar); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.12rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0; }
svg { width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.strong { font-weight: 700; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: .92em; }
.warn { color: var(--danger); }
.danger { color: var(--danger) !important; }
.grow { flex: 1; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }

/* ---------- Buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink);
  font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--primary); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-sm { min-height: 34px; padding: 5px 10px; font-size: .88rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn-wa:hover { filter: brightness(.95); border-color: var(--wa); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-ghost { color: var(--danger); }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.icon-btn:hover { background: var(--primary-soft); }
.link { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; text-align: left; font: inherit; }
.link:hover { text-decoration: underline; }
.link.strong { color: var(--ink); }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field > span { font-size: .85rem; font-weight: 600; color: var(--muted); }
input:not([type=checkbox]):not([type=radio]):not([type=color]), select, textarea {
  width: 100%; min-height: 42px; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: 16px;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
input[type=color] { width: 46px; height: 38px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 2px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; margin: 6px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 8px 14px; font-weight: 600; font-size: .9rem; }
.seg input:checked + span { background: var(--primary); color: var(--primary-ink); }
.seg input:focus-visible + span { outline: 2px solid var(--primary); }

/* ---------- Pills ---------- */
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.pill-late { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.pill-soon { background: var(--ochre-soft); color: var(--ochre); border-color: transparent; }
.pill-open { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.pill-ok, .pill-paid, .pill-active { background: var(--teal-soft); color: var(--teal); border-color: transparent; }
.pill-me { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.pill-sub { background: var(--ochre-soft); color: var(--ochre); border-color: transparent; }
.pill-renewed { background: var(--surface-2); color: var(--muted); }
.pill-cancelled, .pill-lapsed { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-art { background: var(--sidebar); color: var(--sidebar-ink); padding: 40px; display: flex; flex-direction: column; justify-content: space-between; gap: 30px; }
.login-form { display: grid; place-items: center; padding: 30px 16px; }
.login-form form { width: 100%; max-width: 380px; }
.login-form h1 { margin-bottom: 18px; }
.login-form .btn { width: 100%; margin-top: 4px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; color: #fff; }
.brand-big { font-size: 1.5rem; }
.season-ar { font-family: var(--font-ar); font-size: 1.6rem; color: #fff; margin-bottom: 10px; }
.login-desc { font-size: 1.1rem; max-width: 420px; }
.form-msg { padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: .92rem; }
.form-msg.ok { background: var(--teal-soft); color: var(--teal); }
.form-msg.err { background: var(--danger-soft); color: var(--danger); }
.switch-line { margin-top: 16px; text-align: center; font-size: .9rem; color: var(--muted); }
.switch-line button { background: none; border: 0; color: var(--primary); cursor: pointer; font-weight: 600; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 232px; flex: none; background: var(--sidebar); color: var(--sidebar-ink); display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 4px 8px 20px; font-size: 1rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius); color: var(--sidebar-ink); text-decoration: none; font-weight: 600; }
.nav a:hover { background: var(--sidebar-active); }
.nav a[aria-current="page"] { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 var(--teal); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; font-size: .85rem; padding: 0 8px; }
.sidebar-foot .who { font-weight: 700; color: #fff; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot button { background: none; border: 1px solid rgba(255,255,255,.15); color: var(--sidebar-ink); border-radius: var(--radius-sm); padding: 6px 10px; cursor: pointer; text-align: left; }
.sidebar-foot button:hover { background: var(--sidebar-active); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.demo-banner { background: var(--ochre-soft); color: var(--ochre); padding: 8px 20px; font-size: .88rem; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.brand-mobile { display: none; align-items: center; gap: 8px; font-weight: 800; }
.content { padding: 22px 24px 60px; max-width: 1400px; width: 100%; }
.bottom-nav, .fab { display: none; }

/* ---------- Page parts ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.panel > h2 { margin-bottom: 6px; }
.empty-line { color: var(--muted); padding: 10px 0; }
.panel.empty-line { padding: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2 > .panel { margin-bottom: 0; }
.grid-2 + * { margin-top: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.tile-label { font-size: .82rem; color: var(--muted); font-weight: 600; }
.tile-value { font-size: 1.45rem; font-weight: 800; margin: 2px 0; overflow-wrap: anywhere; line-height: 1.25; }
.tile-sub { font-size: .82rem; color: var(--muted); }
.tile-accent { border-color: var(--teal); background: linear-gradient(180deg, var(--teal-soft), var(--surface) 70%); }
.tile-warn { border-color: var(--danger); background: linear-gradient(180deg, var(--danger-soft), var(--surface) 70%); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; align-items: center; }
.filters input[type=search] { flex: 2 1 220px; width: auto; }
.filters select { flex: 1 1 150px; width: auto; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }
.plain-list.compact li { padding: 5px 0; font-size: .9rem; }

/* Renewal cards */
.ren-list { display: grid; gap: 10px; }
.ren-card { border: 1px solid var(--line); border-left: 4px solid var(--type, var(--primary)); border-radius: var(--radius); padding: 10px 12px; background: var(--surface-2); }
.pay-card { border-left-color: var(--ochre); }
.ren-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 2px; }
.ren-meta { font-size: .87rem; color: var(--muted); }
.ren-meta b { color: var(--ink); }
.ren-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.table .num { text-align: right; white-space: nowrap; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--primary-soft); }
.table td.actions { white-space: nowrap; text-align: right; }
.table td.actions > * + * { margin-left: 6px; }
.sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.table.mini { font-size: .88rem; margin-bottom: 8px; }
.table.mini td { padding: 6px 8px; }
.table.mini tr.total td { font-weight: 800; border-top: 2px solid var(--ink); border-bottom: 0; }
.table.mini tr.strong td { font-weight: 700; }
.table.mini input { min-height: 36px; padding: 5px 8px; }
.edit-table input:not([type=checkbox]):not([type=color]), .edit-table select { min-width: 110px; }
.edit-table .num-in { max-width: 110px; }
.new-row td { background: var(--surface-2); }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 18, 27, .5); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.modal.small { max-width: 420px; }
.modal.large { max-width: 860px; }
.modal > header { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal > .body { padding: 16px 18px; overflow-y: auto; }
.modal > footer { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); }
.modal textarea#wa-text { min-height: 240px; font-size: 15px; }
.detail-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 18px; margin: 0 0 12px; }
.facts div { min-width: 0; }
.facts .wide { grid-column: 1 / -1; }
.facts dt { font-size: .78rem; color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.sub-h { margin: 16px 0 8px; }
.paybar { height: 10px; border-radius: 999px; background: var(--danger-soft); overflow: hidden; margin-bottom: 6px; }
.paybar div { height: 100%; background: var(--teal); }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.new-client { display: grid; grid-template-columns: 2fr 1.4fr 1fr; gap: 0 14px; background: var(--primary-soft); padding: 10px 12px 0; border-radius: var(--radius); margin-bottom: 12px; }
.preview { background: var(--teal-soft); color: var(--ink); padding: 9px 12px; border-radius: var(--radius); margin-bottom: 12px; font-size: .9rem; }
.terms { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 0 0 12px; }
.terms legend { font-weight: 700; padding: 0 4px; }
.inst-box { margin-top: 10px; }
.inst-gen { align-items: flex-end; }
.inst-gen .field { flex: 1 1 120px; margin-bottom: 8px; }
.inst-gen .btn { margin-bottom: 8px; }
.paid-now { max-width: 240px; margin: 10px 0 0; }
.more-nav { display: flex; flex-direction: column; gap: 4px; }
.more-nav a, .more-nav button { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius); text-decoration: none; color: var(--ink); font-weight: 600; background: none; border: 0; cursor: pointer; text-align: left; }
.more-nav a:hover, .more-nav button:hover { background: var(--primary-soft); }

/* ---------- Calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.cal-head h2 { min-width: 160px; text-align: center; }
.cal-head .check { margin-left: auto; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-wd { text-align: center; font-size: .75rem; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-cell { position: relative; min-height: 92px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 5px 6px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-cell.empty { background: transparent; border-color: transparent; cursor: default; }
.cal-cell:hover:not(.empty) { border-color: var(--primary); }
.cal-cell.has { background: var(--surface-2); }
.cal-cell.today .cal-n { background: var(--primary); color: var(--primary-ink); border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; }
.cal-cell.sel { outline: 2px solid var(--teal); outline-offset: -1px; }
.cal-n { font-weight: 700; font-size: .85rem; }
.cal-dots { display: flex; gap: 3px; flex-wrap: wrap; }
.cal-dots i { width: 8px; height: 8px; border-radius: 50%; }
.cal-dots i.pay { background: transparent; border: 2px solid var(--ochre); width: 9px; height: 9px; }
.cal-count { position: absolute; top: 5px; right: 6px; font-size: .72rem; font-weight: 800; background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: 0 6px; }
.cal-names { display: flex; flex-direction: column; font-size: .72rem; line-height: 1.25; color: var(--muted); }
.cal-names em { font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Settings ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 14px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs button { background: none; border: 0; padding: 10px 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.form-narrow { max-width: 560px; }

/* ---------- Toast ---------- */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: var(--radius); font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 80; max-width: calc(100vw - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--danger); color: #fff; }

body.hide-money .tile-value { letter-spacing: .05em; }

/* ---------- Phones & small tablets ---------- */
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } .grid-2 > .panel { margin-bottom: 0; } }
@media (max-width: 860px) {
  body { font-size: 15px; }
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 28px 20px; gap: 16px; }
  .sidebar { display: none; }
  .brand-mobile { display: flex; }
  .topbar { padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
  .top-add { display: none; }
  .content { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
  .demo-banner { padding: 8px 16px; }
  h1 { font-size: 1.35rem; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile { padding: 10px 12px; }
  .tile-value { font-size: 1.1rem; }
  .panel { padding: 14px; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); z-index: 20; padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; font-size: .72rem; font-weight: 600; color: var(--muted); text-decoration: none; }
  .bottom-nav a[aria-current="page"] { color: var(--primary); }
  .fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--primary); color: var(--primary-ink); box-shadow: 0 6px 18px rgba(0,0,0,.25); z-index: 21; cursor: pointer; }
  .fab svg { width: 26px; height: 26px; }
  .form-grid, .new-client { grid-template-columns: 1fr 1fr; }
  .modal-backdrop { padding: 0; place-items: end stretch; }
  .modal, .modal.small, .modal.large { max-width: none; max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal > footer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .modal > footer .grow { display: none; }

  /* Tables become cards: one card per row, each value with its label. */
  .table-wrap:has(.cards-on-phone) { background: none; border: 0; box-shadow: none; overflow: visible; }
  .cards-on-phone thead { display: none; }
  .cards-on-phone, .cards-on-phone tbody, .cards-on-phone tfoot { display: block; }
  .cards-on-phone tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow); }
  .cards-on-phone td { border: 0; padding: 2px 0; min-width: 0; }
  .cards-on-phone td[data-label]::before { content: attr(data-label); display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; }
  .cards-on-phone .num { text-align: left; }
  .cards-on-phone td.actions { grid-column: 1 / -1; text-align: left; padding-top: 6px; }
  .cards-on-phone tfoot tr { background: var(--surface-2); }
  .cards-on-phone tfoot td:empty { display: none; }
  .cards-on-phone tfoot td[colspan] { grid-column: 1 / -1; }
  .edit-table input:not([type=checkbox]):not([type=color]), .edit-table select, .edit-table .num-in { min-width: 0; max-width: none; }

  .cal-cell { min-height: 54px; padding: 4px; }
  .cal-names { display: none; }
  .cal-count { top: auto; bottom: 4px; right: 4px; }
  .cal-head h2 { min-width: 0; flex: 1; font-size: 1rem; }
  .cal-head .check { margin-left: 0; width: 100%; }
  .page-head .row { width: 100%; }
}
@media (max-width: 420px) {
  .form-grid, .new-client { grid-template-columns: 1fr; }
  .tile-value { font-size: 1rem; }
  .cal-grid { gap: 2px; }
  .cal-cell { min-height: 46px; }
}
@media print {
  .sidebar, .topbar, .bottom-nav, .fab, .filters, .demo-banner, .btn, .ren-actions { display: none !important; }
  .content { padding: 0; }
  .panel, .table-wrap, .tile { box-shadow: none; }
}
.plain-list.compact .right { flex-direction: row; align-items: center; gap: 10px; }
.table td .mono { white-space: nowrap; }
@media (min-width: 861px) { .cards-on-phone td { font-size: .86rem; } }
