/* ══════════════════════════════════════════════════════════
   DuoDues v4.1 — Supabase edition · dark, split-color, automated
   Teal = User A · Coral = User B · White = Admin
   v4.1: PDF export permission styling (Admin-only current month)
   ══════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;
  --bg:        #0B0F10;
  --surface:   #111719;
  --surface-2: #161E20;
  --surface-3: #1B2427;
  --line:   rgba(226,238,232,.07);
  --line-2: rgba(226,238,232,.15);
  --text:  #EAF1ED;
  --muted: #8A9993;
  --faint: #616D68;
  --a: #2FE0C6;  --a-dim: rgba(47,224,198,.13);  --a-line: rgba(47,224,198,.38);
  --b: #FF8A75;  --b-dim: rgba(255,138,117,.13); --b-line: rgba(255,138,117,.38);
  --font-display: 'Syne', sans-serif;
  --font-body:    'Space Grotesk', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;
  --r: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font-body); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input  { font: inherit; color: inherit; }
::selection { background: rgba(47,224,198,.25); }
:focus-visible { outline: 2px solid rgba(234,241,237,.45); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ── Body-state visibility (signed-out / gate / loading / ready) ── */
.auth-screen, .gate-screen, .app-loading, #app-topbar, #app-main { display: none; }
body.state-signed-out .auth-screen { display: grid; }
body.state-gate        .gate-screen { display: flex; }
body.state-loading     .app-loading { display: flex; }
body.state-ready #app-topbar,
body.state-ready #app-main         { display: block; }

/* ══ AUTH SCREEN ═════════════════════════════════════════ */
.auth-screen { position: fixed; inset: 0; z-index: 80; overflow-y: auto; background: var(--bg); grid-template-columns: 1.05fr 1fr; }
.auth-brand { padding: clamp(28px, 5vw, 64px); display: flex; flex-direction: column; justify-content: space-between; gap: 40px; border-right: 1px solid var(--line); }
.auth-wordmark { font-family: var(--font-display); font-weight: 800; font-size: clamp(44px, 6vw, 76px); letter-spacing: -.03em; line-height: 1; }
.wm-a { color: var(--a); } .wm-b { color: var(--b); }
.auth-tagline { margin-top: 12px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.auth-beam { margin-top: 36px; max-width: 400px; }
.auth-features { list-style: none; display: flex; flex-direction: column; gap: 16px; }
.auth-features li { display: flex; gap: 12px; align-items: flex-start; }
.auth-features svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.auth-features li:nth-child(1) svg { color: var(--a); }
.auth-features li:nth-child(2) svg { color: var(--b); }
.auth-features li:nth-child(3) svg { color: var(--text); }
.auth-features b { display: block; font-size: 13.5px; }
.auth-features span { font-size: 12.5px; color: var(--muted); }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--surface); }
.auth-card { width: min(400px, 100%); }

.auth-switch { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-bottom: 22px; }
.auth-tab { flex: 1; text-align: center; padding: 9px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--muted); transition: color .18s, background .18s; }
.auth-tab.is-active { background: var(--text); color: #0C1213; }
.auth-tab:not(.is-active):hover { color: var(--text); }

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-field { padding: 11px 14px; }
.auth-field input { width: 100%; background: none; border: 0; outline: 0; font-size: 14.5px; }
.auth-field input::placeholder { color: var(--faint); }
.field-ico { display: inline-flex; color: var(--faint); margin-right: 8px; }
.field-ico svg { width: 15px; height: 15px; }
.auth-submit { margin-top: 6px; width: 100%; }

.form-error { background: var(--b-dim); border: 1px solid var(--b-line); color: #FFB4A6; border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.45; }

.seat-label { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 8px 0 2px; }
.seat-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seat-option { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); transition: border-color .15s, background .15s, opacity .15s; }
.seat-option .seat-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.seat-status { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.seat-option[data-seat="A"].is-selected { border-color: var(--a-line); background: var(--a-dim); }
.seat-option[data-seat="B"].is-selected { border-color: var(--b-line); background: var(--b-dim); }
.seat-option.is-taken { opacity: .4; cursor: not-allowed; }
.seat-option.is-taken .seat-status { color: var(--b); }
.auth-foot { margin-top: 16px; font-size: 11.5px; color: var(--faint); line-height: 1.55; }

.setup-notice { display: flex; flex-direction: column; gap: 12px; }
.setup-notice svg { width: 22px; height: 22px; color: var(--a); }
.setup-notice h2 { font-family: var(--font-display); font-size: 18px; }
.setup-notice p { font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.setup-notice ol { margin: 4px 0 0 18px; display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.setup-notice b { font-weight: 700; }
.setup-foot { font-size: 12px; color: var(--faint); }

/* ══ SEAT GATE ════════════════════════════════════════════ */
.gate-screen { position: fixed; inset: 0; z-index: 75; align-items: center; justify-content: center; background: var(--bg); padding: 20px; }
.gate-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 26px; }
.gate-title { font-family: var(--font-display); font-weight: 700; font-size: 21px; }
.gate-sub { font-size: 13.5px; color: var(--muted); margin: 6px 0 18px; line-height: 1.5; }
.gate-field { margin-bottom: 6px; }
.gate-card .form-error { margin: 12px 0 0; }
.gate-card .auth-submit { margin-top: 14px; }

/* ── Loading state ── */
.app-loading { min-height: 100vh; align-items: center; justify-content: center; flex-direction: column; gap: 16px; color: var(--muted); font-size: 13.5px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--a); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Top bar ── */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(11,15,16,.82); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 32px); min-height: 60px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.wordmark { font-family: var(--font-display); font-weight: 800; font-size: 21px; letter-spacing: -.02em; }
.tagline { font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); }
.topbar-spacer { flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.month-nav { display: flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.month-label { font-weight: 600; font-size: 14px; min-width: 112px; text-align: center; }
body[data-view="history"] .month-nav { display: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; color: var(--muted); transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }
.tabs { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.tab { padding: 7px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--muted); transition: color .18s, background .18s; }
.tab.is-active { background: var(--text); color: #0C1213; }
.tab:not(.is-active):hover { color: var(--text); }
.sync-chip { display: flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; color: var(--muted); }
.sync-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.sync-chip.is-live { color: var(--a); }
.sync-chip.is-live .dot { background: var(--a); animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }

/* user menu */
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; transition: border-color .15s; }
.user-btn:hover { border-color: var(--line-2); }
.avatar { width: 27px; height: 27px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; }
.av-a { background: var(--a-dim); color: var(--a); }
.av-b { background: var(--b-dim); color: var(--b); }
.av-admin { background: var(--surface-3); color: var(--text); border: 1px solid var(--line-2); }
.user-name-top { font-size: 13.5px; font-weight: 600; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chev { width: 13px; height: 13px; color: var(--faint); }
.user-pop { position: absolute; right: 0; top: calc(100% + 8px); width: 232px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.5); z-index: 60; padding: 6px; animation: pop .18s cubic-bezier(.22,1,.36,1); }
.user-pop-head { padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.user-pop-name { font-weight: 600; font-size: 14.5px; }
.user-pop-mail { font-size: 12px; color: var(--muted); margin: 3px 0 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-badge { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; border: 1px solid; }
.role-badge svg { width: 11px; height: 11px; }
.rb-a { color: var(--a); border-color: var(--a-line); background: var(--a-dim); }
.rb-b { color: var(--b); border-color: var(--b-line); background: var(--b-dim); }
.rb-admin { color: var(--text); border-color: var(--line-2); background: var(--surface-3); }
.btn-signout { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); transition: background .15s, color .15s; }
.btn-signout:hover { background: var(--surface-2); color: var(--text); }
.btn-signout svg { width: 15px; height: 15px; }

/* ── Layout ── */
.app { max-width: 1180px; margin: 0 auto; padding: 26px clamp(16px, 4vw, 32px) 90px; }
.app-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 18px; align-items: start; }
.col-side { position: sticky; top: 80px; }

/* ── Panels ── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.panel-title { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.panel-sub, .panel-count { font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); }

/* ── Composer ── */
.composer { padding: 16px 18px 18px; margin-bottom: 18px; }
.composer .panel-head { margin-bottom: 14px; }
.composer-row { display: flex; gap: 10px; align-items: center; }
.composer-row + .composer-row { margin-top: 12px; }
.field { display: flex; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 9px 14px; transition: border-color .15s, box-shadow .15s; }
.field:focus-within { border-color: var(--line-2); box-shadow: 0 0 0 3px rgba(234,241,237,.05); }
.field.is-invalid { border-color: var(--b); animation: shake .3s; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.field-amount .currency { font-family: var(--font-mono); font-size: 18px; font-weight: 600; color: var(--muted); margin-right: 8px; }
.amount-input { background: none; border: 0; outline: 0; width: 112px; font-family: var(--font-mono); font-size: 22px; font-weight: 700; letter-spacing: -.01em; caret-color: var(--a); }
.amount-input::placeholder { color: var(--faint); font-weight: 500; }
.field-note { flex: 1; min-width: 0; }
.field-note input { width: 100%; background: none; border: 0; outline: 0; font-size: 15px; }
.field-note input::placeholder { color: var(--faint); }
.date-input { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-family: var(--font-mono); font-size: 13px; color: var(--text); outline: 0; }
.date-input:focus { border-color: var(--line-2); }
.payer-toggle { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.payer-btn { padding: 7px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--muted); transition: color .18s, background .18s; white-space: nowrap; }
.payer-btn:not(.is-active):hover { color: var(--text); }
.payer-a.is-active { background: var(--a); color: #06211C; }
.payer-b.is-active { background: var(--b); color: #2B110C; }
.payer-static { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--text); color: #0C1213; border-radius: 10px; padding: 11px 18px; font-size: 14px; font-weight: 700; transition: background .15s, transform .1s, opacity .15s; }
.btn-primary:hover { background: #fff; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.btn-primary svg { width: 15px; height: 15px; }
.btn-add { margin-left: auto; }
.btn-ghost { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-2); color: var(--muted); border-radius: 10px; padding: 11px 16px; font-size: 14px; font-weight: 600; transition: color .15s, border-color .15s; }
.btn-ghost:hover { color: var(--text); border-color: rgba(234,241,237,.32); }
.btn-ghost svg { width: 15px; height: 15px; }
.btn-export { width: 100%; margin-top: 10px; }

/* ══ v4.1 · PDF EXPORT PERMISSIONS ═══════════════════════
   The sidebar export button is disabled for members on the current
   month (Admin-only). Disabled state + the explanatory note below. */
.btn-ghost:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost:disabled:hover { color: var(--muted); border-color: var(--line-2); }
.export-note { margin-top: 9px; font-size: 11px; line-height: 1.55; color: var(--faint); }

/* ── Transaction feed ── */
.feed-panel { padding: 0; }
.feed-panel .panel-head { padding: 15px 18px 4px; }
.day-group .entry:last-child { border-bottom: 0; }
.day-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 8px; }
.day-head::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.day-title { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.entry { position: relative; display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 19px; border-bottom: 1px solid var(--line); transition: background .15s; }
.entry:hover { background: var(--surface-2); }
.entry::before { content: ""; position: absolute; left: 6px; top: 11px; bottom: 11px; width: 3px; border-radius: 2px; }
.entry--a::before { background: var(--a); }
.entry--b::before { background: var(--b); }
.entry.is-new { animation: enter .35s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(-4px); } }
.entry-main { flex: 1; min-width: 0; }
.entry-note { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-sub { font-size: 11px; color: var(--faint); margin-top: 2px; }
.entry-right { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.entry-amount { font-family: var(--font-mono); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.entry-payer { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; opacity: .75; }
.entry--a .entry-amount, .entry--a .entry-payer { color: var(--a); }
.entry--b .entry-amount, .entry--b .entry-payer { color: var(--b); }
.entry-del { width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--faint); opacity: 0; transition: opacity .15s, color .15s, background .15s; }
.entry:hover .entry-del { opacity: 1; }
.entry-del:hover { color: var(--b); background: var(--b-dim); }
.entry-del svg { width: 14px; height: 14px; }
.feed.is-readonly .entry-del { display: none; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 52px 20px; color: var(--faint); text-align: center; }
.empty svg { width: 26px; height: 26px; opacity: .6; }
.empty p { font-size: 13.5px; line-height: 1.6; }

/* ── Settled banner ── */
.settled-banner { display: flex; gap: 14px; align-items: center; padding: 16px 18px; margin-bottom: 18px; background: var(--a-dim); border: 1px solid var(--a-line); border-left: 3px solid var(--a); border-radius: var(--r); }
.settled-banner svg { width: 20px; height: 20px; color: var(--a); flex: none; }
.settled-title { font-weight: 600; font-size: 14.5px; }
.settled-detail { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── Balance panel ── */
.balance-panel { padding: 18px; }
.balance-panel .panel-head { margin-bottom: 16px; }
.owes-label { font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.owes-label.ol-A { color: var(--a); }
.owes-label.ol-B { color: var(--b); }
.owes-amount { font-family: var(--font-mono); font-weight: 700; font-size: clamp(38px, 4.5vw, 52px); letter-spacing: -.03em; line-height: 1.15; margin-top: 6px; font-variant-numeric: tabular-nums; }
.owes-amount.v-A { color: var(--a); }
.owes-amount.v-B { color: var(--b); }
.owes-note { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-top: 8px; }
.beam { position: relative; margin-top: 22px; }
.beam-bar { position: relative; height: 12px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line); overflow: hidden; }
.beam-a { position: absolute; left: 0; top: 0; bottom: 0; width: 50%; background: var(--a); border-radius: 999px 0 0 999px; transition: width .7s cubic-bezier(.22,1,.36,1); }
.beam-b { position: absolute; right: 0; top: 0; bottom: 0; width: 50%; background: var(--b); border-radius: 0 999px 999px 0; transition: width .7s cubic-bezier(.22,1,.36,1); }
.beam.is-empty .beam-a, .beam.is-empty .beam-b { opacity: .22; }
.beam-center { position: absolute; left: 50%; top: -5px; transform: translateX(-50%); width: 2px; height: 22px; background: var(--text); opacity: .85; border-radius: 1px; z-index: 2; }
.beam-labels { display: flex; justify-content: space-between; margin-top: 9px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; color: var(--muted); }
.beam-label--a { color: var(--a); }
.beam-label--b { color: var(--b); }
.beam-mid { color: var(--faint); }
.divider { height: 1px; background: var(--line); margin: 18px 0 14px; }
.stats { display: flex; flex-direction: column; gap: 9px; }
.stat { display: flex; justify-content: space-between; align-items: baseline; }
.stat dt { font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.stat dd { font-family: var(--font-mono); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pip { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.pip-a { background: var(--a); }
.pip-b { background: var(--b); }
.settle-note { margin-top: 11px; font-size: 11.5px; line-height: 1.55; color: var(--faint); }

/* ── Auto-settlement timeline (replaces every manual settle button) ── */
.auto-timeline { margin-top: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.auto-head { display: flex; align-items: center; gap: 10px; }
.auto-ico { width: 30px; height: 30px; border-radius: 8px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--muted); }
.auto-ico svg { width: 15px; height: 15px; }
.ico-wrap { display: inline-flex; }
.auto-title { font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.auto-date { font-size: 13px; font-weight: 600; margin-top: 2px; }
.auto-days { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; color: var(--faint); text-align: right; white-space: nowrap; }
.auto-days b { color: var(--a); font-weight: 600; }
.auto-timeline.is-settled .auto-ico { background: var(--a-dim); color: var(--a); }
.auto-timeline.is-settled .auto-date { color: var(--a); }
.auto-timeline.is-pending .auto-ico { background: var(--b-dim); color: var(--b); }
.auto-timeline.is-upcoming { opacity: .75; }
.auto-track { position: relative; height: 6px; border-radius: 999px; background: var(--surface-3); margin-top: 13px; }
.auto-track::after { content: ""; position: absolute; right: 0; top: -4px; bottom: -4px; width: 2px; border-radius: 1px; background: var(--a); }
.auto-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; border-radius: 999px; background: rgba(234,241,237,.16); transition: width .5s cubic-bezier(.22,1,.36,1); }
.auto-marker { position: absolute; top: 50%; left: 0%; transform: translate(-50%, -50%); width: 12px; height: 12px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 3px var(--surface-2); transition: left .5s cubic-bezier(.22,1,.36,1); }
.auto-caption { display: flex; justify-content: space-between; margin-top: 9px; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }

/* ── History view ── */
.history-view .panel { padding: 0; }
.history-view .panel-head { padding: 15px 18px 4px; }
.hist-item { border-bottom: 1px solid var(--line); }
.hist-item:last-child { border-bottom: 0; }
.hist-row { display: flex; align-items: stretch; }
.hist-head { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; text-align: left; padding: 15px 6px 15px 18px; transition: background .15s; }
.hist-head:hover { background: var(--surface-2); }
.hist-chev { width: 16px; height: 16px; color: var(--faint); transition: transform .2s; flex: none; }
.hist-item.is-open .hist-chev { transform: rotate(180deg); }
.hist-month { font-family: var(--font-display); font-weight: 700; font-size: 15.5px; min-width: 118px; }
.hist-total { font-family: var(--font-mono); font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted); }
.hist-net { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.hist-net b { font-family: var(--font-mono); font-weight: 600; }
.hn-A { color: var(--a); } .hn-B { color: var(--b); }
.hist-date { font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.hist-pdf { width: 52px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: none; transition: color .15s, background .15s; }
.hist-pdf:hover { color: var(--a); background: var(--a-dim); }
.hist-pdf svg { width: 15px; height: 15px; }
.hist-body { margin: 0 12px 14px 34px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 4px 0 6px; }
.hist-body .day-head { padding: 10px 14px 6px; }
.hist-body .entry { padding: 9px 12px 9px 17px; }
.hist-body .entry:hover { background: transparent; }
.hist-body .entry-note { font-size: 14px; }
.hist-body .entry-amount { font-size: 13.5px; }
.hist-empty-row { padding: 14px; font-size: 13px; color: var(--faint); }

/* ── Toasts ── */
#toast-root { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 10px; background: var(--surface-3); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 16px; font-size: 13.5px; box-shadow: 0 12px 32px rgba(0,0,0,.45); animation: toastIn .28s cubic-bezier(.22,1,.36,1); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
.toast.is-out { opacity: 0; transform: translateY(6px); transition: all .25s; }
.toast svg { width: 15px; height: 15px; color: var(--a); flex: none; }
.toast--error svg { color: var(--b); }
.toast-act { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--a); margin-left: 4px; }
.toast-act:hover { text-decoration: underline; }

/* ══ PDF REPORT v4.2 — DOM-driven pagination ══════════════════════════
   One .dd-page div = exactly one A4 sheet (794×1123px ≈ 210×297mm at
   96dpi). html2pdf runs with margin: 0, so EVERY margin in the PDF is
   real CSS padding defined here — no image scaling, no slicing offsets,
   no white rails beside the header. The dark header bleeds to the
   paper edges, and every sheet carries a footer at the same position.
   Side margin 53px ≈ 14mm ≈ the 40pt margin of the original design. */
.report-host { position: absolute; left: -10000px; top: 0; width: 794px; }
.dd-report { width: 794px; background: #ffffff; color: #171E20; font-family: 'Poppins', 'Segoe UI', sans-serif; }

.dd-page {
  position: relative; width: 794px; height: 1123px;
  overflow: hidden; background: #ffffff;
  break-after: page; page-break-after: always;   /* html2pdf css pagebreak mode */
}
.dd-page:last-child { break-after: auto; page-break-after: auto; }

/* full-bleed header (sheet 1) */
.dd-head { background: #171E20; padding: 26px 53px; display: flex; justify-content: space-between; align-items: flex-start; }
.dd-logo { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 30px; letter-spacing: -.02em; color: #fff; }
.dd-la { color: #2FE0C6; } .dd-lb { color: #FF8A75; }
.dd-sub { font-size: 9px; letter-spacing: .22em; color: #9FB0AA; margin-top: 4px; }
.dd-head-r { text-align: right; }
.dd-month { font-weight: 700; font-size: 18px; color: #fff; }
.dd-gen { font-size: 10px; color: #9FB0AA; margin-top: 4px; }
.dd-badge { display: inline-block; margin-top: 8px; font-size: 9px; font-weight: 700; letter-spacing: .14em; color: #2FE0C6; border: 1.5px solid #2FE0C6; border-radius: 99px; padding: 3px 10px; }

/* slim continuation strip (sheet 2+) — also full-bleed */
.dd-cont { background: #171E20; padding: 15px 53px; display: flex; justify-content: space-between; align-items: baseline; }
.dd-cont-l { font-weight: 700; font-size: 13px; color: #fff; }
.dd-cont-r { font-size: 9px; letter-spacing: .18em; color: #9FB0AA; text-transform: uppercase; }

.dd-body { padding: 24px 53px 0; }
.dd-legend { display: flex; align-items: center; gap: 18px; font-size: 13px; font-weight: 600; }
.dd-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.dd-dot-a { background: #12B39B; } .dd-dot-b { background: #F2664D; }
.dd-legend-note { margin-left: auto; font-size: 10px; font-weight: 400; color: #7A8682; }
.dd-stats { display: flex; gap: 12px; margin-top: 16px; }
.dd-box { flex: 1; border: 1px solid #E2ECE9; border-radius: 10px; padding: 12px 14px; background: #F6F8F7; }
.dd-k { font-size: 8.5px; font-weight: 600; letter-spacing: .12em; color: #7A8682; }
.dd-v { font-size: 19px; font-weight: 700; margin-top: 4px; }
.dd-c-a { color: #0E8F7C; } .dd-c-b { color: #E04E33; }
.dd-verdict { margin-top: 14px; border: 1.5px solid #7A8682; border-radius: 12px; padding: 14px 18px; }
.dd-vk { font-size: 11px; font-weight: 700; letter-spacing: .1em; }
.dd-vv { font-size: 30px; font-weight: 700; margin: 4px 0 2px; }
.dd-vn { font-size: 10px; color: #7A8682; }
.dd-money { font-variant-numeric: tabular-nums; }

/* table-layout: fixed + column widths = the table can never grow past
   the body's content box (a width blow-out would shift the margins). */
.dd-table { width: 100%; border-collapse: collapse; margin-top: 18px; font-size: 11.5px; table-layout: fixed; }
.dd-table th { background: #171E20; color: #fff; font-size: 9px; font-weight: 600; letter-spacing: .1em; text-align: left; padding: 8px 10px; }
.dd-th-r { text-align: right; }
.dd-table td { border-bottom: 1px solid #E2ECE9; padding: 7px 10px; overflow-wrap: break-word; }
.th-date, .td-date { width: 74px; color: #7A8682; }
.th-payer, .td-payer { width: 116px; font-weight: 600; }
.th-amt, .td-amt { width: 104px; text-align: right; }
.td-amt { font-weight: 700; }
.td-a { color: #0E8F7C; } .td-b { color: #E04E33; }
.td-empty { color: #7A8682; text-align: center; padding: 18px; }
.dd-table tfoot th { background: #EDF1F0; color: #171E20; font-size: 10px; padding: 9px 10px; }

/* per-page footer — identical position on every sheet */
.dd-foot { position: absolute; left: 53px; right: 53px; bottom: 26px; display: flex; justify-content: space-between; font-size: 9px; color: #9FB0AA; }

/* ── Responsive ── */
@media (max-width: 1020px) { .app-grid { grid-template-columns: 1fr; } .col-side { position: static; order: -1; } }
@media (max-width: 900px) { .auth-screen { grid-template-columns: 1fr; } .auth-brand { border-right: 0; border-bottom: 1px solid var(--line); gap: 24px; } .auth-panel { padding: 24px 18px 40px; } }
@media (max-width: 720px) { .auth-features { display: none; } .auth-beam { margin-top: 22px; } }
@media (max-width: 680px) {
  .tagline, .user-name-top, .sync-chip { display: none; }
  .topbar-inner { gap: 10px; }
  .composer-row--main { flex-direction: column; align-items: stretch; }
  .field-amount .amount-input { width: 100%; }
  .composer-row--meta { flex-wrap: wrap; }
  .date-input { flex: 1; min-width: 0; }
  .payer-area { flex: 1; }
  .payer-btn { padding: 7px 10px; }
  .btn-add { flex: 1 1 100%; margin-left: 0; }
  .hist-head { flex-wrap: wrap; row-gap: 4px; }
  .hist-month { min-width: 0; }
  .hist-date { display: none; }
  .beam-labels { font-size: 9.5px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }