/* Zayafka panel. Signature element: the "ticket" (queue card with notches + perforation).
   Colour logic follows a traffic light: green = let in, amber = waiting, red = decline. */

:root {
  --font: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --display: "Unbounded", "Onest", -apple-system, sans-serif;
  --shell: 480px;
  --tabbar-h: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);

  --paper: #f3f5f4;
  --card: #ffffff;
  --sunk: #eaeeec;
  --ink: #121815;
  --ink-2: #4b5650;
  --ink-3: #87918c;
  --line: #e0e5e2;
  --side: #dfe5e2;

  --brand: #0b8a62;
  --brand-ink: #ffffff;
  --brand-soft: #e1f2ea;
  --wait: #b86f05;
  --wait-soft: #fbefd8;
  --stop: #d23f3f;
  --stop-soft: #fbe6e6;

  /* the ticket is always deep pine, in both themes */
  --ticket: #0f3a2d;
  --ticket-2: #164a3a;
  --ticket-ink: #effaf5;
  --ticket-dim: rgba(239, 250, 245, .62);
  --mint: #5ee6b0;
  color-scheme: light;
}

[data-theme="dark"] {
  --paper: #0c1613;
  --card: #13221d;
  --sunk: #1a2c27;
  --ink: #e8f1ed;
  --ink-2: #a7b9b2;
  --ink-3: #6c837a;
  --line: #20362f;
  --side: #07100d;

  --brand: #2ec58f;
  --brand-ink: #04170f;
  --brand-soft: rgba(46, 197, 143, .13);
  --wait: #f0b24a;
  --wait-soft: rgba(240, 178, 74, .13);
  --stop: #ff7b7b;
  --stop-soft: rgba(255, 123, 123, .12);

  --ticket: #1d4638;
  --ticket-2: #28604c;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 15px/1.5 var(--font);
  color: var(--ink);
  background: var(--side);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; text-align: inherit; }
a { color: var(--brand); text-decoration: none; }
svg { display: block; flex-shrink: 0; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 10px; }

/* Wide screens: the phone-sized app sits in the middle on a quiet perforated backdrop. */
.backdrop {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(circle, var(--line) 1.4px, transparent 1.6px);
  background-size: 18px 18px;
}
.shell {
  position: relative; z-index: 1;
  max-width: var(--shell); min-height: 100vh; min-height: 100dvh;
  margin: 0 auto; background: var(--paper);
}
@media (min-width: 520px) {
  .shell { box-shadow: 0 0 0 1px var(--line), 0 30px 80px rgba(8, 30, 22, .14); }
}
@media (max-width: 519px) { .backdrop { display: none; } body { background: var(--paper); } }

.screen { padding: 14px 16px calc(var(--tabbar-h) + 30px + env(safe-area-inset-bottom)); }
.screen.sub { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
.screen.nav { animation: screen-in .28s var(--ease); }
@keyframes screen-in { from { opacity: 0; transform: translateX(10px); } }

/* ---------- type ---------- */
h1, h2, h3, p { margin: 0; }
.title { font: 600 26px/1.15 var(--display); letter-spacing: -.02em; }
.head { display: flex; align-items: center; gap: 12px; margin: 6px 2px 18px; }
.sec { margin-top: 26px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 10px; }
.sec-title { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.sec-note { font-size: 13px; color: var(--ink-3); }
.more { font-size: 14px; font-weight: 600; color: var(--brand); display: inline-flex; align-items: center; gap: 2px; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- surfaces ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.card.pad { padding: 16px; }
.list { overflow: hidden; }
.list > * + * { border-top: 1px solid var(--line); }
.item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; text-align: left; }
button.item, .press { transition: background-color .15s; }
button.item:active, .press:active { background: var(--sunk); }
.item-title { font-weight: 600; }
.item-sub { font-size: 13px; color: var(--ink-3); margin-top: 1px; }
.chev { color: var(--ink-3); }

/* ---------- avatars ---------- */
.avatar {
  position: relative; width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  display: grid; place-items: center; font-weight: 650; font-size: 16px;
  background: var(--brand-soft); color: var(--brand);
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.sq { border-radius: 14px; }
.avatar.lg { width: 60px; height: 60px; font-size: 22px; border-radius: 18px; }
.avatar.xl { width: 76px; height: 76px; font-size: 28px; }

/* ---------- the ticket ---------- */
.ticket {
  position: relative; border-radius: 22px; color: var(--ticket-ink);
  background: linear-gradient(160deg, var(--ticket-2), var(--ticket) 60%);
}
.ticket-main { padding: 18px 18px 16px; }
.ticket-stub { position: relative; padding: 14px 18px 16px; }
.ticket-stub::before {
  content: ""; position: absolute; left: 22px; right: 22px; top: 0;
  border-top: 2px dashed rgba(239, 250, 245, .18);
}
/* notches: cut-outs in the page colour on both ends of the perforation */
.ticket-stub::after, .ticket-cut {
  content: ""; position: absolute; top: -11px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--paper); left: -11px;
}
.ticket-cut { left: auto; right: -11px; }
.t-label { font-size: 13px; color: var(--ticket-dim); font-weight: 500; }
.t-big { font: 700 46px/1.05 var(--display); letter-spacing: -.035em; word-spacing: .12em; color: var(--mint); margin: 4px 0 2px; white-space: nowrap; }
.t-big.sm { font-size: 34px; }
.t-row { display: flex; gap: 22px; margin-top: 10px; }
.t-stat { font-size: 12.5px; color: var(--ticket-dim); line-height: 1.3; }
.t-stat b { display: block; font-size: 16px; font-weight: 650; color: var(--ticket-ink); }
.t-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.t-chip {
  height: 26px; padding: 0 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 600; background: rgba(239, 250, 245, .1); color: var(--ticket-ink); white-space: nowrap;
}
.t-stub-row { display: flex; align-items: center; gap: 12px; }
.t-value { font-size: 18px; font-weight: 650; }
.btn-mint {
  height: 42px; padding: 0 16px; border-radius: 12px; display: inline-flex; align-items: center; gap: 6px;
  font-weight: 650; font-size: 14.5px; background: var(--mint); color: #062a1d; white-space: nowrap;
  transition: transform .12s var(--ease);
}
.btn-mint:active { transform: scale(.96); }
.btn-mint.wide { width: 100%; height: 50px; justify-content: center; font-size: 15.5px; border-radius: 14px; }
.t-chips { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.t-chips::-webkit-scrollbar { display: none; }
.t-amount {
  flex-shrink: 0; height: 36px; padding: 0 14px; border-radius: 10px; font-weight: 600; font-size: 14px;
  background: rgba(239, 250, 245, .1); color: var(--ticket-ink);
}
.t-amount:active { background: rgba(239, 250, 245, .2); }
.t-progress { height: 8px; border-radius: 4px; background: rgba(239, 250, 245, .12); overflow: hidden; margin-top: 12px; }
.t-progress > i { display: block; height: 100%; border-radius: 4px; background: var(--mint); transition: width .6s var(--ease); }
.t-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; text-align: center; }
.t-grid b { display: block; font-size: 16px; font-weight: 650; color: var(--ticket-ink); }
.t-grid span { font-size: 11.5px; color: var(--ticket-dim); }
.live { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); animation: live 1.4s ease-in-out infinite; }
@keyframes live { 50% { opacity: .3; } }

/* ---------- pills, meta ---------- */
.pill {
  min-width: 30px; height: 26px; padding: 0 9px; border-radius: 999px; display: inline-grid; place-items: center;
  font-size: 13px; font-weight: 650; background: var(--wait-soft); color: var(--wait);
}
.pill.zero { background: var(--sunk); color: var(--ink-3); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 3px; font-size: 12.5px; color: var(--ink-3); }
.meta .on { color: var(--brand); font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.meta .warn { color: var(--wait); font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.meta .pro { color: var(--ink-2); font-weight: 650; }

/* ---------- buttons ---------- */
.btn {
  width: 100%; min-height: 48px; padding: 0 16px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 650; font-size: 15px; transition: transform .12s var(--ease), background .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-brand { background: var(--brand); color: var(--brand-ink); }
.btn-soft { background: var(--brand-soft); color: var(--brand); }
.btn-plain { background: var(--sunk); color: var(--ink); }
.btn-stop { background: transparent; color: var(--stop); }
.btn-stop:active { background: var(--stop-soft); }
.btn-sm { min-height: 40px; border-radius: 12px; font-size: 14px; width: auto; white-space: nowrap; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-row > .btn { flex: 1 1 140px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 36px; padding: 0 13px; border-radius: 10px; font-weight: 600; font-size: 14px;
  background: var(--sunk); color: var(--ink-2); transition: background .15s, color .15s;
}
.chip.on { background: var(--brand); color: var(--brand-ink); }

.seg { display: flex; padding: 3px; gap: 3px; border-radius: 13px; background: var(--sunk); }
.seg button {
  flex: 1; height: 38px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .2s, color .2s;
}
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

.switch { position: relative; width: 48px; height: 28px; flex-shrink: 0; border-radius: 14px; background: var(--line); transition: background .2s var(--ease); }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .22s var(--ease);
}
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(20px); }

/* ---------- channel page ---------- */
.chat-name { font: 600 19px/1.25 var(--display); letter-spacing: -.02em; word-break: break-word; }
.notice { display: flex; gap: 12px; padding: 14px; border-radius: 16px; align-items: flex-start; }
.notice.warn { background: var(--wait-soft); }
.notice.warn > svg { color: var(--wait); }
.notice.info { background: var(--brand-soft); }
.notice.info > svg { color: var(--brand); }
.notice b { display: block; margin-bottom: 2px; }
.trio { display: grid; grid-template-columns: repeat(3, 1fr); }
.trio > div { padding: 14px 8px; text-align: center; }
.trio > div + div { border-left: 1px solid var(--line); }
.trio b { display: block; font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.trio span { font-size: 12px; color: var(--ink-3); line-height: 1.25; display: block; margin-top: 2px; }
.ok { color: var(--brand); }

.chart { padding: 16px 16px 12px; }
.chart svg { width: 100%; height: 120px; }
.bar-req { fill: var(--sunk); }
.bar-ok { fill: var(--brand); }
.hit { fill: transparent; cursor: pointer; }
.sel { fill: var(--brand-soft); }
.chart-foot { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); margin-top: 6px; }
.legend { display: flex; gap: 12px; font-size: 12.5px; color: var(--ink-3); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.chart-tip { font-size: 13px; color: var(--ink-2); margin-top: 6px; min-height: 20px; }
.chart-tip b { color: var(--ink); }

.set { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; text-align: left; }
.set-extra { padding: 0 14px 14px 62px; }
.card > .set + .set, .card > .set + .set-extra, .card > .set-extra + .set { border-top: 1px solid var(--line); }
.ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; background: var(--sunk); color: var(--ink-2); }
.ico.brand { background: var(--brand-soft); color: var(--brand); }
.ico.wait { background: var(--wait-soft); color: var(--wait); }

/* ---------- balance ---------- */
.packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pack {
  padding: 12px 6px; border-radius: 14px; text-align: center; background: var(--card); border: 1px solid var(--line);
  transition: border-color .15s, transform .12s var(--ease);
}
.pack:active { transform: scale(.96); border-color: var(--brand); }
.pack-stars { font-size: 17px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 4px; }
.pack-stars svg { color: #f2b01e; }
.pack-sum { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }
.tx { font-weight: 650; white-space: nowrap; }
.tx.plus { color: var(--brand); }
.tx-ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; background: var(--sunk); color: var(--ink-3); }
.tx-ico.plus { background: var(--brand-soft); color: var(--brand); }

/* ---------- empty & misc ---------- */
.empty { text-align: center; padding: 30px 20px; }
.empty-mark {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.empty h3 { font-size: 17px; margin-bottom: 6px; }
.empty p { color: var(--ink-2); margin-bottom: 16px; }
.center { min-height: 80vh; display: grid; place-items: center; }
.add-row { color: var(--brand); font-weight: 600; }
.add-row .ico { background: transparent; border: 1.5px dashed var(--brand); color: var(--brand); }
.search {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border-radius: 13px;
  background: var(--sunk); color: var(--ink-3); margin-bottom: 12px;
}
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px; color: var(--ink); }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 12px; padding: 7px 0; }
.steps li::before {
  content: counter(s); width: 24px; height: 24px; border-radius: 8px; flex-shrink: 0; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700; background: var(--brand-soft); color: var(--brand);
}
.foot { text-align: center; font-size: 12.5px; color: var(--ink-3); margin-top: 24px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.sk { border-radius: 18px; background: var(--sunk); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.sk-head { height: 44px; width: 60%; margin: 6px 0 18px; border-radius: 14px; }
.sk-ticket { height: 230px; border-radius: 22px; }
.sk-line { height: 18px; width: 40%; margin: 26px 2px 12px; border-radius: 8px; }
.sk-item { height: 64px; margin-bottom: 8px; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; z-index: 20; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--shell);
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr);
}
.tab {
  position: relative; height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--ink-3); transition: color .2s;
}
.tab.on { color: var(--brand); }
.tab.on::before { content: ""; position: absolute; top: -6px; width: 22px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
.tab:active svg { transform: scale(.9); }

/* ---------- sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-dim { position: absolute; inset: 0; background: rgba(4, 14, 10, .5); animation: fade .22s var(--ease); }
.sheet {
  position: relative; width: 100%; max-width: var(--shell); max-height: 88vh; overflow-y: auto;
  background: var(--paper); border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(18px + env(safe-area-inset-bottom)); animation: up .32s var(--ease);
}
.sheet.closing { animation: down .2s var(--ease) forwards; }
.sheet-wrap.closing .sheet-dim { animation: fade .2s reverse forwards; }
.grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet h3 { font: 600 19px/1.25 var(--display); letter-spacing: -.02em; margin-bottom: 6px; }
.sheet .lead { color: var(--ink-2); margin-bottom: 16px; }
.opt-group { margin-bottom: 14px; }
.opt-label { font-size: 13px; font-weight: 600; color: var(--ink-3); margin: 0 2px 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(100%); } }
@keyframes down { to { transform: translateY(100%); } }
textarea.field {
  width: 100%; min-height: 140px; resize: vertical; padding: 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--card); outline: 0; font-size: 15px; line-height: 1.5;
}
textarea.field:focus { border-color: var(--brand); }
.hint { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-3); margin: 8px 2px 14px; }

/* ---------- toast ---------- */
#toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom)); z-index: 60; display: flex; justify-content: center; pointer-events: none; padding: 0 16px; }
.toast {
  max-width: 440px; padding: 12px 16px; border-radius: 14px; display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: var(--paper); font-weight: 550; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  animation: toast .3s var(--ease);
}
.toast.ok svg { color: var(--mint); }
.toast.err svg { color: #ff8f8f; }
[data-theme="dark"] .toast.ok svg { color: var(--brand-ink); }
[data-theme="dark"] .toast.err svg { color: #b42318; }
.toast.hide { animation: toast .22s reverse forwards; }
@keyframes toast { from { opacity: 0; transform: translateY(12px); } }

@media (max-width: 360px) {
  .screen { padding-left: 12px; padding-right: 12px; }
  .t-big { font-size: 38px; }
  .t-big.sm { font-size: 28px; }
  .packs { grid-template-columns: repeat(2, 1fr); }
  .title { font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
