/* NutriPetPlan Finance — plain CSS, mobile first, light + dark. No build step.
   Own palette (--f-*) on top of tokens.css' fonts/sizes: the shared dark tokens invert --text-inverse, which made buttons unreadable. */

:root {
  --f-bg: #f5f6fa;
  --f-surface: #ffffff;
  --f-surface-2: #eff1f7;
  --f-border: #e3e6ef;
  --f-border-strong: #cbd1e2;
  --f-text: #10172e;
  --f-text-2: #566080;
  --f-text-3: #8089a6;
  --f-primary: #001b70;
  --f-primary-hover: #0a2a9a;
  --f-on-primary: #ffffff;
  --f-link: #1f40c4;
  --f-tint: #eaeefb;
  --f-ok: #0b7a4b;
  --f-ok-bg: #e5f6ee;
  --f-warn: #a85a00;
  --f-warn-bg: #fff3dc;
  --f-bad: #b3261e;
  --f-bad-bg: #fdecea;
  --f-logo: #001b70;
  --f-header: rgba(255, 255, 255, 0.82);
  --f-shadow: 0 1px 2px rgba(16, 23, 46, 0.05), 0 4px 14px rgba(16, 23, 46, 0.05);
  --f-shadow-lg: 0 10px 40px rgba(16, 23, 46, 0.18);
  --f-radius: 16px;
  --f-radius-sm: 12px;
  --f-tabbar-h: 64px;
  color-scheme: light;
}

[data-theme="dark"] {
  --f-bg: #0a0e24;
  --f-surface: #141a38;
  --f-surface-2: #1b2247;
  --f-border: #262e57;
  --f-border-strong: #38427a;
  --f-text: #f1f3fa;
  --f-text-2: #a4acc9;
  --f-text-3: #7079a0;
  --f-primary: #4f7dff;
  --f-primary-hover: #6a91ff;
  --f-on-primary: #ffffff;
  --f-link: #86a3ff;
  --f-tint: #1b2550;
  --f-ok: #4cd6a0;
  --f-ok-bg: #0f2b27;
  --f-warn: #ffbd5c;
  --f-warn-bg: #2e2412;
  --f-bad: #ff8f87;
  --f-bad-bg: #321a22;
  --f-logo: #ffffff;
  --f-header: rgba(10, 14, 36, 0.82);
  --f-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.25);
  --f-shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  margin: 0;
  min-width: 0;
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: 1.5;
  color: var(--f-text);
  background: var(--f-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--f-link); text-underline-offset: 2px; }
h1 { font-size: clamp(24px, 4.5vw, 30px); line-height: 1.15; margin: 0 0 6px; letter-spacing: -0.02em; font-weight: 700; }
h2 { font-size: var(--text-lg); line-height: 1.3; margin: 0 0 10px; letter-spacing: -0.01em; font-weight: 650; }
h3 { margin: 0; font-weight: 650; }
p { margin: 0 0 12px; }
.lead { color: var(--f-text-2); max-width: 62ch; }
.muted { color: var(--f-text-2); font-size: var(--text-sm); line-height: 1.45; }
.eyebrow { margin: 0 0 6px; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.1em; color: var(--f-text-3); font-weight: 650; }
:focus-visible { outline: 2px solid var(--f-primary); outline-offset: 2px; }

/* ── logo (the brand SVG as a mask, so one file follows the theme) ── */
.logo-mark, .logo-word { display: inline-block; flex: none; background: var(--f-logo); -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; -webkit-mask-size: contain; mask-size: contain; }
.logo-mark { width: 30px; height: 30px; -webkit-mask-image: url(/static/logo-mark.svg); mask-image: url(/static/logo-mark.svg); }
.logo-word { width: 140px; height: 26px; -webkit-mask-image: url(/static/logo-word.svg); mask-image: url(/static/logo-word.svg); }

/* ── icons ── */
.ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic circle[r="1.5"] { fill: currentColor; stroke: none; }
.ic-moon { display: none; }
[data-theme="dark"] .ic-sun { display: none; }
[data-theme="dark"] .ic-moon { display: block; }
.when-dark { display: none; }
[data-theme="dark"] .when-dark { display: inline; }
[data-theme="dark"] .when-light { display: none; }

/* ── header: row 1 (logo, search, person), row 2 (menu, centred) ── */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--f-header); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--f-border); }
.topbar {
  display: flex; align-items: center; gap: 12px 20px;
  height: calc(60px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  max-width: 1280px; margin: 0 auto;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--f-text); min-width: 0; flex: none; }
.logo-word { display: none; }
.topbar__end { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: none; }
.userbox { display: none; align-items: center; gap: 10px; margin: 0; }
.userbox__logout { margin: 0; }
.userbox__who { display: flex; flex-direction: column; line-height: 1.2; font-size: var(--text-sm); font-weight: 600; min-width: 0; }
.userbox__who small { font-weight: 500; color: var(--f-text-3); font-size: var(--text-xs); }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--f-primary); color: var(--f-on-primary); font-size: var(--text-sm); font-weight: 700; flex: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--f-text-2); cursor: pointer; }
.icon-btn:hover { background: var(--f-surface-2); color: var(--f-text); }

/* the search box (opens the search window) */
.searchbtn { flex: 1 1 auto; display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 560px; height: 42px; margin: 0 auto; padding: 0 8px 0 14px; border: 1px solid var(--f-border); border-radius: 14px; background: var(--f-surface-2); color: var(--f-text-3); font: inherit; font-size: var(--text-base); text-align: left; cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.searchbtn:hover { border-color: var(--f-border-strong); background: var(--f-surface); }
.searchbtn .ic { width: 18px; height: 18px; flex: none; }
.searchbtn__text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.searchbtn__kbd { display: none; flex: none; min-width: 24px; padding: 1px 7px; border: 1px solid var(--f-border-strong); border-radius: 7px; background: var(--f-surface); color: var(--f-text-3); font: inherit; font-size: var(--text-xs); font-weight: 650; text-align: center; }

/* dark / light switch */
.theme-switch { position: relative; flex: none; display: inline-flex; align-items: center; justify-content: space-between; width: 54px; height: 30px; padding: 0 7px; border: 1px solid var(--f-border-strong); border-radius: 999px; background: var(--f-surface-2); color: var(--f-text-3); cursor: pointer; }
.theme-switch .ic { width: 15px; height: 15px; position: relative; z-index: 1; }
.theme-switch .ic-sun, .theme-switch .ic-moon { display: block; }
[data-theme="dark"] .theme-switch .ic-sun { display: block; }
.theme-switch__knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--f-surface); box-shadow: 0 1px 3px rgba(16, 23, 46, 0.3); transition: transform 0.18s ease; }
[data-theme="dark"] .theme-switch__knob { transform: translateX(24px); background: var(--f-primary); }
.theme-switch .ic-sun { color: #e8820c; }
.theme-switch .ic-moon { color: var(--f-text-3); }
[data-theme="dark"] .theme-switch .ic-moon { color: #fff; }

/* the menu bar under the header (desktop); on a phone the bottom tab bar does this job */
.subnav { display: none; align-items: center; justify-content: center; gap: 4px; padding: 0 16px; border-top: 1px solid var(--f-border); }
.subnav a { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 12px 14px; color: var(--f-text-2); text-decoration: none; font-weight: 600; font-size: var(--text-base); white-space: nowrap; }
.subnav a .ic { width: 18px; height: 18px; }
.subnav a:hover { color: var(--f-text); }
.subnav a.is-active { color: var(--f-primary); }
.subnav a.is-active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--f-primary); }

@media (min-width: 880px) {
  .logo-word { display: inline-block; }
  .logo-mark { display: none; }
  .subnav { display: flex; }
  .userbox { display: flex; }
  .searchbtn__kbd { display: inline-block; }
  .tabbar, .sheet { display: none !important; }
}

/* ── page ── */
.page { max-width: 1040px; margin: 0 auto; padding: 22px max(16px, env(safe-area-inset-left)) calc(var(--f-tabbar-h) + 36px + env(safe-area-inset-bottom)); overflow-wrap: anywhere; }
@media (min-width: 880px) { .page { padding-top: 32px; padding-bottom: 56px; } }
.head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px 16px; margin-bottom: 20px; }
.head > div { min-width: 0; flex: 1 1 260px; }

/* ── bottom tab bar (phone) ── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; align-items: center;
  height: calc(var(--f-tabbar-h) + env(safe-area-inset-bottom)); padding: 0 8px env(safe-area-inset-bottom);
  background: var(--f-header); -webkit-backdrop-filter: saturate(1.4) blur(16px); backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--f-border);
}
.tabbar-5 { grid-template-columns: repeat(5, 1fr); }
.tabbar-3 { grid-template-columns: repeat(3, 1fr); }
.tabbar-2 { grid-template-columns: repeat(2, 1fr); }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: var(--f-tabbar-h); padding: 0; border: 0; background: none; color: var(--f-text-3); font: inherit; font-size: 11px; font-weight: 600; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.tab.is-active { color: var(--f-primary); }
.tab__icon { position: relative; display: inline-flex; }
.tab-scan { overflow: visible; }
.tab-scan__btn { display: flex; align-items: center; justify-content: center; width: 58px; height: 58px; margin-top: -26px; border-radius: 50%; background: var(--f-primary); color: var(--f-on-primary); box-shadow: 0 6px 18px rgba(0, 27, 112, 0.35), 0 0 0 5px var(--f-bg); transition: transform 0.12s; }
[data-theme="dark"] .tab-scan__btn { box-shadow: 0 6px 18px rgba(79, 125, 255, 0.35), 0 0 0 5px var(--f-bg); }
.tab-scan__btn .ic { width: 26px; height: 26px; stroke-width: 2; }
.tab-scan:active .tab-scan__btn { transform: scale(0.94); }
.tab-scan__label { margin-top: 2px; color: var(--f-text-3); }
.tab-scan.is-active .tab-scan__label { color: var(--f-primary); }

/* "More" sheet */
.sheet { position: fixed; inset: 0; z-index: 40; }
.sheet[hidden] { display: none; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(8, 12, 32, 0.5); animation: fade 0.15s ease-out; }
.sheet__panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 82vh; overflow-y: auto; padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); background: var(--f-surface); border-radius: 22px 22px 0 0; box-shadow: var(--f-shadow-lg); animation: rise 0.2s ease-out; }
.sheet__grab { width: 40px; height: 4px; margin: 0 auto 12px; border-radius: 4px; background: var(--f-border-strong); }
.sheet__user { display: flex; align-items: center; gap: 12px; padding: 4px 4px 14px; border-bottom: 1px solid var(--f-border); }
.sheet__user .userbox__who { flex: 1; font-size: var(--text-md); }
.sheet__list { list-style: none; margin: 8px 0 0; padding: 0; }
.sheet__list a, .sheet__list button { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 52px; padding: 0 8px; border: 0; background: none; border-radius: 12px; color: var(--f-text); font: inherit; font-weight: 550; text-decoration: none; text-align: left; cursor: pointer; }
.sheet__list a:hover, .sheet__list button:hover, .sheet__list a.is-active { background: var(--f-surface-2); }
.sheet__list a.is-active { color: var(--f-primary); }
.sheet__list .danger { color: var(--f-bad); }
.sheet__list form { margin: 0; }
.sheet__list .ic { color: var(--f-text-2); }
.sheet__list .danger .ic { color: var(--f-bad); }
body.sheet-open { overflow: hidden; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet__backdrop, .sheet__panel { animation: none; } }

/* ── cards, stats ── */
.card { background: var(--f-surface); border: 1px solid var(--f-border); border-radius: var(--f-radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--f-shadow); }
.card h2 + .muted, .card h2 + p { margin-top: -4px; }
.card-highlight { border-color: var(--f-ok); background: var(--f-ok-bg); }
.card-warn { border-color: color-mix(in srgb, var(--f-warn) 45%, transparent); background: var(--f-warn-bg); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stats-4 { grid-template-columns: repeat(4, 1fr); }
.stat { background: var(--f-surface); border: 1px solid var(--f-border); border-radius: var(--f-radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--f-shadow); min-width: 0; }
.stat__label { font-size: var(--text-xs); color: var(--f-text-3); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 650; }
.stat__value { font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
@media (max-width: 720px) { .stats-4, .stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .stat { padding: 12px 14px; } .stat__value { font-size: 26px; } }
.stat-warn .stat__value, .text-warn { color: var(--f-warn); }

/* ── chips, notices, counters ── */
.chip { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: var(--text-xs); font-weight: 650; background: var(--f-tint); color: var(--f-primary); white-space: nowrap; }
.chip-off, .chip-duplicate, .chip-rejected { background: var(--f-bad-bg); color: var(--f-bad); }
.chip-needs_review, .chip-partial, .chip-missing { background: var(--f-warn-bg); color: var(--f-warn); }
.chip-filed, .chip-complete { background: var(--f-ok-bg); color: var(--f-ok); }
.chip-waived, .chip-extra { background: var(--f-surface-2); color: var(--f-text-2); }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 6px; border-radius: 999px; background: #e8820c; color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
.count-dot { position: absolute; top: -6px; right: -10px; }
.notice { border-radius: var(--f-radius-sm); padding: 12px 14px; margin-bottom: 16px; font-size: var(--text-base); }
.notice-error { background: var(--f-bad-bg); color: var(--f-bad); }
.notice-ok { background: var(--f-ok-bg); color: var(--f-ok); }
.notice:not(.notice-error):not(.notice-ok) { background: var(--f-surface-2); color: var(--f-text-2); }

/* ── forms ── */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.form-row label { font-weight: 600; font-size: var(--text-base); }
.form-row small { color: var(--f-text-3); }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="date"], input[type="month"], input[type="number"], input[type="tel"], input[type="url"], textarea, select {
  width: 100%; min-width: 0; min-height: 46px; padding: 10px 14px; font: inherit; color: var(--f-text);
  background: var(--f-surface); border: 1px solid var(--f-border-strong); border-radius: var(--f-radius-sm);
  -webkit-appearance: none; appearance: none; transition: border-color 0.12s, box-shadow 0.12s;
}
input::placeholder, textarea::placeholder { color: var(--f-text-3); }
input:hover, select:hover, textarea:hover { border-color: var(--f-text-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--f-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--f-primary) 22%, transparent); }
input[type="date"], input[type="month"] { text-align: left; }
input::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.7; }
[data-theme="dark"] input::-webkit-calendar-picker-indicator { filter: invert(1); }
select { padding-right: 38px; background-image: linear-gradient(45deg, transparent 50%, var(--f-text-2) 50%), linear-gradient(135deg, var(--f-text-2) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--f-primary); flex: none; }
.field-error { color: var(--f-bad); font-weight: 550; font-size: var(--text-sm); }
.copy-field { font-family: var(--font-mono); font-size: var(--text-sm); }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.inline-form { display: grid; grid-template-columns: 1fr; gap: 0 12px; align-items: end; }
@media (min-width: 720px) { .inline-form { grid-template-columns: 1fr 1fr auto; } .inline-form .btn { margin-bottom: 14px; } }
.inline-edit { display: flex; gap: 8px; flex: 1; min-width: 0; margin: 0; }
.inline-edit input { flex: 1; min-width: 0; }
.check { display: flex; align-items: center; gap: 10px; margin: 6px 0 16px; font-weight: 500; }
.filters .check { margin-top: 0; }

/* ── buttons (44px+ tap targets) ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; font: inherit; font-weight: 600; border-radius: var(--f-radius-sm); border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: background 0.12s, border-color 0.12s, transform 0.08s; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--f-primary); color: var(--f-on-primary); }
.btn-primary:hover { background: var(--f-primary-hover); }
.btn-ghost { background: var(--f-surface); color: var(--f-text); border-color: var(--f-border-strong); }
.btn-ghost:hover { background: var(--f-surface-2); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.quick { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.quick .btn { flex: 1 1 180px; }
.card .quick:last-child { margin-bottom: 0; }

/* ── lists ── */
.list { list-style: none; margin: 0; padding: 0; }
.list__row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--f-border); flex-wrap: wrap; }
.list__row:first-child { border-top: 0; }
.list__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list__actions form { margin: 0; }
.list__main { display: flex; flex-direction: column; text-decoration: none; color: inherit; min-width: 0; flex: 1; }
.list__row-block { display: block; padding: 0; }
.amount { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.bullets { margin: 0; padding-left: 20px; }
.bullets li { margin-bottom: 6px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.facts dt { color: var(--f-text-2); }
.facts dd { margin: 0; }
code { font-family: var(--font-mono); font-size: 0.9em; background: var(--f-surface-2); padding: 2px 6px; border-radius: 6px; }

/* ── sign-in style pages ── */
body.plain { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 50% -10%, var(--f-tint), transparent), var(--f-bg); }
.auth-card { width: 100%; max-width: 420px; background: var(--f-surface); border: 1px solid var(--f-border); border-radius: 22px; padding: 28px 24px; box-shadow: var(--f-shadow-lg); }
.auth-card__brand { display: flex; justify-content: center; margin-bottom: 22px; }
.auth-card__brand .logo-word { display: inline-block; width: 210px; height: 40px; }
.auth-card h1 { text-align: center; }
.auth-card > .lead, .auth-card > p.lead { text-align: center; margin-left: auto; margin-right: auto; }
.hint { color: var(--f-text-3); font-size: var(--text-sm); line-height: 1.5; margin: 18px 0 0; text-align: center; }

/* ── capture, inbox, document ── */
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-bottom: 12px; }
.page-thumb { position: relative; background: var(--f-surface-2); border: 1px solid var(--f-border); border-radius: var(--f-radius-sm); overflow: hidden; }
.page-thumb img { display: block; width: 100%; height: 140px; object-fit: cover; }
.page-thumb__pdf { height: 140px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: var(--text-xl); color: var(--f-primary); background: var(--f-tint); }
.page-thumb__n { display: block; padding: 4px 8px; font-size: var(--text-xs); color: var(--f-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-thumb__x { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.actions { display: grid; gap: 10px; }
.status { min-height: 24px; margin: 12px 0 0; color: var(--f-text-2); }
.status-error { color: var(--f-bad); font-weight: 550; }
.preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.preview img { width: 100%; border: 1px solid var(--f-border); border-radius: 10px; background: #fff; }

/* ── ledger board ── */
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav .btn { min-width: 46px; padding: 0 12px; font-size: var(--text-xl); }
.progress-card__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.progress-card__pct { font-size: 40px; line-height: 1; font-weight: 700; letter-spacing: -0.03em; }
.bar { height: 10px; border-radius: 999px; background: var(--f-surface-2); overflow: hidden; }
.bar__fill { display: block; height: 100%; background: linear-gradient(90deg, #17b978, #4cd6a0); border-radius: 999px; min-width: 4px; }
.section-title { margin: 28px 0 12px; }
.category__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.category__head h3 { font-size: var(--text-lg); }
.supplier summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; padding: 8px 0; cursor: pointer; list-style: none; }
.supplier summary::-webkit-details-marker { display: none; }
.supplier summary::before { content: ""; width: 7px; height: 7px; margin-right: 6px; border-right: 2px solid var(--f-text-3); border-bottom: 2px solid var(--f-text-3); transform: rotate(-45deg); transition: transform 0.15s; flex: none; }
.supplier[open] summary::before { transform: rotate(45deg); }
.supplier__name { flex: 1; min-width: 0; font-weight: 550; }
.supplier__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.docs { list-style: none; margin: 0 0 8px; padding: 0 0 0 18px; }
.docs li { display: flex; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--f-border); }
.docs li > .muted { flex: 1; min-width: 120px; }
.docs-empty { margin: 0 0 10px 18px; }
.docs-wide { list-style: none; margin: 0; padding: 0; }
.docs-wide li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 0; border-top: 1px solid var(--f-border); }
.docs-wide li:first-child { border-top: 0; }
.docs-wide .muted { grid-column: 1; }
.docs-wide .amount { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
@media (max-width: 420px) { .docs-wide li { grid-template-columns: 1fr; } .docs-wide .amount { grid-column: 1; grid-row: auto; } }
.filters { padding-bottom: 6px; }

/* ── refinements (phone) ── */
.logo-word { display: inline-block; }
.logo-mark { display: none; }
.only-desktop { display: none !important; }
@media (min-width: 880px) { .only-desktop { display: inline-flex !important; } }
.filters .grid2 { grid-template-columns: 1fr 1fr; gap: 0 12px; }
.filters .form-row:nth-child(3), .filters .form-row:nth-child(4) { grid-column: 1 / -1; }
.filters .form-row small { display: none; }
.filters .quick .btn { flex: 1 1 0; min-width: 0; padding: 0 10px; }
@media (min-width: 720px) {
  .filters .grid2 { grid-template-columns: 1.1fr 1.3fr 1.6fr 1fr; }
  .filters .form-row:nth-child(3), .filters .form-row:nth-child(4) { grid-column: auto; }
}

/* filter form: month full width, category + status side by side, search full width (phone) */
.filters .grid2 { grid-template-columns: 1fr 1fr; }
.filters .form-row:nth-child(1) { grid-column: 1 / -1; }
.filters .form-row:nth-child(2) { order: 1; grid-column: auto; }
.filters .form-row:nth-child(4) { order: 2; grid-column: auto; }
.filters .form-row:nth-child(3) { order: 3; grid-column: 1 / -1; }
.filters .quick .btn { white-space: nowrap; font-size: var(--text-base); }
@media (min-width: 720px) {
  .filters .grid2 { grid-template-columns: 1.1fr 1.3fr 1.6fr 1fr; }
  .filters .form-row:nth-child(n) { order: 0; grid-column: auto; }
}

/* lists inside warning cards keep the chip on the row's right */
.card-warn .list__row { flex-wrap: nowrap; }
.card-warn .list__row > div { flex: 1; min-width: 0; }
.card-warn .list__row > .chip, .card-warn .list__row > .amount { flex: none; }
.card-warn .chip-missing, .card-warn .chip-partial, .card-warn .chip-needs_review { background: color-mix(in srgb, var(--f-warn) 16%, transparent); }
.docs a, .docs-wide a, .list__row a:not(.btn) { text-decoration: none; font-weight: 600; }
.docs a:hover, .docs-wide a:hover, .list__row a:not(.btn):hover { text-decoration: underline; }

/* ── round 2: visible form errors (the header logo stays at its original size) ── */
.form-row small.field-error { color: var(--f-bad); font-weight: 600; }
.form-row:has(.field-error) input, .form-row:has(.field-error) select, .form-row:has(.field-error) textarea,
input[aria-invalid="true"], select[aria-invalid="true"], input:user-invalid, select:user-invalid, textarea:user-invalid {
  border-color: var(--f-bad); background-color: color-mix(in srgb, var(--f-bad) 7%, var(--f-surface));
}
.form-row:has(.field-error) input:focus, .form-row:has(.field-error) select:focus, input:user-invalid:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--f-bad) 25%, transparent); }
.form-row:has(.field-error) label { color: var(--f-bad); }

/* ── documents: search bar with pills, actions, category row, list ── */
.sbar-form { margin: 0 0 14px; }
.sbar { position: relative; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 6px 6px 6px 14px; background: var(--f-surface); border: 1px solid var(--f-border-strong); border-radius: 16px; box-shadow: var(--f-shadow); }
.sbar:focus-within { border-color: var(--f-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--f-primary) 22%, transparent); }
.sbar__icon { color: var(--f-text-3); display: inline-flex; }
.sbar__pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.sbar__pills input[type="search"] { flex: 1 1 120px; min-width: 90px; width: auto; min-height: 36px; padding: 4px 4px; border: 0; background: transparent; box-shadow: none; border-radius: 0; }
.sbar__pills input[type="search"]:focus { box-shadow: none; border: 0; }
.sbar__pills input[type="search"]::-webkit-search-cancel-button { display: none; }
.pill { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; padding: 4px 4px 4px 11px; border-radius: 999px; background: var(--f-tint); color: var(--f-primary); font-size: var(--text-sm); font-weight: 600; }
.pill__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46vw; }
.pill__x { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; color: inherit; text-decoration: none; }
.pill__x:hover { background: color-mix(in srgb, var(--f-primary) 18%, transparent); }
.pill__x .ic { width: 14px; height: 14px; stroke-width: 2.4; }
.sbar__more { position: static; }
.sbar__more summary { list-style: none; cursor: pointer; }
.sbar__more summary::-webkit-details-marker { display: none; }
.sbar__more[open] summary { background: var(--f-tint); color: var(--f-primary); }
.sbar__panel { position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 15; padding: 16px; background: var(--f-surface); border: 1px solid var(--f-border); border-radius: var(--f-radius); box-shadow: var(--f-shadow-lg); }
@media (min-width: 720px) { .sbar__panel { left: auto; width: 340px; } }

.actions-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; padding: 14px 18px; }
.actions-card__head h2 { font-size: var(--text-md); margin: 0; }
.actions-card__head p { margin: 2px 0 0; font-size: var(--text-sm); }
.actions-card__btns { display: flex; flex-wrap: wrap; gap: 8px; }
.actions-card .btn { gap: 8px; }
.btn.is-disabled, .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }

.catrow { display: flex; gap: 8px; overflow-x: auto; margin: 0 calc(-1 * max(16px, env(safe-area-inset-left))) 16px; padding: 2px max(16px, env(safe-area-inset-left)) 8px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.catrow::-webkit-scrollbar { display: none; }
@media (min-width: 880px) { .catrow { margin: 0 0 16px; padding: 2px 0 8px; flex-wrap: wrap; overflow: visible; } }
.catchip { display: inline-flex; align-items: center; gap: 8px; flex: none; scroll-snap-align: start; min-height: 44px; padding: 6px 14px 6px 8px; border-radius: 14px; background: var(--f-surface); border: 1px solid var(--f-border); color: var(--f-text); text-decoration: none; font-size: var(--text-sm); font-weight: 600; white-space: nowrap; }
.catchip:hover { border-color: var(--f-text-3); }
.catchip__icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 10px; background: var(--f-surface-2); color: var(--f-text-2); }
.catchip__icon .ic { width: 18px; height: 18px; }
.catchip__n { color: var(--f-text-3); font-weight: 650; }
.catchip.is-active { background: var(--f-primary); border-color: var(--f-primary); color: var(--f-on-primary); }
.catchip.is-active .catchip__icon { background: rgba(255, 255, 255, 0.18); color: inherit; }
.catchip.is-active .catchip__n { color: inherit; opacity: 0.85; }

.doclist-card { padding: 4px 16px; }
.doclist { list-style: none; margin: 0; padding: 0; }
.doclist li { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--f-border); }
.doclist li:first-child { border-top: 0; }
.doclist__icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; background: var(--f-surface-2); color: var(--f-text-2); }
.doclist__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.doclist__main a { font-weight: 650; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doclist__main a:hover { text-decoration: underline; }
.doclist__main .muted { font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doclist .amount { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }

/* ── scanner (phone): full-screen camera, cut-out check, sending ── */
body.is-scanning { overflow: hidden; }
.scanner { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: #05070f; color: #fff; }
.scanner[hidden], .sending[hidden], .working[hidden], .adjust[hidden], .chooser[hidden] { display: none; }
.scanner__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.scanner__top { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(12px + env(safe-area-inset-top)) 16px 0; }
.scanner__round { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: rgba(0, 0, 0, 0.5); color: #fff; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.scanner__chip { border: 0; padding: 0 16px; min-height: 40px; border-radius: 999px; background: var(--f-primary); color: var(--f-on-primary); font: inherit; font-weight: 650; cursor: pointer; }
.scanner__hint { position: relative; z-index: 2; align-self: center; max-width: 88%; margin: 12px 0 0; padding: 8px 14px; border-radius: 999px; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: var(--text-sm); text-align: center; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.scanner__bar { position: relative; z-index: 2; margin-top: auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent); }
.scanner__side { display: flex; flex-direction: column; align-items: center; gap: 4px; justify-self: start; min-width: 64px; padding: 8px; border: 0; background: none; color: #fff; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.scanner__side:last-child { justify-self: end; }
.scanner__side .ic { width: 28px; height: 28px; }
.shutter { width: 78px; height: 78px; padding: 6px; border-radius: 50%; border: 4px solid #fff; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; transition: transform 0.1s; }
.shutter:active span { transform: scale(0.88); }

.scanner-review { background: #0a0e1c; }
.review__top { padding: calc(16px + env(safe-area-inset-top)) 20px 8px; text-align: center; }
.review__title { margin: 0; font-size: var(--text-lg); font-weight: 700; }
.review__sub { margin: 4px 0 0; font-size: var(--text-sm); color: rgba(255, 255, 255, 0.72); }
.review__stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 16px; }
.review__canvas { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); background: #fff; }
.adjust { position: relative; display: flex; max-width: 100%; max-height: 100%; touch-action: none; }
.adjust .review__canvas { width: 100%; height: 100%; max-width: none; max-height: none; }
.adjust__svg { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.adjust__svg polygon { fill: rgba(79, 125, 255, 0.18); stroke: #6f9bff; stroke-width: 3; vector-effect: non-scaling-stroke; }
.adjust__handle { fill: rgba(111, 155, 255, 0.35); stroke: #fff; stroke-width: 3; vector-effect: non-scaling-stroke; cursor: grab; touch-action: none; }
.working { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(10, 14, 28, 0.6); font-weight: 600; }
.review__error { margin: 0 16px; padding: 10px 14px; border-radius: var(--f-radius-sm); background: rgba(255, 143, 135, 0.16); color: #ffb4ad; font-weight: 600; text-align: center; }
.review__error[hidden] { display: none; }
.review__bar { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
.review__bar[hidden] { display: none; }
.review__row { display: flex; gap: 8px; }
.review__row .btn { flex: 1; min-width: 0; padding: 0 8px; gap: 6px; white-space: nowrap; }
.scanner .btn-primary, .scanner-review .btn-primary { background: #4f7dff; border-color: #4f7dff; color: #fff; }
.btn-dark { background: rgba(255, 255, 255, 0.12); color: #fff; border-color: transparent; }
.btn-dark:hover { background: rgba(255, 255, 255, 0.2); }
.btn-lg { min-height: 56px; font-size: var(--text-lg); }
.btn-link-dark { background: none; border: 0; color: rgba(255, 255, 255, 0.78); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; padding: 6px; }
.sending { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; background: rgba(5, 7, 15, 0.94); color: #fff; text-align: center; font-weight: 600; }
.spinner { width: 28px; height: 28px; border: 3px solid rgba(255, 255, 255, 0.25); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
.spinner-lg { width: 48px; height: 48px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.chooser .actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
/* the scanner toggles things with the hidden attribute: an author display rule must never win over it */
#capture [hidden] { display: none !important; }


/* ═══ redesign: month title picker, small header actions, category tabs, ledger table, search window ═══ */
.btn-sm { min-height: 38px; padding: 0 14px; font-size: var(--text-base); border-radius: 11px; gap: 7px; }
.btn-sm .ic { width: 17px; height: 17px; }
.btn-sm .count { margin-left: 2px; }

.head { align-items: flex-end; }
.head__title { min-width: 0; flex: 1 1 280px; }
.head > .head__actions { display: flex; gap: 8px; flex: none; margin-bottom: 4px; }
.monthpick { position: relative; display: inline-block; max-width: 100%; }
.monthpick summary { display: inline-flex; align-items: center; gap: 6px; list-style: none; cursor: pointer; border-radius: 12px; padding: 2px 8px 2px 0; -webkit-tap-highlight-color: transparent; }
.monthpick summary::-webkit-details-marker { display: none; }
.monthpick summary h1 { margin: 0; }
.monthpick summary:hover h1 { color: var(--f-primary); }
.monthpick__chev { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 10px; background: var(--f-surface-2); color: var(--f-text-2); transition: transform 0.15s; }
.monthpick[open] .monthpick__chev { transform: rotate(180deg); }
.monthpick__chev .ic { width: 18px; height: 18px; }
.monthpick__list { position: absolute; z-index: 25; top: calc(100% + 8px); left: 0; width: 240px; max-height: 340px; overflow-y: auto; margin: 0; padding: 6px; list-style: none; background: var(--f-surface); border: 1px solid var(--f-border); border-radius: var(--f-radius-sm); box-shadow: var(--f-shadow-lg); }
.monthpick__list a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--f-text); text-decoration: none; font-weight: 550; }
.monthpick__list a:hover { background: var(--f-surface-2); }
.monthpick__list a.is-active { background: var(--f-tint); color: var(--f-primary); font-weight: 650; }
.monthpick__list .ic { width: 16px; height: 16px; }

/* category tabs */
.ledger { margin-bottom: 20px; background: var(--f-surface); border: 1px solid var(--f-border); border-radius: var(--f-radius); box-shadow: var(--f-shadow); overflow: hidden; }
.cattabs { display: flex; gap: 6px; padding: 10px 12px; overflow-x: auto; border-bottom: 1px solid var(--f-border); background: var(--f-surface); scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.cattab { display: inline-flex; align-items: center; gap: 8px; flex: none; min-height: 40px; padding: 5px 12px 5px 8px; border-radius: 12px; border: 1px solid transparent; color: var(--f-text-2); text-decoration: none; font-size: var(--text-sm); font-weight: 600; white-space: nowrap; }
.cattab:hover { background: var(--f-surface-2); color: var(--f-text); }
.cattab__icon { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 8px; background: var(--f-surface-2); color: var(--f-text-2); }
.cattab__icon .ic { width: 16px; height: 16px; }
.cattab__n { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--f-warn-bg); color: var(--f-warn); font-size: 11px; font-weight: 700; }
.cattab__ok { display: inline-flex; color: var(--f-ok); }
.cattab__ok .ic { width: 15px; height: 15px; stroke-width: 2.4; }
.cattab.is-active { background: var(--f-primary); color: var(--f-on-primary); }
.cattab.is-active .cattab__icon { background: rgba(255, 255, 255, 0.18); color: inherit; }
.cattab.is-active .cattab__n { background: rgba(255, 255, 255, 0.2); color: #fff; }
.cattab.is-active .cattab__ok { color: #fff; }

/* the ledger table */
.ltable-wrap { overflow-x: auto; }
.ltable { width: 100%; border-collapse: collapse; font-size: var(--text-base); }
.ltable th, .ltable td { padding: 10px 14px; text-align: left; vertical-align: middle; }
.ltable thead th { padding-top: 12px; padding-bottom: 8px; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--f-text-3); font-weight: 650; }
.ltable .col-amt { text-align: right; white-space: nowrap; }
.ltable .col-status { text-align: right; white-space: nowrap; }
.ltable .col-type, .ltable .col-date { white-space: nowrap; }
.ltable--all .col-type, .ltable--all .col-date { display: none; }
.lcat th { padding: 12px 14px; background: var(--f-surface-2); border-top: 1px solid var(--f-border); border-bottom: 1px solid var(--f-border); font-weight: 650; }
.lcat__name { display: inline-flex; align-items: center; gap: 8px; }
.lcat__name .ic { width: 18px; height: 18px; color: var(--f-text-2); }
.lcat__sum { float: right; font-weight: 500; font-size: var(--text-sm); color: var(--f-text-2); }
.lgroup tr + tr td, .lgroup tr + tr th { border-top: 1px solid var(--f-border); }
.lsupplier th { font-weight: 500; }
.lsupplier strong { font-weight: 650; }
.lsupplier__from { display: block; font-size: var(--text-xs); }
.minibar { display: block; width: 72px; height: 5px; margin: 5px 0 0 auto; border-radius: 999px; background: var(--f-surface-2); overflow: hidden; }
.minibar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #17b978, #4cd6a0); }
.lgroup .chip + .chip { margin-left: 4px; }
.ldoc td { padding-top: 8px; padding-bottom: 8px; }
.ldoc__main { padding-left: 34px !important; }
.ldoc__main a { font-weight: 600; text-decoration: none; }
.ldoc__main a:hover { text-decoration: underline; }
.ldoc__sub { display: none; font-size: var(--text-xs); }
.lmore td { padding: 8px 14px 10px 34px; font-size: var(--text-sm); }
.lmore a { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-weight: 600; }
.lmore .ic { width: 15px; height: 15px; }
.lmissing td { background: var(--f-warn-bg); }
.lmissing td:first-child { padding-left: 34px; border-left: 3px dashed color-mix(in srgb, var(--f-warn) 70%, transparent); }
.lmissing__icon { display: inline-flex; vertical-align: middle; margin-right: 10px; color: var(--f-warn); }
.lmissing__icon .ic { width: 20px; height: 20px; }
.lmissing__text { display: inline-flex; flex-direction: column; vertical-align: middle; gap: 1px; }
.lmissing__text strong { color: var(--f-warn); font-weight: 650; }
.lmissing .btn { white-space: nowrap; }

@media (max-width: 720px) {
  .ltable .col-type, .ltable .col-date, .ltable thead { display: none; }
  .ldoc__sub { display: block; }
  .ltable th, .ltable td { padding: 10px 12px; }
  .ldoc__main { padding-left: 24px !important; }
  .lmore td { padding-left: 24px; }
  .lmissing td:first-child { padding-left: 14px; }
  .lcat__sum { float: none; display: block; margin-top: 2px; }
  .head__actions { width: 100%; }
  .head__actions .btn { flex: 1; }
}

/* search window */
.searchmodal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; }
.searchmodal[hidden] { display: none; }
.searchmodal__backdrop { position: absolute; inset: 0; background: rgba(8, 12, 32, 0.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade 0.15s ease-out; }
.searchmodal__panel { position: relative; width: 100%; max-width: 640px; max-height: 84vh; overflow-y: auto; padding: 14px; background: var(--f-surface); border: 1px solid var(--f-border); border-radius: 20px; box-shadow: var(--f-shadow-lg); animation: rise 0.18s ease-out; }
.searchmodal__form { display: flex; flex-direction: column; gap: 12px; }
.searchmodal__input { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 14px; border: 1px solid var(--f-border-strong); border-radius: 14px; background: var(--f-surface); }
.searchmodal__input:focus-within { border-color: var(--f-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--f-primary) 22%, transparent); }
.searchmodal__input > .ic { color: var(--f-text-3); }
.searchmodal__input input[type="search"] { flex: 1; min-width: 0; min-height: 44px; padding: 0 4px; border: 0; background: transparent; box-shadow: none; border-radius: 0; font-size: var(--text-lg); }
.searchmodal__input input[type="search"]:focus { box-shadow: none; border: 0; }
.searchmodal__input input[type="search"]::-webkit-search-cancel-button { display: none; }
.searchmodal__filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.searchmodal__field { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-xs); font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--f-text-3); }
.searchmodal__field select { min-height: 42px; text-transform: none; letter-spacing: 0; font-size: var(--text-base); font-weight: 500; }
.searchmodal__check { margin: 0; align-self: end; min-height: 42px; }
.searchmodal__sect { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--f-border); }
.searchmodal__sect h3 { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--f-text-3); }
.chiprow { display: flex; flex-wrap: wrap; gap: 8px; }
.qchip { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--f-border); background: var(--f-surface); color: var(--f-text); text-decoration: none; font-size: var(--text-sm); font-weight: 600; }
.qchip:hover { background: var(--f-tint); border-color: var(--f-primary); color: var(--f-primary); }
.qchip .ic { width: 16px; height: 16px; color: var(--f-text-3); }
.qchip:hover .ic { color: inherit; }
.linkbtn { border: 0; background: none; padding: 2px 4px; color: var(--f-link); font: inherit; font-size: var(--text-xs); font-weight: 650; text-transform: none; letter-spacing: 0; cursor: pointer; }
.recent { list-style: none; margin: 0; padding: 0; }
.recent a { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 10px; color: var(--f-text); text-decoration: none; font-weight: 550; }
.recent a:hover { background: var(--f-surface-2); }
.recent .ic { width: 16px; height: 16px; color: var(--f-text-3); flex: none; }
body.search-open { overflow: hidden; }
@media (max-width: 520px) { .searchmodal { padding-top: 4vh; } .searchmodal__filters { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .searchmodal__backdrop, .searchmodal__panel { animation: none; } .theme-switch__knob { transition: none; } }

/* phone: the table's rows become small stacked cards (a 390 px table cannot hold five columns) */
@media (max-width: 720px) {
  .ltable, .ltable tbody { display: block; }
  .ltable .lcat tr, .ltable .lcat th { display: block; }
  .lsupplier { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; row-gap: 6px; padding: 12px 14px; }
  .lsupplier th, .lsupplier td { display: block; padding: 0; border: 0 !important; }
  .lsupplier th { grid-column: 1; grid-row: 1; }
  .lsupplier .col-amt { grid-column: 2; grid-row: 1; }
  .lsupplier .col-status { grid-column: 1 / -1; grid-row: 2; text-align: left; }
  .ldoc { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 8px 14px 8px 24px; }
  .ldoc td { display: block; padding: 0; border: 0 !important; }
  .ldoc__main { padding-left: 0 !important; }
  .ldoc .col-status { display: none; }
  .lmore { display: block; }
  .lmore td { display: block; padding: 6px 14px 10px 24px; }
  .lmissing { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 12px 14px; background: var(--f-warn-bg); border-left: 3px dashed color-mix(in srgb, var(--f-warn) 70%, transparent); }
  .lmissing td { display: block; padding: 0 !important; border: 0 !important; background: none; }
  .lmissing td:first-child { display: flex; align-items: flex-start; gap: 10px; border-left: 0; }
  .lmissing__icon { margin: 2px 0 0; flex: none; }
  .lmissing .col-status { text-align: left; }
  .lmissing .btn { width: 100%; }
  .lgroup { border-top: 1px solid var(--f-border); }
  .lgroup tr + tr td, .lgroup tr + tr th { border-top: 0; }
}
