/* class-based display rules must not defeat the hidden attribute */
[hidden] { display: none !important; }

/* ---------- layout ---------- */

#app {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  min-height: var(--tg-viewport-stable-height, 100dvh);
  padding:
    calc(var(--s3) + var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px))
    var(--s4)
    calc(var(--s6) + env(safe-area-inset-bottom, 0px));
}

.screen { animation: fade-up .26s ease both; }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- typography ---------- */

h1, h2, h3 { font-weight: 800; letter-spacing: -.02em; margin: 0 0 var(--s2); }
h1 { font-size: var(--t-2xl); line-height: 1.15; }
h2 { font-size: var(--t-xl); line-height: 1.2; margin-top: var(--s5); }
h3 { font-size: var(--t-lg); line-height: 1.25; }
p { margin: 0 0 var(--s3); }
b, strong { font-weight: 600; }

.amount, .num, .counter, [data-left], .stat-value, .guarantee-num, .price {
  font-variant-numeric: tabular-nums;
}

.dim { color: var(--text-dim); }
.center { text-align: center; }
.small { font-size: var(--t-sm); }
.note {
  display: block;
  font-size: var(--t-xs);
  line-height: 1.45;
  color: var(--text-dim);
  margin-top: var(--s2);
}
.rich { font-size: var(--t-md); white-space: pre-line; }

/* ---------- topline: demo badge + agency link ---------- */

.topline-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  font-size: var(--t-xs);
  color: var(--text-dim);
  padding: 0 var(--s1) var(--s2);
}
.topline-meta .badge-demo { display: inline-flex; align-items: center; gap: 6px; }
.topline-meta .badge-demo::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold-400);
  flex: none;
}
.topline-meta a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  padding: 4px 2px;
}

/* ---------- tabs + controls ---------- */

.topline { display: flex; gap: var(--s2); align-items: stretch; margin-bottom: var(--s4); }
.tabs {
  flex: 1;
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  min-width: 0;
}
.tab {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 8px 4px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: var(--t-sm);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}
.tab.active {
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 6px 16px var(--glow);
}
.tab-badge {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 999px;
  font-size: 11px;
  background: color-mix(in srgb, var(--on-accent) 22%, transparent);
}
.tab:not(.active) .tab-badge { background: var(--bg-soft); }

.icon-btn {
  flex: none;
  width: var(--tap);
  min-height: var(--tap);
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: var(--t-lg);
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease;
}
.icon-btn[aria-pressed='true'] { border-color: var(--accent); color: var(--accent); }
.icon-btn:active { background: var(--bg-soft); }

/* ---------- buttons ---------- */

.btn {
  display: flex; align-items: center; justify-content: center; gap: var(--s2);
  width: 100%;
  min-height: var(--tap);
  padding: 14px 18px;
  border: 0;
  border-radius: 14px;
  font: inherit;
  font-weight: 700;
  font-size: var(--t-lg);
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 8px 22px var(--glow);
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; box-shadow: none; cursor: default; }
.btn.secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: none;
  color: var(--text);
  font-weight: 600;
  font-size: var(--t-md);
}
.btn.is-loading { pointer-events: none; opacity: .8; }
.btn-row { display: flex; gap: var(--s2); margin-top: var(--s2); }
.btn-row .btn { flex: 1; }

.link-btn {
  border: 0;
  background: none;
  padding: 8px 2px;
  font: inherit;
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sticky {
  position: sticky;
  bottom: 0;
  z-index: 4;
  margin-top: var(--s4);
  padding: var(--s3) 0 max(var(--s3), env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  backdrop-filter: blur(8px);
}
.sticky:empty { display: none; }

/* ---------- chips ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg-soft);
  border: 1px solid var(--border);
}
.chip.accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.chip.warn { color: var(--legendary-ink); border-color: color-mix(in srgb, var(--legendary) 50%, transparent); }
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--r-ink, var(--common-ink));
  background: color-mix(in srgb, var(--r, var(--common)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--r, var(--common)) 40%, transparent);
}

/* ---------- pitch header ---------- */

.pitch {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  padding: var(--s5) var(--s4) var(--s4);
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(9, 11, 22, .55), rgba(9, 11, 22, .88)),
    url('../assets/ui/hero.jpg') center / cover no-repeat;
  color: #fff;
  box-shadow: var(--shadow-card);
}
.pitch .eyebrow {
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold-400);
  margin-bottom: var(--s2);
}
.pitch h1 { color: #fff; font-size: var(--t-2xl); margin-bottom: var(--s2); }
.pitch .sub { font-size: var(--t-md); color: rgba(255, 255, 255, .84); margin-bottom: var(--s3); }
.pitch .platforms {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--t-xs);
  font-weight: 600;
  color: rgba(255, 255, 255, .72);
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .22);
  margin-bottom: var(--s4);
}
.pitch .btn.secondary {
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .28);
  color: #fff;
}

/* ---------- stats ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s2);
  margin-top: var(--s3);
}
.stat-row.two { grid-template-columns: repeat(2, 1fr); }
.stat {
  padding: var(--s3) var(--s2);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  text-align: center;
}
.stat-value { display: block; font-size: var(--t-xl); font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.stat-label { display: block; font-size: var(--t-xs); color: var(--text-dim); line-height: 1.3; margin-top: 2px; }

/* ---------- packs ---------- */

.packs { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s2); margin-top: var(--s3); }
.pack {
  min-height: 76px;
  padding: var(--s3);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .14s ease, transform .12s ease, background .14s ease;
}
.pack:active { transform: scale(.98); }
.pack .n { display: block; font-size: var(--t-lg); font-weight: 800; }
.pack .sum { display: block; font-size: var(--t-sm); color: var(--text-dim); font-variant-numeric: tabular-nums; }
.pack .hint { display: block; font-size: 11px; color: var(--accent); margin-top: 3px; line-height: 1.25; }
.pack[aria-pressed='true'] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-card));
}

.count-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--s2); margin-top: var(--s3); }
.count {
  min-height: var(--tap);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  font-size: var(--t-md);
  font-weight: 700;
  cursor: pointer;
}
.count.active {
  border-color: transparent;
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
}

/* ---------- guarantee ---------- */

.guarantee {
  margin-top: var(--s4);
  padding: var(--s4);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.guarantee-num {
  font-size: var(--t-3xl);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
  display: block;
}
.guarantee-num.tick { animation: tick .45s cubic-bezier(.2,.9,.3,1.3); }
@keyframes tick { 0% { transform: scale(1) } 40% { transform: scale(1.16); color: var(--accent) } 100% { transform: scale(1) } }
.guarantee .cap { font-size: var(--t-sm); color: var(--text-dim); }
.guarantee .hint { font-size: var(--t-xs); color: var(--text-dim); margin-top: var(--s2); line-height: 1.45; }

.bar { height: 8px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; margin: var(--s2) 0; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .5s ease; }
.bar-head { display: flex; justify-content: space-between; font-size: var(--t-sm); color: var(--text-dim); }

/* ---------- prize list ---------- */

.pool-line { font-size: var(--t-sm); color: var(--text-dim); margin: var(--s2) 0; }
.prize-list { margin: var(--s2) 0; }
.prize-row {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--r, var(--common));
  padding-left: var(--s3);
}
.prize-row:last-child { border-bottom: 0; }
.prize-row img {
  width: 56px; height: 56px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  flex: none;
  background: var(--bg-soft);
  aspect-ratio: 1;
}
.prize-row .name { flex: 1; font-size: var(--t-sm); line-height: 1.3; font-weight: 600; }
.prize-row .meta { display: block; font-size: var(--t-xs); color: var(--text-dim); font-weight: 400; margin-top: 2px; }
.prize-row .price { font-size: var(--t-sm); font-weight: 700; white-space: nowrap; color: var(--r-ink, var(--text-dim)); }
.prize-row.out { opacity: .5; }
.dots { letter-spacing: 1px; font-size: 10px; color: var(--r-ink, var(--common-ink)); }

/* ---------- cards ---------- */

.card {
  padding: var(--s4);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  margin-bottom: var(--s2);
}
.card h3 { margin-bottom: var(--s1); }
.card p { margin: 0; font-size: var(--t-sm); color: var(--text-dim); line-height: 1.5; }
.card.accent { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

.feature-card { border-left: 3px solid var(--accent); }
.step-card { display: flex; gap: var(--s3); align-items: flex-start; }
.step-card .step-letter {
  flex: none;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  font-weight: 800;
  font-size: var(--t-sm);
}

/* ---------- owner annotations ---------- */

.owner-note {
  position: relative;
  margin: var(--s2) 0 var(--s4);
  padding: var(--s3) var(--s3) var(--s3) var(--s4);
  border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  font-size: var(--t-sm);
  color: var(--text);
  line-height: 1.45;
}
.owner-note::before {
  content: 'в боевой версии';
  position: absolute;
  top: -9px; left: var(--s3);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--on-accent);
  background: var(--accent);
}

/* ---------- inventory ---------- */

.inv-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s3); }
.inv-card {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.inv-card img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--bg-soft); }
.inv-card.locked img { filter: var(--locked-filter); }
.inv-card .body { padding: var(--s3); display: flex; flex-direction: column; gap: 6px; flex: 1; }
.inv-card .t { font-size: var(--t-sm); line-height: 1.3; font-weight: 600; }
.inv-card .n { font-size: var(--t-xs); color: var(--text-dim); }
.inv-card .go {
  margin-top: auto;
  min-height: var(--tap);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-xs);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font: inherit;
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.order-row {
  display: flex; justify-content: space-between; gap: var(--s3);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--t-sm);
}
.order-row:last-child { border-bottom: 0; }
.order-row .id { font-weight: 600; }
.order-row .when { font-size: var(--t-xs); color: var(--text-dim); }
.order-row .what { text-align: right; color: var(--text-dim); font-size: var(--t-xs); max-width: 55%; }

/* ---------- pending / waiting ---------- */

.pending {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3);
  margin-bottom: var(--s3);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-card));
  border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
}
.pending img { width: 38px; height: 38px; flex: none; }
.pending .txt { flex: 1; font-size: var(--t-sm); line-height: 1.3; }
.pending .txt b { display: block; font-size: var(--t-md); font-weight: 700; }
.pending button {
  flex: none;
  min-height: 38px;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--radius-xs);
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-size: var(--t-sm);
  font-weight: 700;
  cursor: pointer;
}

.waiting { padding-top: 6dvh; }
.pay-spinner { display: flex; gap: var(--s2); justify-content: center; margin-bottom: var(--s5); }
.pay-spinner i { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); animation: bounce 1.1s ease-in-out infinite; }
.pay-spinner i:nth-child(2) { animation-delay: .16s; }
.pay-spinner i:nth-child(3) { animation-delay: .32s; }
@keyframes bounce { 0%,80%,100% { transform: scale(.6); opacity: .45 } 40% { transform: scale(1); opacity: 1 } }

.mini-spinner {
  width: 20px; height: 20px; flex: none;
  border: 2.5px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
.btn .mini-spinner { border-color: color-mix(in srgb, var(--on-accent) 35%, transparent); border-top-color: var(--on-accent); }
@keyframes spin { to { transform: rotate(360deg) } }

.timer-line {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: var(--s3) var(--s4);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-top: var(--s3);
}
.timer-line .amount { font-size: var(--t-2xl); font-weight: 800; }

/* ---------- celebration ---------- */

.celebration { text-align: center; padding-top: 10dvh; }
.celebration svg { width: 72px; height: 72px; margin-bottom: var(--s3); }
.celebration h1 { font-size: var(--t-2xl); }
.celebration .sub { color: var(--text-dim); font-size: var(--t-md); }
.hero-num { font-size: var(--t-3xl); font-weight: 800; line-height: 1.05; letter-spacing: -.03em; }

/* ---------- summary line ---------- */

.sum-line {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3);
  padding: var(--s3) var(--s4);
  margin-top: var(--s3);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.sum-line .amount { font-size: var(--t-2xl); font-weight: 800; letter-spacing: -.02em; }

/* ---------- consent ---------- */

.checkbox { display: flex; gap: var(--s3); align-items: flex-start; font-size: var(--t-sm); color: var(--text-dim); margin: var(--s4) 0 var(--s2); }
.checkbox input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin: 0; }

/* ---------- support ---------- */

.status {
  display: block;
  padding: var(--s3) var(--s4);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: var(--t-sm);
  color: var(--text-dim);
  margin: var(--s2) 0;
}
.status b { display: block; font-size: var(--t-md); color: var(--text); margin-bottom: 2px; }
.status--wait { border-color: color-mix(in srgb, var(--legendary) 45%, transparent); }
.status--ok { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.status--idle { border-color: var(--border); }

.faq {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: var(--s3) var(--s4);
  margin-bottom: var(--s2);
}
.faq summary { cursor: pointer; font-size: var(--t-md); font-weight: 600; list-style: none; min-height: 28px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; float: right; color: var(--text-dim); font-weight: 400; }
.faq[open] summary::after { content: '–'; }
.faq p { margin: var(--s2) 0 0; font-size: var(--t-sm); color: var(--text-dim); }

.diag {
  margin: var(--s2) 0 var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--t-xs);
  line-height: 1.55;
  color: var(--text-dim);
  white-space: pre-wrap;
  overflow-x: auto;
}

/* ---------- admin mock ---------- */

.admin-table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.admin-table th, .admin-table td { padding: var(--s2) var(--s1); text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { font-size: var(--t-xs); color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.admin-table td:last-child, .admin-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table td:not(:first-child), .admin-table th:not(:first-child) { white-space: nowrap; }
.admin-table td:first-child { width: 46%; }
.funnel-bar { height: 26px; border-radius: 6px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); display: flex; align-items: center; padding: 0 var(--s2); color: var(--on-accent); font-size: var(--t-xs); font-weight: 700; margin-bottom: 6px; }

/* ---------- toggles ---------- */

.toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  margin-bottom: var(--s2);
  font-size: var(--t-sm);
}
.toggle-row input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }

/* ---------- modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: color-mix(in srgb, var(--bg-deep) 78%, transparent);
  backdrop-filter: blur(3px);
  animation: overlay-in .18s ease both;
  padding: var(--s4);
}
@keyframes overlay-in { from { opacity: 0 } to { opacity: 1 } }
.modal-overlay.closing { animation: overlay-in .18s ease reverse both; }
.modal {
  width: 100%;
  max-width: 520px;
  max-height: 86dvh;
  overflow-y: auto;
  padding: var(--s5) var(--s4) max(var(--s5), env(safe-area-inset-bottom, 0px));
  border-radius: 22px 22px var(--radius) var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-modal);
  animation: sheet-up .26s cubic-bezier(.2,.9,.3,1.1) both;
}
@keyframes sheet-up { from { transform: translateY(28px); opacity: .4 } to { transform: none; opacity: 1 } }
.modal-title { font-size: var(--t-xl); font-weight: 800; margin-bottom: var(--s2); }
.modal-body { font-size: var(--t-md); color: var(--text-dim); line-height: 1.5; }
.modal-body b { color: var(--text); font-weight: 600; }
.modal-body ul { margin: var(--s2) 0 0; padding-left: 18px; }
.modal-body li { margin-bottom: 6px; }
.modal-actions { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s4); }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--s5) + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 30;
  display: flex; align-items: center; gap: var(--s3);
  max-width: min(520px, calc(100vw - 32px));
  padding: var(--s3) var(--s4);
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  font-size: var(--t-sm);
  animation: toast-in .24s cubic-bezier(.2,.9,.3,1.2) both;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 14px) } to { opacity: 1; transform: translate(-50%, 0) } }
.toast.closing { animation: toast-in .2s ease reverse both; }
.toast button {
  border: 0; background: none; padding: 6px 2px;
  font: inherit; font-size: var(--t-sm); font-weight: 700; color: var(--accent); cursor: pointer;
}

/* ---------- skeleton ---------- */

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(100deg, var(--bg-soft) 30%, color-mix(in srgb, var(--text) 8%, transparent) 50%, var(--bg-soft) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 180% 0 } to { background-position: -40% 0 } }

/* ---------- error ---------- */

.error-screen { text-align: center; padding-top: 18dvh; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* four tabs + one control must fit 375px: the role switch lives in the meta row */
.topline-meta .meta-actions { display: flex; align-items: center; gap: var(--s3); flex: none; }
.meta-btn {
  border: 0;
  background: none;
  padding: 4px 2px;
  font: inherit;
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.meta-btn[aria-pressed='true'] { color: var(--accent); text-decoration-style: solid; }
.topline-meta .badge-demo {
  min-width: 0;
  flex: 0 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topline-meta .meta-btn, .topline-meta a { white-space: nowrap; }

/* ---------- mode switcher on the offer screen ---------- */
.mode-switch {
  margin-bottom: var(--s3);
  padding: var(--s3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.mode-switch-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2);
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: var(--s2);
}
.mode-switch-head .link-btn { text-transform: none; letter-spacing: 0; font-size: var(--t-xs); padding: 2px; }
.mode-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.mode-chips::-webkit-scrollbar { display: none; }
.mode-chip {
  flex: none;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-dim);
  font: inherit;
  font-size: var(--t-sm);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.mode-chip.active {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border-color: transparent;
  color: var(--on-accent);
}

.milestone-teaser {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  margin-top: var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-card));
}
.milestone-teaser .txt { min-width: 0; }
.milestone-teaser b { display: block; font-size: var(--t-md); }
.milestone-teaser span { font-size: var(--t-sm); color: var(--text-dim); }

/* ---------- tickets ---------- */
.ticket-list { display: flex; flex-direction: column; gap: var(--s2); }
.ticket-row {
  display: block; width: 100%; text-align: left;
  padding: var(--s3) var(--s4);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.ticket-row .head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.ticket-row .subject { font-weight: 600; font-size: var(--t-md); display: flex; align-items: center; gap: 6px; }
.ticket-row .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.ticket-row .meta { display: block; font-size: var(--t-xs); color: var(--text-dim); margin-top: 2px; }
.ticket-row .preview {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: var(--t-sm); color: var(--text-dim); margin-top: var(--s2);
}
.ticket-row .rate-call { display: block; font-size: var(--t-xs); font-weight: 700; color: var(--accent); margin-top: var(--s2); }

.thread { display: flex; flex-direction: column; gap: var(--s2); margin: var(--s3) 0; }
.msg { padding: var(--s3); border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-card); }
.msg.agent { background: color-mix(in srgb, var(--accent) 8%, var(--bg-card)); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.msg .who { font-size: var(--t-xs); color: var(--text-dim); margin-bottom: 4px; }
.msg .text { font-size: var(--t-sm); white-space: pre-line; }

.field {
  width: 100%;
  padding: var(--s3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  font-size: var(--t-sm);
  margin-top: var(--s2);
}
.field-label { display: block; font-size: var(--t-sm); font-weight: 600; margin-top: var(--s3); }
.reply { margin-top: var(--s3); }
.reply .btn { margin-top: var(--s2); }
.toggle-row select { font: inherit; font-size: var(--t-sm); padding: 6px 8px; border-radius: var(--radius-xs); border: 1px solid var(--border); background: var(--bg-card); color: var(--text); }

.stars { display: flex; gap: 4px; margin-top: var(--s2); }
.star {
  border: 0; background: none; cursor: pointer;
  font-size: 28px; line-height: 1; padding: 4px;
  color: var(--text-dim);
}
.star.on { color: var(--legendary); }

.dist-row { display: flex; align-items: center; gap: var(--s2); margin-bottom: 6px; font-size: var(--t-sm); }
.dist-row .lbl { width: 34px; flex: none; color: var(--text-dim); }
.dist-row .bar { flex: 1; height: 10px; margin: 0; }
.dist-row .cnt { width: 26px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-dim); }

/* role switch: both states visible, active one highlighted — no guessing */
.role-switch {
  display: inline-flex;
  padding: 2px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  flex: none;
}
.role-opt {
  border: 0;
  background: none;
  padding: 4px 10px;
  border-radius: 999px;
  font: inherit;
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
}
.role-opt.on { background: var(--accent); color: var(--on-accent); }
