/*
  PAUTA — QUIET LEDGER
  A single visual source of truth layered over the legacy application.
  The underlying data model and workflows remain untouched.
*/

:root,
:root[data-theme="light"] {
  --paper: #f4f3ef;
  --surface: #fffefa;
  --surface-2: #eeece6;
  --ink: #20282b;
  --ink-soft: #5e696c;
  --ink-faint: #7a8384;
  --rule: #dedbd2;
  --rule-strong: #c7c2b7;
  --accent: #bd4f2e;
  --accent-2: #9f3e22;
  --accent-tint: #f8e8e1;
  --red: #a93f38;
  --red-tint: #f8e6e4;
  --gold: #8b681f;
  --stripe: #faf9f5;
  --success: #34745b;
  --success-tint: #e5f0ea;
  --warning: #8b681f;
  --warning-tint: #f7efd8;
  --shadow: 0 1px 2px rgba(32, 40, 43, .04), 0 8px 24px rgba(32, 40, 43, .055);
  --shadow-raised: 0 18px 50px rgba(32, 40, 43, .12);
  --radius: 12px;
  --serif: "MuotoWeb", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --sans: "MuotoWeb", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "MuotoWeb", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --content: 1120px;
  --gutter: clamp(18px, 3.2vw, 40px);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #171a19;
  --surface: #202423;
  --surface-2: #292e2c;
  --ink: #f4f1ea;
  --ink-soft: #b8bcb7;
  --ink-faint: #969c97;
  --rule: #383e3b;
  --rule-strong: #4b524e;
  --accent: #ee8a67;
  --accent-2: #f39c7e;
  --accent-tint: #443028;
  --red: #f08c83;
  --red-tint: #482c2a;
  --gold: #d3af5c;
  --stripe: #1b1f1d;
  --success: #80c4a5;
  --success-tint: #293b33;
  --warning: #d3af5c;
  --warning-tint: #3e3828;
  --shadow: 0 1px 2px rgba(0, 0, 0, .22), 0 10px 30px rgba(0, 0, 0, .18);
  --shadow-raised: 0 22px 60px rgba(0, 0, 0, .36);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html {
  background: var(--surface);
  color: var(--ink);
  scroll-behavior: auto;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button,
input,
select,
textarea { font: inherit; }
button,
[role="button"] { -webkit-tap-highlight-color: transparent; }
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 38%, transparent);
  outline-offset: 2px;
}
::selection { background: var(--accent-tint); color: var(--ink); }
::placeholder { color: var(--ink-faint); opacity: 1; }

#app {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

/* Desktop archive rail */
.index {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px 18px;
  overflow: hidden;
  background: var(--surface);
  color: var(--ink);
  border-right: 1px solid var(--rule);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px 22px;
  border-bottom: 1px solid var(--rule);
}
.brand::before { display: none; }
.pauta-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  color: #fffaf6;
  background: var(--accent);
  box-shadow: none;
}
.pauta-mark svg { width: 28px; height: 28px; }
.brand-copy { min-width: 0; }
.brand .kicker {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.01em;
  text-transform: none;
}
.brand h1 {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: .76rem;
  font-weight: 400;
  line-height: 1.3;
}
.brand .prov { display: none; }
.year-switch {
  margin: 20px 0 0;
  padding: 4px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface-2);
}
.year-switch .yr { color: var(--ink); font-size: .92rem; font-weight: 650; }
.index .chev,
.period-arrow,
.theme-btn,
.nav-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  color: var(--ink-soft);
  background: var(--surface);
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}
.index .chev { min-width: 36px; width: 36px; height: 36px; border-color: transparent; background: transparent; }
.chev:hover,
.period-arrow:hover,
.theme-btn:hover,
.nav-back:hover { color: var(--accent); border-color: var(--rule-strong); background: var(--accent-tint); }
.year-list { gap: 4px; padding: 8px 2px 0; background: transparent; }
.year-list .yb {
  min-height: 32px;
  padding: 4px 9px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: .74rem;
}
.year-list .yb.on { color: var(--accent); background: var(--accent-tint); border-color: transparent; }
.months { padding: 18px 0 12px; }
.mrow,
.m-all,
.months-toggle {
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--ink-soft);
}
.mrow:hover,
.m-all:hover,
.months-toggle:hover { color: var(--ink); background: var(--surface-2); }
.mrow.on,
.m-all.on {
  color: var(--accent);
  font-weight: 650;
  background: var(--accent-tint);
  border-color: transparent;
  border-left-color: var(--accent);
}
.mrow.on .mh { color: var(--accent); }

/* Header + navigation */
main { min-width: 0; background: var(--paper); }
.masthead {
  position: sticky;
  top: 0;
  z-index: 22;
  min-height: 76px;
  margin: 0;
  padding: 14px var(--gutter);
  gap: 12px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: none;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.period-nav { gap: 10px; }
.masthead .period .kicker {
  margin-bottom: 2px;
  color: var(--ink-soft);
  font-size: .66rem;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.masthead .period h2 {
  color: var(--ink);
  font-size: clamp(1.3rem, 2vw, 1.8rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -.025em;
  text-transform: none;
}
.avatar-btn {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  overflow: hidden;
  border: 2px solid var(--surface);
  border-radius: 50%;
  color: #fff;
  box-shadow: 0 0 0 1px var(--rule-strong);
}
.tabs {
  margin: 0;
  padding: 0 var(--gutter);
  gap: 24px;
  overflow-x: auto;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: var(--surface);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  min-height: 52px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--ink-soft);
  background: transparent;
  font-size: .86rem;
  font-weight: 500;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--accent); background: transparent; border-bottom-color: var(--accent); font-weight: 650; }
.view {
  width: min(100%, calc(var(--content) + 2 * var(--gutter)));
  max-width: none;
  padding: 32px var(--gutter) 80px;
}
.stack { gap: 20px; }

/* Surfaces and hierarchy */
h1, h2, h3, h4 { color: var(--ink); font-family: var(--sans); text-wrap: balance; }
.card,
.tile,
.overview,
.home-panel,
.home-stats,
.home-balance {
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: none;
}
.card.pad { padding: 24px; }
.card-h {
  padding: 18px 22px;
  border-bottom-color: var(--rule);
  align-items: baseline;
}
.card-h h3,
.entry-card .card-h h3 {
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -.015em;
}
.card-h .sub { color: var(--ink-soft); font-size: .78rem; }
.entry-card {
  border-top: 3px solid var(--accent);
  box-shadow: var(--shadow);
}
.empty-note,
.week-mobile-empty,
.home-empty {
  color: var(--ink-soft);
  line-height: 1.55;
}
.empty-note { padding: 52px 24px; }
.empty-note .big { color: var(--ink); font-size: 1.1rem; font-weight: 600; }

/* Forms */
.grid2 { gap: 16px; }
.field { gap: 7px; }
.field label,
.inline-date {
  color: var(--ink);
  font-size: .78rem;
  font-weight: 650;
}
.field input,
.field select,
.field textarea,
.inline-date input,
.inline-date select {
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--rule-strong);
  border-radius: 9px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(32, 40, 43, .02);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.field textarea { min-height: 100px; line-height: 1.5; }
.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--ink-faint); }
.field input:focus,
.field select:focus,
.field textarea:focus,
.inline-date input:focus,
.inline-date select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.field input:invalid:not(:placeholder-shown) { border-color: var(--red); }
.hint,
.inline-help { color: var(--ink-soft); font-size: .78rem; line-height: 1.5; }
.entry-grid { grid-template-columns: minmax(0, 1.7fr) minmax(170px, .6fr); gap: 16px; }
.entry-meta { gap: 16px 24px; }
.linky {
  min-height: 44px;
  padding: 8px 2px;
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}
.linky:hover { color: var(--accent-2); text-decoration: none; }
.timer-mini { width: 48px; border-radius: 9px; background: var(--surface-2); }

/* Buttons */
.btn {
  min-height: 44px;
  padding: 10px 16px;
  gap: 8px;
  border: 1px solid var(--accent);
  border-radius: 9px;
  color: #fff;
  background: var(--accent);
  font-size: .86rem;
  font-weight: 650;
  line-height: 1.2;
  box-shadow: none;
  transition: color .16s ease, background .16s ease, border-color .16s ease, opacity .16s ease;
}
.btn:hover { border-color: var(--accent-2); background: var(--accent-2); }
.btn:active { opacity: .84; }
.btn.ghost { color: var(--accent); background: transparent; }
.btn.ghost:hover { border-color: var(--accent); background: var(--accent-tint); }
.btn.mut { color: var(--ink); border-color: var(--rule-strong); background: var(--surface); }
.btn.mut:hover { color: var(--ink); border-color: var(--ink-faint); background: var(--surface-2); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 55%, var(--rule)); background: transparent; }
.btn.danger:hover { color: var(--red); border-color: var(--red); background: var(--red-tint); }
.btn.sm { min-height: 40px; padding: 8px 12px; font-size: .78rem; }
.btn[disabled], button[disabled] { opacity: .46; cursor: not-allowed; }
.row-actions { gap: 8px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Clients: search first, compact until a record is opened */
.client-directory {
  display: grid;
  gap: 18px;
  width: 100%;
  max-width: 920px;
}
.client-dir-head,
.client-editor-head,
.client-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.client-dir-head { padding: 2px 2px 4px; }
.client-dir-head h3,
.client-editor-head h3 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: clamp(1.8rem, 4vw, 2.55rem);
  font-weight: 560;
  line-height: 1.05;
  letter-spacing: -.04em;
}
.client-dir-head p,
.client-editor-head p {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: .84rem;
}
.client-eyebrow {
  color: var(--accent);
  font-size: .66rem;
  font-weight: 720;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.client-add-button,
.client-close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
}
.client-add-button {
  color: #fff;
  border: 1px solid var(--accent);
  background: var(--accent);
}
.client-add-button:hover { border-color: var(--accent-2); background: var(--accent-2); }
.client-add-button .ico { width: 22px; height: 22px; }
.client-close {
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  background: var(--surface);
  font-size: 1.55rem;
  font-weight: 300;
  line-height: 1;
}
.client-close:hover { color: var(--accent); border-color: var(--rule-strong); background: var(--accent-tint); }
.client-search {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.client-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.client-search .ico { width: 20px; height: 20px; flex: 0 0 auto; color: var(--ink-faint); }
.client-search input {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 0 0 0 12px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 1rem;
}
.client-search input::-webkit-search-cancel-button { opacity: .55; }
.client-filters {
  display: flex;
  gap: 8px;
  padding-bottom: 2px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}
.client-filters::-webkit-scrollbar { display: none; }
.client-chip {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--surface);
  font-size: .76rem;
  font-weight: 620;
}
.client-chip span { margin-left: 4px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.client-chip:hover { color: var(--ink); border-color: var(--ink-faint); }
.client-chip.on { color: var(--surface); border-color: var(--ink); background: var(--ink); }
.client-chip.on span { color: color-mix(in srgb, var(--surface) 72%, transparent); }
.client-add-panel,
.client-editor {
  padding: 22px;
  border: 1px solid var(--rule);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.client-add-panel .grid2,
.client-editor form > .grid2 { margin-top: 20px; }
.client-editor-head { align-items: flex-start; margin-bottom: 2px; }
.client-editor-head h3 { font-size: 1.55rem; }
.client-hub-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface-2);
}
.client-hub-stats > div { min-width: 0; display: grid; gap: 4px; padding: 13px 14px; }
.client-hub-stats > div + div { border-left: 1px solid var(--rule); }
.client-hub-stats span { color: var(--ink-faint); font-size: .61rem; font-weight: 680; letter-spacing: .06em; text-transform: uppercase; }
.client-hub-stats strong { overflow: hidden; color: var(--ink); font-size: .92rem; font-weight: 650; white-space: nowrap; text-overflow: ellipsis; }
.client-hub-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.client-activity { margin-top: 18px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.client-activity summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  color: var(--ink);
  font-size: .82rem;
  font-weight: 650;
  list-style: none;
}
.client-activity summary::-webkit-details-marker { display: none; }
.client-activity summary span { margin-left: auto; color: var(--ink-faint); font-size: .69rem; font-weight: 500; }
.client-activity summary::after { content: "+"; color: var(--accent); font-size: 1rem; }
.client-activity[open] summary::after { content: "−"; }
.client-activity-list { padding-bottom: 8px; }
.client-activity-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-top: 1px solid var(--rule); }
.client-activity-row > div { min-width: 0; display: grid; gap: 2px; }
.client-activity-row strong { font-size: .74rem; }
.client-activity-row span { overflow: hidden; color: var(--ink-soft); font-size: .7rem; white-space: nowrap; text-overflow: ellipsis; }
.client-activity-row b { flex: 0 0 auto; color: var(--ink); font-size: .78rem; font-weight: 650; }
.client-activity-empty { padding: 12px 0; border-top: 1px solid var(--rule); color: var(--ink-soft); font-size: .75rem; }
.client-editor-warn { margin: 18px 0 0; }
.client-billing {
  margin-top: 18px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.client-billing summary {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 650;
  list-style: none;
}
.client-billing summary::-webkit-details-marker { display: none; }
.client-billing summary::after { content: "+"; color: var(--accent); font-size: 1.1rem; font-weight: 500; }
.client-billing[open] summary::after { content: "−"; }
.client-billing summary span { margin-left: auto; color: var(--ink-faint); font-size: .72rem; font-weight: 500; }
.client-missing { margin: 0 0 15px; }
.client-billing-grid { margin-top: 2px; }
.client-address { margin: 14px 0 18px; }
.client-editor-actions { margin-top: 18px; }
.client-section { display: grid; gap: 9px; }
.client-section-title { padding: 2px 2px; }
.client-section-title h4 {
  margin: 0;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 680;
  letter-spacing: -.01em;
}
.client-section-title h4 span,
.client-section-title > span { color: var(--ink-faint); font-size: .72rem; font-weight: 500; }
.client-list {
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
}
.client-alpha {
  padding: 7px 15px 6px;
  border-bottom: 1px solid var(--rule);
  color: var(--accent);
  background: var(--surface-2);
  font-size: .65rem;
  font-weight: 740;
  letter-spacing: .08em;
}
.client-row {
  width: 100%;
  min-height: 68px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto 20px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  background: var(--surface);
  text-align: left;
}
.client-row:last-child { border-bottom: 0; }
.client-row:hover,
.client-row.selected { background: color-mix(in srgb, var(--surface) 78%, var(--accent-tint)); }
.client-row:active { opacity: .8; }
.client-initial {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: var(--accent);
  background: var(--accent-tint);
  font-size: .76rem;
  font-weight: 720;
}
.client-row-copy { min-width: 0; display: grid; gap: 2px; }
.client-row-copy strong,
.client-row-copy small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.client-row-copy strong { font-size: .88rem; font-weight: 650; }
.client-row-copy small { color: var(--ink-soft); font-size: .7rem; }
.client-row-status {
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--surface-2);
  font-size: .66rem;
  font-weight: 620;
  white-space: nowrap;
}
.client-row-status.needs { color: var(--warning); background: var(--warning-tint); }
.client-row-status.due { color: var(--red); background: var(--red-tint); }
.client-row-status.ready { color: var(--success); background: var(--success-tint); }
.client-row-arrow { width: 17px; height: 17px; color: var(--ink-faint); }
.client-more { justify-self: center; margin-top: 5px; }
.client-empty {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 24px;
  color: var(--ink-soft);
  text-align: center;
}
.client-empty .ico { width: 24px; height: 24px; color: var(--ink-faint); }
.client-empty strong { color: var(--ink); font-size: .92rem; }
.client-empty span { font-size: .76rem; }

/* Home: one clear path, supporting context second */
.home { display: grid; gap: 20px; max-width: 1040px; }
.home-welcome { padding: 4px 0 8px; }
.home-welcome .kicker {
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: none;
}
.home-welcome h3 {
  max-width: 18ch;
  color: var(--ink);
  font-size: clamp(2.25rem, 5vw, 4rem);
  font-weight: 500;
  line-height: .98;
  letter-spacing: -.052em;
}
.home-welcome p { margin-top: 12px; color: var(--ink-soft); font-size: 1rem; }
.home-primary { grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 14px; }
.home-primary-card,
.home-shortcut {
  border: 1px solid var(--rule);
  color: var(--ink);
  background: var(--surface);
  box-shadow: none;
  transform: none;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}
.home-primary-card:hover,
.home-shortcut:hover { transform: none; border-color: var(--rule-strong); box-shadow: none; background: color-mix(in srgb, var(--surface) 82%, var(--surface-2)); }
.home-primary-card:active,
.home-shortcut:active { transform: none; opacity: .84; }
.home-primary-card {
  min-height: 178px;
  padding: 24px;
  border-radius: 14px;
}
.home-primary-card.main { color: #fffaf6; border-color: var(--accent); background: var(--accent); }
.home-primary-card.main:hover { border-color: var(--accent-2); background: var(--accent-2); }
.home-primary-card .home-icon,
.home-shortcut .home-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-tint);
}
.home-primary-card.main .home-icon { color: #fff; background: rgba(255,255,255,.14); }
.home-primary-go { display: none; }
.home-primary-card strong { font-size: 1.42rem; font-weight: 650; letter-spacing: -.02em; }
.home-primary-card small { max-width: 34ch; margin-top: 6px; font-size: .84rem; opacity: .82; }
.home-timer-time { color: var(--accent); font-size: 1.15rem; }
.home-shortcuts { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.home-shortcut {
  min-height: 130px;
  padding: 16px;
  border-radius: 12px;
}
.home-shortcut .home-icon { width: 38px; height: 38px; margin-bottom: 12px; border-radius: 9px; }
.home-shortcut strong { margin-top: auto; font-size: .94rem; font-weight: 650; }
.home-shortcut small { margin-top: 3px; color: var(--ink-soft); font-size: .74rem; }
.home-shortcut.green .home-icon { color: var(--success); background: var(--success-tint); }
.home-shortcut.gold .home-icon { color: var(--warning); background: var(--warning-tint); }
.home-shortcut.blue .home-icon { color: #477083; background: #e7eff2; }
.home-shortcut.plum .home-icon { color: #795e73; background: #eee8ed; }
:root[data-theme="dark"] .home-shortcut.blue .home-icon { color: #9cc1cf; background: #293a40; }
:root[data-theme="dark"] .home-shortcut.plum .home-icon { color: #c8a7bf; background: #3b3038; }
.home-stats { overflow: hidden; box-shadow: none; }
.home-stat { padding: 17px 20px; border-right-color: var(--rule); }
.home-stat span { color: var(--ink-soft); font-size: .65rem; font-weight: 650; letter-spacing: .07em; }
.home-stat strong { margin-top: 6px; color: var(--ink); font-size: 1.4rem; font-weight: 600; }
.home-stat.accent strong { color: var(--accent); }
.home-lower { grid-template-columns: minmax(0, 1.3fr) minmax(270px, .7fr); gap: 14px; }
.home-panel { padding: 20px; }
.home-panel-head { margin-bottom: 8px; }
.home-panel-head h4 { font-size: 1rem; font-weight: 650; }
.home-panel-head button { color: var(--accent); font-size: .8rem; }
.home-recent-row { padding: 13px 0; border-top-color: var(--rule); }
.home-recent-client { font-weight: 600; }
.home-recent-meta { color: var(--ink-soft); font-size: .75rem; }
.home-recent-hours { color: var(--ink); font-weight: 650; }
.home-alert {
  width: 100%;
  min-height: 48px;
  padding: 11px 0;
  border: 0;
  border-radius: 0;
  border-top: 1px solid var(--rule);
  color: var(--ink);
  background: transparent;
  font: inherit;
  text-align: left;
}
.home-alert:first-child { border-top: 0; }
.home-alert strong { color: var(--ink); }
.home-alert-label { min-width: 0; flex: 1; }
.home-alert.is-action { cursor: pointer; transition: color .16s ease, background .16s ease; }
.home-alert.is-action:hover { color: var(--accent); background: color-mix(in srgb, var(--accent-tint) 56%, transparent); }
.home-alert.is-action:active { opacity: .72; }
.home-alert .home-alert-arrow { width: 17px; height: 17px; margin-left: 2px; color: var(--ink-faint); }
.home-alert.is-action:hover .home-alert-arrow { color: var(--accent); }

/* Reserve a real label lane above the columns so values never collide with the card edge. */
.bars { height: 206px; padding-top: 24px; overflow: hidden; }
.barcol { height: 100%; justify-content: flex-end; }
.barcol .bval { min-height: 15px; line-height: 15px; white-space: nowrap; }

@media (max-width: 860px) {
  .bars { height: 190px; padding-top: 20px; gap: 5px; }
  .barcol { gap: 5px; }
}

/* Overview and time */
.overview { grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; }
.overview-item { min-width: 0; padding: 16px 18px; border-right-color: var(--rule); }
.overview-item:last-child { background: var(--accent-tint); }
.overview-label,
.tile .lab { color: var(--ink-soft); font-size: .65rem; font-weight: 650; letter-spacing: .08em; }
.overview-value { margin-top: 6px; color: var(--ink); font-size: 1.35rem; font-weight: 600; }
.timer-strip { gap: 14px; }
.timer-strip .timer-display { color: var(--ink); font-size: 1.25rem; font-weight: 650; }
.timer-label,
.timer-hint { color: var(--ink-soft); }
.run-dot { background: var(--ink-faint); }
.run-dot.on { background: var(--success); }
.run-dot.paused { background: var(--warning); }

/* Tables and records */
table.ledger { font-size: .86rem; }
table.ledger th {
  padding: 11px 14px;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule-strong);
  font-size: .65rem;
  font-weight: 650;
  letter-spacing: .07em;
}
table.ledger td { padding: 13px 14px; border-bottom-color: var(--rule); }
table.ledger tbody tr:hover { background: var(--stripe); }
.badge {
  padding: 3px 8px;
  border-color: var(--rule-strong);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: .65rem;
  font-weight: 650;
  text-decoration: none;
}
.badge.draft { color: var(--ink-soft); background: var(--surface-2); text-decoration: none; }
.badge.paid,
.badge.approved { color: var(--success); border-color: color-mix(in srgb, var(--success) 38%, var(--rule)); background: var(--success-tint); }
.badge.pending { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 38%, var(--rule)); background: var(--warning-tint); }
.record-card { padding: 16px; }
.record-client { font-weight: 650; }
.record-hours { color: var(--ink); }
.record-actions { border-top-color: var(--rule); }
.record-more summary { border-radius: 9px; }
.record-more-menu { border-radius: 10px; box-shadow: var(--shadow-raised); }

/* Calendar: one workflow, weekly detail and monthly orientation */
.calendar-page { width: 100%; max-width: 1120px; }
.calendar-toolbar { display: grid; gap: 18px; }
.calendar-topbar,
.calendar-top-actions,
.calendar-period-actions,
.calendar-summary {
  display: flex;
  align-items: center;
}
.calendar-topbar { justify-content: space-between; gap: 18px; }
.calendar-topbar h3 {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 1.45rem;
  font-weight: 590;
  line-height: 1.1;
  letter-spacing: -.035em;
}
.calendar-top-actions { justify-content: flex-end; align-items: flex-end; gap: 10px; }
.calendar-filter-row { display: flex; align-items: flex-end; gap: 8px; }
.calendar-view-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface-2);
}
.calendar-view-switch button {
  min-width: 82px;
  min-height: 36px;
  padding: 7px 13px;
  border: 0;
  border-radius: 7px;
  color: var(--ink-soft);
  background: transparent;
  font-size: .76rem;
  font-weight: 650;
}
.calendar-view-switch button:hover { color: var(--ink); }
.calendar-view-switch button.on { color: var(--ink); background: var(--surface); box-shadow: 0 1px 3px rgba(32,40,43,.08); }
.calendar-select-field { min-width: 190px; display: grid; gap: 4px; }
.calendar-select-field > span { padding-left: 2px; color: var(--ink-faint); font-size: .6rem; font-weight: 680; letter-spacing: .055em; text-transform: uppercase; }
.calendar-provider,
.calendar-client {
  width: 100%;
  min-height: 44px;
  padding: 8px 32px 8px 11px;
  border: 1px solid var(--rule-strong);
  border-radius: 9px;
  color: var(--ink);
  background-color: var(--surface);
  font-size: .78rem;
}
.calendar-period-actions { gap: 8px; }
.month-calendar { overflow: hidden; }
.calendar-summary {
  justify-content: flex-start;
  gap: 0;
  padding: 0 18px;
  border-bottom: 1px solid var(--rule);
}
.calendar-summary > div {
  min-width: 170px;
  display: grid;
  gap: 2px;
  padding: 14px 22px 14px 0;
}
.calendar-summary > div + div { padding-left: 22px; border-left: 1px solid var(--rule); }
.calendar-summary span { color: var(--ink-soft); font-size: .65rem; font-weight: 650; letter-spacing: .055em; text-transform: uppercase; }
.calendar-summary strong { color: var(--ink); font-size: 1.05rem; font-weight: 650; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--rule);
  gap: 1px;
}
.calendar-weekday {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 7px 10px;
  color: var(--ink-faint);
  background: var(--surface-2);
  font-size: .64rem;
  font-weight: 680;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.calendar-day {
  position: relative;
  min-width: 0;
  min-height: 108px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr;
  align-content: start;
  gap: 7px 8px;
  padding: 10px;
  border: 0;
  color: var(--ink);
  background: var(--surface);
  text-align: left;
}
.calendar-day:hover { z-index: 1; background: color-mix(in srgb, var(--surface) 80%, var(--accent-tint)); }
.calendar-day:active { opacity: .82; }
.calendar-day.outside { color: var(--ink-faint); background: color-mix(in srgb, var(--surface) 70%, var(--surface-2)); }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.calendar-day-number {
  width: 27px;
  height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: .76rem;
  font-weight: 650;
}
.calendar-day.today .calendar-day-number { color: #fff; background: var(--accent); }
.calendar-day > strong { align-self: center; color: var(--accent); font-size: .74rem; font-weight: 680; white-space: nowrap; }
.calendar-day-empty { align-self: center; color: var(--ink-faint); font-size: .72rem; }
.calendar-day-clients {
  min-width: 0;
  grid-column: 1 / -1;
  display: grid;
  align-content: start;
  gap: 3px;
}
.calendar-day-clients span { overflow: hidden; color: var(--ink-soft); font-size: .65rem; white-space: nowrap; text-overflow: ellipsis; }
.calendar-day i { display: none; }
.calendar-help { margin: 0; padding: 11px 16px 13px; color: var(--ink-faint); font-size: .7rem; }

/* Weekly mobile flow */
.week-day-strip { gap: 8px; padding: 14px 14px 10px; }
.week-day-chip {
  flex-basis: 62px;
  min-height: 70px;
  border-radius: 10px;
  color: var(--ink-soft);
  background: var(--surface);
}
.week-day-chip.on { color: #fff; border-color: var(--accent); background: var(--accent); }
.week-day-chip.has:not(.on) { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--rule)); }
.week-mobile-body { padding: 12px 16px 16px; }
.week-mobile-row { border-radius: 10px; }
.week-actions { border-top: 1px solid var(--rule); }

/* Settings, permissions and avatar */
.shortcut-option,
.notify-option {
  min-height: 60px;
  padding: 13px;
  border-radius: 9px;
  background: var(--surface);
}
.permission-row { padding: 13px 4px; }
.permission-row input,
.shortcut-option input,
.notify-option input { accent-color: var(--accent); }
.profile-avatar-card { overflow: hidden; }
.profile-avatar-preview { display: flex; flex-direction: column; align-items: center; gap: 9px; }
.profile-avatar-caption { color: var(--ink-soft); font-size: .7rem; font-weight: 650; }
.avatar-library { min-width: 0; }
.avatar-library-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.avatar-library-head > span { color: var(--ink-faint); font-size: .68rem; }
.avatar-presets { display: grid; grid-template-columns: repeat(6, minmax(58px, 1fr)); gap: 10px; margin: 0 0 18px; }
.avatar-choice {
  width: auto;
  height: auto;
  min-width: 0;
  padding: 5px 5px 7px;
  display: grid;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.avatar-choice.illustrated { overflow: visible; background: transparent; }
.avatar-choice-art { display: block; overflow: hidden; aspect-ratio: 1; border-radius: 12px; box-shadow: 0 1px 0 rgba(20,25,24,.08); transition: transform .16s ease, box-shadow .16s ease; }
.avatar-choice-art svg,
.avatar-choice-art img { width: 100%; height: 100%; display: block; object-fit: cover; }
.avatar-choice-name { overflow: hidden; color: var(--ink-soft); font-size: .62rem; font-weight: 620; line-height: 1; text-overflow: ellipsis; white-space: nowrap; }
.avatar-choice:hover { transform: translateY(-2px); border-color: var(--rule); background: var(--surface-soft); }
.avatar-choice:hover .avatar-choice-art { box-shadow: 0 5px 14px rgba(20,25,24,.12); }
.avatar-choice.on { border-color: var(--accent); background: var(--accent-tint); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.avatar-choice.on .avatar-choice-name { color: var(--accent); }
.avatar-choice:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 2px; }
.avatar-photo-divider { display: flex; align-items: center; gap: 10px; margin: 2px 0 13px; color: var(--ink-faint); font-size: .66rem; }
.avatar-photo-divider::before, .avatar-photo-divider::after { content: ""; height: 1px; flex: 1; background: var(--rule); }
.profile-avatar-preview .pk-av { border-radius: 22px; }
.fiscal-item { padding: 17px 0; }
.fiscal-icon { color: var(--accent); background: var(--accent-tint); }
.warnbar { border-radius: 10px; }
.settings-group { border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); overflow: hidden; }
.settings-group > summary {
  min-height: 72px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  list-style: none;
  cursor: pointer;
  color: var(--ink);
}
.settings-group > summary::-webkit-details-marker { display: none; }
.settings-group > summary > span:nth-child(2) { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.settings-group > summary strong { font-size: .94rem; font-weight: 650; }
.settings-group > summary small { margin-top: 2px; color: var(--ink-soft); font-size: .72rem; }
.settings-group-icon { width: 38px; height: 38px; flex: 0 0 38px; display: flex; align-items: center; justify-content: center; border-radius: 9px; color: var(--accent); background: var(--accent-tint); }
.settings-group-icon .ico { width: 19px; height: 19px; }
.settings-group-chevron { width: 19px; height: 19px; color: var(--ink-soft); transition: transform .16s ease; }
.settings-group[open] .settings-group-chevron { transform: rotate(90deg); }
.settings-group-body { display: grid; gap: 10px; padding: 0 10px 10px; border-top: 1px solid var(--rule); background: var(--paper); }
.settings-group-body > .card { margin-top: 10px; }

/* Picker, loading, errors and confirmations */
#picker {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  color: var(--ink);
  background: var(--surface);
}
#picker::before { display: none; }
#picker .pk-wrap { width: min(100%, 860px); padding: 56px 24px; }
.pk-brand { margin-bottom: 30px; color: var(--ink); }
.pk-brand .pauta-mark { width: 44px; height: 44px; }
#picker .pk-title {
  margin-top: 0;
  color: var(--ink);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.045em;
}
.pk-grid { gap: 28px 22px; margin-top: 44px; }
.pk-tile { width: 122px; min-height: 154px; border-radius: 12px; }
.pk-av { width: 96px; height: 96px; border: 2px solid transparent; border-radius: 22px; box-shadow: none; }
.pk-tile:hover .pk-av,
.pk-tile:focus-visible .pk-av { border-color: var(--accent); transform: none; }
.pk-name { color: var(--ink); font-size: .9rem; font-weight: 650; }
.pk-profile-state { color: var(--ink-soft); }
.pk-add .pk-av { color: var(--ink-soft); border-color: var(--rule-strong); border-radius: 22px; background: var(--surface-2); }
.pk-form {
  width: min(100%, 400px);
  max-width: none;
  margin-top: 32px;
  padding: 24px;
  gap: 14px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.pk-err {
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--red) 30%, var(--rule));
  border-radius: 8px;
  color: var(--red);
  background: var(--red-tint);
  font-size: .8rem;
}
.pk-loading { width: min(100%, 400px); margin: 32px auto 0; display: grid; gap: 10px; }
.pk-skeleton { height: 64px; overflow: hidden; border-radius: 12px; background: var(--surface-2); position: relative; }
.pk-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 75%, transparent), transparent);
  animation: pauta-shimmer 1.4s infinite;
}
@keyframes pauta-shimmer { to { transform: translateX(100%); } }
#toast {
  left: 50%;
  right: auto;
  bottom: max(24px, calc(12px + env(safe-area-inset-bottom)));
  max-width: min(90vw, 440px);
  padding: 12px 16px;
  transform: translate(-50%, 16px);
  border: 1px solid color-mix(in srgb, #fff 14%, transparent);
  border-radius: 10px;
  color: #fff;
  background: #27302f;
  box-shadow: var(--shadow-raised);
  font-size: .84rem;
  font-weight: 600;
}
#toast.show { transform: translate(-50%, 0); }
#modal { background: rgba(22, 25, 24, .52); backdrop-filter: blur(2px); }
.modal-box { border: 1px solid var(--rule); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-raised); }
.modal-box h3 { font-size: 1.3rem; font-weight: 650; }
.modal-box p { color: var(--ink-soft); line-height: 1.55; }

/* No glass carousel: stable, predictable bottom navigation */
.botnav::before { display: none !important; }
.fab { display: none !important; }

@media (max-width: 1040px) and (min-width: 861px) {
  #app { grid-template-columns: 224px minmax(0, 1fr); }
  .index { padding-inline: 14px; }
  .home-shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  html,
  body { width: 100%; max-width: 100%; min-height: 100%; overflow-x: hidden; background: var(--surface); }
  #app { display: block; min-height: 100dvh; background: var(--paper); }
  .index,
  .tabs { display: none; }
  main { min-height: 100dvh; }
  .masthead {
    min-height: calc(64px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    padding-right: max(14px, env(safe-area-inset-right));
    padding-bottom: 0;
    padding-left: max(14px, env(safe-area-inset-left));
    gap: 8px;
    background: var(--surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .masthead.contextual { justify-content: flex-start; }
  .masthead.contextual .period-nav {
    position: static;
    width: auto;
    max-width: none;
    flex: 1 1 auto;
    order: 0;
    justify-content: flex-start;
    margin: 0;
    transform: none;
    pointer-events: none;
  }
  .masthead.contextual .period { text-align: left; }
  .masthead.contextual .period h2 { white-space: nowrap; }
  .masthead .period .kicker { display: none; }
  .masthead .period h2 { font-size: 1.35rem; font-weight: 600; letter-spacing: -.025em; }
  .period-nav { min-width: 0; justify-content: space-between; }
  .period-nav .period { min-width: 0; text-align: center; }
  .period-nav .period h2 { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .period-arrow,
  .theme-btn,
  .avatar-btn,
  .nav-back { width: 44px; height: 44px; flex: 0 0 44px; }
  .header-sync { display: none; }
  .view {
    width: 100%;
    padding-top: 20px;
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
    overflow-x: hidden;
  }
  .stack,
  .home { gap: 14px; }
  .card,
  .overview,
  .home-panel,
  .home-stats { border-radius: 11px; }
  .card.pad { padding: 18px; }
  .card-h { padding: 15px 17px; }
  .card-h h3,
  .entry-card .card-h h3 { font-size: 1.14rem; }
  .card-h .sub { width: auto; margin-left: auto; text-align: right; }
  .grid2,
  .entry-grid { grid-template-columns: 1fr; gap: 14px; }
  .field input,
  .field select,
  .field textarea,
  .inline-date input,
  .inline-date select { min-height: 48px; font-size: 16px; }
  .btn { min-height: 46px; }
  .btn.sm { min-height: 44px; }
  .client-directory { gap: 14px; }
  .client-dir-head { padding-inline: 1px; }
  .client-dir-head h3 { font-size: 2rem; }
  .client-dir-head p { margin-top: 5px; font-size: .76rem; }
  .client-add-button { width: 44px; height: 44px; }
  .client-search { min-height: 50px; padding-inline: 14px; }
  .client-search input { min-height: 48px; padding-left: 10px; font-size: 16px; }
  .client-chip { min-height: 36px; padding: 6px 11px; }
  .client-add-panel,
  .client-editor { padding: 17px; border-radius: 11px; }
  .client-editor-head h3 { font-size: 1.35rem; }
  .client-editor-head p { font-size: .75rem; }
  .client-hub-stats > div { padding: 11px 9px; }
  .client-hub-stats span { font-size: .54rem; }
  .client-hub-stats strong { font-size: .8rem; }
  .client-hub-actions { display: grid; grid-template-columns: 1fr; }
  .client-hub-actions .btn { width: 100%; }
  .client-editor-actions { display: grid; grid-template-columns: 1fr; }
  .client-editor-actions .btn { width: 100%; }
  .client-section-title { padding-inline: 1px; }
  .client-row {
    min-height: 64px;
    grid-template-columns: 34px minmax(0, 1fr) auto 16px;
    gap: 9px;
    padding: 9px 11px;
  }
  .client-initial { width: 34px; height: 34px; border-radius: 8px; }
  .client-row-copy strong { font-size: .84rem; }
  .client-row-copy small { font-size: .66rem; }
  .client-row-status { max-width: 118px; overflow: hidden; text-overflow: ellipsis; font-size: .61rem; }
  .client-alpha { padding-inline: 12px; }
  .overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-item { padding: 14px; border-bottom: 1px solid var(--rule); }
  .overview-item:nth-child(2n) { border-right: 0; }
  .overview-item:nth-last-child(-n + 2) { border-bottom: 0; }
  .overview-item:last-child { grid-column: auto; }
  .overview-value { font-size: 1.2rem; white-space: normal; }
  .timer-strip { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 10px; }
  .timer-strip .timer-actions { grid-column: 3; grid-row: 1 / span 2; }
  .timer-strip .timer-label { display: block; margin-top: 2px; font-size: .74rem; }
  .entry-meta { gap: 8px 16px; }
  .entry-card > .row-actions .btn { flex: 1; }
  .ledger-wrap { display: none; }
  .mobile-records { display: block; }
  .home-welcome { padding: 8px 0 10px; }
  .home-welcome .kicker { margin-bottom: 6px; font-size: .68rem; }
  .home-welcome h3 { font-size: clamp(2.35rem, 11vw, 3.35rem); }
  .home-welcome p { margin-top: 10px; font-size: .94rem; }
  .home-primary { grid-template-columns: 1fr; gap: 10px; }
  .home-primary-card { min-height: auto; padding: 18px; border-radius: 12px; }
  .home-primary-card.main {
    min-height: 104px;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 24px;
    align-items: center;
    gap: 14px;
    padding: 17px 16px;
  }
  .home-primary-card.main .home-icon { width: 46px; height: 46px; align-self: center; }
  .home-primary-card.main .home-primary-copy { min-width: 0; }
  .home-primary-card.main strong { font-size: 1.12rem; line-height: 1.15; }
  .home-primary-card.main small { max-width: 29ch; margin-top: 4px; font-size: .76rem; line-height: 1.3; }
  .home-primary-card.main .home-primary-go { display: block; width: 22px; height: 22px; opacity: .8; }
  .home-primary-card:not(.main) {
    min-height: 96px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
  }
  .home-primary-card:not(.main) > div:first-child { display: contents !important; }
  .home-primary-card:not(.main) > span { min-width: 0; }
  .home-primary-card:not(.main) .row-actions { grid-column: 3; grid-row: 1; }
  .home-primary-card:not(.main) .row-actions .btn { min-width: 82px; }
  .home-primary-card strong { font-size: 1.15rem; }
  .home-primary-card small { font-size: .78rem; }
  .home-shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .home-shortcut { min-height: 118px; padding: 14px; }
  .home-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .home-stat { padding: 13px 10px; }
  .home-stat span { font-size: .57rem; }
  .home-stat strong { font-size: 1.08rem; }
  .home-lower { grid-template-columns: 1fr; gap: 10px; }
  .home-panel { padding: 17px; }
  .calendar-toolbar { gap: 14px; }
  .calendar-topbar { align-items: flex-start; flex-wrap: wrap; gap: 14px; }
  .calendar-topbar h3 { font-size: 1.25rem; }
  .calendar-top-actions { width: 100%; display: grid; align-items: stretch; justify-content: stretch; }
  .calendar-view-switch { width: 100%; }
  .calendar-view-switch button { min-width: 0; width: 100%; min-height: 38px; }
  .calendar-filter-row { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .calendar-select-field { min-width: 0; width: 100%; }
  .calendar-provider,
  .calendar-client { max-width: none; width: 100%; min-height: 44px; font-size: 16px; }
  .calendar-period-actions { justify-content: flex-start; }
  .calendar-period-actions .btn:nth-child(2) { flex: 1; max-width: 170px; }
  .calendar-summary { padding: 0 14px; }
  .calendar-summary > div { min-width: 0; flex: 1; padding: 12px 12px 12px 0; }
  .calendar-summary > div + div { padding-left: 12px; }
  .calendar-summary span { font-size: .56rem; }
  .calendar-summary strong { font-size: .96rem; }
  .calendar-weekday { min-height: 28px; justify-content: center; padding: 5px 2px; font-size: .55rem; }
  .calendar-day {
    min-height: 62px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
    padding: 5px 2px 4px;
    text-align: center;
  }
  .calendar-day-number { width: 25px; height: 25px; font-size: .69rem; }
  .calendar-day > strong { font-size: .56rem; line-height: 1; }
  .calendar-day-empty,
  .calendar-day-clients { display: none; }
  .calendar-day i { width: 4px; height: 4px; display: block; margin-top: 1px; border-radius: 50%; background: var(--accent); }
  .calendar-help { padding: 9px 12px 11px; text-align: center; }
  .week-desktop,
  .mobile-scroll-hint { display: none !important; }
  .week-mobile { display: block; }
  .week-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 14px 14px !important;
  }
  .week-actions .btn { width: 100%; padding-inline: 8px; font-size: .76rem; }
  .week-actions .week-submit-btn,
  .week-submit-help { grid-column: 1 / -1; }
  .permission-grid { grid-template-columns: 1fr; }
  .profile-avatar-layout { grid-template-columns: 1fr; }
  .profile-avatar-preview { width: 100%; height: auto; flex-direction: row; justify-content: flex-start; }
  .profile-avatar-preview .pk-av { width: 76px; height: 76px; flex: 0 0 76px; }
  .profile-avatar-caption { font-size: .78rem; }
  .avatar-library-head { align-items: flex-start; flex-direction: column; gap: 3px; }
  .avatar-presets { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .avatar-choice { padding: 4px 4px 7px; border-radius: 12px; }
  .avatar-choice-art { border-radius: 10px; }
  .avatar-choice-name { font-size: .58rem; }
  .botnav {
    --active-index: 0;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: 100%;
    height: calc(64px + env(safe-area-inset-bottom));
    min-height: calc(64px + env(safe-area-inset-bottom));
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    overflow: visible;
    border: 0;
    border-top: 1px solid var(--rule);
    border-radius: 0;
    background: var(--surface);
    box-shadow: none;
    isolation: auto;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .botnav a {
    position: relative;
    z-index: 1;
    display: flex;
    height: 64px;
    min-height: 64px;
    padding: 9px 3px 7px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    border-radius: 0;
    color: var(--ink-soft);
    background: transparent;
    font-size: .68rem;
    font-weight: 500;
    text-shadow: none;
    transform: none;
    transition: color .16s ease;
  }
  .botnav a::after {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 24px;
    height: 2px;
    border-radius: 0 0 2px 2px;
    background: transparent;
    transform: translateX(-50%);
  }
  .botnav a.on { color: var(--accent); font-weight: 650; }
  .botnav a.on::after { background: var(--accent); }
  .botnav a:active { transform: none; opacity: .7; }
  .botnav a .ico { width: 21px; height: 21px; }
  .nav-badge { top: 5px; box-shadow: 0 0 0 2px var(--surface); }
  #toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
  #picker .pk-wrap { min-height: 100dvh; padding: 32px 18px; justify-content: center; }
  .pk-brand { margin-bottom: 24px; }
  #picker .pk-title { font-size: 2.4rem; }
  .pk-grid { gap: 22px 10px; margin-top: 34px; }
  .pk-tile { width: 102px; min-height: 136px; }
  .pk-av { width: 82px; height: 82px; border-radius: 19px; }
  .pk-name { font-size: .82rem; }
  .pk-form { padding: 20px; }
  #modal { align-items: flex-end; padding: 0; }
  .modal-box { max-width: none; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; }
}

@media (max-width: 390px) {
  .view { padding-inline: max(12px, env(safe-area-inset-left)); }
  .masthead { padding-inline: max(10px, env(safe-area-inset-left)); }
  .masthead .period h2 { font-size: 1.2rem; }
  .home-welcome h3 { font-size: 2.25rem; }
  .home-shortcut { min-height: 112px; }
  .home-stat { padding-inline: 8px; }
  .home-stat strong { font-size: 1rem; }
  .card.pad { padding: 16px; }
  .timer-strip { grid-template-columns: auto minmax(0, 1fr); }
  .timer-strip .timer-actions { grid-column: 1 / -1; grid-row: auto; width: 100%; margin-top: 8px; }
  .timer-strip .timer-actions .btn { flex: 1; }
}

@media (orientation: landscape) and (max-height: 520px) and (max-width: 860px) {
  .masthead { position: relative; }
  .view { padding-top: 14px; }
  #picker .pk-wrap { min-height: auto; padding-block: 24px; }
}

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

@media print {
  .botnav { display: none !important; }
}
