/* assets/css/app.css - sue.hplusspeakers.com */

:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --ink: #1e293b;
  --mute: #64748b;
  --line: #e2e8f0;
  --field: #ffffff;
  --ok: #16a34a;
  --ok-bg: #ecfdf3;
  --bad: #dc2626;
  --bad-bg: #fef2f2;
  --warn: #c2410c;
  --warn-bg: #fff7ed;
  --info: #2563eb;
  --info-bg: #eff6ff;
  --grey-bg: #f1f5f9;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05);
  --side-w: 248px;
  --radius: 12px;
  --soft: var(--accent-soft);
  --soft-ink: var(--accent-ink);
}

[data-theme="dark"] {
  --bg: #0f172a;
  --card: #1e293b;
  --ink: #e2e8f0;
  --mute: #94a3b8;
  --line: #334155;
  --field: #0f172a;
  --ok-bg: rgba(22, 163, 74, .15);
  --bad-bg: rgba(220, 38, 38, .15);
  --warn-bg: rgba(194, 65, 12, .18);
  --info-bg: rgba(37, 99, 235, .18);
  --grey-bg: rgba(148, 163, 184, .14);
  --soft: color-mix(in srgb, var(--accent) 22%, transparent);
  --soft-ink: #e2e8f0;
  --shadow: none;
}

@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --bg: #0f172a;
    --card: #1e293b;
    --ink: #e2e8f0;
    --mute: #94a3b8;
    --line: #334155;
    --field: #0f172a;
    --ok-bg: rgba(22, 163, 74, .15);
    --bad-bg: rgba(220, 38, 38, .15);
    --warn-bg: rgba(194, 65, 12, .18);
    --info-bg: rgba(37, 99, 235, .18);
    --grey-bg: rgba(148, 163, 184, .14);
    --soft: color-mix(in srgb, var(--accent) 22%, transparent);
    --soft-ink: #e2e8f0;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; padding-bottom: 64px; }
.shell.no-side { padding-bottom: 0; }
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}
.top h1 { flex: 1; margin: 0; font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 36px; height: 36px; border: 0; border-radius: 9px; cursor: pointer;
  display: inline-grid; place-items: center; flex-shrink: 0;
  background: rgba(255, 255, 255, .18); color: #fff;
}
.side-user .icon-btn { background: var(--grey-bg); color: var(--mute); }
.page { width: 100%; max-width: 1180px; margin: 0 auto; padding: 16px; }

.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 40;
  background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform .2s ease;
}
.side.open { transform: none; }
.scrim { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 35; display: none; }
.scrim.open { display: block; }
.side-brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px; border-bottom: 1px solid var(--line); }
.side-brand b { display: block; font-size: 14px; line-height: 1.25; }
.side-brand span { font-size: 12px; color: var(--mute); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
}
.side nav { flex: 1; overflow: auto; padding: 10px; }
.side-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px;
  color: var(--ink); font-weight: 500; margin-bottom: 2px;
}
.side-link i { width: 18px; text-align: center; color: var(--mute); }
.side-link.on { background: var(--soft); color: var(--soft-ink); font-weight: 600; }
.side-link.on i { color: var(--accent); }
.side-link.soon { color: var(--mute); cursor: default; }
.side-link em { margin-left: auto; font-style: normal; font-size: 10.5px; padding: 1px 7px; border-radius: 20px; background: var(--grey-bg); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); }
.side-user b { display: block; font-size: 13px; }
.side-user span { font-size: 12px; color: var(--mute); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  background: var(--soft); color: var(--soft-ink); font-weight: 700;
}

.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom a { flex: 1; text-align: center; padding: 8px 0 7px; font-size: 11px; color: var(--mute); }
.bottom a i { display: block; font-size: 17px; margin-bottom: 2px; }
.bottom a.on { color: var(--accent); font-weight: 600; }

@media (min-width: 960px) {
  .side { transform: none; }
  .scrim, .menu-btn, .bottom { display: none !important; }
  .shell { margin-left: var(--side-w); padding-bottom: 0; }
  .shell.no-side { margin-left: 0; }
  .page { padding: 22px 26px; }
}

/* ---------- building blocks ---------- */
.grow { flex: 1; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 600; flex: 1; }
.card-head .muted { font-size: 12px; }
.muted { color: var(--mute); }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: 10px; margin-bottom: 14px; font-size: 13.5px; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.err { background: var(--bad-bg); color: var(--bad); }
.alert.info { background: var(--info-bg); color: var(--info); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 10px 16px; cursor: pointer; font-weight: 600;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
}
.btn.ghost { background: var(--card); color: var(--accent); border: 1px solid var(--line); }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.top .btn { background: rgba(255, 255, 255, .2); padding: 8px 12px; font-size: 13px; }

.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: 1fr; }
.g3 { grid-template-columns: 1fr; }
@media (min-width: 640px) { .g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .dash { grid-template-columns: 1.6fr 1fr; align-items: start; } }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.5px; color: var(--mute); font-weight: 500; }
.field .req { color: var(--bad); }
.input, .field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--field); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft); }
.field .hint { font-size: 12px; color: var(--mute); }
.field .error { font-size: 12px; color: var(--bad); }
.field.has-error input, .field.has-error select { border-color: var(--bad); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; flex-wrap: wrap; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--mute); font-weight: 600; margin: 6px 0 2px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13.5px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--card); color: var(--mute); font-size: 12.5px; cursor: pointer; font-weight: 500;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.new { background: var(--info-bg); color: var(--info); }
.badge.active { background: var(--ok-bg); color: var(--ok); }
.badge.risk { background: var(--warn-bg); color: var(--warn); }
.badge.lost { background: var(--bad-bg); color: var(--bad); }
.badge.none { background: var(--grey-bg); color: var(--mute); }
.badge.plain::before { display: none; }

/* ---------- lists ---------- */
.search { display: flex; gap: 8px; margin-bottom: 12px; }
.search .input { flex: 1; }
.list .row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.list .row:last-child { border-bottom: 0; }
.list .row .sub { font-size: 12px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .row .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .row .amt { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dr { color: var(--bad); }
.cr { color: var(--ok); }
.empty { text-align: center; padding: 34px 12px; color: var(--mute); }
.empty i { font-size: 30px; color: var(--accent); opacity: .7; display: block; margin-bottom: 10px; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 13px; }

/* ---------- dashboard ---------- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.kpi span { display: block; font-size: 12px; color: var(--mute); }
.kpi b { display: block; font-size: 19px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi small { font-size: 11.5px; }
.kpi small.up { color: var(--ok); }
.kpi small.down { color: var(--bad); }
.chart-box { position: relative; height: 240px; }
.bar-list .b { margin-bottom: 11px; }
.bar-list .b:last-child { margin-bottom: 0; }
.bar-list .b-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 4px; }
.bar-list .b-top span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-list .b-top span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-list .track { height: 8px; border-radius: 8px; background: var(--grey-bg); overflow: hidden; }
.bar-list .fill { height: 100%; border-radius: 8px; background: var(--accent); }
.status-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
@media (min-width: 640px) { .status-grid { grid-template-columns: repeat(4, 1fr); } }
.status-tile { border-radius: 10px; padding: 10px 12px; }
.status-tile b { display: block; font-size: 20px; }
.status-tile span { font-size: 12px; font-weight: 600; }
.status-tile.new { background: var(--info-bg); color: var(--info); }
.status-tile.active { background: var(--ok-bg); color: var(--ok); }
.status-tile.risk { background: var(--warn-bg); color: var(--warn); }
.status-tile.lost { background: var(--bad-bg); color: var(--bad); }

/* ---------- theme picker ---------- */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--card); cursor: pointer;
  box-shadow: 0 0 0 1px var(--line); position: relative;
}
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }
.swatch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.mode-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mode-row label {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; cursor: pointer; font-size: 13px;
}
.mode-row label i { display: block; font-size: 18px; margin-bottom: 4px; color: var(--mute); }
.mode-row input { display: none; }
.mode-row input:checked + span { color: var(--accent); font-weight: 600; }
.mode-row label:has(input:checked) { border-color: var(--accent); background: var(--soft); }
.mode-row label:has(input:checked) i { color: var(--accent); }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; }
.auth-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 26px 22px; box-shadow: var(--shadow); }
.auth-card .brand-mark { width: 58px; height: 58px; border-radius: 15px; font-size: 24px; margin: 0 auto 12px; }
.auth-card h1 { text-align: center; font-size: 19px; margin: 0; }
.auth-card .tag { text-align: center; color: var(--mute); font-size: 13px; margin: 3px 0 20px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--mute); width: 34px; height: 34px; cursor: pointer; }
.auth-foot { text-align: center; font-size: 12px; color: var(--mute); margin-top: 16px; }

/* ---------- tables (desktop) ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 12px; color: var(--mute); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line); }
.tbl .n { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }

/* ---------- sales ---------- */
.tabs-scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.tabs-scroll::-webkit-scrollbar { display: none; }
.tabs-scroll .chip { white-space: nowrap; flex-shrink: 0; }
.count-dot { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; font-style: normal; }
.side-link .count-dot { margin-left: auto; }
.action-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.action-bar .btn { padding: 9px 13px; font-size: 13px; }
.line-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; background: var(--card); }
.line-card.off { opacity: .45; }
.line-top { display: flex; gap: 8px; align-items: center; }
.line-top .l-desc { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); font-weight: 600; }
.line-top .l-desc:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--soft); }
.line-top .icon-btn { background: var(--bad-bg); color: var(--bad); }
.l-pick-wrap input { width: 20px; height: 20px; accent-color: var(--accent); }
.line-note { margin: 6px 0 0; }
.line-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
@media (min-width: 760px) { .line-grid { grid-template-columns: repeat(7, 1fr); } }
.line-grid .field input, .line-grid .field select { padding: 8px 9px; }
.line-grid .field label { font-size: 11.5px; }
.line-sum { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12.5px; color: var(--mute); }
.line-sum b { color: var(--ink); font-size: 14px; }
.tot-card .tot-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13.5px; }
.tot-card .tot-row b { font-variant-numeric: tabular-nums; }
.tot-card .grand { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 9px; font-size: 17px; font-weight: 700; }
/* Save / Cancel bar of create and edit pages.
   Phone: a full-width bar fixed at the bottom (the bottom menu steps aside on these pages).
   Computer: a bar that stays at the bottom of the form. */
.sticky-actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31;
  display: flex; gap: 10px; align-items: center;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(15, 23, 42, .10);
}
.sticky-actions .btn { flex: 1 1 0; justify-content: center; min-height: 46px; font-size: 15px; }
.sticky-actions .btn:last-child { flex: 2 1 0; }
.sticky-actions .btn.ghost { background: var(--grey-bg); border-color: transparent; color: var(--ink); }
body.has-actions .bottom { display: none; }
body.has-actions .shell { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
@media (min-width: 960px) {
  .sticky-actions {
    position: sticky; left: auto; right: auto; bottom: 14px; justify-content: flex-end;
    margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px;
  }
  .sticky-actions .btn, .sticky-actions .btn:last-child { flex: 0 0 auto; min-width: 140px; }
  body.has-actions .shell { padding-bottom: 0; }
}
.toggle-row { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.toggle-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.toggle-row i { color: var(--accent); width: 18px; text-align: center; }
label.chip input { accent-color: #fff; }

@media print {
  .side, .top, .bottom, .no-print, .action-bar, .scrim { display: none !important; }
  .shell { margin: 0 !important; padding: 0 !important; }
  body { background: #fff; }
  .card, .kpi { border-color: #ccc; box-shadow: none; }
}
a.kpi { color: var(--ink); }
a.kpi:hover { border-color: var(--accent); }
.alert.info .dr { color: inherit; }

/* pop-up forms (new party / item without leaving the page) */
dialog.sheet {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); overflow: auto;
  padding: 16px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--card); color: var(--ink, inherit); box-shadow: 0 20px 50px rgba(15, 23, 42, .25);
}
dialog.sheet::backdrop { background: rgba(15, 23, 42, .45); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-head h2 { margin: 0; font-size: 17px; }
dialog.sheet .error:empty { display: none; }
@media (max-width: 600px) {
  dialog.sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 16px 16px 0 0; max-height: 92vh; }
}
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font-size: 12.5px; font-weight: 600; cursor: pointer; display: inline-flex; gap: 5px; align-items: center; justify-self: start; }
.add-row { display: flex; gap: 8px; }
.add-row .btn { flex: 1; justify-content: center; }

/* filter selects under the search box */
.search { flex-wrap: wrap; }
.filter-row { flex-basis: 100%; display: flex; gap: 8px; flex-wrap: wrap; }
.filter-row select { flex: 1 1 140px; min-width: 0; }
.search.loading .btn i { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- accounts and reports ---------- */
.list .row a.grow { color: inherit; min-width: 0; }
.period-bar { display: grid; gap: 10px; }
.period-fields { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.period-fields .field { flex: 1 1 130px; }
.period-fields .btn { flex: 0 0 auto; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { display: grid; gap: 3px; padding: 14px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); color: var(--ink); box-shadow: var(--shadow); }
.tile i { color: var(--accent); font-size: 18px; margin-bottom: 4px; }
.tile b { font-size: 14px; }
.tile span { font-size: 12px; color: var(--mute); }
.tile:hover { border-color: var(--accent); }
.tbl tr.tot td { font-weight: 700; border-top: 2px solid var(--line); }
.tbl tr.grp td { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--mute); font-weight: 600; background: var(--soft); }
.tbl.compact td { padding: 6px 4px; }
.tbl a { color: inherit; }
.tbl a:hover { color: var(--accent); }
.db-card { padding: 10px 14px; }
.ac-sheet { padding: 16px; }
.ac-title { font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.ac-title small { display: block; font-weight: 500; font-size: 12.5px; color: var(--mute); }
.ac-sec { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); font-weight: 700; margin: 16px 0 4px; }
.ac-sub { font-size: 12.5px; color: var(--mute); font-weight: 600; margin: 10px 0 2px; }
.ac-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0 6px 10px; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.ac-row b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ac-row a { color: inherit; }
.ac-row a:hover { color: var(--accent); }
.ac-total { padding-left: 0; font-weight: 700; border-bottom: 0; border-top: 2px solid var(--line); margin-top: 6px; }
.ac-total.grand { font-size: 15.5px; }
.bs-grid { display: grid; gap: 14px; }
@media (min-width: 900px) { .bs-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.j-line { display: grid; grid-template-columns: 1fr 96px 96px; gap: 8px; margin-bottom: 8px; }
.j-line select, .j-line input { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); min-width: 0; }
@media (max-width: 480px) { .j-line { grid-template-columns: 1fr 1fr; } .j-line select { grid-column: 1 / -1; } }
.gst-tbl td, .gst-tbl th { white-space: nowrap; }
@media print {
  .period-bar, .tiles, nav.bottom, .side, header.top { display: none !important; }
  .ac-sheet { border: 0; box-shadow: none; }
}
.rep-tbl td, .rep-tbl th { white-space: nowrap; }
.rep-tbl td:nth-child(4) { white-space: normal; min-width: 140px; }

.side-user { padding-bottom: 6px; }
.side-out { padding: 0 10px calc(10px + env(safe-area-inset-bottom)); }
.side-link.out { width: 100%; border: 0; background: var(--bad-bg); color: var(--bad); font: inherit; font-weight: 600; cursor: pointer; justify-content: center; }
.side-link.out i { color: var(--bad); }
.side-link.out:hover { filter: brightness(.97); }
.signout-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* read-only view of a saved record (Edit unlocks) */
.view-mode input:disabled, .view-mode select:disabled, .view-mode textarea:disabled {
  background: var(--soft); border-color: transparent; color: var(--ink); -webkit-text-fill-color: var(--ink); opacity: 1;
  appearance: none; -webkit-appearance: none; cursor: default;
}
.view-mode .hint { display: none; }
.view-mode input[type="checkbox"]:disabled { opacity: .8; }
.party-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 13.5px; z-index: 80; max-width: calc(100vw - 32px); transition: .2s; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: #b91c1c; }
@media (min-width: 960px) { .toast { bottom: 24px; } }
.btn.wa-btn { color: #15803d; }
.lock-user { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--soft); margin-bottom: 12px; text-align: left; }
.lock-user .avatar { width: 44px; height: 44px; font-size: 18px; }
.lock-user b { display: block; }
.lock-user span { font-size: 12.5px; color: var(--mute); }
.grid > *, .field select { min-width: 0; }
.bom-row select { width: 100%; }

/* ---------- appearance settings ---------- */
.mode-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mode-card { position: relative; border: 2px solid var(--line); border-radius: 14px; overflow: hidden; cursor: pointer; background: var(--card); transition: border-color .15s, transform .15s; }
.mode-card:hover { transform: translateY(-1px); }
.mode-card.on, .mode-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft); }
.mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.mc-art { display: grid; gap: 5px; padding: 12px; height: 74px; align-content: start; }
.mc-art i { display: block; height: 9px; border-radius: 5px; }
.mc-art i:first-child { height: 14px; width: 100%; background: var(--accent); }
.mc-art i:nth-child(2) { width: 75%; } .mc-art i:nth-child(3) { width: 50%; }
.mode-light .mc-art { background: #f4f7fb; } .mode-light .mc-art i:not(:first-child) { background: #dbe3ee; }
.mode-dark .mc-art { background: #0f172a; } .mode-dark .mc-art i:not(:first-child) { background: #334155; }
.mode-auto .mc-art { background: linear-gradient(90deg, #f4f7fb 50%, #0f172a 50%); } .mode-auto .mc-art i:not(:first-child) { background: #94a3b8; }
.mc-txt { display: block; padding: 8px 12px 11px; font-size: 13.5px; }
.mc-txt i { color: var(--accent); }
.mc-txt small { display: block; color: var(--mute); font-size: 11.5px; margin-top: 2px; }
.swatch { transition: transform .15s; }
.swatch:hover { transform: scale(1.08); }
.swatch.custom { background: conic-gradient(#ef4444, #f59e0b, #22c55e, #0ea5e9, #6366f1, #ec4899, #ef4444); display: grid; place-items: center; color: #fff; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }
.swatch.custom i { pointer-events: none; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.theme-preview { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; max-width: 420px; }
.tp-bar { display: flex; gap: 12px; align-items: center; padding: 12px 14px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.tp-body { padding: 12px; display: grid; gap: 10px; background: var(--bg); }
.tp-row { display: flex; gap: 6px; }
.tp-card { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.tp-card small { display: block; color: var(--mute); font-size: 12px; }
.tp-body .btn { justify-self: start; pointer-events: none; }
@media (max-width: 420px) { .mc-txt small { display: none; } }

/* ---------- select boxes (closed) ---------- */
select:not([multiple]):not([size]) {
  appearance: none; -webkit-appearance: none; -moz-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px; padding-right: 34px !important;
}
select:not([multiple]):not([size]):disabled { background-image: none; cursor: default; }

/* ---------- picker (opened) ---------- */
dialog.pick {
  border: 0; padding: 0; margin: auto; width: min(440px, calc(100vw - 24px)); max-height: min(72vh, 620px);
  background: var(--card); color: var(--ink); border-radius: 18px; box-shadow: 0 24px 60px rgba(15, 23, 42, .35);
  display: none; flex-direction: column; overflow: hidden;
}
dialog.pick[open] { display: flex; animation: pickIn .16s ease-out; }
dialog.pick::backdrop { background: rgba(15, 23, 42, .5); }
@keyframes pickIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.pick-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 14px 10px 18px; }
.pick-title { font-size: 16px; }
.pick-x { width: 34px; height: 34px; border-radius: 10px; border: 0; background: var(--grey-bg); color: var(--mute); cursor: pointer; display: grid; place-items: center; }
.pick-search { position: relative; padding: 0 14px 10px; }
.pick-search i { position: absolute; left: 28px; top: 13px; color: var(--mute); font-size: 13px; pointer-events: none; }
.pick-search input { width: 100%; padding: 10px 12px 10px 36px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); color: var(--ink); font: inherit; outline: none; }
.pick-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft); }
.pick-list { overflow-y: auto; padding: 4px 8px 12px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.pick-group { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--mute); font-weight: 700; padding: 12px 12px 4px; }
.pick-opt {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left;
  padding: 13px 12px; border: 0; border-radius: 12px; background: transparent; color: var(--ink); font: inherit; font-size: 15px; cursor: pointer;
}
.pick-opt + .pick-opt { margin-top: 2px; }
.pick-opt:hover, .pick-opt:focus-visible { background: var(--grey-bg); outline: none; }
.pick-opt i { color: var(--accent); visibility: hidden; flex-shrink: 0; }
.pick-opt.on { background: var(--soft); color: var(--soft-ink, var(--accent)); font-weight: 600; }
.pick-opt.on i { visibility: visible; }
.pick-opt.empty span { color: var(--mute); }
.pick-opt:disabled { opacity: .45; cursor: not-allowed; }
.pick-empty { padding: 18px; text-align: center; color: var(--mute); font-size: 13.5px; }
@media (max-width: 699px) {
  dialog.pick { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 20px 20px 0 0; max-height: 78vh; padding-bottom: env(safe-area-inset-bottom); }
  dialog.pick[open] { animation: pickUp .2s ease-out; }
  .pick-head::before { content: ""; position: absolute; left: 50%; top: 7px; width: 40px; height: 4px; border-radius: 4px; background: var(--line); transform: translateX(-50%); }
  .pick-head { position: relative; padding-top: 20px; }
}
@keyframes pickUp { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 18px; height: 18px; flex-shrink: 0; }
.pick-opt[hidden], .pick-group[hidden], .pick-search[hidden] { display: none !important; }
@media (max-width: 600px) {
  .form-actions { gap: 10px; }
  .form-actions .btn { flex: 1 1 0; justify-content: center; min-height: 44px; }
  .form-actions .btn:last-child:not(:first-child) { flex: 2 1 0; }
}
[hidden] { display: none !important; }

/* ---------- bill designs (templates.php) ---------- */
.g4 { grid-template-columns: 1fr 1fr; }
@media (min-width: 640px) { .g4 { grid-template-columns: repeat(4, 1fr); } }
.danger-text { color: var(--bad) !important; }
.tpl-link { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: inherit; background: var(--card); }
.tpl-link > i:first-child { color: var(--accent); font-size: 18px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.tpl-card, .tpl-pick-card { display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); color: inherit; text-decoration: none; cursor: pointer; position: relative; }
.tpl-card small, .tpl-pick-card small { color: var(--mute); font-size: 11.5px; line-height: 1.3; }
.tpl-card.off { opacity: .55; }
.tpl-card:hover, .tpl-pick-card:hover { border-color: var(--accent); }
.tpl-pick-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tpl-pick-card input { position: absolute; opacity: 0; pointer-events: none; }
.tpl-designs { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.tpl-art { display: grid; grid-template-rows: 13px 9px 5px 1fr 9px; gap: 4px; aspect-ratio: 210 / 230; padding: 8px; background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; }
.tpl-art i { display: block; border-radius: 2px; }
.tpl-art .a-hd { border-bottom: 2px solid var(--ac); background: linear-gradient(90deg, var(--ac) 0 45%, transparent 45%); background-size: 100% 4px; background-repeat: no-repeat; }
.tpl-art .a-meta { background: linear-gradient(90deg, #e2e8f0 0 48%, transparent 48% 52%, #e2e8f0 52%); }
.tpl-art .a-th { background: var(--hbg); border: 1px solid var(--ln); }
.tpl-art .a-rows { background: repeating-linear-gradient(180deg, transparent 0 6px, #e5e7eb 6px 7px); }
.tpl-art .a-tot { margin-left: 50%; background: var(--ac); opacity: .85; }
.art-gst_boxed { border: 1.5px solid var(--ln); gap: 0; padding: 0; }
.art-gst_boxed i { border-radius: 0; border-bottom: 1px solid var(--ln); }
.art-gst_boxed .a-rows { background: repeating-linear-gradient(90deg, transparent 0 18%, var(--ln) 18% calc(18% + 1px)); }
.art-gst_boxed .a-tot { background: var(--hbg); opacity: 1; }
.art-modern .a-hd, .art-bold .a-hd { background: var(--ac); border: 0; border-radius: 4px; }
.art-bold { border-left: 5px solid var(--ac); }
.art-bold .a-th { background: var(--ac); }
.art-minimal .a-hd { background-size: 60% 3px; border-bottom-width: 1px; }
.art-minimal .a-th { background: transparent; border: 0; border-top: 1px solid #111; border-bottom: 1px solid #111; }
.art-minimal .a-tot { background: transparent; border-top: 2px solid #111; }
.art-elegant .a-hd { background: linear-gradient(90deg, transparent 25%, var(--ac) 25% 75%, transparent 75%); background-size: 100% 4px; background-repeat: no-repeat; border-bottom: 3px double var(--ac); }
.art-compact { grid-template-rows: 9px 6px 4px 1fr 6px; gap: 2px; }
.art-compact .a-rows { background: repeating-linear-gradient(180deg, transparent 0 3px, #e5e7eb 3px 4px); }
.tpl-colors .field { display: grid; gap: 5px; }
.tpl-colors .lbl { font-size: 12.5px; font-weight: 600; color: var(--mute); }
.color-in { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.color-in input[type=color] { width: 34px; height: 30px; padding: 0; border: 0; background: none; cursor: pointer; }
.color-in code { font-size: 12px; color: var(--mute); }
.tpl-more { display: flex; flex-wrap: wrap; gap: 8px; }
.tpl-edit { display: block; }
.tpl-preview { display: none; }
.tpl-preview iframe { width: 100%; border: 0; background: #e9eef5; border-radius: 0 0 12px 12px; }
.pv-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.pv-head .muted { font-size: 12px; flex: 1; }
.pv-head .pv-close { display: none; }
@media (max-width: 1099px) {
  .tpl-preview.open { display: flex; flex-direction: column; position: fixed; inset: 0; z-index: 60; background: var(--card); }
  .tpl-preview.open iframe { flex: 1; border-radius: 0; }
  .tpl-preview.open .pv-close { display: inline-grid; }
}
@media (min-width: 1100px) {
  .tpl-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .tpl-preview { display: block; position: sticky; top: 74px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
  .tpl-preview iframe { height: calc(100vh - 140px); }
  .tpl-pv-btn { display: none !important; }
}

/* ---------- bill view (sale_view.php) ---------- */
.dv-head { display: grid; gap: 10px; }
.dv-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.dv-title { display: flex; flex-direction: column; min-width: 0; }
.dv-kind { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--mute); font-weight: 700; }
.dv-no { font-size: 19px; overflow-wrap: anywhere; }
.dv-party { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 14px; }
.dv-party > a:first-child { font-weight: 700; }
.dv-party .muted { font-size: 13px; }
.dv-amts { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.dv-amts > div { background: var(--grey-bg); border-radius: 10px; padding: 8px 10px; display: grid; gap: 2px; }
.dv-amts span { font-size: 11.5px; color: var(--mute); font-weight: 600; }
.dv-amts b { font-size: 15.5px; }
.dv-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.dv-form { display: contents; }
.dv-act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 64px; padding: 8px 4px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--card); color: var(--ink); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; text-decoration: none; }
.dv-act i { font-size: 18px; color: var(--accent); }
.dv-act:hover { border-color: var(--accent); }
.dv-act.wa i { color: #16a34a; }
.dv-act.bad i, .dv-act.bad { color: var(--bad); }
.dv-act[aria-busy="true"] { opacity: .7; }
.dv-more { margin-bottom: 12px; }
.dv-paper { margin: 0 -4px 14px; }
.dv-paper iframe { display: block; width: 100%; height: 70vh; border: 0; background: transparent; }
@media (min-width: 760px) { .dv-actions { grid-template-columns: repeat(6, minmax(0, 120px)); } .dv-paper { margin: 0 0 14px; } }
button.chip { font-family: inherit; font-size: 12.5px; }

/* number series list (templates.php?doc=) */
.series-list { display: grid; gap: 8px; }
.series-row { border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.series-row.off { opacity: .7; }
.series-row > summary { display: flex; align-items: center; gap: 10px; padding: 11px 12px; cursor: pointer; list-style: none; }
.series-row > summary::-webkit-details-marker { display: none; }
.series-row > summary .grow { display: grid; gap: 2px; min-width: 0; }
.series-row > summary small { color: var(--mute); font-size: 12px; overflow-wrap: anywhere; }
.series-row[open] > summary { border-bottom: 1px solid var(--line); }
.series-row[open] > summary .fa-chevron-down { transform: rotate(180deg); }
.series-row.add > summary { color: var(--accent); }
.series-fields { padding: 12px; }
.series-sample { padding: 10px 12px; border-radius: 10px; background: var(--grey-bg); font-weight: 700; font-family: ui-monospace, Menlo, Consolas, monospace; overflow-wrap: anywhere; }

/* print copies dialog (bill view) */
.pc-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.pc-opt input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.pc-opt span { display: grid; gap: 2px; }
.pc-opt small { color: var(--mute); font-size: 12.5px; }
.pc-opt:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* ---------- bill form: item search, line description, series dialog ---------- */
.line-top { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40; max-height: 300px; overflow-y: auto; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(15, 23, 42, .18); padding: 4px; }
.combo-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.combo-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
.combo-row span b { font-weight: 700; color: var(--accent); }
.combo-row small { color: var(--mute); font-size: 12px; white-space: nowrap; flex-shrink: 0; }
.combo-row.on, .combo-row:hover { background: var(--grey-bg); box-shadow: inset 3px 0 0 var(--accent); }
.combo-row.new { justify-content: flex-start; color: var(--accent); font-weight: 600; border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; margin-bottom: 2px; }
.combo-empty { padding: 10px; color: var(--mute); font-size: 13px; }
.l-note { width: 100%; margin-top: 6px; padding: 7px 10px; border: 1px dashed var(--line); border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-size: 12.5px; }
.l-note:focus { border-style: solid; border-color: var(--accent); outline: none; }
.series-pick { margin-bottom: 6px; }
.lines-head { display: none; }
@media (min-width: 1200px) {
  .lines-head, .line-card { display: grid; grid-template-columns: minmax(220px, 2.8fr) .8fr .8fr 1fr .9fr .7fr .75fr .9fr 118px; column-gap: 8px; }
  .lines-head { padding: 0 10px 6px; font-size: 11.5px; font-weight: 700; color: var(--mute); text-transform: uppercase; letter-spacing: .03em; }
  .lines-head .n { text-align: right; }
  .line-card { align-items: start; padding: 8px 10px; margin-bottom: 6px; border-radius: 10px; }
  .line-card > .line-top { grid-column: 1; grid-row: 1; }
  .line-card > .l-note { grid-column: 1; grid-row: 2; }
  .line-card > .line-note { grid-column: 1; grid-row: 3; }
  .line-card > .line-grid { display: contents; }
  .line-card .line-grid .field { grid-row: 1; margin: 0; }
  .line-card .line-grid .field label { display: none; }
  .line-card > .line-sum { grid-column: 9; grid-row: 1 / span 2; flex-direction: column; align-items: flex-end; justify-content: center; gap: 2px; margin: 0; padding-top: 8px; text-align: right; }
  .line-card > .line-sum .l-calc { font-size: 11px; }
}
.series-dlg { width: min(640px, calc(100vw - 24px)); }
.sd-table { display: grid; gap: 8px; }
.sd-table.off { opacity: .45; pointer-events: none; }
.sd-row { display: grid; grid-template-columns: 1fr 1.3fr .8fr auto auto; gap: 6px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 10px; }
.sd-row input, .sd-row select { padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--ink); font: inherit; font-size: 13.5px; min-width: 0; }
.sd-def { display: flex; align-items: center; gap: 4px; font-size: 12.5px; white-space: nowrap; }
.sd-acts { display: flex; gap: 4px; }
.sd-acts .sd-del { background: var(--bad-bg); color: var(--bad); }
.sd-next { grid-column: 1 / -1; color: var(--mute); font-size: 12px; }
@media (max-width: 560px) { .sd-row { grid-template-columns: 1fr 1fr; } .sd-row .sd-def, .sd-row .sd-acts { justify-self: start; } }
.disc-row { align-items: center; }
.disc-in { display: flex; align-items: center; gap: 6px; }
.disc-in select, .disc-in input { padding: 5px 7px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--ink); font: inherit; font-size: 13px; }
.disc-in input { width: 84px; text-align: right; }
.disc-row.has-error .disc-in input { border-color: var(--bad); }

/* message after save / delete: Android-style toast that leaves by itself */
.flash-toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 90; display: flex; align-items: flex-start; gap: 10px;
  width: max-content; max-width: min(520px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 14px; background: #1e293b; color: #fff;
  font-size: 14px; line-height: 1.4; box-shadow: 0 10px 30px rgba(0, 0, 0, .28); cursor: pointer;
  transform: translateX(-50%); animation: toastIn .28s ease-out, toastOut .35s ease-in 3.6s forwards; }
.flash-toast i { margin-top: 2px; }
.flash-toast.ok i { color: #4ade80; }
.flash-toast.info i { color: #93c5fd; }
.flash-toast.info { animation: toastIn .28s ease-out, toastOut .35s ease-in 6s forwards; }
.flash-toast.err { background: #b91c1c; animation: toastIn .28s ease-out, toastOut .35s ease-in 6s forwards; }
.flash-toast.gone { animation: toastOut .25s ease-in forwards; }
body.has-actions .flash-toast { bottom: calc(90px + env(safe-area-inset-bottom)); }
@media (min-width: 960px) { .flash-toast { bottom: 28px; } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toastOut { to { opacity: 0; transform: translate(-50%, 16px); visibility: hidden; pointer-events: none; } }
@media (prefers-reduced-motion: reduce) { .flash-toast, .flash-toast.err { animation-duration: .01s, .01s; } }
.side-link em.count-dot { background: var(--bad); color: #fff; padding: 0 6px; font-weight: 700; }
input.auto-filled { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }

/* ================= Costing & Ledger ================= */
.calc-explain { display: grid; gap: 6px; padding: 12px 14px; border-radius: 12px; background: var(--grey-bg); font-size: 13px; line-height: 1.45; }
.steps-mini { display: grid; gap: 6px; font-size: 13px; }
.steps-mini b:first-child { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; margin-right: 6px; }
.rate-list .row { gap: 10px; }
.rate-list .row > a.grow { min-width: 0; color: inherit; }
.rate-in { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.rate-in span { color: var(--mute); font-size: 13px; }
.rate-in input { width: 96px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--field); color: var(--ink); font: inherit; text-align: right; }
.rate-in input:placeholder-shown { border-color: var(--bad); }
.rate-in input:focus { border-color: var(--accent); outline: none; }
.mode-pick { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .mode-pick { grid-template-columns: repeat(3, 1fr); } .mode-pick.two { grid-template-columns: 1fr 1fr; } }
.pay-due { font-size: 12.5px; color: var(--mute); margin-top: 4px; }
.calc-tbl td { vertical-align: top; }
.calc-tbl .sub { font-size: 11.5px; color: var(--mute); }
.calc-tbl tr.miss td { background: var(--bad-bg); }
.rate-cell { width: 92px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--ink); font: inherit; text-align: right; }
.calc-sum { display: grid; gap: 2px; max-width: 460px; margin-left: auto; width: 100%; font-size: 14px; }
.calc-sum > div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.calc-sum > div b { font-variant-numeric: tabular-nums; }
.calc-sum .grand { font-size: 16px; font-weight: 700; border-bottom: 1px solid var(--line); }
.ledger-tbl .sub { font-size: 11.5px; color: var(--mute); }
.ledger-tbl .sub-row td { background: var(--grey-bg); }
.nowrap { white-space: nowrap; }
.del-btn { background: var(--bad-bg) !important; color: var(--bad) !important; }
.kpi-link { font-size: 15px; }
.only-print { display: none; }
a.alert { text-decoration: none; }
@media print {
  .only-print { display: block; }
  .period-bar, .search, .chips { display: none !important; }
  .card { box-shadow: none; border: 0; }
}
