@font-face { font-family:"Trajan Pro"; font-weight:400 700; font-style:normal; font-display:swap; src:url("../fonts/TrajanPro3-Semibold.otf") format("opentype"); }
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  /* Violet + tritium frost blue (matches the app). Revert: --accent #4f8ef7 etc. */
  --bg: #08060f; --panel: #130f1e; --line: #2b2440;
  --ink: #e8e2f7; --dim: #9990b3; --accent: #b14dff; --frost: #5fd7ee;
  --ok: #3fb96f; --bad: #e5604c; --warn: #d9a441;
  --purple: #b14dff;
  /* Archaic Latin, one font. REVERT: --font-body to "SF Mono", ui-monospace, Menlo, monospace */
  --font-body: "Trajan Pro", "Trajan", "Copperplate", serif;
  --font-display: var(--font-body);
}
body {
  width: 380px; background: var(--bg); color: var(--ink);
  font: 13px/1.55 var(--font-body);
  overflow-x: hidden;
}
b, strong, h1 { font-weight: 700; } em, i { font-style: italic; }
header img.brandmark { width: 24px; height: 24px; filter: drop-shadow(0 0 5px rgba(177,77,255,0.5)); }

/* ── Layout ── */
.screen { display: none; flex-direction: column; min-height: 480px; }
.screen.active { display: flex; }
header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--line);
}
header h1 { font-size: 15px; letter-spacing: 0.5px; flex: 1; font-family: var(--font-display); }
header h1 span { color: var(--frost); }
.lock-btn { background: none; border: none; color: var(--dim); cursor: pointer; font-size: 14px; padding: 2px 4px; }
.lock-btn:hover { color: var(--ink); }

/* ── Loading screen ── */
#screen-loading { justify-content: center; align-items: center; gap: 12px; padding: 40px 24px; }
.loading-mark {
  width: 56px; height: 56px;
  filter: drop-shadow(0 0 10px rgba(177,77,255,0.55));
  animation: vault-breathe 1.8s ease-in-out infinite;
}
.loading-title { font-size: 16px; letter-spacing: 0.5px; font-family: var(--font-display); }
.loading-title span { color: var(--frost); }
.loading-sub { color: var(--dim); font-size: 12px; font-style: italic; }
@keyframes vault-breathe {
  0%, 100% { opacity: 0.55; filter: drop-shadow(0 0 4px rgba(177,77,255,0.35)); }
  50%      { opacity: 1;    filter: drop-shadow(0 0 14px rgba(177,77,255,0.75)); }
}

/* ── Tier 1 pipeline log (Run tab) — engine-log palette ── */
.t1row { display: flex; gap: 8px; padding: 1px 0; line-height: 1.5; }
.t1ts { color: var(--dim); font-variant-numeric: tabular-nums; min-width: 34px; flex-shrink: 0; text-align: right; }
.t1msg { white-space: pre-wrap; word-break: break-word; }
.t1-ok      .t1msg { color: var(--ok); }
.t1-bad     .t1msg { color: var(--bad); }
.t1-warn    .t1msg { color: var(--warn); }
.t1-accent  .t1msg { color: var(--accent); font-weight: 600; }
.t1-neutral .t1msg { color: var(--dim); }

/* ── Vault lock screen ── */
#screen-lock { justify-content: center; align-items: center; gap: 14px; padding: 40px 24px; }
#screen-lock h2 { font-size: 15px; }
#screen-lock p  { color: var(--dim); font-size: 12px; text-align: center; max-width: 28ch; }
.lock-icon { font-size: 38px; margin-bottom: 4px; }

/* ── Form elements ── */
input, select {
  width: 100%; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 10px; font: inherit; outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
input[type=password] { letter-spacing: 2px; }
input::placeholder { color: var(--dim); letter-spacing: 0; }

button { font: inherit; cursor: pointer; border: none; border-radius: 6px; padding: 8px 14px; }
.btn-primary { background: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:disabled { opacity: 0.4; cursor: default; }
.btn-ghost  { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-danger { background: rgba(229,96,76,0.12); color: var(--bad); border: 1px solid var(--bad); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── Tabs ── */
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1; padding: 9px 0; text-align: center; cursor: pointer;
  color: var(--dim); font-size: 12px; border-bottom: 2px solid transparent;
  background: none; border-top: none; border-left: none; border-right: none;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }

/* ── Provider list ── */
.provider-list { flex: 1; overflow-y: auto; }
.provider-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.provider-item:hover { background: var(--panel); }
.provider-item.selected { background: rgba(79,142,247,0.08); }
.dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: var(--line); border: 1.5px solid var(--dim);
}
.dot.active { background: var(--ok); border-color: var(--ok); }
.pname { font-weight: 500; font-size: 13px; }
.ptype { font-size: 11px; color: var(--dim); margin-top: 1px; }
.provider-item .actions { margin-left: auto; display: flex; gap: 6px; opacity: 0; }
.provider-item:hover .actions { opacity: 1; }

/* ── Detail / edit form ── */
.detail { flex: 1; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.6px; }
.field-row { display: flex; gap: 8px; align-items: center; }
.key-status { font-size: 12px; display: flex; align-items: center; gap: 6px; }
.key-status.has-key { color: var(--ok); }
.key-status.no-key  { color: var(--dim); }

.rha-url-row { display: flex; gap: 6px; align-items: center; }
.rha-url-row input { flex: 1; }

.activate-bar { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.activate-bar button { flex: 1; }

.status-active {
  color: var(--ok); font-size: 12px; text-align: center;
  padding: 6px; background: rgba(63,185,111,0.08);
  border-radius: 6px; border: 1px solid rgba(63,185,111,0.3);
}
.error-msg { color: var(--bad); font-size: 12px; margin-top: -4px; }

/* ── Audit log ── */
.audit-log { flex: 1; overflow-y: auto; padding: 10px 0; }
.audit-entry {
  padding: 8px 16px; border-bottom: 1px solid var(--line);
  font-size: 11.5px; display: flex; gap: 8px; align-items: baseline;
}
.audit-ts   { color: var(--dim); flex-shrink: 0; }
.audit-op   { color: var(--accent); flex-shrink: 0; font-weight: 600; }
.audit-ok   { color: var(--ok); }
.audit-fail { color: var(--bad); }

/* ── Security info panel ── */
.security-panel { flex: 1; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.sec-item { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.sec-item h3 { font-size: 12px; color: var(--accent); margin-bottom: 4px; }
.sec-item p  { font-size: 11.5px; color: var(--dim); line-height: 1.6; }
.sec-item code { color: var(--ink); font: inherit; }

/* ── Footer ── */
footer {
  padding: 8px 16px; border-top: 1px solid var(--line);
  font-size: 10.5px; color: var(--dim); text-align: center;
}
footer a { color: var(--accent); text-decoration: none; }

/* ── Misc ── */
.empty { color: var(--dim); font-size: 12px; text-align: center; padding: 40px 20px; }
.badge {
  font-size: 10px; border-radius: 999px; padding: 1px 8px;
  border: 1px solid currentColor; flex-shrink: 0;
}
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
