/* Guará One CRM — design system */
@font-face { font-family: 'Cormorant Garamond'; font-weight: 500 700; font-display: swap;
  src: local('Cormorant Garamond SemiBold'), local('CormorantGaramond-SemiBold'), url('/fonts/CormorantGaramond-SemiBold.woff2') format('woff2'); }
:root {
  --red: #D0202E; --red-deep: #9E1424; --red-soft: #FBECEC; --coral: #FF4D55;
  --ink: #1F2328; --ink-2: #474C55; --muted: #8A867E; --line: #ECE6DC; --line-2: #F4EFE7;
  --bg: #F8F4EE; --surface: #FFFFFF; --surface-2: #FCFAF6; --side: #1F2328; --side-ink: #CFCAC2; --side-muted: #7D7870;
  --gold: #B89B5E; --gold-soft: #F5EEE0; --blue: #2A7AB0; --green: #2E8B57; --amber: #B8860B; --violet: #6B5B95;
  --ok: #2E8B57; --ok-soft: #E7F3EC; --warn: #B8860B; --warn-soft: #FBF3DD; --bad: #C0392B; --bad-soft: #FBE9E7; --info: #2A7AB0; --info-soft: #E6F0F7;
  --shadow: 0 1px 2px rgba(30,25,20,.04), 0 4px 18px rgba(30,25,20,.05);
  --shadow-lg: 0 18px 60px rgba(20,16,12,.18);
  --radius: 14px; --radius-sm: 9px;
  --serif: 'Cormorant Garamond', 'Cormorant', 'EB Garamond', Garamond, 'GFS Baskerville', 'Libre Baskerville', Georgia, serif;
  --sans: Montserrat, Inter, 'Segoe UI', system-ui, -apple-system, Helvetica, Arial, sans-serif;
  --chart-a: #2A7AB0; --chart-b: #D0202E; --grid: #EFEAE3;
  color-scheme: light;
}
[data-theme="dark"] {
  --ink: #EDEAE4; --ink-2: #C5C1BA; --muted: #8C877F; --line: #2C2B2E; --line-2: #242326;
  --bg: #121417; --surface: #1A1D21; --surface-2: #1F2227; --side: #0E1013; --red-soft: #3A1518; --gold-soft: #2B261D;
  --ok-soft: #15291E; --warn-soft: #2D2611; --bad-soft: #321614; --info-soft: #132433;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); --chart-a: #4A97CC; --chart-b: #F0444D; --grid: #2A292C;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--sans); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01', 'tnum' 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, td.num, .money { font-variant-numeric: tabular-nums; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
.serif { font-family: var(--serif); font-weight: 600; letter-spacing: 0; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 22px 14px 16px; z-index: 30; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; text-decoration: none; flex-wrap: wrap; }
.side .brand img { height: 44px; width: auto; margin-left: -6px; }
.side .brand .tags { display: flex; gap: 6px; width: 100%; padding-left: 4px; }
.side .brand .crm { font: 600 10px/1 var(--sans); letter-spacing: .22em; color: var(--gold); border: 1px solid rgba(184,155,94,.4); border-radius: 4px; padding: 4px 6px; }
.nav-sec { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--side-muted); padding: 16px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; text-decoration: none; color: var(--side-ink); font-weight: 500; position: relative; transition: background .15s, color .15s; }
.nav a svg { width: 18px; height: 18px; opacity: .75; flex: none; }
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.active { background: rgba(208,32,46,.16); color: #fff; }
.nav a.active::before { content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--red); }
.nav a.active svg { opacity: 1; color: var(--coral); }
.nav .badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 600; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px; }
.nav .badge.soft { background: rgba(255,255,255,.1); color: var(--side-ink); }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255,255,255,.07); display: flex; align-items: center; gap: 10px; }
.side-foot .who { min-width: 0; flex: 1; }
.side-foot .who b { display: block; color: #fff; font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { font-size: 11.5px; color: var(--side-muted); }
.icon-btn { background: transparent; border: 0; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; cursor: pointer; color: inherit; }
.icon-btn:hover { background: rgba(127,127,127,.12); }
.icon-btn svg { width: 18px; height: 18px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 12.5px; color: #fff; background: var(--red); flex: none; letter-spacing: .02em; }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 32px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid transparent; }
.top.scrolled { border-bottom-color: var(--line); }
.search-trigger { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; color: var(--muted); cursor: pointer; text-align: left; }
.search-trigger:hover { border-color: color-mix(in srgb, var(--gold) 50%, var(--line)); }
.search-trigger > svg { width: 17px; height: 17px; flex: none; }
.search-trigger > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-trigger kbd { margin-left: auto; font: 500 11px var(--sans); border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; color: var(--muted); }
.top .spacer { flex: 1; }
.menu-btn { display: none; }
.content { padding: 8px 32px 64px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin: 14px 0 22px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--serif); font-size: 36px; font-weight: 600; line-height: 1.05; letter-spacing: -.005em; }
.page-head .eyebrow { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); font-weight: 600; margin-bottom: 6px; }
.page-head .sub { color: var(--muted); margin-top: 6px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .08s, background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 6px 16px -6px rgba(208,32,46,.55); }
.btn.primary:hover { background: var(--red-deep); border-color: var(--red-deep); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(127,127,127,.1); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.danger { color: var(--bad); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.input, select.input, textarea.input { width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 18%, transparent); }
.input.sm { height: 32px; font-size: 13px; border-radius: 8px; }
label.f { display: block; }
label.f > span { display: block; font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 5px; letter-spacing: .01em; }
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px 16px; }
.c12 { grid-column: span 12; } .c8 { grid-column: span 8; } .c6 { grid-column: span 6; } .c4 { grid-column: span 4; } .c3 { grid-column: span 3; } .c2 { grid-column: span 2; } .c9 { grid-column: span 9; } .c5 { grid-column: span 5; } .c7 { grid-column: span 7; } .c10 { grid-column: span 10; } .c1 { grid-column: span 1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters .input { width: auto; min-width: 150px; }
.filters .grow { flex: 1; min-width: 220px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 0 12px; height: 30px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 500; font-size: 13px; }
.seg button.on { background: var(--ink); color: var(--surface); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 18px 20px 4px; }
.card-h h3 { font-size: 15px; font-weight: 600; }
.card-h .hint { color: var(--muted); font-size: 12.5px; }
.card-h .stack { display: grid; gap: 2px; }
.card-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-b { padding: 14px 20px 20px; }
.grid { display: grid; gap: 18px; }
.g-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2 { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.g-2e { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { padding: 18px 20px 18px; position: relative; overflow: hidden; }
.kpi .lbl { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .val { font-family: var(--sans); font-size: 30px; font-weight: 600; margin-top: 8px; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -.025em; }
.kpi .val small { font-family: var(--sans); font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.kpi .foot { margin-top: 8px; font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kpi.accent { background: linear-gradient(140deg, #272C33 0%, #1B1F24 100%); color: #F8F4EE; border-color: #2a2f36; }
.kpi.accent .lbl, .kpi.accent .foot { color: #A39E95; }
.kpi.accent::after { content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(208,32,46,.35), transparent 70%); }
.delta { font-weight: 600; font-size: 12px; padding: 2px 7px; border-radius: 999px; }
.delta.up { color: var(--ok); background: var(--ok-soft); } .delta.down { color: var(--bad); background: var(--bad-soft); }
.meter { height: 6px; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--red); border-radius: 6px; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.meter.gold > i { background: var(--gold); } .meter.ok > i { background: var(--ok); }
.kpi.accent .meter { background: rgba(255,255,255,.08); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; }
table.t th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
table.t th.sortable { cursor: pointer; } table.t th.sortable:hover { color: var(--ink); }
table.t td { padding: 13px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tbody tr { transition: background .12s; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr:hover { background: var(--surface-2); }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t td.num, table.t th.num { text-align: right; white-space: nowrap; }
table.t .strong { font-weight: 600; }
table.t .sub { color: var(--muted); font-size: 12.5px; }
table.t tfoot td { font-weight: 600; border-top: 1px solid var(--line); padding: 12px 14px; }
.code { font: 500 12px/1 ui-monospace, 'SF Mono', Menlo, monospace; color: var(--ink-2); background: var(--line-2); padding: 4px 7px; border-radius: 6px; white-space: nowrap; }
.muted { color: var(--muted); }
.empty { padding: 42px 20px; text-align: center; color: var(--muted); }
.empty .serif { font-size: 22px; color: var(--ink); display: block; margin-bottom: 4px; }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill.nodot::before { display: none; }
.st-preventivo, .st-approvato { background: var(--info-soft); color: var(--info); }
.st-confermata, .st-confermato, .st-ok { background: var(--ok-soft); color: var(--ok); }
.st-conclusa { background: var(--line-2); color: var(--ink-2); }
.st-persa, .st-cancellata, .st-cancellato, .st-bad { background: var(--bad-soft); color: var(--bad); }
.st-proposto, .st-warn { background: var(--warn-soft); color: var(--warn); }
.st-richiesto { background: var(--gold-soft); color: #8A6D3B; }
[data-theme="dark"] .st-richiesto { color: var(--gold); }
.demo-tag { font: 600 9.5px/1 var(--sans); letter-spacing: .12em; color: var(--gold); border: 1px solid color-mix(in srgb, var(--gold) 50%, transparent); padding: 3px 5px; border-radius: 4px; vertical-align: middle; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------- reservation detail ---------- */
.res-hero { padding: 24px 26px; display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: start; }
.res-hero h1 { font-family: var(--serif); font-size: 34px; line-height: 1.1; font-weight: 600; }
.res-hero .meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--ink-2); margin-top: 10px; }
.res-hero .meta span { display: inline-flex; align-items: center; gap: 6px; }
.res-hero .meta svg { width: 15px; height: 15px; color: var(--gold); }
.money-panel { display: grid; grid-template-columns: repeat(3, auto); gap: 4px 26px; text-align: right; }
.money-panel .l { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.money-panel .v { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.money-panel .v.red { color: var(--red); } .money-panel .v.ok { color: var(--ok); }
.stepper { display: flex; padding: 0 26px 22px; gap: 0; overflow-x: auto; }
.step { flex: 1; min-width: 92px; position: relative; padding-top: 22px; font-size: 12px; color: var(--muted); font-weight: 500; }
.step::before { content: ''; position: absolute; top: 7px; left: 0; right: 0; height: 2px; background: var(--line); }
.step::after { content: ''; position: absolute; top: 1px; left: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); }
.step.done { color: var(--ink); } .step.done::before { background: var(--red); } .step.done::after { background: var(--red); border-color: var(--red); }
.step.cur::after { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.hint-bar { margin: 0 26px 22px; padding: 11px 14px; border-radius: 10px; background: var(--gold-soft); color: var(--ink-2); display: flex; gap: 10px; align-items: center; font-size: 13.5px; }
.hint-bar svg { width: 16px; height: 16px; color: var(--gold); flex: none; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 22px 0 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; gap: 7px; align-items: center; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--red); }
.tabs a .n { font-size: 11px; background: var(--line-2); border-radius: 10px; padding: 1px 7px; color: var(--ink-2); }

.timeline { position: relative; }
.tl-day { display: grid; grid-template-columns: 92px 1fr; gap: 18px; padding: 4px 0 18px; }
.tl-date { text-align: right; padding-top: 6px; }
.tl-date .d { font-size: 26px; font-weight: 600; line-height: 1; letter-spacing: -.03em; }
.tl-date .m { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tl-date .dn { font-size: 11px; color: var(--gold); font-weight: 600; margin-top: 4px; letter-spacing: .06em; }
.it-sel input { width: 15px; height: 15px; accent-color: var(--red); }
.tl-items { display: grid; gap: 8px; border-left: 2px solid var(--line); padding-left: 18px; position: relative; }
.tl-items::before { content: ''; position: absolute; left: -6px; top: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--red); }
.it { display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); transition: border-color .15s, box-shadow .15s; cursor: pointer; }
.it:hover { border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); box-shadow: var(--shadow); }
.it.cancel { opacity: .55; } .it.cancel .it-title { text-decoration: line-through; }
.it-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--line-2); color: var(--ink-2); }
.it-ic svg { width: 18px; height: 18px; }
.it-ic.hotel, .it-ic.lodge { background: var(--gold-soft); color: #8A6D3B; }
.it-ic.transfer_in, .it-ic.transfer_out, .it-ic.transfer { background: var(--info-soft); color: var(--info); }
.it-ic.escursione { background: var(--ok-soft); color: var(--ok); }
.it-ic.taxa { background: var(--red-soft); color: var(--red); }
.it-title { font-weight: 600; }
.it-sub { font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.it-right { display: flex; gap: 14px; align-items: center; justify-content: flex-end; }
.it-right .money { font-size: 13.5px; color: var(--ink-2); min-width: 72px; text-align: right; font-weight: 500; }
.it-right .pill { min-width: 104px; justify-content: center; }
.it-sel { margin-right: -4px; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.list { display: grid; }
.li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.li:last-child { border-bottom: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .t1 { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .t2 { font-size: 12.5px; color: var(--muted); }
.date-chip { width: 46px; flex: none; text-align: center; border: 1px solid var(--line); border-radius: 10px; padding: 5px 0 4px; background: var(--surface-2); }
.date-chip b { display: block; font-size: 18px; font-weight: 600; line-height: 1; letter-spacing: -.02em; }
.date-chip span { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

/* ---------- charts ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { font-size: 11px; fill: var(--muted); font-family: var(--sans); }
.chart .gridl { stroke: var(--grid); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover { fill: rgba(127,127,127,.06); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--ink); color: var(--surface); padding: 9px 12px; border-radius: 10px; font-size: 12.5px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; max-width: 260px; }
.tip.on { opacity: 1; transform: none; }
.tip b { display: block; margin-bottom: 3px; }
.tip .r { display: flex; gap: 14px; justify-content: space-between; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.hbar { display: grid; grid-template-columns: 150px 1fr auto; gap: 8px 12px; align-items: center; font-size: 13px; }
.hbar .bar { height: 10px; background: var(--line-2); border-radius: 5px; position: relative; overflow: hidden; }
.hbar .bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; }
.hbar .bar i.a { background: color-mix(in srgb, var(--chart-a) 35%, transparent); }
.hbar .bar i.b { background: var(--chart-b); }

/* ---------- modal / toast / palette ---------- */
.overlay { position: fixed; inset: 0; background: rgba(18,16,14,.42); backdrop-filter: blur(3px); z-index: 60; display: grid; place-items: start center; padding: 6vh 16px; overflow-y: auto; animation: fade .15s; }
.modal { width: min(720px, 100%); background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); animation: pop .18s cubic-bezier(.2,.8,.2,1); border: 1px solid var(--line); }
.modal.wide { width: min(980px, 100%); } .modal.narrow { width: min(460px, 100%); }
.modal-h { padding: 22px 24px 6px; display: flex; align-items: center; gap: 12px; }
.modal-h h2 { font-family: var(--serif); font-size: 26px; font-weight: 600; }
.modal-h .x { margin-left: auto; }
.modal-b { padding: 14px 24px 8px; }
.modal-f { padding: 16px 24px 22px; display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.modal-f .left { margin-right: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 120; display: grid; gap: 8px; }
.toast { background: var(--ink); color: var(--surface); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 500; animation: pop .2s; max-width: 380px; display: flex; gap: 10px; align-items: center; }
.toast.err { background: var(--bad); color: #fff; }
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.toast.err::before { background: #fff; }
.palette { width: min(640px, 100%); background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid var(--line); animation: pop .15s; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 18px 20px; font-size: 16px; outline: none; background: transparent; }
.palette .res { max-height: 56vh; overflow-y: auto; padding: 6px; }
.palette .r { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; cursor: pointer; text-decoration: none; }
.palette .r.on, .palette .r:hover { background: var(--line-2); }
.palette .r .ty { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); width: 84px; flex: none; font-weight: 600; }
.palette .r .t2 { font-size: 12.5px; color: var(--muted); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { position: relative; overflow: hidden; background: #1F2328; color: #F4F1EC; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art::before { content: ''; position: absolute; inset: 0; background:
  radial-gradient(900px 500px at 110% 110%, rgba(208,32,46,.45), transparent 60%),
  radial-gradient(600px 400px at -10% -10%, rgba(184,155,94,.22), transparent 60%); }
.auth-art .waves { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; opacity: .9; }
.auth-art > * { position: relative; }
.auth-art h2 { font-family: var(--serif); font-size: 52px; font-weight: 500; line-height: 1.02; max-width: 520px; letter-spacing: -.01em; }
.auth-art h2 em { color: var(--gold); font-style: italic; }
.auth-art p { color: #B9B3A9; max-width: 460px; }
.auth-form { display: grid; place-items: center; padding: 40px; background: var(--surface); }
.auth-form form { width: min(380px, 100%); display: grid; gap: 16px; }
.auth-form h1 { font-family: var(--serif); font-size: 36px; font-weight: 600; }

/* ---------- misc ---------- */
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.gap-s { gap: 6px; }
.right { margin-left: auto; }
.mt { margin-top: 18px; } .mb { margin-bottom: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 8px; background: var(--line-2); font-size: 12.5px; }
.callout { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line); color: var(--ink-2); }
pre.block { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; white-space: pre-wrap; font: 13px/1.55 var(--sans); margin: 0; max-height: 360px; overflow: auto; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12.5px; }
.todo-sec .card-h h3 { display: flex; align-items: center; gap: 10px; }
.count { font-size: 20px; font-weight: 600; color: var(--red); letter-spacing: -.02em; font-variant-numeric: tabular-nums; min-width: 22px; text-align: right; }
.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, var(--line-2), var(--surface-2), var(--line-2)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.fade-in { animation: fade .25s; }
.link { color: var(--red); text-decoration: none; font-weight: 500; cursor: pointer; }
.link:hover { text-decoration: underline; }
.mobile-nav { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) { .g-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-2, .g-3 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-100%); transition: transform .22s; box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .menu-btn { display: grid; }
  .top { padding: 12px 16px; }
  .content { padding: 4px 16px 90px; }
  .page-head h1 { font-size: 30px; }
  .g-2e, .g-kpi { grid-template-columns: 1fr 1fr; }
  .res-hero { grid-template-columns: 1fr; }
  .money-panel { text-align: left; grid-template-columns: repeat(3, 1fr); }
  .tl-day { grid-template-columns: 58px 1fr; gap: 10px; }
  .tl-date .d { font-size: 24px; }
  .it { grid-template-columns: 32px 1fr; } .it-right { grid-column: 2; justify-items: start; text-align: left; display: flex; gap: 8px; }
  .form-grid > * { grid-column: span 12 !important; }
  .auth { grid-template-columns: 1fr; } .auth-art { display: none; }
  .hbar { grid-template-columns: 100px 1fr auto; }
  .search-trigger kbd { display: none; }
  .search-trigger { min-width: 0; flex: 1 1 0; }
  html, body { overflow-x: hidden; }
  .top .btn.primary span { display: none; }
  .top .btn.primary { padding: 0 11px; }
  .page-head .eyebrow { font-size: 10px; }
  .money-panel .v { font-size: 20px; }
  .money-panel { gap: 2px 14px; }
  .res-hero { padding: 20px; }
  .hint-bar { margin: 0 20px 20px; }
  .mobile-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .mobile-nav a { display: grid; justify-items: center; gap: 2px; font-size: 10.5px; color: var(--muted); text-decoration: none; padding: 4px 8px; }
  .mobile-nav a svg { width: 21px; height: 21px; }
  .mobile-nav a.active { color: var(--red); }
  table.t.responsive thead { display: none; }
  table.t.responsive tr { display: grid; grid-template-columns: 1fr auto; padding: 10px 4px; border-bottom: 1px solid var(--line-2); }
  table.t.responsive td { border: 0; padding: 3px 10px; }
  table.t.responsive td.hide-m { display: none; }
}
@media (max-width: 520px) { .g-kpi { grid-template-columns: 1fr; } .kpi .val { font-size: 28px; } }
@media print { .side, .top, .mobile-nav, .no-print { display: none !important; } .shell { display: block; } }
.modal-b:last-child { padding-bottom: 24px; }
