/* Page parts specific to the SEO console. Everything else comes from
 * console.css (the Biztek.io console look) and console-groups.css (the
 * Marketing accent, pink). Tokens only: no colour literals, so dark mode and
 * the group accent follow. tests/test_house_rules.py greps this file for any. */

/* Pages a visitor can reach without a session (error, offline) have no
 * navigation to show. */
.c-bare .c-nav, .c-bare .c-tabbar { display: none; }
.c-bare .c-main { align-items: center; }
.c-bare .c-content { max-width: 720px; }
@media (max-width: 1024px) {
  body.c-bare { padding-bottom: 0; }
}

/* ---- top bar: sign out is a POST form, so it is a button ---- */
.c-signout-form { margin: 0; display: flex; }
.c-signout-form button.c-signout {
  margin: 0; min-height: 0; background: transparent; border: 0;
  font-weight: 400; color: var(--c-bar-dim);
}
.c-signout-form button.c-signout { white-space: nowrap; }
.c-signout-form button.c-signout:hover { background: var(--c-bar-raised); color: var(--c-bar-text); }

/* ---- token balance pill (Site Agent's badge is the fleet standard) ----
 * Geometry and states are the standard's. Two deliberate differences:
 *  - the fill mixes toward --bg instead of toward transparent, so the pill
 *    stays readable while page text scrolls behind a fixed element;
 *  - low and zero use the console's own warn/bad tokens, which keep contrast
 *    on the light surface (a bright amber text fails there) and flip in dark.
 * The accent is the Marketing group's, via --accent. */
.tok-badge {
  position: fixed; top: 4.2rem; right: 1rem; z-index: 150;
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.85rem; border-radius: 999px;
  font-size: 0.85rem; font-weight: 700; white-space: nowrap;
  text-decoration: none; cursor: pointer; transition: transform .15s ease;
  background: color-mix(in srgb, var(--accent) 12%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--bg));
  color: var(--accent-dk);
}
.tok-badge:hover { text-decoration: none; color: var(--accent-dk); background: color-mix(in srgb, var(--accent) 18%, var(--bg)); }
.tok-badge .tok-badge-icon { font-size: 0.95rem; }
.tok-badge[data-state="low"] { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-text); }
.tok-badge[data-state="zero"] { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.tok-badge.tok-badge-pulse { transform: scale(1.06); }

/* Keep the breadcrumb clear of the pill that floats at the right edge. */
.c-trail { min-height: 34px; padding-right: 10.5rem; }

/* ---- shared page parts ---- */
.lead { color: var(--muted); font-size: 20px; line-height: 1.55; max-width: 62ch; }
.row-end { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.row-end form { margin: 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.row-end button[type=submit] { margin-top: 0; }
.page-actions form { flex: none; max-width: none; margin: 0; }
.page-actions button[type=submit] { margin-top: 0; }
.panel > .note, .panel > .lede { margin: 0; }
.method {
  max-width: 70ch; padding: .7rem .9rem; font-size: 16px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: var(--r-md);
}
.method strong { color: var(--text); }
.score { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; margin-right: .5rem; }

/* The hero's call to action sits under the facts. */
.hero-action { margin: 16px 0 0; }
.hero-action button[type=submit] { margin-top: 0; }
.c-hero .btn.hero-action { display: inline-flex; }
.c-hero dd { color: var(--c-bar-text); }

/* ---- forms ---- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
@media (max-width: 720px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { margin: 0; }
.field--wide { grid-column: 1 / -1; }
.field .error { display: block; }
.inline-add { display: flex; gap: 8px; align-items: center; margin: 0; }
.inline-add input { min-width: 160px; }
.inline-add button[type=submit] { margin-top: 0; }
.share-link { min-width: 260px; }
.sample {
  margin: 0; padding: 1rem; overflow-x: auto;
  background: var(--sunken); border: 1px solid var(--border); border-radius: var(--r-md);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; line-height: 1.5;
}
.sample code { background: none; padding: 0; font-size: inherit; }
details.more > summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: .3rem 0; }
details.more > * + * { margin-top: 12px; }

/* ---- tables ---- */
.question { min-width: 260px; }
tr.is-paused td { color: var(--muted); }
.muted.is-expired { color: var(--warn); }
td button.toggle { gap: 8px; color: var(--muted); }
td button.toggle.is-on { color: var(--ok); border-color: var(--ok-line); background: var(--ok-bg); }
.toggle-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; display: block; }
.toggle.is-on .toggle-dot { background: currentColor; }
td button.btn--danger { background: var(--surface); color: var(--bad); border-color: var(--bad-line); }
td button.btn--danger:hover { background: var(--bad-bg); color: var(--bad); }

.rows { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.rows li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-top: 1px solid var(--row-line);
}
.rows li:first-child { border-top: 0; }
.rows form { margin: 0; }
.rows button[type=submit] { margin-top: 0; }

/* ---- dashboard ---- */
/* Three stat cards: three across, else one per row. Never two and an orphan. */
.stats-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 720px) { .stats-3 { grid-template-columns: minmax(0, 1fr); } }
.dot { background: var(--accent); }
.dot--share { background: var(--accent-lt); }
.dot--cite { background: var(--teal); }
.c-stat-value--empty { font-size: 20px; font-weight: 600; color: var(--dim); letter-spacing: 0; }
.stat-note { font-size: 14px; color: var(--muted); }
.stat-note.is-up { color: var(--ok); }
.stat-note.is-down { color: var(--bad); }
.coverage { margin-top: 12px; }

.trend { display: flex; gap: 10px; align-items: stretch; }
.trend-scale {
  order: -1; list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; justify-content: space-between;
  font-size: 13px; color: var(--dim); font-variant-numeric: tabular-nums;
}
.trend-chart { flex: 1; min-width: 0; height: auto; max-height: 240px; overflow: visible; }
.trend-rule { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.trend-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.trend-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }

.advice { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.advice li {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start;
  padding: 12px 0; border-top: 1px solid var(--row-line);
}
.advice li:first-child { border-top: 0; padding-top: 0; }
.advice h3 { margin-bottom: 2px; }

/* ---- actions ---- */
.action-head { display: flex; flex-direction: column; gap: 8px; }
.action-head h2 { margin: 0; }
.action-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.action.is-closed { background: var(--sunken); border-style: dashed; }
.evidence > summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.evidence > summary .muted { display: inline; margin-left: 8px; }
.evidence > * + * { margin-top: 12px; }
.evidence-row { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.evidence-row figcaption { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.evidence-prompt { font-weight: 600; }
.evidence-row blockquote {
  margin: 0; padding: .2rem 0 .2rem 1rem; color: var(--muted); font-size: 16px; line-height: 1.6;
  border-left: 3px solid var(--border-2); max-width: 70ch;
}
.evidence-row p { margin: 0; }

/* ---- run detail ---- */
.cell-head { display: flex; flex-direction: column; gap: 8px; }
.cell-head h2 { margin: 0; font-size: 1.05rem; }
.cell-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }
.cell-meta .muted { display: inline; }
.answer {
  white-space: pre-wrap; max-width: none; padding: .9rem 1rem;
  background: var(--sunken); border: 1px solid var(--border); border-radius: var(--r-md);
  font-size: 16px; line-height: 1.6;
}
.cell-derived { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 720px) { .cell-derived { grid-template-columns: minmax(0, 1fr); } }
.cell-derived h3 { margin-bottom: 6px; }
.taglist { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- tokens page ---- */
.balance-label {
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--dim);
}
.balance { font-size: 40px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.balance--unknown { color: var(--dim); }

/* A form that is only a button (Suggest questions) sits at the panel's even
 * gap; console.css's top margin on a submit is for buttons that follow fields. */
.panel > form > button[type=submit]:only-child { margin-top: 0; }

/* ---- narrow screens: keep the top bar and the six-tab bar on one line ---- */
@media (max-width: 1024px) {
  .c-crumb-sep { display: none; }
}
@media (max-width: 480px) {
  .c-chip { display: none; }
  .c-tabbar a { letter-spacing: .01em; min-width: 0; }
}

/* ---- nav: Workspaces drops its client brands down underneath ---- */
.c-nav-parent { position: relative; display: flex; align-items: center; }
.c-nav-parent > a { flex: 1; min-width: 0; padding-right: 40px; }
.c-nav-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; min-height: 0; margin: 0; padding: 0;
  display: grid; place-items: center;
  background: transparent; border: 0; border-radius: var(--r-sm);
  color: var(--dim); font-size: 14px; line-height: 1; cursor: pointer;
  transition: transform 160ms var(--ease), background 160ms var(--ease);
}
.c-nav-toggle:hover { background: var(--hover); color: var(--text); }
.c-nav-toggle[aria-expanded="false"] { transform: translateY(-50%) rotate(-90deg); }
.c-nav-sub { display: flex; flex-direction: column; gap: 2px; margin-left: 22px; padding-left: 8px; border-left: 1px solid var(--border); }
.c-nav-sub[hidden] { display: none; }
.c-nav a.c-nav-ws { min-height: 36px; }
.c-nav a.c-nav-ws.is-open { font-weight: 600; color: var(--accent-dk); }
.c-nav-pages { display: flex; flex-direction: column; gap: 2px; margin: 0 0 4px 12px; padding-left: 8px; border-left: 1px solid var(--border); }
.c-nav-pages a { min-height: 34px; font-size: 15px; }
@media (prefers-reduced-motion: reduce) {
  .c-nav-toggle { transition: none; }
}
