:root {
  --bg: #f6f7fb; --card: #fff; --text: #14161f; --muted: #6b7080; --line: #e4e6ee;
  --accent: #5b5bf0; --accent-2: #4646d8; --ok: #e7f7ee; --ok-t: #136c3a;
  --warn: #fff6e0; --warn-t: #7a5300; --err: #fdecec; --err-t: #9b1c1c; --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1117; --card: #171a23; --text: #eceef4; --muted: #9aa0b2; --line: #262a36;
    --ok: #12301f; --ok-t: #8be0ae; --warn: #33290f; --warn-t: #f3d07c; --err: #3a1717; --err-t: #f5a3a3; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-row { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-weight: 800; font-size: 20px; color: var(--text); }
.logo span { color: var(--accent); margin-left: 4px; }
nav { display: flex; gap: 14px; align-items: center; }
.balance-pill { background: var(--bg); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px;
  color: var(--text); font-weight: 600; }
main.wrap { padding: 24px 16px 48px; min-height: 60vh; }
h1 { font-size: 28px; line-height: 1.2; margin: 8px 0 12px; }
h2 { font-size: 21px; margin: 32px 0 12px; }
h3 { font-size: 17px; margin: 0 0 6px; }
.muted { color: var(--muted); }
.tiny { font-size: 13px; }
.hero { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.hero p { color: var(--muted); max-width: 640px; }
.steps { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; margin: 16px 0 0; }
.steps li { background: var(--bg); border-radius: 999px; padding: 6px 14px 6px 6px; font-size: 14px; }
.steps b { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 13px; margin-right: 6px; }
.tabs { display: flex; gap: 8px; overflow-x: auto; margin: 20px 0 0; padding-bottom: 4px; }
.tabs a { background: var(--card); border: 1px solid var(--line); padding: 8px 14px; border-radius: 999px;
  white-space: nowrap; color: var(--text); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 14px; }
.card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; color: var(--text); transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.card p { margin: 0 0 10px; font-size: 14px; }
.card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card .tiny { margin: 8px 0 0; }
.price { font-weight: 700; font-size: 18px; margin: 0; }
.price small { font-weight: 400; font-size: 13px; color: var(--muted); }
.price.big { font-size: 28px; margin: 4px 0 16px; }
.btn { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 10px;
  padding: 12px 20px; font: inherit; font-weight: 600; cursor: pointer; text-align: center; }
.btn:hover { background: var(--accent-2); text-decoration: none; }
.btn-small { padding: 7px 14px; font-size: 14px; }
.btn-wide { width: 100%; font-size: 17px; padding: 14px; }
.order-box, .panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; max-width: 560px; }
.order-box.center { margin: 0 auto; text-align: center; }
.tag { display: inline-block; background: var(--bg); border-radius: 999px; padding: 2px 10px; font-size: 13px;
  color: var(--muted); margin: 0; }
.form label { display: block; margin: 0 0 16px; font-weight: 600; }
.form input { display: block; width: 100%; margin: 6px 0 4px; padding: 12px; font: inherit; font-weight: 400;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); }
.form input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.form .tiny { font-weight: 400; }
.total { background: var(--bg); border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; font-size: 17px; }
.alert { border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; }
.alert p { margin: 0 0 8px; } .alert p:last-child { margin: 0; }
.alert-ok { background: var(--ok); color: var(--ok-t); }
.alert-warn { background: var(--warn); color: var(--warn-t); }
.alert-error { background: var(--err); color: var(--err-t); }
form.inline { margin: 8px 0; }
.tg-login { margin: 20px 0; min-height: 48px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 14px; }
.cols .panel { max-width: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -6px 0 14px; }
.chip { background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 999px;
  padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.chip:hover { border-color: var(--accent); }
input.copy { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  color: var(--text); font: inherit; font-size: 14px; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.orders { width: 100%; border-collapse: collapse; font-size: 14px; }
.orders th, .orders td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.orders th { color: var(--muted); font-weight: 500; }
.orders tr:last-child td { border-bottom: 0; }
.link-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.logout { margin-top: 24px; }
.linklike { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; }
.prose { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; max-width: 760px; }
.prose h2 { font-size: 18px; margin-top: 24px; }
.foot { border-top: 1px solid var(--line); padding: 20px 0; font-size: 14px; color: var(--muted); }
.foot p { margin: 4px 0; }
@media (max-width: 560px) { h1 { font-size: 24px; } .hero, .order-box, .panel { padding: 18px; } }
body { overflow-wrap: anywhere; }
@media (max-width: 420px) { nav { gap: 10px; } .steps li { font-size: 13px; } }
@media (max-width: 640px) {
  .table-wrap { background: none; border: 0; overflow: visible; }
  .orders thead { display: none; }
  .orders tr { display: block; background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px; }
  .orders td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0;
    border: 0; white-space: normal; text-align: right; }
  .orders td::before { content: attr(data-label); color: var(--muted); text-align: left; }
  .link-cell { max-width: none; word-break: break-all; }
  .status-cell { font-weight: 600; }
}
