/*
 * AgriTracker — hand-written CSS, no build step (same approach as AgriTrader's
 * entry screens). Mobile first; desktop layout from 760px.
 */

:root {
  --bg: #f2f5f3;
  --surface: #ffffff;
  --surface-2: #f7faf8;
  --ink: #16221b;
  --muted: #5b6a61;
  --line: #dbe3de;
  --accent: #17653a;
  --accent-strong: #0f4f2c;
  --accent-ink: #ffffff;
  --soft: #e8f1ec;
  --warn: #b3341f;
  --warn-soft: #fbeae6;
  --gold: #8a5a00;
  --gold-soft: #fbf1dc;
  --shadow: 0 1px 2px rgba(16, 40, 25, .06), 0 4px 16px rgba(16, 40, 25, .05);
  --radius: 14px;
  --tabbar-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1712; --surface: #17221b; --surface-2: #1b2820; --ink: #e9f1ec; --muted: #9bb0a3;
    --line: #2a3b31; --accent: #5ec488; --accent-strong: #7fd6a2; --accent-ink: #06210f; --soft: #1e3026;
    --warn: #f0907c; --warn-soft: #3a1f19; --gold: #f0c674; --gold-soft: #3a2f17;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1712; --surface: #17221b; --surface-2: #1b2820; --ink: #e9f1ec; --muted: #9bb0a3;
  --line: #2a3b31; --accent: #5ec488; --accent-strong: #7fd6a2; --accent-ink: #06210f; --soft: #1e3026;
  --warn: #f0907c; --warn-soft: #3a1f19; --gold: #f0c674; --gold-soft: #3a2f17;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; letter-spacing: -.01em; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 8px; }
a { color: var(--accent); }
p { margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.ic { width: 20px; height: 20px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- App shell ---------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--accent); color: var(--accent-ink);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .08);
}
:root[data-theme="dark"] .topbar { background: #133d25; color: #e9f1ec; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .topbar { background: #133d25; color: #e9f1ec; } }
.topbar-inner { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; font-weight: 750; font-size: 18px; letter-spacing: -.01em; white-space: nowrap; }
.brand .ic { width: 24px; height: 24px; }
.brand small { font-weight: 600; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .3); }
.topbar .spacer { flex: 1; }

.firm-switch { display: flex; align-items: center; gap: 6px; min-width: 0; }
.firm-switch select {
  min-height: 38px; max-width: 46vw; padding: 6px 30px 6px 10px; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .35); background-color: rgba(255, 255, 255, .14); color: inherit;
  font: inherit; font-size: 14px; font-weight: 600; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.firm-switch select option { color: #16221b; background: #fff; }
.firm-name { font-weight: 600; font-size: 14px; opacity: .95; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.top-actions { display: flex; align-items: center; gap: 4px; }
.top-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 10px; border-radius: 10px;
  color: inherit; text-decoration: none; font: inherit; font-size: 14px; font-weight: 600;
  background: transparent; border: 1px solid transparent; cursor: pointer;
}
.top-btn:hover { background: rgba(255, 255, 255, .14); }
.top-btn .txt { display: none; }

/* Desktop tabs live in the top bar; on phones they move to a bottom bar. */
.tabs { display: none; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -2px 12px rgba(16, 40, 25, .06);
}
.tabbar .tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: var(--tabbar-h); color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 600;
}
.tabbar .tab .ic { width: 22px; height: 22px; }
.tabbar .tab.is-active { color: var(--accent); }
.tabbar .tab.is-active .ic { background: var(--soft); border-radius: 999px; padding: 3px 14px; width: 52px; height: 28px; box-sizing: border-box; overflow: visible; }

main.page {
  max-width: 1120px; margin: 0 auto;
  padding: 18px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 28px);
}
main.page.no-tabbar { padding-bottom: 40px; }

@media (min-width: 760px) {
  .topbar { padding-top: 12px; padding-bottom: 12px; }
  .tabs { display: flex; gap: 4px; margin-left: 12px; }
  .tabs .tab {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px;
    color: inherit; opacity: .85; text-decoration: none; font-weight: 600; font-size: 15px;
  }
  .tabs .tab:hover { opacity: 1; background: rgba(255, 255, 255, .12); }
  .tabs .tab.is-active { opacity: 1; background: rgba(255, 255, 255, .2); }
  .tabbar { display: none; }
  .top-btn .txt { display: inline; }
  main.page { padding: 26px 24px 48px; }
  h1 { font-size: 26px; }
}
@media (min-width: 760px) and (max-width: 1020px) {
  .tabs .tab .ic { display: none; }
  .top-btn .txt { display: none; }
}

/* ---------- Page head / flash ------------------------------------------ */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head p { margin: 4px 0 0; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crumb { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; text-decoration: none; margin-bottom: 8px; }
.crumb .ic { width: 16px; height: 16px; }

.flash-stack { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); top: 76px; width: min(560px, calc(100% - 32px)); display: grid; gap: 8px; }
.flash {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px;
  background: var(--ink); color: var(--bg); box-shadow: 0 8px 28px rgba(0, 0, 0, .18); font-size: 15px;
  animation: flash-in .2s ease-out;
}
.flash.alert { background: var(--warn); color: #fff; }
.flash button { margin-left: auto; background: none; border: 0; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; opacity: .8; padding: 0 2px; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (min-width: 760px) { .flash-stack { top: 80px; } }

/* ---------- Cards & layout --------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card > h2 { margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 16px 18px 0; }

.grid-2 { display: grid; gap: 16px; }
@media (min-width: 900px) {
  .grid-2 { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; }
  .grid-2.even { grid-template-columns: 1fr 1fr; }
  .sticky { position: sticky; top: 88px; }
}

/* ---------- Stats ------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.stat b { display: block; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat.hero { grid-column: 1 / -1; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.stat.hero span { color: inherit; opacity: .85; }
.stat.hero b { font-size: 30px; }
.stat.due b { color: var(--gold); }
@media (min-width: 760px) { .stat.hero { grid-column: span 2; } }

/* ---------- Forms ------------------------------------------------------- */
label, .label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.fields { display: grid; gap: 0 12px; grid-template-columns: 1fr 1fr; }
.fields > .full { grid-column: 1 / -1; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], input[type=search], input:not([type]), select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; appearance: none;
}
select {
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235b6a61' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input.big { font-size: 22px; font-weight: 700; min-height: 54px; font-variant-numeric: tabular-nums; }
.input-prefix { position: relative; }
.input-prefix > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.input-prefix > input { padding-left: 28px; }
.checks { display: grid; gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 15px; font-weight: 500; color: var(--ink); margin: 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.form-errors { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }
.form-errors ul { margin: 0; padding-left: 18px; }

/* ---------- Buttons ----------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 650; font-size: 15px; text-decoration: none; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); white-space: nowrap;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: var(--accent-strong); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--soft); }
.btn.danger { background: var(--surface); color: var(--warn); border-color: var(--line); }
.btn.danger:hover { background: var(--warn-soft); }
.btn.solid-danger { background: var(--warn); color: #fff; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.lg { min-height: 54px; font-size: 17px; }
.btn .ic { width: 18px; height: 18px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--soft); color: var(--ink); }
.icon-btn.danger:hover { background: var(--warn-soft); color: var(--warn); }
.icon-btn .ic { width: 18px; height: 18px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 760px) { .action-grid { grid-template-columns: repeat(4, 1fr); } }
form.inline { display: inline; }
form.button_to { display: inline; }

/* ---------- Chips (work type quick pick, periods) ------------------------ */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left;
  min-height: 52px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.chip b { font-size: 13px; color: var(--muted); font-weight: 600; }
.chip .tag { font-size: 11px; color: var(--gold); font-weight: 700; }
.chip:hover { border-color: var(--accent); }
.chip.is-selected { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.is-selected b, .chip.is-selected .tag { color: inherit; opacity: .9; }
.chip.add { justify-content: center; align-items: center; flex-direction: row; gap: 6px; color: var(--accent); border-style: dashed; background: transparent; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--soft); border-radius: 12px; }
.segmented a { padding: 7px 12px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: none; }
.segmented a.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

/* ---------- Calculation line ------------------------------------------- */
.calc {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; margin: 4px 0 16px; border-radius: 12px; background: var(--soft);
}
.calc .formula { color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.calc .total { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent); }
.calc .note { width: 100%; font-size: 12.5px; color: var(--gold); font-weight: 600; }

/* ---------- Lists ------------------------------------------------------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 18px; color: inherit; text-decoration: none; min-height: 60px; }
a.item:hover, .item.link:hover { background: var(--surface-2); }
.item .main { flex: 1; min-width: 0; }
.item .title { font-weight: 650; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sub { font-size: 13.5px; color: var(--muted); display: block; }
.item .end { text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.item .end strong { display: block; font-size: 16px; }
.item .end small { display: block; font-size: 12.5px; color: var(--muted); }
.item .ic.chev { color: var(--muted); width: 18px; height: 18px; }
.day-head { padding: 10px 18px 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); display: flex; justify-content: space-between; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }
.empty .ic { width: 36px; height: 36px; opacity: .5; display: block; margin: 0 auto 8px; }
.card .list .item { padding-left: 0; padding-right: 0; }
.card.flush .list .item { padding-left: 18px; padding-right: 18px; }

/* Avatar */
.avatar {
  --h: 140; display: inline-grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 50%;
  background: hsl(var(--h) 35% 38%); color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .02em;
}
.avatar-lg { width: 60px; height: 60px; font-size: 21px; }

/* Pills */
.pill { display: inline-block; vertical-align: middle; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--soft); color: var(--accent); }
.pill.off { background: var(--warn-soft); color: var(--warn); }
.pill.gold { background: var(--gold-soft); color: var(--gold); }
.pill.grey { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

/* Staff cards */
.worker-grid { display: grid; gap: 12px; }
@media (min-width: 700px) { .worker-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .worker-grid { grid-template-columns: repeat(3, 1fr); } }
.worker-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; color: inherit; text-decoration: none; box-shadow: var(--shadow); transition: border-color .12s, transform .12s; }
.worker-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.worker-card .who { display: flex; gap: 12px; align-items: center; }
.worker-card .who .name { font-weight: 700; font-size: 16px; }
.worker-card .figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.worker-card .figures span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.worker-card .figures b { font-variant-numeric: tabular-nums; font-size: 15px; }
.worker-card .figures .due b { color: var(--gold); }

/* Tables (desktop-friendly; wrap in .table-wrap) */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 15px; vertical-align: middle; }
th { color: var(--muted); font-weight: 650; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 700; background: var(--surface-2); }
.rate-input { max-width: 130px; min-height: 40px !important; padding: 6px 10px !important; text-align: right; }

/* Breakdown lines */
.lines { display: grid; gap: 0; }
.line { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 15px; }
.line:last-child { border-bottom: 0; }
.line .what small { display: block; color: var(--muted); font-size: 13px; }
.line .amt { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.line.total { border-top: 2px solid var(--line); border-bottom: 0; font-weight: 750; padding-top: 11px; }

/* Pay report worker block */
.pay-row { padding: 16px 18px; border-top: 1px solid var(--line); }
.pay-row:first-child { border-top: 0; }
.pay-row .top { display: flex; align-items: center; gap: 12px; }
.pay-row .top .main { flex: 1; min-width: 0; }
.pay-row .amount { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pay-row.is-paid { background: color-mix(in srgb, var(--soft) 55%, transparent); }
.pay-row.is-paid .amount { color: var(--accent); }
.pay-row details { margin-top: 8px; }
.pay-row summary { cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600; }
.pay-row .foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

/* Filters bar */
.filters { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; align-items: end; }
.filters .full { grid-column: 1 / -1; }
.filters .field { margin: 0; }
@media (min-width: 760px) { .filters { grid-template-columns: 170px 170px minmax(160px, 240px) auto; } .filters .full { grid-column: auto; } }

/* Details/summary as an accordion */
details.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; font-weight: 650; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: "+"; font-size: 22px; color: var(--muted); line-height: 1; }
details.fold[open] > summary::after { content: "−"; }
details.fold[open] > summary { margin-bottom: 14px; }

/* ---------- Dialogs ----------------------------------------------------- */
dialog.sheet {
  border: 0; padding: 0; background: var(--surface); color: var(--ink); width: min(460px, calc(100% - 24px));
  border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); max-height: calc(100dvh - 40px);
}
dialog.sheet::backdrop { background: rgba(10, 20, 14, .5); backdrop-filter: blur(2px); }
dialog.sheet form.body, dialog.sheet .body { padding: 20px; }
dialog.sheet h2 { margin-bottom: 4px; }
dialog.sheet .sub { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
dialog.sheet .btn-row { margin-top: 6px; justify-content: flex-end; }
@media (max-width: 599px) {
  dialog.sheet { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  dialog.sheet[open] { animation: sheet-up .2s ease-out; }
  dialog.sheet .btn-row .btn { flex: 1; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }

/* ---------- Auth / landing --------------------------------------------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent), var(--bg); }
.auth-box { width: min(420px, 100%); }
.auth-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 22px; color: var(--accent); text-decoration: none; }
.auth-brand .ic { width: 34px; height: 34px; }
.auth-brand span { font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.auth .card { padding: 24px; }
.auth h1 { font-size: 22px; margin-bottom: 4px; }
.auth .lead { color: var(--muted); margin-bottom: 20px; }
.choice { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: inherit; background: var(--surface); margin-bottom: 12px; box-shadow: var(--shadow); }
.choice:hover { border-color: var(--accent); }
.choice .bubble { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--soft); color: var(--accent); flex: none; }
.choice .bubble .ic { width: 26px; height: 26px; }
.choice strong { display: block; font-size: 17px; }
.choice span { color: var(--muted); font-size: 14px; }
.auth .foot { text-align: center; margin-top: 16px; font-size: 14px; }

/* Admin accents */
.admin-badge { background: #f0c674 !important; color: #3a2a00 !important; border-color: #f0c674 !important; }

/* ---------- Print ------------------------------------------------------- */
.print-only { display: none; }
@media print {
  body { background: #fff; color: #000; font-size: 12px; }
  .topbar, .tabbar, .flash-stack, .no-print, .btn, .icon-btn, form.button_to, .segmented { display: none !important; }
  .print-only { display: block; }
  main.page { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .pay-row { break-inside: avoid; }
  .pay-row details { display: block; }
  .pay-row details > summary { display: none; }
  .pay-row details:not([open]) > *:not(summary) { display: block; }
}

/* Small phones: keep the firm switcher readable. */
@media (max-width: 480px) {
  .brand > span { display: none; }
  .firm-switch select { max-width: 58vw; }
  .firm-name { max-width: 50vw; }
}

/* Grid children and date inputs must be allowed to shrink on narrow phones. */
.filters > *, .fields > * { min-width: 0; }
input[type=date] { min-width: 0; max-width: 100%; display: block; }
.grid-2 { row-gap: 0; }
