/* ImperialHost.cc: client area + admin. Builds on the tokens in style.css */

.app-body { min-height: 100vh; }
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--text); }
.boot svg { width: 36px; height: 64px; animation: bootPulse 1.2s ease-in-out infinite; }
@keyframes bootPulse { 50% { opacity: .35; transform: scale(.94); } }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.block { display: block; }
.center { text-align: center; }
.pad { padding: 8px 0; }
.mono, code { font-family: var(--mono); font-size: .92em; }
.pos { color: var(--ok); }
.neg { color: var(--text); }
.link { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.link:hover { color: var(--text); }
.br { font-family: "DejaVu Sans Mono", "Segoe UI Symbol", "Apple Braille", var(--mono); display: inline-block; letter-spacing: 0; }

/* ---------- buttons (extra variants) ---------- */
.btn { gap: 8px; }
.btn .ico { width: 18px; height: 18px; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn--block { width: 100%; }
.btn--danger { background: #d70015; color: #fff; }
.btn--danger-ghost { border: 1px solid rgba(215, 0, 21, .35); color: #d70015; }
.btn--danger-ghost:hover { background: rgba(215, 0, 21, .08); }
:root[data-theme="dark"] .btn--danger-ghost { color: #ff6961; border-color: rgba(255, 105, 97, .4); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn--danger-ghost { color: #ff6961; border-color: rgba(255, 105, 97, .4); } }
.btn--text { color: var(--text-2); min-height: 40px; }
.btn--text:hover { color: var(--text); }
.app-body .chip-btn {
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; min-height: 28px;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line); vertical-align: middle;
}
.app-body .chip-btn:hover { border-color: var(--line-2); }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.app-body .icon-btn svg { width: 19px; height: 19px; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(60% 50% at 50% 0%, var(--glow), transparent 70%), var(--bg); }
.auth-top { display: flex; align-items: center; justify-content: space-between; padding: 16px max(20px, env(safe-area-inset-left)); }
.auth-main { flex: 1; display: grid; place-items: center; padding: 16px 16px 64px; }
.auth-card {
  width: 100%; max-width: 420px; padding: 36px 32px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: authIn .8s var(--ease) both;
}
@keyframes authIn { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.auth-card > * { animation: enterUp .7s var(--ease) both; }
.auth-card > :nth-child(2) { animation-delay: .08s; } .auth-card > :nth-child(3) { animation-delay: .14s; }
.auth-card > :nth-child(4) { animation-delay: .2s; } .auth-card > :nth-child(5) { animation-delay: .26s; }
.auth-card h1 { font-size: 28px; letter-spacing: -.03em; margin-bottom: 8px; }
.auth-card > .muted { margin-bottom: 24px; }
.auth-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
.auth-head .fx-orb { margin-top: 6px; }
.auth-logo { width: 26px; height: 46px; color: var(--text); }
.check a { color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.auth-logo svg { width: 100%; height: 100%; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 20px; font-size: 14px; color: var(--text-2); }
.auth-links a { color: var(--text); font-weight: 600; }
.auth-links a:hover { text-decoration: underline; }

/* ---------- forms ---------- */
.form { display: grid; gap: 16px; }
.form--2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form--3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.form-h { font-size: 15px; margin-top: 8px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field small { font-size: 12.5px; color: var(--text-2); }
.field input, .field select, .field textarea, .search-inline input, .num-in {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 12px;
  background: var(--bg); color: var(--text); border: 1px solid var(--line-2);
  font: 16px/1.4 var(--font); transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; min-height: 110px; }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.field input:focus, .field select:focus, .field textarea:focus, .search-inline input:focus, .num-in:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 4px var(--glow); }
.field input:disabled { opacity: .6; }
.field--inline { grid-template-columns: auto auto; align-items: center; gap: 10px; }
.field--inline select { min-height: 36px; padding: 6px 34px 6px 12px; font-size: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--text); flex: none; }
.form-error { padding: 10px 14px; border-radius: 12px; font-size: 14px; background: rgba(255, 69, 58, .1); color: #d70015; border: 1px solid rgba(255, 69, 58, .25); }
:root[data-theme="dark"] .form-error { color: #ff6961; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .form-error { color: #ff6961; } }
.form-ok { padding: 10px 14px; border-radius: 12px; font-size: 14px; background: rgba(52, 199, 89, .12); color: var(--ok); }
.sep { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
  padding: 20px 14px; border-right: 1px solid var(--line); background: var(--bg-alt);
}
.side__brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -.02em; padding: 4px 10px 12px; }
.side__brand svg { width: 13px; height: 23px; flex: none; }
.side__brand em { font-style: normal; color: var(--text-2); font-weight: 500; }
.side__tag { font-style: normal; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; background: var(--btn-bg); color: var(--btn-fg); }
.side__bal { display: flex; justify-content: space-between; align-items: baseline; margin: 0 4px 8px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); transition: border-color .2s; }
.side__bal:hover { border-color: var(--line-2); }
.side__bal b { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }
.side__nav { display: grid; gap: 2px; position: relative; }
.side__link {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 10px;
  font-size: 14.5px; font-weight: 500; color: var(--text-2); text-align: left; transition: background-color .2s, color .2s;
}
.side__link:hover { background: var(--surface-2); color: var(--text); }
.side__link .ico { transition: transform .45s var(--ease); }
.side__link:hover .ico { transform: translateX(2px); }
.side__link.on { color: var(--text); font-weight: 600; }
.side__nav .side__link { position: relative; z-index: 1; }
.side__nav .side__link.on, .side__nav .side__link.on:hover { background: transparent; }
.side__nav .side__link.on .ico { animation: icoPop .6s var(--ease); }
@keyframes icoPop { 40% { transform: scale(1.18); } }
/* active item highlight: slides between items (ui.js moveInd) */
.side__ind {
  position: absolute; left: 0; right: 0; top: 0; height: 40px; border-radius: 10px; pointer-events: none;
  background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 0 0 1px var(--line);
  transition: transform .55s var(--ease), height .3s var(--ease), opacity .2s;
}
.side__badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; font-size: 11.5px; background: var(--btn-bg); color: var(--btn-fg); }
.side__foot { margin-top: auto; display: grid; gap: 2px; padding-top: 12px; border-top: 1px solid var(--line); }
.side__prefs { display: flex; gap: 8px; align-items: center; padding: 10px 8px; }
.side__user { display: flex; gap: 10px; align-items: center; padding: 8px; min-width: 0; }
.side__user > span:last-child { display: grid; min-width: 0; }
.side__user b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side__user small { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--btn-bg); color: var(--btn-fg); }
.topbar, .tabbar { display: none; }
.topbar__r { display: flex; align-items: center; gap: 6px; }
.main { padding: 32px clamp(20px, 3vw, 44px) 64px; max-width: 1240px; width: 100%; outline: none; animation: fadeIn .35s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } }
.loading { display: flex; align-items: center; gap: 10px; color: var(--text-2); padding: 40px 0; }
.loading .br { color: var(--text); font-size: 18px; }

/* ---------- page ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.page-head h1 { font-size: clamp(26px, 3vw, 34px); letter-spacing: -.035em; overflow-wrap: anywhere; }
.page-head__a { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.crumbs { margin: -12px 0 20px; font-size: 13.5px; color: var(--text-2); }
.crumbs a { color: var(--text-2); font-weight: 600; }
.crumbs a:hover { color: var(--text); }
.panel-card { padding: 22px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); margin-bottom: 16px; min-width: 0; transition: border-color .3s, box-shadow .4s var(--ease); }
.panel-card:hover { border-color: var(--line-2); box-shadow: 0 18px 40px -28px rgba(0, 0, 0, .45); }
.panel-card h2 { font-size: 17px; letter-spacing: -.02em; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.panel-card__h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-card__h h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 0; }
.grid2 > .panel-card { margin-bottom: 16px; }
.actions-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 16px; }
.empty { display: grid; justify-items: center; gap: 14px; padding: 32px 16px; text-align: center; color: var(--text-2); }
.note { display: flex; gap: 10px; align-items: center; padding: 12px 16px; margin-bottom: 16px; border-radius: 14px; font-size: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.note--info { border-color: rgba(52, 199, 89, .3); background: rgba(52, 199, 89, .08); }
.note--warn { border-color: rgba(255, 159, 10, .35); background: rgba(255, 159, 10, .08); }
.note .br { color: var(--ok); }
.row-line { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 4px; border-top: 1px solid var(--line); font-size: 14.5px; }
.row-line:first-of-type { border-top: 0; }
.row-link:hover { background: var(--surface-2); border-radius: 10px; }
.warn-card { border-color: rgba(255, 159, 10, .4); }

/* stats */
.stats { display: grid; grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { display: grid; align-content: start; gap: 4px; padding: 18px 20px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); transition: border-color .2s, transform .3s var(--ease); min-width: 0; }
a.stat:hover { border-color: var(--line-2); transform: translateY(-2px); }
.stat span { font-size: 13px; color: var(--text-2); font-weight: 500; }
.stat b { font-size: 28px; letter-spacing: -.035em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat em { font-style: normal; font-size: 12.5px; color: var(--text-2); }
.stat em .br { color: var(--ok); }
.stat--hero { background: var(--btn-bg); color: var(--btn-fg); border-color: transparent; }
.stat--hero span, .stat--hero em { color: inherit; opacity: .72; }
.stat--warn { border-color: rgba(255, 159, 10, .45); }

/* kv */
.kv { display: grid; gap: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.kv > div:first-child { border-top: 0; }
.kv span { color: var(--text-2); flex: none; }
.kv b { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.kv .specs { font-weight: 400; }
.kv--row { grid-template-columns: repeat(3, 1fr); margin-top: 14px; }
.kv--row > div { flex-direction: column; border-top: 1px solid var(--line) !important; gap: 2px; }
.kv--row b { text-align: left; font-size: 20px; }
.secret { letter-spacing: .05em; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 14px; margin-top: 4px; border-top: 1px solid var(--line); cursor: pointer; }
.toggle-row span { display: grid; gap: 2px; font-size: 14.5px; }
.toggle-row small { color: var(--text-2); font-size: 12.5px; }
.toggle-row .switch { flex: none; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--ok { color: #1a7f37; background: rgba(52, 199, 89, .14); }
.badge--warn { color: #9a5b00; background: rgba(255, 159, 10, .16); }
.badge--bad { color: #c4000f; background: rgba(255, 69, 58, .13); }
.badge--info { color: var(--text); background: var(--surface-2); border-color: var(--line); }
.badge--mute { color: var(--text-2); background: var(--surface-2); }
:root[data-theme="dark"] .badge--ok { color: #30d158; } :root[data-theme="dark"] .badge--warn { color: #ffb340; } :root[data-theme="dark"] .badge--bad { color: #ff6961; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge--ok { color: #30d158; } :root:not([data-theme="light"]) .badge--warn { color: #ffb340; } :root:not([data-theme="light"]) .badge--bad { color: #ff6961; } }
.prio { font-size: 13px; font-weight: 600; }
.prio--high { color: #d70015; }
.prio--low { color: var(--text-2); }

/* tables */
.tbl-wrap { overflow-x: auto; margin: 0 -6px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr[data-href] { cursor: pointer; transition: background-color .15s; }
.tbl tr[data-href]:hover td, .tbl tr[data-href]:focus-visible td { background: var(--surface-2); }
.tbl tr[data-href]:focus-visible { outline: none; }
.tbl small.muted { font-size: 12.5px; }
.num-in { width: 120px; min-height: 38px; padding: 6px 10px; text-align: right; font-size: 14px; }
.filters { margin-bottom: 16px; display: flex; flex-wrap: wrap; }
.segbtn { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.segbtn[aria-pressed="true"] { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.search-inline input { min-height: 40px; width: min(320px, 70vw); }

/* ---------- order ---------- */
.order { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.order__sum { position: sticky; top: 24px; padding: 24px; }
.step { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-style: normal; font-size: 12.5px; background: var(--btn-bg); color: var(--btn-fg); }
.seg--sm [role="tab"], .seg--sm [role="radio"] { padding: 0 12px; height: 32px; font-size: 13px; white-space: nowrap; }
.seg--sm [role="tab"][aria-selected="true"], .seg--sm [role="radio"][aria-checked="true"] { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.cycle { margin-bottom: 14px; }
.save { font-style: normal; font-size: 11px; font-weight: 700; color: var(--ok); margin-left: 4px; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.pcard {
  position: relative; display: grid; gap: 6px; text-align: left; padding: 16px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--bg); transition: border-color .2s, box-shadow .3s var(--ease), transform .3s var(--ease);
}
.pcard:hover { border-color: var(--line-2); transform: translateY(-2px); }
.pcard.on { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.pcard__pop { position: absolute; top: 12px; right: 14px; font-style: normal; font-size: 13px; }
.pcard__name { font-size: 17px; }
.pcard__price { font-size: 22px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.pcard__price small { font-size: 13px; font-weight: 500; color: var(--text-2); margin-left: 2px; }
.pcard__specs { font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.pcard__specs b { color: var(--text); font-weight: 600; }
.sum__line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 14.5px; }
.sum__total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0 4px; margin-top: 6px; border-top: 1px solid var(--line); }
.sum__total b { font-size: 28px; letter-spacing: -.035em; }
.sum__total b { font-variant-numeric: tabular-nums; }
.sum__h { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); margin: 24px 0 12px; }
.sum__go { margin-top: 20px; white-space: normal; line-height: 1.25; }
/* main pay buttons: a light sweep on hover */
.sum__go, .pay-box__go { position: relative; overflow: hidden; isolation: isolate; }
.sum__go::after, .pay-box__go::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, color-mix(in srgb, var(--btn-fg) 22%, transparent) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform .8s var(--ease);
}
.sum__go:hover:not(:disabled)::after, .pay-box__go:hover:not(:disabled)::after { transform: translateX(120%); }

/* payment method picker (order summary + invoice) */
.paym { display: grid; gap: 10px; }
.paym__o {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) 20px; align-items: center; gap: 14px;
  width: 100%; padding: 12px 14px; border-radius: 14px; text-align: left;
  border: 1px solid var(--line-2); background: var(--bg);
  transition: border-color .2s, box-shadow .3s var(--ease), transform .3s var(--ease), opacity .2s;
}
.paym__o:hover:not(:disabled) { border-color: var(--text-2); transform: translateY(-1px); }
.paym__o:active:not(:disabled) { transform: scale(.985); }
.paym__o[aria-checked="true"] { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.paym__o:disabled { opacity: .5; cursor: not-allowed; }
.paym__o:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.paym__i { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); transition: background-color .3s var(--ease), color .3s var(--ease); }
.paym__o[aria-checked="true"] .paym__i { background: var(--btn-bg); color: var(--btn-fg); }
.paym__t { display: grid; gap: 3px; min-width: 0; }
.paym__t b { font-size: 14.5px; font-weight: 600; }
.paym__t small { font-size: 12.5px; line-height: 1.4; color: var(--text-2); }
.paym__dot { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; transition: border-color .2s; }
.paym__dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--text); transform: scale(0); transition: transform .35s var(--ease); }
.paym__o[aria-checked="true"] .paym__dot { border-color: var(--text); }
.paym__o[aria-checked="true"] .paym__dot::after { transform: scale(1); }
.paym__top { display: block; width: fit-content; margin-top: 10px; }
.pay-box .paym { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.pay-box__go { margin-top: 16px; }

/* ---------- balance ---------- */
.bal-hero { display: grid; align-content: start; gap: 8px; }
.bal-hero > span:first-child { font-size: 13px; color: var(--text-2); }
.bal-hero > b { font-size: clamp(34px, 4vw, 48px); letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.bal-hero .btn { justify-self: start; margin-top: 8px; }
.bal-spark { font-size: 18px; color: var(--ok); overflow: hidden; max-width: 100%; }
.presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.presets button { min-height: 44px; border-radius: 12px; border: 1px solid var(--line-2); font-weight: 600; font-size: 14px; transition: all .2s; }
.presets button:hover { border-color: var(--text); }
.presets button[aria-checked="true"] { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-bg); }
.pay-box .actions-row { margin-bottom: 0; }

/* ---------- invoice document ---------- */
.invoice { padding: clamp(20px, 4vw, 44px); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); display: grid; gap: 26px; }
.invoice__h { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.invoice__h h2 { font-size: 20px; text-align: right; }
.invoice__h p { text-align: right; color: var(--text-2); }
.invoice__brand { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.invoice__brand svg { width: 16px; height: 28px; }
.invoice__brand em { font-style: normal; color: var(--text-2); font-weight: 500; }
.invoice__parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.invoice__parties > div > span, .invoice__meta > div > span { display: block; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); margin-bottom: 6px; }
.invoice__parties b { font-size: 16px; }
.invoice__parties p { font-size: 14px; color: var(--text-2); margin-top: 4px; line-height: 1.6; }
.invoice__meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.invoice__parties .invoice__reg { font-size: 12.5px; margin-top: 8px; }
.invoice__note { margin-top: -14px; }
.invoice__tot { display: grid; justify-content: end; gap: 6px; }
.invoice__tot > div { display: flex; justify-content: space-between; gap: 48px; font-size: 14.5px; }
.invoice__tot span { color: var(--text-2); }
.invoice__tot .grand { padding-top: 10px; border-top: 1px solid var(--line); font-size: 20px; }
.invoice__tot .grand span { color: var(--text); font-weight: 700; }
.invoice__paid { font-weight: 600; color: var(--ok); }

/* ---------- tickets ---------- */
.thread { display: grid; gap: 12px; margin-bottom: 16px; }
.msg { max-width: 760px; padding: 14px 18px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); animation: fadeIn .4s var(--ease) both; }
.msg--mine { justify-self: end; background: var(--surface-2); }
.msg--staff { border-color: var(--line-2); }
.msg__h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13.5px; }
.msg__h small { color: var(--text-2); margin-left: auto; }
.msg__b { font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }

/* ---------- mock gateway ---------- */
.mock { display: grid; place-items: center; padding: 24px 0; }
.mock__card { width: 100%; max-width: 440px; display: grid; gap: 14px; padding: 32px; border-radius: var(--r-lg); background: var(--surface); border: 1px dashed var(--line-2); box-shadow: var(--shadow); }
.mock__card h1 { font-size: 24px; letter-spacing: -.03em; }
.mock__badge { justify-self: start; font: 700 11px var(--mono); letter-spacing: .12em; padding: 4px 8px; border-radius: 6px; background: #ff9f0a; color: #000; }
.mock__amt { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.mock__amt b { font-size: 30px; letter-spacing: -.04em; }
.mock__cardnum { display: flex; justify-content: space-between; padding: 14px 16px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); font: 14px var(--mono); color: var(--text-2); }

/* ---------- dialog + toasts ---------- */
.dlg { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; animation: fadeIn .2s ease; }
.dlg.out { opacity: 0; transition: opacity .2s; }
.dlg__back { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.dlg__box { position: relative; width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow-y: auto; display: grid; gap: 16px; padding: 26px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); animation: dlgIn .35s var(--ease); }
@keyframes dlgIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.dlg__box h2 { font-size: 20px; letter-spacing: -.02em; }
.dlg__body { display: grid; gap: 14px; }
.dlg__actions { display: flex; justify-content: flex-end; gap: 10px; }
.toasts { position: fixed; z-index: 100; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--btn-bg); color: var(--btn-fg); font-size: 14px; font-weight: 500; box-shadow: 0 12px 40px -12px rgba(0,0,0,.5); animation: toastIn .4s var(--ease); max-width: min(420px, calc(100vw - 32px)); }
.toast.out { opacity: 0; transform: translateY(8px); transition: all .35s var(--ease); }
.toast__i { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--ok-dot); color: #fff; flex: none; }
.toast--error .toast__i { background: #ff453a; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.96); } }

/* admin chart */
.chart { width: 100%; height: 160px; display: block; }
.chart__a { fill: var(--glow); }
.chart__l { fill: none; stroke: var(--text); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark-lg { font-size: 16px; color: var(--ok); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order { grid-template-columns: 1fr; }
  .order__sum { position: static; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar {
    display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 30;
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px 16px; background: var(--glass); border-bottom: 1px solid var(--glass-line);
    -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  }
  .topbar .side__brand { padding: 4px 0; }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--glass); border-top: 1px solid var(--glass-line);
    -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  }
  .tabbar__link { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; font-size: 10.5px; font-weight: 600; color: var(--text-2); min-height: 48px; }
  .tabbar__link.on { color: var(--text); }
  .main { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  .grid2 { grid-template-columns: 1fr; }
  .invoice__meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); left: 16px; }
}
@media (prefers-reduced-transparency: reduce) {
  .topbar, .tabbar { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (max-width: 640px) {
  .form--2, .form--3 { grid-template-columns: 1fr; }
  .invoice__parties { grid-template-columns: 1fr; }
  .presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-card { padding: 16px; }
  .kv--row { grid-template-columns: 1fr 1fr 1fr; }
  .stat b { font-size: 24px; }
  /* tables become cards */
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { padding: 10px 6px; border-bottom: 1px solid var(--line); }
  .tbl tr:last-child { border-bottom: 0; }
  .tbl td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; border: 0; text-align: right; }
  .tbl td::before { content: attr(data-label); font-size: 12px; color: var(--text-2); text-align: left; flex: none; }
  .tbl td:first-child { display: block; text-align: left; padding-bottom: 6px; }
  .tbl td:first-child::before { display: none; }
  .tbl td[data-label=""]::before { display: none; }
  .tbl .num { text-align: right; }
  .page-head__a .btn { flex: 1 1 auto; }
  .auth-card { padding: 28px 22px; }
  .topbar .seg--sm button { min-width: 32px; }
}

/* ---------- print (invoice) ---------- */
/* margin: 0 keeps the browser from printing its own header/footer (date, page title, URL); the page padding comes from .main */
@page { size: A4; margin: 0; }
@media print {
  .side, .topbar, .tabbar, .page-head, .crumbs, .pay-box, .note, .toasts, .skip, .demo-chip, .cur, .redirect { display: none !important; }
  html, body, .app-body { background: #fff !important; color: #000 !important; }
  .shell { display: block; }
  .main { padding: 16mm 16mm 14mm; max-width: none; animation: none; }
  .enter, .invoice * { animation: none !important; }
  .invoice { border: 0; border-radius: 0; padding: 0; background: #fff; color: #000; box-shadow: none; gap: 22px; }
  .invoice__h { flex-wrap: nowrap; }
  .invoice__parties { grid-template-columns: 1fr 1fr; }
  .invoice__meta { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
  .invoice .tbl thead { display: table-header-group; }
  .invoice .tbl, .invoice .tbl tbody { display: table-row-group; }
  .invoice .tbl { display: table; }
  .invoice .tbl tr { display: table-row; }
  .invoice .tbl td, .invoice .tbl th { display: table-cell; }
  .invoice .tbl td::before { display: none; }
  .invoice .badge { padding: 0; background: none !important; color: #000 !important; }
  .invoice .badge::before { display: none; }
  .muted, .invoice__parties p, .invoice__tot span, .invoice__parties > div > span, .invoice__meta > div > span { color: #444 !important; }
  .invoice__paid { color: #1a7f37 !important; }
}
.cell { min-width: 0; }
@media (max-width: 640px) { .tbl td:first-child .cell { display: block; } }

/* libraries.dev islands in the app */
.loading { flex-direction: column; justify-content: center; min-height: 40vh; }
.loading .fx-orb--lg .br { font-size: 22px; }
.redirect { position: fixed; inset: 0; z-index: 95; display: grid; place-content: center; justify-items: center; gap: 14px; background: color-mix(in srgb, var(--bg) 82%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); font-weight: 600; animation: fadeIn .3s ease; }
.page-head__a .fx-wrap--metal .btn { flex: none; }
.fx-orb--md { width: 32px; height: 32px; }
.fx-orb--md .br { font-size: 18px; }
.empty .fx-orb { opacity: .9; }

/* ---------- motion (ui.js IHA.enter adds .enter to a view's blocks, --i = stagger index) ---------- */
.enter { animation: enterUp .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes enterUp { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.tbl tbody tr.enter { animation-name: enterRow; }
@keyframes enterRow { from { opacity: 0; transform: translateX(-8px); } }
.pcard.enter { animation-name: enterPop; }
@keyframes enterPop { from { opacity: 0; transform: translateY(10px) scale(.96); } }
.main { animation: none; }
.pcard.on .pcard__name { animation: icoPop .5s var(--ease); }
.stat--hero b, .bal-hero > b, #sideBal { font-variant-numeric: tabular-nums; }
/* ticket: support is working on it */
.typing { display: flex; align-items: center; gap: 10px; margin: -4px 0 16px; padding: 10px 14px; width: fit-content; border-radius: 999px; font-size: 13.5px; color: var(--text-2); background: var(--surface); border: 1px solid var(--line); }

.none { color: var(--text-3); }

/* demo mode note (no server: static hosting / preview) */
.demo-chip {
  position: fixed; z-index: 60; left: 16px; bottom: 16px; max-width: min(380px, calc(100vw - 32px));
  display: grid; gap: 3px; padding: 12px 36px 12px 14px; border-radius: 14px;
  background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  font-size: 12.5px; line-height: 1.45; color: var(--text-2);
}
.demo-chip b { color: var(--text); font-size: 13px; }
.demo-chip code { font-family: var(--mono); font-size: 12px; color: var(--text); white-space: nowrap; }
.demo-chip__x { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: none; color: var(--text-2); font-size: 18px; line-height: 1; cursor: pointer; }
.demo-chip__x:hover { background: var(--surface-2); color: var(--text); }
body:has(.shell) .demo-chip { left: calc(264px + 20px); }
@media (max-width: 900px) { body:has(.shell) .demo-chip { left: 16px; } .demo-chip { bottom: calc(84px + env(safe-area-inset-bottom)); } }
