/* AutoTradeBridge: LET'S TRADE 10X palette. Green #008037, red #FF3131, white on dark charcoal. */
:root {
  --bg: #121212;
  --surface: #1c1c1c;
  --surface-2: #242424;
  --border: #333333;
  --text: #ffffff;
  --muted: #b3b3b3;
  --green: #008037;
  --green-hover: #00a046;
  --red: #ff3131;
  --focus: #4dd388;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--focus); }
a:hover { color: #7fe3ab; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand {
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
  font-size: 18px;
}
.brand em { font-style: normal; color: var(--green-hover); }
.brand small {
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
}

.nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.nav a { color: var(--text); text-decoration: none; font-weight: 600; }
.nav a:hover { color: var(--green-hover); }
.nav form { margin: 0; }

main {
  flex: 1;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px));
}

.narrow { max-width: 440px; margin: 0 auto; }

h1 { font-size: 28px; line-height: 1.2; margin: 0 0 8px; text-wrap: balance; }
h2 { font-size: 20px; margin: 0 0 12px; }
.lead { color: var(--muted); margin: 0 0 24px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.card + .card { margin-top: 20px; }

form.stack, .stack { display: grid; gap: 16px; }
.stack > .pill { justify-self: start; }
.stack > h2, .stack > p { margin: 0; }

label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"] {
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
}
input:focus { border-color: var(--green-hover); outline: none; box-shadow: 0 0 0 3px rgba(0, 160, 70, 0.35); }
input.code { letter-spacing: 0.4em; font-size: 22px; text-align: center; font-variant-numeric: tabular-nums; }

.field-error { color: var(--red); font-weight: 500; font-size: 13px; }
.hint { color: var(--muted); font-weight: 400; font-size: 13px; }

.btn {
  display: inline-block;
  padding: 11px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn:hover { background: var(--green-hover); color: #fff; }
.btn.secondary { background: transparent; border-color: var(--border); color: var(--text); }
.btn.secondary:hover { border-color: var(--green-hover); }
.btn.link { background: none; border: none; padding: 0; color: var(--text); font-weight: 600; }
.btn.link:hover { color: var(--green-hover); }

.flash, .alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.flash.success { border-color: var(--green); }
.alert.error, .flash.error { border-color: var(--red); color: #ffd6d6; }

.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.mt { margin-top: 16px; }
.mb0 { margin-bottom: 0; }
.form-narrow { max-width: 440px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat .value { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--surface-2); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
tr:last-child td { border-bottom: none; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.good { background: rgba(0, 128, 55, 0.25); color: #7fe3ab; }
.pill.wait { background: rgba(255, 255, 255, 0.08); color: var(--muted); }
.pill.bad { background: rgba(255, 49, 49, 0.18); color: #ff9a9a; }

.hero { padding: 24px 0 8px; }
.hero h1 { font-size: 38px; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }

footer { padding: 18px 16px; color: var(--muted); font-size: 13px; text-align: center; border-top: 1px solid var(--border); }

@media (max-width: 480px) {
  h1 { font-size: 24px; }
  .hero h1 { font-size: 30px; }
  .card { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ── Phase 2: brand mark, pricing, checkout, billing ─────────────────────── */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand img { display: block; }
.hero-mark { display: block; margin-bottom: 20px; height: 48px; width: auto; }

.test-banner {
  background: #3a2a00;
  color: #ffd98a;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
}

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 40px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.feature h2 { font-size: 17px; }
.feature p { margin: 0; }

.toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 4px; margin-bottom: 24px; }
.toggle a { padding: 7px 18px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 700; font-size: 14px; }
.toggle a.on { background: var(--green); color: #fff; }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.plans.two { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.plan {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.plan.featured { border-color: var(--green); box-shadow: 0 0 0 1px var(--green) inset; }
.plan h2 { font-size: 19px; }
.plan .btn { margin-top: auto; }
.plan-desc { font-size: 14px; min-height: 42px; }
.ribbon {
  position: absolute;
  top: -11px;
  right: 16px;
  background: var(--green);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
}
.price { font-size: 34px; font-weight: 800; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.price span { font-size: 15px; font-weight: 600; color: var(--muted); }
.save { color: #7fe3ab; font-size: 13px; font-weight: 700; margin: 0 0 8px; }
.ticks { list-style: none; padding: 0; margin: 14px 0 20px; display: grid; gap: 8px; font-size: 14px; }
.ticks li { padding-left: 22px; position: relative; }
.ticks li::before { content: ""; position: absolute; left: 2px; top: 6px; width: 10px; height: 6px; border-left: 2px solid var(--green-hover); border-bottom: 2px solid var(--green-hover); transform: rotate(-45deg); }
.btn.wide { display: block; width: 100%; }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #ff5a5a; }

.checkout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.checkout-main { display: grid; gap: 16px; }
.checkout-main .card + .card { margin-top: 0; }
fieldset.card { margin: 0; min-width: 0; }
legend { font-weight: 800; font-size: 16px; padding: 0 6px; margin-left: -6px; }
.choices { display: grid; gap: 10px; margin-top: 6px; }
.choices.two { grid-template-columns: 1fr 1fr; }
.choice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
  font-weight: 400;
}
.choice:has(input:checked) { border-color: var(--green-hover); background: rgba(0, 128, 55, 0.12); }
.choice input { margin-top: 4px; accent-color: var(--green); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 6px; }
.row-inline { display: flex; gap: 10px; margin-top: 6px; }
.row-inline input { flex: 1; }
.summary { position: sticky; top: 16px; }
.lines { width: 100%; font-size: 14px; margin-bottom: 12px; }
.lines td { padding: 6px 0; border-bottom: 1px solid var(--border); white-space: normal; }
.lines td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 12px; }
.lines tr.total td { font-weight: 800; font-size: 16px; border-bottom: none; }
.due { font-size: 17px; }
.good-text { color: #7fe3ab; }

input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
}
textarea { min-height: 120px; resize: vertical; }
select:focus, textarea:focus { border-color: var(--green-hover); outline: none; box-shadow: 0 0 0 3px rgba(0, 160, 70, 0.35); }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 600; }
label.check input { width: 18px; height: 18px; accent-color: var(--green); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 24px; margin: 8px 0 18px; }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 2px 0 0; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.actions form { margin: 0; }
.note { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; }
form.inline { display: inline; }

details.confirm summary { list-style: none; }
details.confirm summary::-webkit-details-marker { display: none; }
.confirm-body { margin-top: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); max-width: 420px; white-space: normal; }
.confirm-body p { margin-top: 0; font-size: 14px; }

.receipt { max-width: 560px; margin: 0 auto; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.section-title { margin-top: 28px; }
td.wrap { white-space: normal; }

@media (max-width: 820px) {
  .checkout { grid-template-columns: 1fr; }
  .summary { position: static; }
}
@media (max-width: 520px) {
  .grid-2, .choices.two { grid-template-columns: 1fr; }
}
@media print {
  .topbar, footer, .no-print, .test-banner { display: none; }
  body { background: #fff; color: #000; }
  .card { border: none; background: #fff; }
}
fieldset.plain { border: none; padding: 0; margin: 0; }
fieldset.plain legend { font-size: 14px; margin-bottom: 8px; }

/* ── Header: logo only, and a folding menu on phones ─────────────────────── */
.brand img { height: 32px; width: auto; }
.brand small { margin-left: 0; }
.menu-button { display: none; }
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; row-gap: 0; }
  .topbar.collapsible .menu-button {
    display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px;
    background: transparent; color: var(--text); font: inherit; font-weight: 700;
    border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
  }
  .topbar.collapsible .nav { display: none; }
  .topbar.collapsible.open .nav {
    display: flex; flex-direction: column; align-items: stretch; gap: 0;
    width: 100%; margin-top: 12px; border-top: 1px solid var(--border);
  }
  .topbar.open .nav > a, .topbar.open .nav > form { padding: 12px 2px; border-bottom: 1px solid var(--border); }
  .topbar.open .nav > form .btn.link { padding: 0; font-weight: 600; font-size: inherit; }
  .topbar.open .nav > a.btn { margin-top: 12px; border-bottom: 0; text-align: center; justify-content: center; }
}

.admin-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.admin-tools details { flex: 0 1 auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* Telegram (Phase 3) */
.plain-list { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.small { font-size: 13px; }
.messages { display: grid; gap: 12px; margin-top: 16px; }
.message.card { margin: 0; }
.message .row { gap: 12px; flex-wrap: wrap; }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 0; }
.message.deleted .message-text { text-decoration: line-through; opacity: 0.7; }
form.row { align-items: end; gap: 12px; flex-wrap: wrap; justify-content: flex-start; }

/* Signal readings (Phase 4) */
.reading { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.08); display: grid; gap: 4px; }
.reading .pill { margin-right: 6px; }
fieldset { border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 8px; padding: 12px 16px; }
legend { padding: 0 6px; font-weight: 600; }
