/* Jeeves Builder console — dark, black + gold, aligned to the desktop app tokens. */
:root {
  color-scheme: dark;
  --bg: #000; --bg-raised: #0d0d0c; --surface: #141310; --surface-2: #1c1b16;
  --border: rgba(199, 176, 109, 0.20); --border-subtle: rgba(255, 255, 255, 0.07);
  --heading: #fff; --text: #f2f0ea; --muted: #b7b1a3; --dim: #7d7768;
  --gold: #c7b06d; --gold-bright: #e9c96a; --gold-hover: #f0d488; --on-gold: #0a0a0a;
  --success: #5fbf8f; --warning: #e0a94a; --danger: #e24b4a;
  --font: Inter, system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
  --radius: 12px; --radius-sm: 8px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
button, select, textarea, input { font-family: inherit; }

.shell { display: grid; grid-template-columns: 236px 1fr; height: 100vh; }

/* Rail */
.rail { background: var(--bg-raised); border-right: 1px solid var(--border-subtle); display: flex; flex-direction: column; }
.brand { padding: 18px 16px 14px; font-size: 18px; font-weight: 700; color: var(--heading); display: flex; align-items: center; gap: 8px; }
.brand em { color: var(--gold); font-style: normal; font-weight: 500; }
.brand-dot { width: 12px; height: 12px; border-radius: 3px; background: var(--gold-bright); }
.nav { display: flex; flex-direction: column; padding: 4px 8px; gap: 2px; }
.nav button {
  text-align: left; background: transparent; border: none; color: var(--muted);
  padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px;
  display: flex; justify-content: space-between; align-items: center; transition: background 120ms, color 120ms;
}
.nav button:hover { background: var(--surface); color: var(--text); }
.nav button.active { background: var(--surface-2); color: var(--text); box-shadow: inset 2px 0 0 var(--gold-bright); }
.count { background: var(--gold-bright); color: var(--on-gold); font-size: 11px; font-weight: 700; border-radius: 9px; padding: 1px 7px; min-width: 18px; text-align: center; }
.rail-foot { margin-top: auto; padding: 14px; border-top: 1px solid var(--border-subtle); }
.rail-foot label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gold); }
.rail-foot select { width: 100%; margin-top: 6px; padding: 7px 8px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.actor-meta { margin-top: 8px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Main */
.main { display: flex; flex-direction: column; overflow: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--border-subtle); }
#crumb { font-size: 15px; font-weight: 600; color: var(--heading); }
.topbar-note { font-size: 12px; color: var(--dim); }
.view { flex: 1; overflow-y: auto; padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius); padding: 16px; }
.card.row { display: flex; align-items: center; gap: 14px; }
.grow { flex: 1; }
.card-title { font-size: 15px; font-weight: 600; color: var(--heading); }
.card-h { font-size: 13px; font-weight: 600; color: var(--gold); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.muted { color: var(--muted); font-size: 13px; }
.empty { color: var(--dim); text-align: center; padding: 60px 0; }

/* Buttons */
.btn { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; transition: background 120ms, border-color 120ms; }
.btn:hover { background: var(--surface); }
.btn.gold { background: var(--gold-bright); color: var(--on-gold); border-color: transparent; font-weight: 600; }
.btn.gold:hover { background: var(--gold-hover); }
.btn.ghost { background: transparent; }
.btn.link { background: none; border: none; color: var(--gold); padding: 0 0 6px; }
.btn.danger-ghost { background: transparent; border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); }

/* Tenant management */
.admin-badge { font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--on-gold); background: var(--gold); border-radius: 5px; padding: 1px 5px; margin-left: 6px; }
.text-in { width: 100%; margin-top: 8px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 14px; }
.assign-row { display: flex; flex-wrap: wrap; gap: 8px; }
.assign-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; padding: 6px 11px; border-radius: 20px; border: 1px solid var(--border-subtle); background: var(--surface-2); color: var(--muted); cursor: pointer; transition: background 120ms, color 120ms, border-color 120ms; }
.assign-chip:hover { color: var(--text); }
.assign-chip.on { background: color-mix(in srgb, var(--gold) 16%, transparent); border-color: var(--border); color: var(--gold-bright); }
.assign-chip input { accent-color: var(--gold-bright); margin: 0; }

/* Tenant-side users */
.role-select { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border-subtle); }
.user-row:first-of-type { border-top: none; }
.pill.role-t_admin { background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--gold-bright); border-color: transparent; }
.pill.role-operator { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); border-color: transparent; }
.pill.role-reviewer { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); border-color: transparent; }
.pill.role-viewer { background: var(--surface-2); color: var(--muted); }
.vtable.matrix th.c, .vtable.matrix td.c { text-align: center; }
.vtable.matrix td.g-allow { color: var(--success); font-weight: 700; }
.vtable.matrix td.g-conditional { color: var(--warning); font-weight: 700; }
.vtable.matrix td.g-deny { color: var(--dim); }

/* Detail */
.detail-head h2 { margin: 4px 0 6px; color: var(--heading); font-size: 20px; }
.skill { font-family: var(--mono); font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; color: var(--text); margin: 0; max-height: 340px; overflow: auto; }
.notes { border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent); background: color-mix(in srgb, var(--warning) 8%, transparent); border-radius: var(--radius); padding: 12px 14px; }
.notes-h { color: var(--warning); font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.note { font-size: 13px; color: var(--text); padding: 3px 0; }

/* Certify panel */
.certify .field { margin-bottom: 10px; }
.certify label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.certify select, .certify textarea { width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }
.certify textarea { resize: vertical; }
.certify .actions { display: flex; gap: 8px; margin-top: 6px; }
.blocked { color: var(--warning); font-size: 14px; padding: 6px 0 10px; }

/* Pills */
.pill { font-size: 11px; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--border); color: var(--gold); text-transform: none; }
.pill.admin { background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--gold-bright); border-color: transparent; }
.pill.builder { background: var(--surface-2); color: var(--muted); }
.pill.st-in_review { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 45%, transparent); }
.pill.st-published { color: var(--success); border-color: color-mix(in srgb, var(--success) 45%, transparent); }
.pill.st-approved { color: var(--success); border-color: color-mix(in srgb, var(--success) 45%, transparent); }
.pill.st-needs_changes, .pill.st-rejected { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.ver { margin-left: auto; font-family: var(--mono); color: var(--gold-bright); font-size: 13px; }

/* Tables */
.vtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.vtable th { text-align: left; color: var(--dim); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; padding: 6px 10px; border-bottom: 1px solid var(--border-subtle); }
.vtable td { padding: 9px 10px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.vtable tr:last-child td { border-bottom: none; }
.sig { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.vtable code { font-family: var(--mono); font-size: 12px; color: var(--gold); }

/* Toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0; transition: opacity 180ms, transform 180ms; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); padding: 10px 16px; border-radius: var(--radius); font-size: 13px; pointer-events: none; max-width: 80vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: color-mix(in srgb, var(--danger) 55%, transparent); color: #ffb4b3; }

/* In-flight captures (MP-4585, ported to the served console under MP-4885) — uploaded, not yet
   certifiable. Reuses .card/.pill; only the states that did not exist before are new. `pending`
   borrows --warning and `dead` --danger, the same vocabulary the rest of the console already uses
   for "attention" vs "wrong". */
.section-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--dim); margin: 18px 0 8px; }
.section-label:first-child { margin-top: 0; }
.card.inflight { border-style: dashed; }
.card.inflight.dead { border-color: color-mix(in srgb, var(--danger) 40%, transparent); border-style: solid; }
.pill.pending { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); border-color: transparent; }
.pill.dead { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); border-color: transparent; }
.err { color: var(--danger); }
/* Review-card verdicts (MP-4585): the two questions a reviewer used to answer by opening the item —
   "will certify refuse this?" and "may I be the one to press it?". `ready` uses --success, `check`
   reuses the pending amber, `not yours` stays neutral because it is not a fault of the artifact. */
.pill.ready { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); border-color: transparent; }
.pill.muted-pill { background: var(--surface-2); color: var(--muted); border-color: transparent; }
/* `unverified` is deliberately the quietest pill on the page (MP-4585): it reports a gap in the
   capture pipeline, not a fault in the artifact, and it is currently true of every Teach capture.
   Loud is reserved for what differs between two cards. */
.pill.unverified { background: transparent; color: var(--dim); border-color: var(--border-subtle); }
