/* ───────── Tokens (ported from ballpark-placeholder/public/styles.css) ───────── */
:root {
  --bg:        #0b1120;
  --bg-soft:   #111a2e;
  --panel:     #16213a;
  --line:      #243049;
  --ink:       #eaf0fb;
  --ink-soft:  #9fb0cc;
  --ink-mute:  #6b7c9c;
  --brand:     #4ade80;   /* ballpark green */
  --brand-2:   #38bdf8;   /* sky accent */
  --just:      #fbbf24;   /* just insure highlight */
  --danger:    #f87171;
  --radius:    14px;
  --maxw:      1080px;
  --shadow:    0 20px 50px -20px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 460px; }

/* ───────── Buttons ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .5em; font-weight: 600; font-size: .95rem;
  padding: .8em 1.4em; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; transition: transform .12s ease, background .2s ease, border-color .2s ease;
  font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); color: #052e16; }
.btn--primary:hover { background: #5ef193; }
.btn--ghost { border-color: var(--line); color: var(--ink); background: none; }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn--text { background: none; color: var(--ink-soft); padding-left: .3em; }
.btn--text:hover { color: var(--ink); }
.btn--block { width: 100%; }

/* ───────── Nav ───────── */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11,17,32,.8); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: .5em; font-weight: 800; font-size: 1.15rem; }
.brand__mark { font-size: 1.1em; }
.brand__name { letter-spacing: -.01em; }
.brand__tag { color: var(--ink-mute); font-weight: 500; font-size: .8rem; margin-left: .2em; }
.nav__links { display: flex; align-items: center; gap: 22px; font-size: .95rem; color: var(--ink-soft); }
.nav__links a:hover { color: var(--ink); }
.nav__links .btn:hover { color: var(--brand); }

/* Account dropdown (logged-in nav) — a styled <details>, no JS framework.
   summary renders as plain block text so it shares the sibling <a>s' line metrics
   (inline-flex made it sit visibly lower in the flex row). */
/* margin/font/color reset: the generic `details` rule further down (results-page debug
   expander) sets margin-top:18px + .9rem, which pushed this below the nav baseline. */
.nav-menu { position: relative; margin: 0; font-size: inherit; color: inherit; }
.nav-menu summary { list-style: none; cursor: pointer; user-select: none; display: block; }
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu summary:hover, .nav-menu[open] summary { color: var(--ink); }
.nav-menu__caret { display: inline-block; font-size: .7em; margin-left: 3px; transition: transform .15s ease; }
.nav-menu[open] .nav-menu__caret { transform: rotate(180deg); }
.nav-menu__panel {
  position: absolute; right: 0; top: calc(100% + 12px); z-index: 60;
  min-width: 170px; padding: 6px; display: grid;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow);
}
.nav-menu__panel a { padding: 9px 12px; border-radius: 7px; font-size: .92rem; white-space: nowrap; }
.nav-menu__panel a:hover { background: var(--panel); color: var(--ink); }
.nav-menu__sep { border-top: 1px solid var(--line); margin: 5px 4px; }

/* ───────── Page scaffold ───────── */
.page { padding: 40px 0 72px; }
.page__head { margin-bottom: 24px; }
.page__title { font-size: clamp(1.7rem, 4vw, 2.2rem); font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; }
.page__sub { color: var(--ink-soft); margin: 0; font-size: 1rem; }
.muted { color: var(--ink-mute); font-size: .9rem; }

/* ───────── Cards / panels ───────── */
.card {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }

fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 0 0 16px; }
legend { font-weight: 700; font-size: .9rem; color: var(--brand); padding: 0 8px; }

/* ───────── Forms ───────── */
.form { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: 7px; color: var(--ink-soft); }
.field .opt, .field .note { color: var(--ink-mute); font-weight: 400; font-size: .82em; }
.field input, .field select {
  width: 100%; padding: .7em .85em; font-size: .95rem; font-family: inherit;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input::placeholder { color: var(--ink-mute); }
.field input:focus, .field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(74,222,128,.15); }
.form__fine { margin: 14px 0 0; font-size: .78rem; color: var(--ink-mute); text-align: center; }
.form__alt { margin: 18px 0 0; font-size: .9rem; color: var(--ink-soft); text-align: center; }
.form__alt a { color: var(--brand); font-weight: 600; }

/* Flash messages */
.flash { padding: 12px 16px; border-radius: 10px; font-size: .92rem; margin-bottom: 16px; }
.flash.ok  { background: rgba(74,222,128,.1); border: 1px solid rgba(74,222,128,.3); color: var(--brand); }
.flash.err { background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.3); color: var(--danger); }

/* ───────── Checkbox chips (states + carriers) ───────── */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
  padding: 9px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); font-size: .92rem; transition: border-color .15s ease, background .15s ease;
}
.chip:hover { border-color: var(--brand-2); }
.chip input { accent-color: var(--brand); width: 16px; height: 16px; }
.chip:has(input:checked) { border-color: var(--brand); background: rgba(74,222,128,.08); }
.chip__states { color: var(--ink-mute); font-size: .78rem; }

/* Carrier list (vertical rows, filtered by selected states) */
.carrier-list { display: grid; gap: 8px; margin-top: 6px; }
.carrier-item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.carrier-item:hover { border-color: var(--brand-2); }
.carrier-item input { accent-color: var(--brand); width: 16px; height: 16px; }
.carrier-item:has(input:checked) { border-color: var(--brand); background: rgba(74,222,128,.08); }
.carrier-item__name { font-weight: 600; }
.carrier-item__states { color: var(--ink-mute); font-size: .8rem; text-align: right; }

/* ───────── Results table ───────── */
.results__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.results__count { font-size: 1.15rem; font-weight: 700; margin: 0; }
.cheapest { color: var(--brand); font-weight: 700; }
table.cmp { width: 100%; border-collapse: collapse; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.cmp th, table.cmp td { padding: 12px 14px; text-align: left; font-size: .95rem; border-bottom: 1px solid var(--line); }
table.cmp th { background: var(--panel); font-size: .72rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
table.cmp tr:last-child td { border-bottom: none; }
td.prem { font-variant-numeric: tabular-nums; font-weight: 700; }
td.prem .band { color: var(--ink-mute); font-size: .72rem; font-weight: 400; }
tr.best { background: rgba(74,222,128,.07); }
tr.best td:first-child { border-left: 3px solid var(--brand); }
.decl { color: var(--danger); }
.unavail { color: var(--ink-mute); }
.badge-live { background: var(--brand); color: #052e16; font-size: 9px; font-weight: 800; padding: 2px 6px; border-radius: 5px; vertical-align: middle; letter-spacing: .04em; }
.grp { color: var(--ink-mute); font-size: .78rem; }
.portal { margin-top: 4px; }
.portal a { color: var(--brand); font-size: .78rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.portal a:hover { text-decoration: underline; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { background: #1b2a47; }
th .arrow { color: var(--brand); font-size: 10px; margin-left: 3px; }
tr.row--just { background: rgba(251,191,36,.06); }
tr.row--just td:first-child { border-left: 3px solid rgba(251,191,36,.5); }

.tiernote { margin-top: 16px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; font-size: .82rem; color: var(--ink-soft); line-height: 1.7; }
.tiernote b { color: var(--ink); }
.notice { background: rgba(56,189,248,.07); border: 1px solid rgba(56,189,248,.25); color: var(--ink-soft); padding: 12px 16px; border-radius: var(--radius); font-size: .88rem; margin-bottom: 18px; }
.notice b { color: var(--brand-2); }
details { margin-top: 18px; font-size: .9rem; color: var(--ink-soft); }
details pre { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 14px; overflow: auto; font-size: .8rem; color: var(--ink-soft); }

/* ───────── Footer ───────── */
.footer { border-top: 1px solid var(--line); padding: 36px 0; background: var(--bg-soft); margin-top: 40px; }
.footer__grid { display: flex; flex-direction: column; gap: 14px; }
.footer__brand { display: flex; align-items: center; gap: .5em; font-weight: 800; }
.footer__dom { color: var(--ink-mute); font-weight: 500; font-size: .9rem; margin-left: .3em; }
.footer__links { display: flex; flex-wrap: wrap; gap: 18px; font-size: .9rem; color: var(--ink-soft); }
.footer__links a:hover { color: var(--ink); }
.footer__disc { margin: 0; color: var(--ink-mute); font-size: .8rem; max-width: 760px; }

/* ───────── Responsive ───────── */
@media (max-width: 760px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr 1fr; }
  .nav__links { gap: 14px; font-size: .9rem; }
}
@media (max-width: 480px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

/* --- Extension install banner (base.html) --- */
.ext-banner { background: linear-gradient(90deg, rgba(74,222,128,.13), rgba(251,191,36,.10)); border-bottom: 1px solid var(--line); }
.ext-banner[hidden] { display: none; }
.ext-banner__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; flex-wrap: wrap; }
.ext-banner__msg { color: var(--ink); font-size: .95rem; }
.ext-banner__actions { display: flex; align-items: center; gap: 12px; }
.ext-banner__x { background: none; border: 0; color: var(--ink-mute); font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; }
.ext-banner__x:hover { color: var(--ink); }

/* --- Quote page: full/quick modes (quote_full.html) --- */
/* One switch link, showing only the mode you're NOT in. */
.quote-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.quote-head > div:first-child { flex: 1 1 0; min-width: 320px; }  /* long sub-text wraps inside, not around the switch */
.mode-switch { flex: none; margin-top: 6px; }
.mode-switch .btn { padding: .55em 1.1em; font-size: .85rem; }
#quote-page.mode-full #mode-btn-full { display: none; }
#quote-page.mode-quick #mode-btn-quick { display: none; }
#quote-page.mode-quick .full-only { display: none; }
#quote-page.mode-full .quick-only { display: none; }

/* --- Admin panel (admin.py; Linear ROB-215/216/218) --- */
.admin-nav { display: flex; gap: 6px; margin-bottom: 20px; }
.admin-nav a { padding: .45em 1em; border: 1px solid var(--line); border-radius: 9px; font-size: .9rem; font-weight: 600; color: var(--ink-soft); }
.admin-nav a:hover { color: var(--ink); border-color: var(--brand-2); }
.admin-nav a.active { background: var(--panel); color: var(--ink); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { display: grid; gap: 2px; padding: 18px 20px; }
.stat__num { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; }
.stat__dim { color: var(--ink-mute); font-weight: 600; }
.stat__label { font-size: .85rem; font-weight: 600; color: var(--ink-soft); }
.stat__sub { font-size: .78rem; color: var(--ink-mute); }
.admin-h2 { font-size: 1rem; font-weight: 700; margin: 0 0 12px; }
.admin-actions { white-space: nowrap; }
.admin-actions form { display: inline-block; margin-right: 6px; }
.admin-actions .btn { padding: .4em .8em; font-size: .78rem; }
.admin-actions .admin-danger:hover { border-color: var(--danger); color: var(--danger); }
.chips .chip b { color: var(--brand); margin-left: .4em; }

/* --- Agent forum (forum.py; Linear ROB-203) --- */
.field textarea {
  width: 100%; padding: .7em .85em; font-size: .95rem; font-family: inherit;
  background: var(--bg); color: var(--ink); line-height: 1.6; resize: vertical;
  border: 1px solid var(--line); border-radius: 9px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea::placeholder { color: var(--ink-mute); }
.field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(74,222,128,.15); }

.forum-crumb { font-size: .88rem; color: var(--ink-soft); margin: 0 0 14px; }
.forum-crumb a:hover { color: var(--brand); }
.forum-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.forum-cats { display: grid; gap: 12px; }
.forum-cat { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 22px; transition: border-color .15s ease; }
.forum-cat:hover { border-color: var(--brand); }
.forum-cat__main { display: grid; gap: 2px; }
.forum-cat__name { font-weight: 700; }
.forum-cat__desc { color: var(--ink-soft); font-size: .9rem; }
.forum-cat__meta { display: grid; gap: 2px; text-align: right; font-size: .85rem; color: var(--ink-soft); white-space: nowrap; }

.forum-threads { padding: 0; overflow: hidden; }
.forum-thread { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 22px; border-bottom: 1px solid var(--line); transition: background .15s ease; }
.forum-thread:last-child { border-bottom: none; }
.forum-thread:hover { background: var(--panel); }
.forum-thread__main { display: grid; gap: 2px; min-width: 0; }
.forum-thread__title { font-weight: 600; }
.forum-thread__by { font-size: .82rem; }
.forum-thread__meta { display: grid; gap: 2px; text-align: right; font-size: .85rem; color: var(--ink-soft); white-space: nowrap; }

.forum-badge { display: inline-block; background: var(--panel); border: 1px solid var(--line); color: var(--ink-soft); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 1px 7px; border-radius: 6px; vertical-align: middle; margin-right: .4em; }
.forum-badge--pin { border-color: var(--brand); color: var(--brand); }
.forum-badge--team { border-color: var(--just); color: var(--just); }

.forum-posts { display: grid; gap: 14px; margin-bottom: 22px; }
.forum-post__head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.forum-post__author { font-weight: 700; font-size: .95rem; }
.forum-post__meta { display: inline-flex; align-items: baseline; gap: 12px; font-size: .85rem; }
.forum-post__del { display: inline; }
.forum-post__del button { background: none; border: 0; cursor: pointer; font-family: inherit; font-size: .82rem; color: var(--ink-mute); }
.forum-post__del button:hover { color: var(--danger); }
.forum-post__body { color: var(--ink); font-size: .95rem; overflow-wrap: break-word; }
.forum-post__body a { color: var(--brand-2); }
.forum-post__body a:hover { text-decoration: underline; }

.forum-mod { display: flex; gap: 8px; flex-wrap: wrap; }
.forum-mod .btn { padding: .5em .9em; font-size: .82rem; }
.forum-mod__danger:hover { border-color: var(--danger); color: var(--danger); }
.forum-pager { display: flex; justify-content: space-between; margin-top: 18px; }
.forum-reply { margin-top: 4px; }

@media (max-width: 600px) {
  .forum-cat, .forum-thread { flex-direction: column; align-items: flex-start; gap: 6px; }
  .forum-cat__meta, .forum-thread__meta { text-align: left; }
}

/* --- Install steps / code chips on the extension page --- */
.install-steps { counter-reset: step; list-style: none; padding: 0; margin: 1.5rem 0; display: grid; gap: 14px; }
.install-steps li { position: relative; padding: 14px 16px 14px 52px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-soft); }
.install-steps li b, .install-steps li strong { color: var(--ink); }
.install-steps li::before { counter-increment: step; content: counter(step); position: absolute; left: 14px; top: 14px; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #052e16; font-weight: 700; display: grid; place-items: center; font-size: .85rem; }
code.kbd { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; color: var(--just); font-size: .9em; }
