@import url("/static/fonts/fonts.css");

/* ================================================================ тема: темна, бронза */
:root {
  --bg: #121418;
  --bg-2: #171a1f;
  --surface: #1b1e24;
  --surface-2: #22262d;
  --line: #2a2f37;
  --line-2: #363c46;
  --ink: #ece8e1;
  --ink-2: #c3bdb3;
  --muted: #8a847b;
  --gold: #c29a6c;
  --gold-2: #dcb88d;
  --gold-3: #8a6a44;
  --gold-soft: rgba(194, 154, 108, .13);
  --cream: #f3efe7;
  --ok: #8fca96;
  --ok-soft: rgba(143, 202, 150, .12);
  --warn: #e6b45c;
  --warn-soft: rgba(230, 180, 92, .13);
  --err: #e5826f;
  --err-soft: rgba(229, 130, 111, .12);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 16px;
  --r-s: 11px;
  --side-w: 248px;
  --top-h: 68px;
  --gold-grad: linear-gradient(135deg, rgba(194, 154, 108, .32) 0%, rgba(194, 154, 108, .1) 45%, rgba(27, 30, 36, .9) 100%);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; overflow-x: hidden;
  font: 14px/1.55 var(--sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold-2); text-decoration: none; transition: color .15s; }
a:hover { color: var(--cream); }
::selection { background: var(--gold); color: var(--bg); }

main { max-width: 1320px; margin: 0 auto; padding: 28px 28px 64px; }
body.has-shell main { margin-left: var(--side-w); max-width: none; padding: calc(var(--top-h) + 24px) 32px 64px; }
body.has-shell main > * { max-width: 1280px; }

/* ================================================================ типографіка */
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; color: var(--cream); }
h1 { font-size: clamp(1.7rem, 2.8vw, 2.3rem); line-height: 1.15; margin: .1rem 0 1.3rem; }
h2 { font-size: 1.3rem; margin: 2.2rem 0 .9rem; }
h3 { font-size: 1.05rem; margin: 0; }
h1 em, h2 em, h3 em, .accent { font-style: italic; color: var(--gold); font-weight: 300; }
h1 > .btn, h1 > .badge, h2 > .btn, h2 > .badge, h2 > form { margin-left: .8rem; vertical-align: middle; }
.eyebrow {
  font: 500 .7rem/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--gold);
  margin-bottom: .7rem; display: block;
}
.rule { width: 120px; height: 1px; background: linear-gradient(90deg, var(--gold), transparent); border: 0; margin: 0 0 1.4rem; }
p { color: var(--ink-2); }
.muted { color: var(--muted); }
.neg { color: var(--err); }
.nowrap { white-space: nowrap; }
.ic { width: 20px; height: 20px; flex: none; }
.ic-xs { width: 13px; height: 13px; flex: none; }

/* ================================================================ бічне меню */
.side {
  position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--side-w);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #16191e 0%, #121418 100%);
  border-right: 1px solid var(--line);
  padding: 18px 14px 14px;
}
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--cream); }
.brand svg { width: 36px; height: 36px; flex: none; }
.brand-name { font: 300 1.3rem/1 var(--serif); white-space: nowrap; }
.brand-name em { color: var(--gold); font-style: italic; }
.side-close { display: none; color: var(--ink-2); cursor: pointer; }
.side-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; }
.side-link {
  display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%;
  padding: 10px 12px; border-radius: var(--r-s); border: 1px solid transparent;
  color: var(--ink-2); font: 500 .86rem/1.2 var(--sans); letter-spacing: 0; text-transform: none;
  background: none; cursor: pointer; text-align: left;
}
.side-link .ic { width: 18px; height: 18px; color: var(--muted); transition: color .15s; }
.side-link:hover { background: var(--surface); color: var(--cream); border-color: transparent; }
.side-link:hover .ic { color: var(--gold-2); }
.side-link.on {
  background: linear-gradient(135deg, rgba(194, 154, 108, .28), rgba(194, 154, 108, .08));
  border-color: rgba(194, 154, 108, .35); color: var(--cream);
}
.side-link.on .ic { color: var(--gold-2); }
.side-sep { margin: 18px 12px 6px; font: 500 .64rem/1 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.side-foot { display: grid; gap: 10px; padding-top: 12px; }
.promo {
  display: grid; gap: 6px; padding: 14px; border-radius: var(--r);
  background: var(--gold-grad); border: 1px solid rgba(194, 154, 108, .3);
}
.promo-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: rgba(0, 0, 0, .25); color: var(--gold-2); }
.promo b { color: var(--cream); font-size: .86rem; }
.promo span { color: var(--ink-2); font-size: .74rem; line-height: 1.4; }
.promo .btn { margin-top: 4px; }
.side-link.logout { color: var(--muted); }

/* ================================================================ верхня панель */
.topbar {
  position: fixed; top: 0; left: var(--side-w); right: 0; z-index: 30; height: var(--top-h);
  display: flex; align-items: center; gap: 14px; padding: 0 32px;
  background: rgba(18, 20, 24, .86); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-spacer { flex: 1; }
.brand-m { display: none; }
.today {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: var(--r-s); color: var(--ink-2); font-size: .8rem;
}
.today .ic { width: 16px; height: 16px; color: var(--gold); }
.icon-btn {
  position: relative; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line); color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { border-color: var(--gold); color: var(--gold-2); }
.icon-btn b {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; display: grid; place-items: center;
  background: var(--gold); color: #16181c; font: 700 .64rem/1 var(--sans); border-radius: 9px; padding: 0 4px;
}
.menu-btn { display: none; }
.me { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--gold-2), var(--gold-3)); color: #16181c;
  font: 600 .8rem/1 var(--sans); letter-spacing: .04em;
}
.me-text { display: grid; line-height: 1.25; }
.me-text b { font-size: .84rem; color: var(--cream); font-weight: 600; }
.me-text small { font-size: .7rem; color: var(--muted); max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-toggle { display: none; }
.scrim { display: none; }
.tabbar { display: none; }

/* ================================================================ кнопки */
button, .btn {
  font: 600 .74rem/1 var(--sans); letter-spacing: .04em;
  padding: 11px 18px; border: 1px solid var(--line-2); border-radius: var(--r-s);
  background: var(--surface); color: var(--ink);
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
button:hover, .btn:hover { border-color: var(--gold); color: var(--gold-2); }
button.primary, .btn.primary { background: linear-gradient(135deg, var(--gold-2), var(--gold)); border-color: var(--gold); color: #16181c; }
button.primary:hover, .btn.primary:hover { filter: brightness(1.08); color: #16181c; }
button.cream, .btn.cream { background: var(--cream); border-color: var(--cream); color: #16181c; padding: 16px 32px; }
button.danger { color: var(--err); border-color: rgba(229, 130, 111, .45); background: transparent; }
button.danger:hover { background: var(--err-soft); color: var(--err); border-color: var(--err); }
button.small, .btn.small { padding: 7px 12px; font-size: .7rem; border-radius: 9px; }
button.link { background: none; border: none; padding: 0; color: var(--ink-2); }

/* ================================================================ форми */
input, select, textarea {
  font: 400 .88rem/1.3 var(--sans); color: var(--ink);
  padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-s);
  max-width: 100%; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
input[type="checkbox"] { accent-color: var(--gold); width: 16px; height: 16px; padding: 0; }
input[type="date"], select { color-scheme: dark; }
input[type="file"] { padding: 8px; }
input[type="file"]::file-selector-button {
  font: 600 .7rem/1 var(--sans); background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--line-2); padding: 8px 12px; margin-right: 10px; border-radius: 8px; cursor: pointer;
}
textarea { width: 100%; min-height: 80px; }
form.inline { display: inline; }
.row, .filters, .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: .8rem 0; }
.actions { margin: 1.4rem 0; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 24px; display: grid; gap: 16px; max-width: 680px;
}
.card label { display: grid; gap: 6px; font: 500 .7rem/1.2 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.card label input, .card label select, .card label textarea { text-transform: none; letter-spacing: 0; }
.card input:not([type="checkbox"]):not([type="file"]), .card select, .card textarea { width: 100%; min-width: 0; }
.card table { table-layout: fixed; }
.card table th, .card table td { padding: 6px 8px 6px 0; border-bottom: 0; background: none; }
.card > button, .card > .row > button { justify-self: start; }
label.check, .card label.check {
  display: flex; gap: 10px; align-items: center;
  font: 400 .88rem/1.3 var(--sans); letter-spacing: 0; text-transform: none; color: var(--ink-2);
}
fieldset { border: 1px solid var(--line); border-radius: var(--r-s); display: grid; gap: 8px; padding: 14px 16px; }
legend { font: 500 .68rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); padding: 0 6px; }
h2 input[type="date"] { font-size: .85rem; padding: 6px 10px; margin-left: .4rem; }

/* ================================================================ таблиці */
.wide-table { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font: 600 .66rem/1.2 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); background: var(--bg-2); }
.wide-table tr:hover td { background: rgba(255, 255, 255, .02); }
td.r, th.r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.c, th.c { text-align: center; white-space: nowrap; }
tr.low td { background: var(--warn-soft); }
tr.neg td, td.neg { color: var(--err); }
tr.unread td { color: var(--cream); font-weight: 500; }
tr.unread td:first-child { box-shadow: inset 2px 0 0 var(--gold); }
td.json { font: .75rem/1.4 ui-monospace, "SF Mono", Menlo, monospace; color: var(--ink-2); max-width: 380px; word-break: break-word; }
.matrix th { white-space: normal; min-width: 90px; }
.matrix td:first-child { color: var(--cream); white-space: nowrap; }
.matrix select { padding: 4px 6px; font-size: .8rem; }
.tiny { font-size: .66rem; display: flex; gap: 4px; align-items: center; justify-content: center; color: var(--muted); margin-top: 4px; }

/* ================================================================ повідомлення і мітки */
.flash { padding: 13px 16px; margin: 0 0 1.4rem; border-radius: var(--r-s); border: 1px solid; font-size: .88rem; }
.flash.ok { background: var(--ok-soft); color: var(--ok); border-color: rgba(143, 202, 150, .3); }
.flash.err { background: var(--err-soft); color: var(--err); border-color: rgba(229, 130, 111, .3); }
.flash a { color: inherit; text-decoration: underline; }
.badge, .tag, .chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px;
  font: 600 .64rem/1.2 var(--sans); letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid var(--line-2); color: var(--ink-2); vertical-align: middle; white-space: nowrap;
}
.badge.ok, .badge.posted, .tag-post, .tag-create { color: var(--ok); border-color: rgba(143, 202, 150, .35); background: var(--ok-soft); }
.badge.err, .tag-unpost, .tag-cancel { color: var(--err); border-color: rgba(229, 130, 111, .35); background: var(--err-soft); }
.badge.warn, .badge.draft, .tag-status, .tag-update { color: var(--warn); border-color: rgba(230, 180, 92, .35); background: var(--warn-soft); }
.tag-form, .chip { color: var(--gold-2); border-color: rgba(194, 154, 108, .4); background: var(--gold-soft); }
.badge.cancelled { color: var(--muted); }

/* ================================================================ дашборд */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head .sub { margin: 4px 0 0; font-size: .88rem; color: var(--muted); }
.wave { font-size: .8em; }
.period {
  display: inline-flex; align-items: center; gap: 8px; padding: 0 0 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); color: var(--gold);
}
.period select { border: 0; background: transparent; padding: 10px 12px 10px 0; font-size: .8rem; box-shadow: none; }
.period button[hidden] { display: none; }

.hero-card {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 22px;
  padding: 26px 28px; margin-bottom: 18px; min-height: 150px;
  border-radius: 20px; border: 1px solid rgba(194, 154, 108, .4); color: var(--ink);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(220, 184, 141, .35), transparent 55%),
    linear-gradient(110deg, #3b2f22 0%, #241f1b 45%, #1b1e24 100%);
}
.hero-card:hover { color: var(--ink); border-color: var(--gold); }
.hero-ic {
  width: 78px; height: 78px; border-radius: 18px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--gold-2), var(--gold-3)); color: #1b1714;
  box-shadow: 0 10px 30px rgba(194, 154, 108, .25), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.hero-ic .ic { width: 36px; height: 36px; stroke-width: 1.4; }
.hero-txt { display: grid; gap: 6px; position: relative; z-index: 1; }
.hero-label { font-size: .82rem; color: var(--ink-2); }
.hero-val { font: 400 clamp(2rem, 4vw, 2.8rem)/1 var(--serif); color: var(--cream); }
.hero-val small { font: 500 .9rem var(--sans); color: var(--ink-2); }
.hero-spark { position: absolute; right: 0; bottom: 0; width: 55%; height: 75%; }
.hero-card .chip { position: absolute; top: 18px; right: 20px; background: rgba(0, 0, 0, .3); }

.delta { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; color: var(--muted); }
.delta.up { color: var(--ok); }
.delta.down { color: var(--err); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  display: grid; gap: 4px; padding: 18px; border-radius: var(--r); color: var(--ink); align-content: start;
  background: var(--surface); border: 1px solid var(--line); transition: border-color .2s, transform .2s;
}
.kpi:hover { border-color: rgba(194, 154, 108, .5); color: var(--ink); transform: translateY(-2px); }
.kpi-ic {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 8px;
  color: var(--gold-2); background: var(--gold-soft);
}
.kpi b { font: 400 2rem/1.05 var(--serif); color: var(--cream); }
.kpi-label { font-size: .8rem; color: var(--ink-2); }
.kpi.warn .kpi-ic { color: var(--warn); background: var(--warn-soft); }
.kpi.bad .kpi-ic { color: var(--err); background: var(--err-soft); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }

.chart { display: grid; grid-template-columns: auto 1fr; grid-template-rows: 1fr auto; gap: 6px 10px; }
.chart-y { display: flex; flex-direction: column; justify-content: space-between; font-size: .66rem; color: var(--muted); text-align: right; height: 180px; }
.chart-plot { position: relative; height: 180px; }
.chart-plot svg { width: 100%; height: 100%; display: block; }
.chart-dot {
  position: absolute; left: var(--x); top: var(--y); width: 10px; height: 10px; margin: -5px 0 0 -5px;
  border-radius: 50%; background: var(--cream); box-shadow: 0 0 0 4px rgba(194, 154, 108, .35);
}
.chart-dot i {
  position: absolute; right: 10px; top: 14px; white-space: nowrap; font: 600 .7rem/1 var(--sans); font-style: normal;
  padding: 6px 8px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--cream);
}
.chart-x { grid-column: 2; display: flex; justify-content: space-between; font-size: .66rem; color: var(--muted); }

.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.donut { position: relative; width: 170px; height: 170px; flex: none; }
.donut svg { width: 100%; height: 100%; }
.donut-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-c b { font: 400 1.9rem/1 var(--serif); color: var(--cream); }
.donut-c span { font-size: .72rem; color: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; flex: 1; min-width: 160px; }
.legend li { display: flex; align-items: center; gap: 10px; font-size: .82rem; color: var(--ink-2); }
.legend i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.legend span { flex: 1; }
.legend b { color: var(--cream); font-weight: 600; }

.feature { display: flex; gap: 18px; align-items: stretch; }
.feature-art {
  width: 150px; flex: none; border-radius: 14px; display: grid; place-items: center; gap: 8px; align-content: center;
  background: radial-gradient(100% 100% at 30% 20%, rgba(220, 184, 141, .4), transparent 60%), #2a241e;
  border: 1px solid rgba(194, 154, 108, .3); color: var(--gold-2); min-height: 150px;
}
.feature-art .ic { width: 44px; height: 44px; stroke-width: 1.2; }
.feature-art span { font: 600 .72rem/1 var(--sans); letter-spacing: .08em; }
.feature-txt { display: grid; gap: 6px; align-content: start; }
.feature-txt b { color: var(--cream); font: 400 1.15rem/1.25 var(--serif); }
.feature-txt p { margin: 4px 0 6px; font-size: .84rem; }
.feature-txt .btn { justify-self: start; }

.activity { list-style: none; margin: 0; padding: 0; display: grid; }
.activity li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.activity li:last-child { border-bottom: 0; }
.act-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--gold-2); }
.act-ic .ic { width: 17px; height: 17px; }
.activity li > div { flex: 1; min-width: 0; display: grid; }
.activity b { font-weight: 500; font-size: .84rem; color: var(--cream); overflow: hidden; text-overflow: ellipsis; }
.activity b a { color: var(--cream); }
.activity small { font-size: .72rem; color: var(--muted); }

.banner {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 18px;
  padding: 20px 24px; border-radius: 20px; color: var(--ink);
  background: linear-gradient(100deg, #2a2219 0%, #1b1e24 70%); border: 1px solid rgba(194, 154, 108, .35);
}
.banner:hover { color: var(--ink); border-color: var(--gold); }
.banner-ic { width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; flex: none; background: linear-gradient(135deg, var(--gold-2), var(--gold-3)); color: #1b1714; }
.banner-ic .ic { width: 26px; height: 26px; }
.banner > div { display: grid; gap: 2px; position: relative; z-index: 1; }
.banner b { font: 400 1.15rem/1.2 var(--serif); color: var(--cream); }
.banner span { font-size: .84rem; color: var(--ink-2); }
.banner-bars { position: absolute; right: 24px; bottom: 0; display: flex; align-items: flex-end; gap: 8px; height: 100%; opacity: .9; }
.banner-bars i { width: 18px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--gold-2), rgba(194, 154, 108, .15)); }
.banner-bars i:nth-child(1) { height: 25%; } .banner-bars i:nth-child(2) { height: 40%; } .banner-bars i:nth-child(3) { height: 55%; }
.banner-bars i:nth-child(4) { height: 72%; } .banner-bars i:nth-child(5) { height: 90%; }

/* плитки й списки на інших сторінках */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin: 1rem 0; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; color: var(--ink); font-size: .82rem; }
.tile.stat b { display: block; margin-bottom: 6px; font: 400 2rem/1 var(--serif); color: var(--cream); }
.notes { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.notes li { padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.notes li .muted { font-size: .78rem; margin-left: 8px; }
main ul:not(.notes):not(.activity):not(.legend) { padding-left: 18px; color: var(--ink-2); }
main ul:not(.notes):not(.activity):not(.legend) li { margin: 4px 0; }
main ul:not(.notes):not(.activity):not(.legend) li::marker { color: var(--gold); }

/* ================================================================ вхід */
.login-page main { max-width: none; padding: 0; }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }
.login-visual {
  position: relative; overflow: hidden;
  background:
    radial-gradient(90% 80% at 20% 15%, rgba(226, 150, 70, .55), transparent 60%),
    radial-gradient(70% 60% at 70% 80%, rgba(120, 70, 40, .5), transparent 70%),
    linear-gradient(160deg, #3a2a1e 0%, #1c1a1b 70%);
  border-bottom-right-radius: 100% 72%;
  display: flex; flex-direction: column; justify-content: flex-end; padding: 56px;
}
.login-visual::before { content: ""; position: absolute; inset: 0; background: repeating-radial-gradient(circle at 18% 120%, rgba(255, 255, 255, .035) 0 1px, transparent 1px 22px); }
.login-visual .quote { position: relative; font: 300 clamp(2rem, 3.6vw, 3.2rem)/1.1 var(--serif); color: var(--cream); max-width: 460px; }
.login-visual .quote em { color: var(--gold-2); font-style: italic; }
.login-side { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 24px; gap: 32px; }
.login-logo { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.login-logo svg { width: 88px; height: 88px; }
.login-logo .brand-name { font-size: 2.2rem; }
.login { width: 100%; max-width: 380px; background: transparent; border: 0; padding: 0; }
.login h1 { font-size: 1.6rem; margin: 0; text-align: center; }
.card.login > button { justify-self: stretch; padding: 16px; }

/* ================================================================ календар */
.calendar { max-width: 640px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; border-collapse: separate; border-spacing: 0; }
.calendar th { text-align: center; }
.calendar td { height: 60px; width: 14.28%; border-right: 1px solid var(--line); font-size: .78rem; }
.calendar td:last-child { border-right: 0; }
.calendar td span { display: block; color: var(--muted); margin-bottom: 4px; }
.calendar td.formed { background: var(--gold-soft); box-shadow: inset 0 -2px 0 var(--gold); }
.calendar td.formed span { color: var(--gold-2); }

/* ================================================================ друк */
.signs { display: flex; justify-content: space-between; gap: 24px; margin-top: 56px; flex-wrap: wrap; }
body.print { background: #fff; color: #111; font-size: 13px; }
body.print h1, body.print h2 { color: #111; }
body.print h1 em { color: #8a6a44; }
body.print p { color: #222; }
body.print th { background: #f3f0ea; color: #333; }
body.print td { color: #111; }
table.bordered th, table.bordered td { border: 1px solid #bbb; }
body:not(.print) table.bordered th, body:not(.print) table.bordered td { border-color: var(--line); }
@media print {
  .side, .topbar, .tabbar, .scrim, .flash, .actions, form { display: none !important; }
  body { background: #fff !important; color: #111 !important; }
  main { max-width: none !important; margin: 0 !important; padding: 0 !important; }
  a { color: inherit; }
}

/* ================================================================ планшет */
@media (max-width: 1180px) {
  .grid-2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ================================================================ телефон: висувне меню, нижні вкладки, таблиці-картки */
@media (max-width: 900px) {
  :root { --top-h: 60px; }
  body.has-shell main { margin-left: 0; padding: calc(var(--top-h) + 18px) 16px calc(84px + env(safe-area-inset-bottom)); }
  .side {
    transform: translateX(-105%); transition: transform .25s ease; width: min(300px, 86vw);
    box-shadow: 20px 0 60px rgba(0, 0, 0, .5);
  }
  .side-close { display: grid; }
  .drawer-toggle:checked ~ .side { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .55); backdrop-filter: blur(2px); }
  .drawer-toggle:checked ~ .scrim { display: block; }
  .topbar { left: 0; padding: 0 14px; gap: 10px; }
  .menu-btn { display: grid; }
  .brand-m { display: flex; }
  .brand-m svg { width: 32px; height: 32px; }
  .avatar { width: 36px; height: 36px; }
  .icon-btn { width: 38px; height: 38px; }
  .hide-m { display: none !important; }

  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex; justify-content: space-around;
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    background: rgba(18, 20, 24, .94); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  }
  .tabbar a, .tabbar label {
    flex: 1; display: grid; justify-items: center; gap: 4px; padding: 4px 0; cursor: pointer;
    color: var(--muted); font: 500 .64rem/1 var(--sans);
  }
  .tabbar .ic { width: 22px; height: 22px; }
  .tabbar a.on { color: var(--gold-2); }
  .tabbar a.on .ic { filter: drop-shadow(0 0 6px rgba(194, 154, 108, .6)); }

  h1 { font-size: 1.65rem; }
  .page-head { margin-bottom: 14px; }
  .period { width: 100%; }
  .period select { flex: 1; }
  .hero-card { padding: 20px; gap: 16px; min-height: 0; }
  .hero-ic { width: 58px; height: 58px; border-radius: 14px; }
  .hero-ic .ic { width: 28px; height: 28px; }
  .hero-spark { width: 70%; height: 55%; opacity: .6; }
  .hero-card .chip { top: 14px; right: 14px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi b { font-size: 1.6rem; }
  .kpi-ic { width: 34px; height: 34px; margin-bottom: 4px; }
  .panel { padding: 16px; }
  .donut { width: 140px; height: 140px; margin: 0 auto; }
  .donut-wrap { justify-content: center; }
  .feature-art { width: 104px; min-height: 120px; }
  .banner-bars { opacity: .35; }

  .row > *, .filters > * { flex: 1 1 150px; min-width: 0; }
  .row > form.inline, .actions > form.inline { flex: 0 0 auto; }
  .card { padding: 18px; }

  /* таблиці → картки (підписи колонок ставить app.js) */
  .wide-table:has(table.stack) { background: none; border: 0; border-radius: 0; overflow: visible; }
  table.stack, table.stack tbody { display: block; }
  table.stack tr.head { display: none; }
  table.stack tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px;
    padding: 14px 16px; margin-bottom: 10px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  }
  table.stack td { display: grid; justify-items: start; gap: 2px; padding: 0; border: 0; text-align: left; white-space: normal; background: none !important; }
  table.stack td::before { content: attr(data-label); font: 600 .6rem/1.2 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
  table.stack td:first-child { grid-column: 1 / -1; font-size: .95rem; }
  table.stack td:first-child::before { display: none; }
  table.stack td.r { text-align: left; }
  table.stack td.empty, table.stack td[data-label=""]::before { display: none; }
  table.stack td.hide-m { display: none !important; }
  table.stack tr.low { border-color: rgba(230, 180, 92, .5); }
  table.stack td[colspan] { grid-column: 1 / -1; }
  table.stack td[colspan]::before { display: none; }

  .login-wrap { grid-template-columns: 1fr; }
  .login-visual { min-height: 32vh; padding: 28px 22px; border-bottom-right-radius: 100% 40%; }
}

/* ================================================================ перемикач мови */
.lang-switch, .login-lang {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--line);
}
.lang-switch a, .login-lang a {
  min-width: 38px; padding: 7px 10px; border-radius: 999px; text-align: center;
  font: 600 .7rem/1 var(--sans); letter-spacing: .08em; color: var(--muted);
}
.lang-switch a:hover, .login-lang a:hover { color: var(--cream); }
.lang-switch a.on, .login-lang a.on { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #16181c; }
.side-lang { display: none; }
.lang-switch.wide { display: flex; }
.lang-switch.wide a { flex: 1; }
.login-side { position: relative; }
.login-lang { position: absolute; top: 24px; right: 24px; }
@media (max-width: 900px) {
  .topbar .lang-switch { display: none; }
  .side-lang { display: block; }
  .login-lang { top: 16px; right: 16px; }
}
.cf-turnstile { min-height: 65px; margin: 4px 0 12px; }
