/* StarAPI — "register" design. Telegram-native grouped lists + one cash-register display. */
:root {
  --bg: #EEF1F5; --surface: #FFFFFF; --surface-2: #F5F7FA; --text: #0D1521; --hint: #8A93A3; --line: rgba(13, 21, 33, .08);
  --accent: #2B7BF3; --on-accent: #FFFFFF; --link: #2B7BF3;
  --gold: #E29400; --gold-soft: #FFF3D6; --violet: #7C5CF0; --violet-soft: #EEE9FF;
  --green: #17A365; --green-soft: #E2F6EC; --red: #E5484D; --red-soft: #FDEBEC; --amber: #C77800; --amber-soft: #FFF1DC;
  --blue-soft: #E6F0FF; --slate-soft: #EDF0F4;
  --screen-a: #151B22; --screen-b: #0A0E12; --digit: #FFC048; --digit-glow: rgba(255, 176, 40, .38); --digit-ghost: rgba(255, 192, 72, .07);
  --paper: #FFFFFF; --paper-ink: #0D1521;
  --radius: 18px; --row: 52px;
  --side: 300px;
  --font: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --safe-top: 0px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0C0F14; --surface: #161A21; --surface-2: #1D222B; --text: #E8ECF2; --hint: #8B94A4; --line: rgba(255, 255, 255, .07);
  --accent: #5A9CFF; --link: #6AA8FF;
  --gold: #FFB52E; --gold-soft: rgba(255, 181, 46, .13); --violet: #A08BFF; --violet-soft: rgba(160, 139, 255, .15);
  --green: #3CCB8A; --green-soft: rgba(60, 203, 138, .13); --red: #FF6B6F; --red-soft: rgba(255, 107, 111, .13); --amber: #FFB547; --amber-soft: rgba(255, 181, 71, .12);
  --blue-soft: rgba(90, 156, 255, .14); --slate-soft: rgba(255, 255, 255, .06);
  --paper: #1B2028; --paper-ink: #E8ECF2;
  color-scheme: dark;
}
html.tg-fs { --safe-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)); }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text); font: 400 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; font-variant-numeric: tabular-nums;
}
a { color: var(--link); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
h1 { font-size: 30px; line-height: 1.12; font-weight: 700; }
h2 { font-size: 20px; line-height: 1.2; font-weight: 650; }
h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
.mono { font-family: var(--mono); letter-spacing: -0.02em; }
.hint { color: var(--hint); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack { display: grid; gap: 14px; }
.stack > *, .cols > *, .kgrid > *, .section > * { min-width: 0; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ================= shell ================= */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; padding-top: var(--safe-top); }
.side {
  position: sticky; top: var(--safe-top); height: calc(100vh - var(--safe-top)); overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px 12px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 16px; color: var(--text); }
.brand b { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; display: block; }
.brand span { font-size: 12.5px; color: var(--hint); }
.logo { width: 36px; height: 36px; flex: none; }
.side-title { padding: 14px 12px 6px; font-size: 13px; font-weight: 600; color: var(--hint); display: flex; justify-content: space-between; }
.klist { display: grid; gap: 2px; }
.kitem {
  display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 14px; color: var(--text);
}
.kitem:hover { background: var(--surface-2); }
.kitem.on { background: var(--accent); color: var(--on-accent); }
.kitem.on .kmeta, .kitem.on .kbal { color: inherit; opacity: .85; }
.kava {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 17px; color: #fff; position: relative;
}
.kava i { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); background: var(--green); }
.kava i.paused { background: var(--hint); }
.kava i.blocked { background: var(--red); }
.kitem.on .kava i { border-color: var(--accent); }
.kname { font-weight: 600; }
.kmeta { font-size: 13px; color: var(--hint); }
.kbal { font-family: var(--mono); font-size: 13px; color: var(--hint); align-self: start; padding-top: 3px; }
.add-k { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; color: var(--accent); font-weight: 600; }
.add-k:hover { background: var(--surface-2); }
.add-k span { width: 42px; height: 42px; border-radius: 50%; background: var(--blue-soft); display: grid; place-items: center; }
.snav { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 2px; }
.snav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--text); font-weight: 500; }
.snav a:hover { background: var(--surface-2); }
.snav a.on { background: var(--surface-2); font-weight: 650; }
.snav a svg.i { color: var(--hint); }
.side-foot { margin-top: auto; padding-top: 12px; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; color: var(--text); }
.me:hover { background: var(--surface-2); }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; overflow: hidden; background: #7C8BA1; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.main { min-width: 0; padding: 28px clamp(20px, 3vw, 44px) 64px; }
.topbar, .tabbar { display: none; }

/* page head */
.phead { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; min-height: 44px; }
.phead .back { margin-left: -8px; }
.crumb { font-size: 13.5px; color: var(--hint); margin-bottom: 2px; display: block; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--slate-soft); color: var(--hint); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.nodot::before { display: none; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.gold { background: var(--gold-soft); color: var(--gold); }
.pill.violet { background: var(--violet-soft); color: var(--violet); }
.pill.blue { background: var(--blue-soft); color: var(--accent); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 13px; border: 0;
  background: var(--accent); color: var(--on-accent); font-weight: 600; white-space: nowrap; transition: filter .12s, transform .06s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.985); }
.btn.soft { background: var(--blue-soft); color: var(--accent); }
.btn.plain { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.sm { height: 34px; padding: 0 13px; border-radius: 10px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.icon { width: 40px; height: 40px; padding: 0; border-radius: 12px; background: transparent; color: var(--hint); }
.btn.icon:hover { background: var(--surface-2); color: var(--text); filter: none; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ================= register display (signature) ================= */
.register {
  position: relative; border-radius: 24px; padding: 20px 22px 18px; color: #E9EEF4; overflow: hidden;
  background: radial-gradient(120% 140% at 10% 0%, var(--screen-a), var(--screen-b));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05), inset 0 2px 18px rgba(0, 0, 0, .55), 0 10px 30px rgba(10, 14, 18, .18);
}
.register::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .018) 0 1px, transparent 1px 3px);
}
.reg-top { display: flex; align-items: center; gap: 10px; font-size: 13px; color: rgba(233, 238, 244, .62); position: relative; z-index: 1; }
.reg-top b { color: #E9EEF4; font-weight: 600; font-size: 14px; }
.reg-led { display: inline-flex; align-items: center; gap: 7px; }
.reg-led::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #3CDB8E; box-shadow: 0 0 10px #3CDB8E; }
.reg-led.paused::before { background: #8B94A4; box-shadow: none; }
.reg-led.blocked::before { background: #FF5A5F; box-shadow: 0 0 10px #FF5A5F; }
.digits { position: relative; z-index: 1; margin: 18px 0 6px; font-family: var(--mono); font-weight: 600; line-height: 1; letter-spacing: -0.03em; font-size: clamp(40px, 6.4vw, 60px); }
.digits .ghost { position: absolute; left: 0; top: 0; color: var(--digit-ghost); white-space: pre; }
.digits .val { position: relative; color: var(--digit); text-shadow: 0 0 22px var(--digit-glow); white-space: pre; }
.reg-unit { position: relative; z-index: 1; font-family: var(--mono); font-size: 13px; letter-spacing: .14em; color: rgba(255, 192, 72, .7); }
.reg-foot { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px dashed rgba(255, 255, 255, .12); font-size: 13.5px; color: rgba(233, 238, 244, .72); }
.reg-foot b { color: #fff; font-weight: 600; }
.reg-foot .warn { color: #FFB25C; }
.reg-foot button { background: rgba(255, 255, 255, .07); border: 0; color: #E9EEF4; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; }
.reg-foot button:hover { background: rgba(255, 255, 255, .13); }
.reg-foot svg.i { width: 17px; height: 17px; }
.spin svg.i { animation: spin .8s linear infinite; }

/* quick actions */
.actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 14px 0 0; }
.act { display: grid; justify-items: center; gap: 7px; padding: 12px 4px 10px; border-radius: 16px; background: var(--surface); border: 0; color: var(--text); font-size: 13px; font-weight: 600; }
.act:hover { background: var(--surface-2); }
.act span { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-soft); color: var(--accent); }

/* ================= grouped lists ================= */
.section { margin-top: 26px; }
.section:first-child { margin-top: 0; }
.sec-head { display: flex; align-items: flex-end; gap: 10px; padding: 0 6px 8px; }
.sec-head h3 { flex: 1; }
.sec-head a, .sec-head button.link { font-size: 14px; font-weight: 600; background: none; border: 0; color: var(--link); padding: 0; }
.sec-note { padding: 8px 6px 0; font-size: 13px; color: var(--hint); }
.group { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.item {
  display: flex; align-items: center; gap: 13px; min-height: var(--row); padding: 9px 16px; position: relative; color: var(--text); width: 100%;
  background: none; border: 0; text-align: left;
}
.item + .item::before { content: ""; position: absolute; top: 0; right: 0; left: 59px; height: 1px; background: var(--line); }
.item.noicon + .item::before, .item.noicon::before { left: 16px; }
a.item:hover, button.item:hover, label.item:hover { background: var(--surface-2); }
.tile { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex: none; }
.tile svg.i { width: 17px; height: 17px; stroke-width: 2; }
.t-blue { background: #2B7BF3; } .t-gold { background: #F0A000; } .t-violet { background: #7C5CF0; } .t-green { background: #17A365; }
.t-red { background: #E5484D; } .t-slate { background: #6E7A8C; } .t-teal { background: #0FA3A3; } .t-pink { background: #E0457B; }
.item .val { color: var(--hint); font-size: 14.5px; text-align: right; min-width: 0; }
.item .val.strong { color: var(--text); font-weight: 600; }
.item .chev { color: var(--hint); opacity: .6; }
.item .sub { font-size: 13px; color: var(--hint); margin-top: 1px; }
.item.danger { color: var(--red); }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; z-index: 1; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--slate-soft); box-shadow: inset 0 0 0 1px var(--line); transition: background .18s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: transform .18s; }
.switch input:checked + i { background: var(--green); box-shadow: none; }
.switch input:checked + i::after { transform: translateX(20px); }

/* segmented */
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--slate-soft); gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 13px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--hint); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
:root[data-theme="dark"] .seg button.on { background: var(--surface-2); }

/* stats */
.stat-card { background: var(--surface); border-radius: var(--radius); padding: 18px 18px 6px; }
.stat-hero { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.stat-hero .big { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.stat-hero .big small { font-size: 15px; color: var(--hint); font-weight: 600; letter-spacing: 0; margin-left: 4px; }
.spark { display: block; width: 100%; height: 96px; margin: 12px 0 2px; }
.spark-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--hint); padding: 0 2px 10px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 -18px; border-top: 1px solid var(--line); }
.stat-grid > div { padding: 13px 18px; border-bottom: 1px solid var(--line); }
.stat-grid > div:nth-child(odd) { border-right: 1px solid var(--line); }
.stat-grid > div:nth-last-child(-n+2) { border-bottom: 0; }
.stat-grid .k { font-size: 13px; color: var(--hint); display: flex; align-items: center; gap: 6px; }
.stat-grid .k svg.i { width: 15px; height: 15px; }
.stat-grid .v { font-size: 19px; font-weight: 650; letter-spacing: -0.02em; margin-top: 2px; }
.stat-grid .v small { font-size: 13px; color: var(--hint); font-weight: 500; letter-spacing: 0; margin-left: 4px; }
.ratio { display: flex; height: 6px; border-radius: 9px; overflow: hidden; background: var(--slate-soft); margin-top: 8px; }
.ratio i { background: var(--green); } .ratio b { background: var(--red); }

/* receipt tape */
.receipt {
  --tooth: 9px;
  background: var(--paper); color: var(--paper-ink); padding: 18px 18px 14px; position: relative;
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--tooth) * 2) var(--tooth) repeat-x,
    linear-gradient(#000 0 0) top / 100% calc(100% - var(--tooth)) no-repeat;
          mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--tooth) * 2) var(--tooth) repeat-x,
    linear-gradient(#000 0 0) top / 100% calc(100% - var(--tooth)) no-repeat;
  padding-bottom: calc(14px + var(--tooth)); border-radius: var(--radius) var(--radius) 0 0;
}
.rc-head { display: flex; align-items: baseline; gap: 10px; padding-bottom: 12px; border-bottom: 1.5px dashed var(--line); }
.rc-head h3 { flex: 1; }
.rc-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.rc-row:last-of-type { border-bottom: 0; }
.rc-row:hover .rc-what { color: var(--link); }
.rc-time { font-family: var(--mono); font-size: 12.5px; color: var(--hint); }
.rc-what { font-weight: 600; }
.rc-what .ico-s { color: var(--gold); }
.rc-what .ico-p { color: var(--violet); }
.rc-sub { font-size: 12.5px; color: var(--hint); }
.rc-amt { text-align: right; font-family: var(--mono); font-size: 14px; font-weight: 600; }
.rc-amt .st { display: block; font-family: var(--font); font-size: 12px; font-weight: 600; margin-top: 2px; }
.st-confirmed { color: var(--green); } .st-sent, .st-pending, .st-processing { color: var(--amber); } .st-failed { color: var(--red); }
.rc-total { display: flex; justify-content: space-between; padding-top: 12px; margin-top: 2px; border-top: 1.5px dashed var(--line); font-family: var(--mono); font-size: 13.5px; }
.rc-empty { padding: 26px 0 12px; text-align: center; color: var(--hint); }

/* banners */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px; border-radius: 16px; margin-top: 12px; font-size: 14px; }
.banner b { display: block; font-weight: 650; margin-bottom: 1px; }
.banner .grow { color: var(--text); opacity: .86; }
.banner.red { background: var(--red-soft); } .banner.red svg.i, .banner.red b { color: var(--red); }
.banner.amber { background: var(--amber-soft); } .banner.amber svg.i, .banner.amber b { color: var(--amber); }
.banner.blue { background: var(--blue-soft); } .banner.blue svg.i, .banner.blue b { color: var(--accent); }
.banner .btn { flex: none; }

/* kassa layout */
.kgrid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 26px; align-items: start; padding-top: 6px; }

/* forms */
.field { display: grid; gap: 7px; }
.field > span { font-size: 13.5px; font-weight: 600; color: var(--hint); padding-left: 4px; }
.input {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 13px; border: 1.5px solid transparent; background: var(--surface); outline: none; transition: border-color .12s;
}
.group .input, .sheet .input { background: var(--surface-2); }
textarea.input { height: auto; min-height: 120px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--accent); }
.input.mono { font-family: var(--mono); font-size: 14px; }
.seed-input { font-family: var(--mono); font-size: 14.5px; line-height: 1.7; min-height: 150px; }
.wcount { font-family: var(--mono); font-size: 13px; color: var(--hint); }
.wcount.ok { color: var(--green); }
.wopt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 2px solid transparent; cursor: pointer; text-align: left; width: 100%; color: var(--text); }
.wopt.on { border-color: var(--accent); }
.wopt[disabled] { opacity: .5; cursor: not-allowed; }
.wopt .radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); position: relative; }
.wopt.on .radio { border-color: var(--accent); }
.wopt.on .radio::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); }
.steps { display: flex; gap: 6px; margin-bottom: 18px; }
.steps i { height: 4px; flex: 1; border-radius: 9px; background: var(--slate-soft); }
.steps i.on { background: var(--accent); }

/* code / docs */
.code { background: #0F141A; color: #DCE3EC; border-radius: 14px; font-family: var(--mono); font-size: 13px; line-height: 1.6; max-width: 100%; overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; border-bottom: 1px solid rgba(255, 255, 255, .06); font-family: var(--font); font-size: 12.5px; color: #7D8896; font-weight: 600; }
.code pre { margin: 0; padding: 14px 16px 16px; overflow-x: auto; white-space: pre; }
.code .copy { background: rgba(255, 255, 255, .08); border: 0; color: #DCE3EC; height: 28px; padding: 0 10px; border-radius: 8px; font-size: 12.5px; font-family: var(--font); font-weight: 600; }
.code .copy:hover { background: rgba(255, 255, 255, .15); }
.c-k { color: #FFC048; } .c-s { color: #8FD6A0; } .c-c { color: #7D8896; } .c-n { color: #7FB4FF; }
.tabs { display: flex; gap: 4px; margin-bottom: 8px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 7px 12px; border-radius: 9px; font-weight: 600; font-size: 13.5px; color: var(--hint); white-space: nowrap; }
.tabs button.on { background: var(--surface); color: var(--text); }
.method { background: var(--surface); border-radius: 16px; margin-top: 8px; overflow: hidden; }
.method > button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; background: none; border: 0; text-align: left; color: var(--text); }
.method > button .grow b { font-family: var(--mono); font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.verb { font-family: var(--mono); font-size: 11.5px; font-weight: 700; padding: 3px 7px; border-radius: 6px; background: var(--green-soft); color: var(--green); }
.verb.post { background: var(--gold-soft); color: var(--gold); }
.method .body { padding: 0 16px 16px; display: grid; gap: 12px; }
.method .chev { transition: transform .15s; color: var(--hint); }
.method.open .chev { transform: rotate(90deg); }
.ptable { width: 100%; border-collapse: collapse; font-size: 14px; }
.ptable td { padding: 9px 0; border-top: 1px solid var(--line); vertical-align: top; }
.ptable td:first-child { width: 34%; padding-right: 12px; font-family: var(--mono); font-size: 13px; }
.ptable .req { display: block; font-family: var(--font); font-size: 11.5px; color: var(--gold); font-weight: 600; }
.inline-code { font-family: var(--mono); font-size: .9em; background: var(--slate-soft); padding: 1px 5px; border-radius: 5px; }
.doc-p { color: var(--text); opacity: .9; max-width: 72ch; line-height: 1.55; }

/* tables (admin) */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; color: var(--hint); font-weight: 600; font-size: 12.5px; padding: 12px 16px 10px; white-space: nowrap; }
table.t td { padding: 12px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--surface-2); }
.r { text-align: right; }

/* chips filter */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 12px; }
.chips::-webkit-scrollbar { display: none; }
.chips button { border: 0; height: 34px; padding: 0 14px; border-radius: 999px; background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; white-space: nowrap; }
.chips button.on { background: var(--text); color: var(--bg); }
.search { position: relative; }
.search svg.i { position: absolute; left: 14px; top: 14px; color: var(--hint); width: 18px; height: 18px; }
.search .input { padding-left: 42px; height: 46px; }

/* date groups (orders) */
.dgroup { margin-top: 18px; }
.dgroup > .dh { padding: 0 6px 8px; font-size: 13.5px; font-weight: 650; color: var(--hint); display: flex; justify-content: space-between; }
.oline { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 16px; cursor: pointer; position: relative; }
.oline + .oline::before { content: ""; position: absolute; top: 0; left: 68px; right: 0; height: 1px; background: var(--line); }
.oline:hover { background: var(--surface-2); }
.oico { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
.oico.s { background: var(--gold-soft); color: var(--gold); } .oico.p { background: var(--violet-soft); color: var(--violet); }
.oline .t { font-weight: 600; }
.oline .s { font-size: 13px; color: var(--hint); }
.oline .a { text-align: right; font-family: var(--mono); font-size: 14px; font-weight: 600; }
.oline .a .st { display: block; font-family: var(--font); font-size: 12.5px; }

/* kpi (admin) */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border-radius: 16px; padding: 16px; }
.kpi .k { font-size: 13px; color: var(--hint); font-weight: 600; display: flex; gap: 8px; align-items: center; }
.kpi .v { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-top: 8px; }
.kpi .s { font-size: 12.5px; color: var(--hint); margin-top: 2px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 110px; }
.bars i { flex: 1; background: var(--accent); border-radius: 5px 5px 2px 2px; min-height: 3px; opacity: .85; }
.bars i.z { background: var(--slate-soft); opacity: 1; }
.subnav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: -6px 0 20px; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { padding: 8px 14px; border-radius: 10px; color: var(--hint); font-weight: 600; font-size: 14px; white-space: nowrap; }
.subnav a.on { background: var(--surface); color: var(--text); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px; align-items: start; }

/* seed grid */
.seed-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; counter-reset: w; }
.seed-grid span { counter-increment: w; font-family: var(--mono); font-size: 13px; padding: 7px 9px; border-radius: 9px; background: var(--surface-2); }
.seed-grid span::before { content: counter(w) " "; color: var(--hint); }

/* sheet */
.overlay { position: fixed; inset: 0; background: rgba(6, 9, 13, .45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s; }
.sheet { background: var(--bg); border-radius: 22px; width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 18px 18px 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.sheet-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.sheet-head h2 { flex: 1; font-size: 19px; padding-left: 4px; }
.sheet .acts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.qr { display: grid; place-items: center; padding: 16px; background: #fff; border-radius: 18px; width: max-content; margin: 4px auto 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { transform: translateY(24px); } }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--slate-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
.loading { display: grid; place-items: center; min-height: 50vh; }
@media (prefers-reduced-motion: reduce) { .spinner, .spin svg.i { animation-duration: 2.5s; } .overlay, .sheet { animation: none !important; } }

.toast-wrap { position: fixed; left: 50%; transform: translateX(-50%); bottom: 26px; z-index: 90; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 14px; font-weight: 600; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); animation: fade .15s; }
.toast.err { background: var(--red); color: #fff; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; text-align: center; }
.login-card .register { text-align: left; margin-bottom: 26px; }
.login-card p { color: var(--hint); margin: 10px 0 22px; }

.empty-hero { max-width: 520px; margin: 6vh auto 0; text-align: center; }
.empty-hero .register { text-align: left; margin-bottom: 24px; }
.empty-hero p { color: var(--hint); margin: 10px 0 22px; }

/* ================= tablet / mobile ================= */
@media (max-width: 1180px) {
  .kgrid { grid-template-columns: minmax(0, 1fr); }
  .cols { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 768px) and (max-width: 1180px) {
  :root { --side: 272px; }
  .kgrid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
}
@media (max-width: 767px) {
  .shell { display: block; }
  .side { display: none; }
  .main { padding: 8px 16px calc(96px + env(safe-area-inset-bottom)); }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; padding: calc(10px + var(--safe-top)) 16px 10px;
    background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  }
  .topbar .switcher { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 0; text-align: left; color: var(--text); }
  .topbar .switcher .kava { width: 36px; height: 36px; font-size: 15px; }
  .topbar .switcher b { font-size: 17px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { display: grid; justify-items: center; gap: 3px; padding: 5px 0 2px; font-size: 11px; font-weight: 600; color: var(--hint); }
  .tabbar a.on { color: var(--accent); }
  .tabbar svg.i { width: 25px; height: 25px; }
  h1 { font-size: 28px; }
  .phead { margin-bottom: 16px; }
  .phead .desk { display: none; }
  .register { border-radius: 22px; padding: 18px 18px 16px; }
  .digits { font-size: 46px; margin: 16px 0 6px; }
  .kgrid { gap: 0; }
  .kgrid > div + div { margin-top: 26px; }
  .form-grid { grid-template-columns: 1fr; }
  .overlay { align-items: flex-end; padding: 0; }
  .sheet { max-width: none; border-radius: 22px 22px 0 0; padding: 16px 16px calc(22px + env(safe-area-inset-bottom)); max-height: 92vh; animation: rise .2s ease-out; }
  .toast-wrap { bottom: calc(90px + env(safe-area-inset-bottom)); }
  .hide-m { display: none !important; }
  .seed-grid { grid-template-columns: repeat(2, 1fr); }
  table.t th, table.t td { padding-left: 12px; padding-right: 12px; }
}
@media (min-width: 768px) { .only-m { display: none !important; } }
