/* ============================================================ */
/*  VoltaContent — shared theme (dark + light)                    */
/* ============================================================ */

:root, [data-theme="dark"] {
  --bg: #0A0A0E;
  --surface: #111116;
  --surface-2: #16161C;
  --surface-3: #1D1D25;
  --line: #26262F;
  --line-2: #33333F;
  --fg: #F4F1E8;
  --fg-soft: #C9C5BA;
  --muted: #8C8A82;
  --mutedB: #6B6860;
  --yellow: #F5B400;
  --yellow-hot: #FFD84D;
  --yellow-soft: #FFE48A;
  --ok: #3DBC7E;
  --warn: #E8A33A;
  --x: #E06B6B;
  --aside-glow-1: rgba(245,180,0,0.18);
  --aside-glow-2: rgba(245,180,0,0.06);
  --code-key: var(--yellow-hot);
  --code-str: var(--ok);
  --check-tick: var(--bg);
  --logo-text: #F4F1E8;
  --logo-bracket: #F4F1E8;
  --logo-sub: #8C8A82;
  --shadow-card: 0 30px 60px -30px rgba(0,0,0,0.6);
}

[data-theme="light"] {
  --bg: #FAF8F2;
  --surface: #FFFFFF;
  --surface-2: #F4F1E8;
  --surface-3: #ECE7D8;
  --line: #E2DDC9;
  --line-2: #CFC9B3;
  --fg: #1A1814;
  --fg-soft: #4A4640;
  --muted: #8A857A;
  --mutedB: #B0AB9E;
  --yellow: #E5A300;
  --yellow-hot: #C98A00;
  --yellow-soft: #FFE48A;
  --ok: #1F8F58;
  --warn: #B3700A;
  --x: #B84444;
  --aside-glow-1: rgba(229,163,0,0.10);
  --aside-glow-2: rgba(229,163,0,0.04);
  --code-key: #B07900;
  --code-str: #1F8F58;
  --check-tick: #FFFFFF;
  --logo-text: #1A1814;
  --logo-bracket: #1A1814;
  --logo-sub: #8A857A;
  --shadow-card: 0 12px 30px -16px rgba(60,50,20,0.18);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: 'Inter Tight', sans-serif; font-weight: 400; -webkit-font-smoothing: antialiased;
  font-size: 14px;
  transition: background-color .25s ease, color .25s ease;
}
a { color: inherit; text-decoration: none; cursor: pointer; }
h1,h2,h3,h4 { margin: 0; font-weight: 600; letter-spacing: -0.025em; line-height: 1.1; }
em { font-style: italic; font-weight: 500; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--fg); }

/* Theme toggle — single icon button */
.theme-toggle {
  background: var(--surface); border: 1px solid var(--line);
  color: var(--fg-soft); width: 36px; height: 36px;
  border-radius: 100px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.theme-toggle:hover { color: var(--yellow-hot); border-color: var(--line-2); }

/* — sidebar slot — */
.theme-toggle.inline { align-self: flex-start; margin: 6px 4px 4px; }

/* — auth form slot — */
.theme-toggle.in-auth { position: absolute; top: 24px; right: 28px; }
.auth-form { position: relative; }

/* — fallback — */
.theme-toggle.floating { position: fixed; top: 16px; right: 18px; z-index: 100; box-shadow: var(--shadow-card); }

/* ============================================================ */
/*  AUTH (login / signup) — centered, single column              */
/* ============================================================ */
.auth {
  min-height: 100vh; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 48px 24px;
  background-image:
    radial-gradient(ellipse at 50% 0%, var(--aside-glow-1), transparent 55%),
    radial-gradient(ellipse at 50% 100%, var(--aside-glow-2), transparent 50%);
}

.auth-form {
  width: 100%; max-width: 420px;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 36px 36px 32px;
  box-shadow: var(--shadow-card);
}
.auth-form .auth-brand { display: flex; justify-content: center; margin-bottom: 22px; }
.auth-form .auth-brand svg { height: 32px; display: block; }
.auth-form .eyebrow { font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--muted); font-weight: 500; text-align: center; }
.auth-form h1 { font-size: 26px; margin: 8px 0 8px; letter-spacing: -0.025em; text-align: center; }
.auth-form .lead { color: var(--fg-soft); font-size: 13.5px; line-height: 1.5; margin: 0 auto 26px; max-width: 320px; text-align: center; }
.auth-form .field { margin-bottom: 18px; }
.auth-form .field label { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); font-weight: 500; display: block; margin-bottom: 8px; }
.auth-form .field input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; outline: none; transition: border-color .15s, background .15s; }
.auth-form .field input:focus { border-color: var(--yellow); background: var(--surface-2); }
.auth-form .field .helper { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.auth-form .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.auth-form .row-misc { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; margin: -4px 0 26px; }
.auth-form .row-misc label { display: flex; align-items: center; gap: 8px; color: var(--fg-soft); cursor: pointer; }
.auth-form .row-misc label input { accent-color: var(--yellow); width: 14px; height: 14px; }
.auth-form .row-misc a { color: var(--fg-soft); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.auth-form .row-misc a:hover { color: var(--yellow-hot); }
.auth-form .submit { width: 100%; background: var(--yellow); color: var(--bg); border: none; border-radius: 8px; padding: 14px; font-weight: 600; font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.auth-form .submit:hover { background: var(--yellow-hot); }
.auth-form .or { text-align: center; font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin: 24px 0; position: relative; }
.auth-form .or::before, .auth-form .or::after { content:''; position:absolute; top: 50%; width: calc(50% - 30px); height: 1px; background: var(--line); }
.auth-form .or::before { left: 0; }
.auth-form .or::after { right: 0; }
.auth-form .sso { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.auth-form .sso button { background: var(--surface); border: 1px solid var(--line); color: var(--fg); border-radius: 8px; padding: 12px; font-size: 13.5px; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 10px; }
.auth-form .sso button:hover { background: var(--surface-2); border-color: var(--line-2); }
.auth-form .footnote { margin-top: 32px; font-size: 13px; color: var(--fg-soft); }
.auth-form .footnote a { color: var(--yellow-hot); font-weight: 500; }

@media (max-width: 920px) {
  .auth-form { padding: 28px 24px 26px; border-radius: 12px; }
  .auth-form h1 { font-size: 22px; }
  .theme-toggle.in-auth { top: 14px; right: 14px; width: 32px; height: 32px; }
}

/* ============================================================ */
/*  APP SHELL                                                    */
/* ============================================================ */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 16px; display: flex; flex-direction: column; gap: 6px; height: 100vh; position: sticky; top: 0; }
.sidebar .brand { display: flex; align-items: center; gap: 8px; padding: 6px 8px 22px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.sidebar .brand svg { height: 28px; display: block; }

.nav-group { font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--muted); padding: 14px 10px 6px; font-weight: 500; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 7px; color: var(--fg-soft); font-size: 13.5px; font-weight: 500; cursor: pointer; transition: background .12s, color .12s; }
.nav-item:hover { background: var(--surface-2); color: var(--fg); }
.nav-item.active { background: var(--surface-3); color: var(--yellow-hot); }
.nav-item svg { flex-shrink: 0; opacity: 0.85; }
.nav-item .pill { margin-left: auto; font-size: 10px; padding: 2px 6px; border-radius: 100px; background: var(--surface-3); color: var(--muted); font-weight: 500; }
.nav-item.active .pill { background: var(--yellow); color: var(--bg); }
.nav-pj-label { font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--mutedB); padding: 16px 10px 6px; display: flex; align-items: center; gap: 8px; }
.nav-pj-label .pj-name { color: var(--fg); font-weight: 600; letter-spacing: -0.02em; text-transform: none; font-size: 12.5px; }

.sidebar .user { margin-top: auto; padding: 12px 10px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.sidebar .user .av { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--yellow), var(--yellow-hot)); color: #1A1814; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; }
.sidebar .user .info { flex: 1; min-width: 0; }
.sidebar .user .info .n { font-size: 12.5px; color: var(--fg); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .user .info .e { font-size: 11px; color: var(--muted); }
.sidebar .user .out { color: var(--muted); cursor: pointer; }
.sidebar .user .out:hover { color: var(--x); }

.main { padding: 28px 40px 80px; max-width: 1320px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.topbar .crumbs { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.topbar .crumbs a { color: var(--muted); }
.topbar .crumbs a:hover { color: var(--fg-soft); }
.topbar .crumbs .sep { color: var(--mutedB); }
.topbar .crumbs .here { color: var(--fg); font-weight: 500; }
.topbar .actions { display: flex; gap: 10px; align-items: center; }

.page-head { margin-bottom: 28px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 32px; letter-spacing: -0.03em; }
.page-head .sub { color: var(--fg-soft); font-size: 14px; margin-top: 8px; max-width: 60ch; line-height: 1.5; }
.page-head .actions { display: flex; gap: 10px; }

/* primitives */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font-size: 13px; font-weight: 500; }
.btn:hover { background: var(--surface-2); border-color: var(--line-2); }
.btn.primary { background: var(--yellow); color: var(--bg); border-color: var(--yellow); font-weight: 600; }
.btn.primary:hover { background: var(--yellow-hot); border-color: var(--yellow-hot); color: var(--bg); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--x); }
.btn.sm { padding: 6px 11px; font-size: 12px; }
.btn.icon { padding: 8px; }

.pill-tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 100px; font-size: 11px; font-weight: 500; letter-spacing: 0.2px; }
.pill-tag.ok    { background: rgba(61,188,126,0.13); color: var(--ok); }
.pill-tag.run   { background: rgba(245,180,0,0.16); color: var(--yellow-hot); }
.pill-tag.warn  { background: rgba(232,163,58,0.14); color: var(--warn); }
.pill-tag.err   { background: rgba(224,107,107,0.14); color: var(--x); }
.pill-tag.muted { background: var(--surface-3); color: var(--muted); }
.pill-tag .dot  { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.card .card-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.card .card-head h3 { font-size: 16px; }
.card .card-body { padding: 22px; }

/* tables */
.tbl-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tbl-toolbar { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tbl-toolbar .search { flex: 1; min-width: 200px; position: relative; }
.tbl-toolbar .search input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 8px 12px 8px 34px; outline: none; font-size: 13px; }
.tbl-toolbar .search input:focus { border-color: var(--yellow); }
.tbl-toolbar .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.tbl-toolbar .filters { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tbl-toolbar .chip { background: var(--surface-2); border: 1px solid var(--line); color: var(--fg-soft); padding: 5px 11px; border-radius: 100px; font-size: 11.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.tbl-toolbar .chip .ct { color: var(--muted); font-variant-numeric: tabular-nums; }
.tbl-toolbar .chip:hover { color: var(--fg); border-color: var(--line-2); }
.tbl-toolbar .chip.active { background: var(--yellow); border-color: var(--yellow); color: var(--bg); font-weight: 600; }
.tbl-toolbar .chip.active .ct { color: rgba(0,0,0,0.7); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl thead th { text-align: left; padding: 12px 16px; font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; }
table.tbl thead th.sort { cursor: pointer; }
table.tbl thead th.sort .arrow { color: var(--mutedB); margin-left: 4px; }
table.tbl tbody td { padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--fg-soft); vertical-align: middle; }
table.tbl tbody tr:hover td { background: var(--surface-2); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl .check { width: 16px; height: 16px; border-radius: 4px; border: 1.4px solid var(--line-2); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer; background: var(--bg); }
table.tbl .check.on { background: var(--yellow); border-color: var(--yellow); }
table.tbl .check.on::after { content:'✓'; color: var(--check-tick); font-size: 10px; font-weight: 700; }
table.tbl .row-actions { display: flex; gap: 6px; opacity: 0.6; transition: opacity .15s; }
table.tbl tr:hover .row-actions { opacity: 1; }
table.tbl .name { font-weight: 500; color: var(--fg); }
table.tbl .name .kw { background: var(--surface-3); padding: 2px 7px; border-radius: 4px; font-family: 'Inter Tight', monospace; font-size: 12px; color: var(--yellow-hot); font-weight: 500; }
table.tbl .num { font-variant-numeric: tabular-nums; color: var(--fg); }
table.tbl .muted { color: var(--muted); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; }
.stat-card .lbl { font-size: 10.5px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.stat-card .val { font-size: 32px; letter-spacing: -0.03em; margin-top: 8px; font-weight: 600; line-height: 1; color: var(--fg); }
.stat-card .delta { font-size: 11px; color: var(--ok); margin-top: 8px; display: flex; align-items: center; gap: 4px; }
.stat-card .delta.down { color: var(--x); }
.stat-card.accent { background: var(--yellow); color: #1A1814; border-color: var(--yellow); }
.stat-card.accent .lbl { color: rgba(0,0,0,0.6); }
.stat-card.accent .val { color: #1A1814; }
.stat-card.accent .delta { color: #1A1814; }

/* form rows */
.field-row { display: grid; grid-template-columns: 220px 1fr; gap: 32px; padding: 22px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.field-row:last-child { border-bottom: none; }
.field-row .meta { padding-top: 6px; }
.field-row .meta .label { font-size: 14px; font-weight: 600; color: var(--fg); margin-bottom: 6px; }
.field-row .meta .desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.field-row .ctl { max-width: 540px; }
.field-row .ctl input, .field-row .ctl select, .field-row .ctl textarea { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; outline: none; transition: border-color .15s; }
.field-row .ctl input:focus, .field-row .ctl select:focus, .field-row .ctl textarea:focus { border-color: var(--yellow); }
.field-row .ctl textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
.field-row .helper { font-size: 11.5px; color: var(--muted); margin-top: 8px; }

.seg { display: inline-flex; padding: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; gap: 2px; }
.seg button { background: transparent; border: none; color: var(--fg-soft); padding: 7px 14px; border-radius: 5px; font-size: 12.5px; font-weight: 500; }
.seg button.on { background: var(--surface-2); color: var(--yellow-hot); border: 1px solid var(--line-2); }

.chip-input { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; min-height: 44px; }
.chip-input .c { background: var(--surface-2); border: 1px solid var(--line-2); color: var(--fg); padding: 4px 10px; border-radius: 100px; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.chip-input .c .x { color: var(--muted); cursor: pointer; }
.chip-input .c .x:hover { color: var(--x); }
.chip-input input { background: transparent; border: none; outline: none; font-size: 13px; flex: 1; min-width: 80px; padding: 4px 6px; color: var(--fg); }

.opt-cards { display: grid; gap: 10px; }
.opt-card { border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 16px 18px; display: flex; align-items: flex-start; gap: 14px; cursor: pointer; transition: all .15s; }
.opt-card:hover { border-color: var(--line-2); }
.opt-card.on { border-color: var(--yellow); background: rgba(245,180,0,0.05); }
.opt-card .rd { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-2); flex-shrink: 0; margin-top: 2px; position: relative; }
.opt-card.on .rd { border-color: var(--yellow); }
.opt-card.on .rd::after { content:''; position:absolute; inset: 4px; border-radius: 50%; background: var(--yellow); }
.opt-card .body { flex: 1; }
.opt-card .body .t { font-size: 14px; font-weight: 600; color: var(--fg); }
.opt-card .body .d { font-size: 12.5px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.opt-card .body .meta { font-size: 11px; color: var(--muted); margin-top: 8px; display: flex; gap: 12px; }
.opt-card .body .meta b { color: var(--fg); font-weight: 500; }

/* QA */
.qa-list { display: flex; flex-direction: column; gap: 12px; }
.qa-item { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.qa-item .head { padding: 16px 20px; display: grid; grid-template-columns: 24px 1fr auto auto auto; gap: 16px; align-items: center; cursor: pointer; }
.qa-item .head:hover { background: var(--surface-2); }
.qa-item .q { font-size: 14.5px; font-weight: 500; color: var(--fg); line-height: 1.4; }
.qa-item .relevance { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.qa-item .relevance .bar { width: 50px; height: 4px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.qa-item .relevance .bar i { display: block; height: 100%; background: var(--yellow); border-radius: 3px; }
.qa-item .body { padding: 0 20px 20px 60px; border-top: 1px dashed var(--line); color: var(--fg-soft); font-size: 13.5px; line-height: 1.65; }
.qa-item .body p { margin: 16px 0 0; }
.qa-item .body .actions { display: flex; gap: 8px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.qa-item .body .meta { font-size: 11px; color: var(--muted); margin-top: 12px; display: flex; gap: 14px; flex-wrap: wrap; }
.qa-item .body .meta b { color: var(--fg-soft); }

/* Q&A list sortable header + keyword grouping (rendered server-side) */
.qa-thead { display: grid; grid-template-columns: 24px 1fr auto auto 36px; gap: 16px; align-items: center; padding: 10px 20px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px 10px 0 0; font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); font-weight: 500; margin-bottom: -1px; }
.qa-thead .qa-sort { background: transparent; border: 0; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; padding: 0; text-align: left; display: inline-flex; align-items: center; gap: 6px; }
.qa-thead .qa-sort:hover { color: var(--fg); }
.qa-thead .qa-sort.active { color: var(--fg); }
.qa-thead .qa-sort .arrow { opacity: 0.4; font-size: 9px; }
.qa-thead .qa-sort.active .arrow { opacity: 1; color: var(--yellow-hot); }
.qa-list.has-thead { gap: 0; }
.qa-list.has-thead .qa-item { border-radius: 0; border-top-width: 0; }
.qa-list.has-thead .qa-item:last-child { border-radius: 0 0 10px 10px; }
.qa-group-head { background: var(--surface-2); padding: 9px 20px; font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); font-weight: 500; border: 1px solid var(--line); border-top: 1px solid var(--line-2); border-bottom: 0; display: flex; align-items: center; gap: 10px; }
.qa-group-head .ct { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 7px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; color: var(--fg-soft); font-weight: 600; font-size: 11px; letter-spacing: 0; text-transform: none; font-variant-numeric: tabular-nums; }
.qa-group-head b { color: var(--fg-soft); font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.qa-list.has-thead > .qa-group-head:first-child { border-top: 0; }
.qa-group-head + .qa-group-head { border-top: 0; }

.exp-preview { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 18px; font-size: 11.5px; line-height: 1.7; color: var(--fg-soft); font-variant-numeric: tabular-nums; overflow-x: auto; white-space: pre; }
.exp-preview .key { color: var(--code-key); }
.exp-preview .str { color: var(--code-str); }
.exp-preview .com { color: var(--mutedB); }

/* ============================================================ */
/*  MOBILE TOPBAR (app pages)                                    */
/* ============================================================ */
.m-topbar { display: none; }

@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 280px; max-width: 88vw;
    transform: translateX(-100%); transition: transform .25s ease;
    z-index: 90; height: 100vh;
    box-shadow: 0 30px 60px rgba(0,0,0,0.4);
  }
  .sidebar.open { transform: translateX(0); }

  .m-topbar {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 18px;
    background: var(--surface); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 50;
  }
  .m-topbar .burger {
    background: transparent; border: 1px solid var(--line); color: var(--fg);
    width: 36px; height: 36px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
  }
  .m-topbar .brand { display: flex; align-items: center; }
  .m-topbar .brand svg { height: 20px; }
  .m-topbar .spacer { flex: 1; }

  .m-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55);
    z-index: 80;
  }
  .m-backdrop.show { display: block; }

  .main { padding: 22px 18px 60px; }
  .topbar { display: none; }
  .page-head { gap: 12px; }
  .page-head h1 { font-size: 24px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; justify-content: center; }
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 14px 16px; }
  .stat-card .val { font-size: 24px; }
  .field-row { grid-template-columns: 1fr; gap: 12px; padding: 18px 0; }
  .tbl-toolbar { padding: 12px; gap: 10px; }
  .tbl-toolbar .filters { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .tbl-wrap { overflow-x: auto; }
  table.tbl thead th, table.tbl tbody td { padding: 10px 12px; font-size: 12.5px; }
  .qa-item .head { grid-template-columns: 20px 1fr auto; gap: 12px; padding: 14px; }
  .qa-item .head .relevance, .qa-item .head .pill-tag { display: none; }
  .qa-item .body { padding: 0 14px 16px 46px; }
}

@media (max-width: 480px) {
  .auth-form .row-2 { grid-template-columns: 1fr; gap: 0; }
  .auth-form .sso { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
}

/* ============================================================ */
/*  LEGACY COMPAT — backwards-compatible aliases for templates   */
/*  not yet rewritten with the new component patterns.           */
/* ============================================================ */

/* Page header (old style) */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 26px; letter-spacing: -0.025em; }

/* Buttons */
.btn-primary { background: var(--yellow); color: var(--bg); border: 1px solid var(--yellow); border-radius: 7px; padding: 9px 16px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.btn-primary:hover { background: var(--yellow-hot); border-color: var(--yellow-hot); }
.btn-outline { background: transparent; color: var(--fg); border: 1px solid var(--line); border-radius: 7px; padding: 9px 16px; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; }
.btn-outline:hover { background: var(--surface-2); border-color: var(--line-2); }
.btn-ghost { background: transparent; border: none; color: var(--fg-soft); }
.btn-ghost:hover { color: var(--fg); }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-lg { padding: 12px 22px; font-size: 14px; }

/* Form controls (old style) */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); font-weight: 500; margin-bottom: 8px; }
.form-control { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; outline: none; color: var(--fg); font-size: 13.5px; transition: border-color 0.15s ease; }
.form-control:focus { border-color: var(--yellow); }
textarea.form-control { min-height: 90px; resize: vertical; line-height: 1.5; }
select.form-control { appearance: auto; }

/* Searchable select (legacy widget) — re-themed to match app.css palette */
.searchable-select { position: relative; }
.searchable-select-display.form-control {
    cursor: pointer;
    user-select: none;
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238C8A82' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-color: var(--bg);
    display: flex;
    align-items: center;
    min-height: 40px;
    line-height: 1.3;
}
.searchable-select-text { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.searchable-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 7px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    z-index: 50;
    overflow: hidden;
}
.searchable-select.open .searchable-select-dropdown { display: block; }
.searchable-select-search {
    width: 100%;
    padding: 8px 12px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--fg);
    font-size: 13px;
    font-family: inherit;
    outline: none;
}
.searchable-select-options { max-height: 220px; overflow-y: auto; }
.searchable-select-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--fg);
}
.searchable-select-option:hover { background: var(--surface-3); }
.searchable-select-option.selected { background: var(--surface-3); color: var(--yellow); font-weight: 500; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13.5px; margin-bottom: 16px; border: 1px solid; }
.alert-success { background: rgba(61,188,126,0.10); border-color: rgba(61,188,126,0.3); color: var(--ok); }
.alert-error,
.alert-danger  { background: rgba(224,107,107,0.10); border-color: rgba(224,107,107,0.3); color: var(--x); }
.alert-warning { background: rgba(232,163,58,0.10); border-color: rgba(232,163,58,0.3); color: var(--warn); }
.alert-info    { background: var(--surface-2); border-color: var(--line); color: var(--fg-soft); }

/* Tables (old) */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.table-wrap table,
table:not(.tbl) { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-wrap thead th,
table:not(.tbl) thead th { text-align: left; padding: 12px 16px; font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.table-wrap tbody td,
table:not(.tbl) tbody td { padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--fg-soft); vertical-align: middle; }
.table-wrap tbody tr:hover td,
table:not(.tbl) tbody tr:hover td { background: var(--surface-2); }
.table-wrap tbody tr:last-child td,
table:not(.tbl) tbody tr:last-child td { border-bottom: none; }

/* Badge / pill */
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 100px; font-size: 11px; font-weight: 500; background: var(--surface-3); color: var(--fg-soft); }
.badge-success, .badge-ok       { background: rgba(61,188,126,0.13); color: var(--ok); }
.badge-warning, .badge-pending  { background: rgba(245,180,0,0.16); color: var(--yellow-hot); }
.badge-danger, .badge-error     { background: rgba(224,107,107,0.14); color: var(--x); }
.badge-info                     { background: var(--surface-2); color: var(--fg-soft); }
.badge-role-admin, .badge-role-superadmin { background: rgba(245,180,0,0.16); color: var(--yellow-hot); }
.badge-role-user                { background: var(--surface-3); color: var(--muted); }
.badge-sm { font-size: 10px; padding: 2px 6px; }

/* Utility classes used in templates */
.text-muted { color: var(--muted); }
.text-sm    { font-size: 12.5px; }
.text-xs    { font-size: 11px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }

/* Card body scoped only when not the new .card-body pattern */
.card:not(:has(.card-head)) { padding: 22px; }

/* Toast container (kept for app.js) */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 11px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-2);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  font-size: 13px;
  color: var(--fg);
  max-width: 340px;
  animation: toast-in 0.25s ease;
}
.toast.toast-success { border-left-color: var(--ok); }
.toast.toast-error   { border-left-color: var(--x); }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* Inline spinner (Generate / AI rewrite buttons) — was only in style.css (marketing), invisible in-app */
.spinner-inline {
  display: inline-block; width: 0.8em; height: 0.8em;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  vertical-align: -0.1em; animation: vc-spin 0.8s linear infinite;
}
@keyframes vc-spin { to { transform: rotate(360deg); } }

/* Global keyboard focus ring (WCAG 2.4.7) — !important to defeat the scattered outline:none rules */
:focus-visible { outline: 2px solid var(--yellow) !important; outline-offset: 2px; border-radius: 3px; }

/* Disabled controls */
.btn:disabled, .btn[disabled], button:disabled, [disabled] { opacity: 0.5; cursor: not-allowed; }

/* Burger button used by old layout (kept for fallback before app-theme.js mounts mobile topbar) */
.burger-menu { display: none; }

/* Old auth-* classes — superseded but harmless if still rendered */
.auth-layout { display: none; }
.auth-card   { display: none; }

/* ====================================================================== */
/*  Q&A EDITOR                                                             */
/* ====================================================================== */
.edit-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.edit-head .left { flex: 1; min-width: 0; }
.edit-head .back { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 12px; text-decoration: none; }
.edit-head .back:hover { color: var(--fg); }
.edit-head .kw-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.edit-head h1 { font-size: 24px; letter-spacing: -0.02em; line-height: 1.25; max-width: 760px; }
.edit-head .kw-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 100px; background: var(--surface); border: 1px solid var(--line); font-size: 12px; color: var(--fg-soft); }
.edit-head .kw-pill b { color: var(--yellow-hot); font-weight: 600; }
.edit-head .rel { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.edit-head .rel .bar { width: 70px; height: 4px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.edit-head .rel .bar i { display: block; height: 100%; background: var(--yellow); }
.edit-head .actions { display: flex; gap: 8px; align-items: center; }

.status-track { display: flex; align-items: center; gap: 4px; padding: 8px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 100px; font-size: 11.5px; color: var(--muted); }
.status-track .step { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 100px; }
.status-track .step.done { color: var(--ok); }
.status-track .step.now { color: var(--yellow-hot); background: rgba(245,180,0,0.1); }
.status-track .step .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-track .sep { color: var(--line-2); }

.prop-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 22px; }
.prop { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.prop:hover { border-color: var(--line-2); }
.prop.selected { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(245,180,0,0.14); }
.prop .p-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.prop .p-head .ic { width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--fg-soft); }
.prop.google .p-head .ic { background: rgba(245,180,0,0.12); color: var(--yellow-hot); }
.prop.ai-1 .p-head .ic, .prop.ai-2 .p-head .ic { background: var(--surface-3); color: var(--fg); }
.prop .p-head .lbl { font-size: 12px; font-weight: 600; color: var(--fg); letter-spacing: -0.01em; }
.prop .p-head .meta { margin-left: auto; font-size: 10.5px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }
.prop .p-body { padding: 18px; flex: 1; font-size: 13.5px; line-height: 1.65; color: var(--fg-soft); }
.prop .p-body p { margin: 0; }
.prop .p-body em { color: var(--yellow-hot); font-style: normal; font-weight: 500; }
.prop .p-foot { padding: 12px 18px; border-top: 1px dashed var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.prop .p-foot .stats { display: flex; gap: 12px; font-size: 11px; color: var(--muted); }
.prop .p-foot .stats span b { color: var(--fg-soft); font-weight: 500; }
.prop .use-btn { padding: 7px 14px; font-size: 12px; font-weight: 500; border-radius: 7px; border: 1px solid var(--line-2); background: transparent; color: var(--fg); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.prop .use-btn:hover { background: var(--surface-2); }
.prop.selected .use-btn { background: var(--yellow); color: var(--bg); border-color: var(--yellow); font-weight: 600; }

.final-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.final-head { padding: 16px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.final-head .title { display: flex; align-items: center; gap: 10px; }
.final-head .title h2 { font-size: 15px; letter-spacing: -0.01em; margin: 0; }
.final-head .title .ic { width: 28px; height: 28px; border-radius: 8px; background: var(--yellow); color: var(--bg); display: inline-flex; align-items: center; justify-content: center; }
.final-head .src { font-size: 11px; color: var(--muted); }
.final-head .src b { color: var(--yellow-hot); font-weight: 500; }
.final-body { padding: 26px 28px 8px; }
.final-body textarea { width: 100%; min-height: 180px; background: transparent; border: 0; outline: 0; resize: vertical; color: var(--fg); font-family: 'Inter Tight', sans-serif; font-size: 16px; line-height: 1.7; letter-spacing: -0.005em; }
.final-body textarea::placeholder { color: var(--mutedB); }
.final-foot { padding: 14px 22px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.final-foot .stats { display: flex; gap: 18px; font-size: 11.5px; color: var(--muted); align-items: center; }
.final-foot .stats b { color: var(--fg-soft); font-weight: 500; font-variant-numeric: tabular-nums; }
.final-foot .stats .ok { color: var(--ok); }
.final-foot .actions { display: flex; gap: 8px; align-items: center; }

.src-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 100px; font-size: 11px; color: var(--yellow-hot); background: rgba(245,180,0,0.12); border: 1px solid rgba(245,180,0,0.25); }
.src-chip code { font-family: ui-monospace, "SF Mono", monospace; font-size: 11px; }

kbd { display: inline-flex; align-items: center; padding: 1px 6px; min-width: 18px; height: 18px; border-radius: 4px; background: var(--surface-3); border: 1px solid var(--line-2); border-bottom-width: 2px; color: var(--fg-soft); font-family: ui-monospace, monospace; font-size: 10px; font-weight: 500; }

@media (max-width: 1100px) {
    .prop-grid { grid-template-columns: 1fr; }
    .edit-head .actions { width: 100%; }
    .edit-head h1 { font-size: 20px; }
    .status-track { flex-wrap: wrap; }
    .final-body { padding: 20px; }
    .final-body textarea { font-size: 15px; }
}

/* ====================================================================== */
/*  PROJECT DETAIL                                                         */
/* ====================================================================== */
.pj-hero { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px 32px; margin-bottom: 24px; }
.pj-hero .meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.pj-hero h1 { font-size: 32px; letter-spacing: -0.03em; margin: 0; }
.pj-hero .domain { display: inline-flex; align-items: center; gap: 8px; color: var(--fg-soft); font-size: 13px; }
.pj-hero .domain a { color: var(--yellow-hot); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.pj-hero .locale { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); padding: 3px 9px; border: 1px solid var(--line); border-radius: 100px; }
.pj-hero .pj-actions { display: flex; gap: 8px; align-items: center; }

.pj-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 24px 0 22px; flex-wrap: wrap; }
.pj-tabs a { padding: 10px 16px; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; cursor: pointer; }
.pj-tabs a:hover { color: var(--fg); }
.pj-tabs a.on { color: var(--yellow-hot); border-bottom-color: var(--yellow); }

.empty { background: var(--surface); border: 1px dashed var(--line-2); border-radius: 12px; padding: 36px; text-align: center; }
.empty .ic { width: 48px; height: 48px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; color: var(--yellow-hot); margin-bottom: 14px; }
.empty h3 { font-size: 18px; margin-bottom: 6px; }
.empty p { color: var(--muted); font-size: 13px; max-width: 420px; margin: 0 auto 16px; line-height: 1.5; }
.empty .actions { display: inline-flex; gap: 8px; }

.members-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.mem-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.mem-head h3 { font-size: 15px; }
.mem-head .ct { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin-left: 10px; }
table.mem-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.mem-tbl thead th { text-align: left; padding: 11px 22px; font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); font-weight: 500; background: var(--surface-2); border-bottom: 1px solid var(--line); }
table.mem-tbl tbody td { padding: 14px 22px; border-bottom: 1px solid var(--line); color: var(--fg-soft); }
table.mem-tbl tbody tr:last-child td { border-bottom: none; }
table.mem-tbl tbody tr:hover td { background: var(--surface-2); }
table.mem-tbl .who { display: flex; align-items: center; gap: 10px; }
table.mem-tbl .who .av { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; }
table.mem-tbl .who .av.a { background: linear-gradient(135deg, var(--yellow), var(--yellow-hot)); color: #1A1814; }
table.mem-tbl .who .av.b { background: var(--surface-3); color: var(--fg-soft); border: 1px solid var(--line); }
table.mem-tbl .who .nm { color: var(--fg); font-weight: 500; }
table.mem-tbl .role-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 100px; font-size: 11px; font-weight: 500; }
table.mem-tbl .role-pill.admin { background: rgba(245,180,0,0.16); color: var(--yellow-hot); }
table.mem-tbl .role-pill.user { background: var(--surface-3); color: var(--fg-soft); }

.col-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 22px; align-items: start; }
.side-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.side-card h3 { font-size: 14px; margin-bottom: 14px; }
.side-card .row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 13px; gap: 10px; }
.side-card .row:last-child { border-bottom: none; }
.side-card .row .k { color: var(--muted); flex-shrink: 0; }
.side-card .row .v { color: var(--fg); font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; word-break: break-word; }
.side-card .row .v.muted { color: var(--muted); font-weight: 400; }

.timeline { display: flex; flex-direction: column; gap: 14px; }
.timeline .ev { display: grid; grid-template-columns: 8px 1fr; gap: 14px; align-items: start; font-size: 12.5px; color: var(--fg-soft); }
.timeline .ev .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); margin-top: 5px; box-shadow: 0 0 0 3px rgba(245,180,0,0.18); }
.timeline .ev .t { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Q&A progress card (mini summary when project has activity) */
.qa-progress-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.qa-progress-card .card-head { padding: 16px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.qa-progress-card .card-head h3 { font-size: 15px; margin: 0; }
.qa-progress-card .card-body { padding: 22px; }
.qa-progress-headline { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.qa-progress-headline .num { font-size: 36px; font-weight: 600; letter-spacing: -0.03em; color: var(--yellow-hot); }
.qa-progress-headline .lbl { font-size: 13px; color: var(--muted); }
.qa-progress-bar { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface-3); margin-bottom: 16px; }
.qa-progress-bar .seg { display: block; min-width: 0; }
.qa-progress-bar .seg.ok { background: var(--ok); }
.qa-progress-bar .seg.warn { background: var(--yellow); }
.qa-progress-bar .seg.run { background: var(--yellow-hot); }
.qa-progress-bar .seg.muted { background: var(--mutedB); }
.qa-progress-bar .seg.err { background: var(--x); }
.qa-progress-legend { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 18px; font-size: 12px; }
.qa-progress-legend li { display: flex; align-items: center; gap: 8px; color: var(--fg-soft); }
.qa-progress-legend li b { margin-left: auto; color: var(--fg); font-variant-numeric: tabular-nums; font-weight: 600; }
.qa-progress-legend .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.qa-progress-legend .dot.ok { background: var(--ok); }
.qa-progress-legend .dot.warn { background: var(--yellow); }
.qa-progress-legend .dot.run { background: var(--yellow-hot); }
.qa-progress-legend .dot.muted { background: var(--mutedB); }
.qa-progress-legend .dot.err { background: var(--x); }
.qa-progress-cta { display: flex; justify-content: flex-end; }

@media (max-width: 920px) {
    .pj-hero { grid-template-columns: 1fr; padding: 22px; gap: 18px; }
    .pj-hero .pj-actions { width: 100%; }
    .pj-hero .pj-actions .btn { flex: 1; justify-content: center; }
    .pj-hero h1 { font-size: 24px; }
    .col-2 { grid-template-columns: 1fr; }
    table.mem-tbl thead th, table.mem-tbl tbody td { padding: 10px 14px; }
    .qa-progress-legend { grid-template-columns: 1fr; }
}

.qa-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
    padding: 4px 0;
}
.qa-nav .qa-nav-pos {
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.2px;
}
.qa-nav .qa-nav-pos b { color: var(--fg-soft); font-weight: 600; }
.qa-nav .btn.disabled,
.qa-nav .btn[aria-disabled="true"] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    color: var(--mutedB);
}
