/* Vault UI — cyberpunk atmosphere, Jobs restraint */
:root {
  --void: #03040a;
  --surface: rgba(8, 10, 18, 0.88);
  --surface-2: rgba(14, 16, 28, 0.95);
  --line: rgba(255, 255, 255, 0.08);
  --line-hot: rgba(0, 245, 255, 0.35);
  --text: #f2f4ff;
  --muted: #7a849c;
  --cyan: #00f0ff;
  --magenta: #ff2bd6;
  --ok: #3dffa8;
  --warn: #ffc14d;
  --danger: #ff5c7a;
  --font: "Instrument Sans", system-ui, sans-serif;
  --display: "Syne", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --r: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--void);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
#app { position: relative; width: 100%; height: 100%; overflow: hidden; }
#c {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#c:active { cursor: grabbing; }

.vignette {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    radial-gradient(ellipse 80% 70% at 50% 45%, transparent 20%, rgba(3, 4, 10, 0.55) 70%, rgba(3, 4, 10, 0.92) 100%),
    linear-gradient(180deg, rgba(3, 4, 10, 0.5) 0%, transparent 18%, transparent 82%, rgba(3, 4, 10, 0.65) 100%);
}

body.no-webgl #c { opacity: 0.12; }
.webgl-fallback {
  position: absolute;
  left: 50%;
  bottom: 48px;
  transform: translateX(-50%);
  z-index: 18;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--warn);
  border: 1px solid rgba(255, 193, 77, 0.3);
  background: rgba(20, 14, 6, 0.9);
}

/* ── Topbar ── */
.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  pointer-events: none;
}
.topbar a, .topbar button, .topbar details, .topbar .status-chip, .topbar .session-chip {
  pointer-events: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.brand img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 240, 255, 0.35), 0 0 20px rgba(0, 240, 255, 0.2);
}
.brand-lockup { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.22em;
}
.brand-by {
  font-style: normal;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: none;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tb, .ghost, .primary, .icon-btn, .text-btn {
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
}
.tb {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border-color: var(--line);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  transition: border-color 0.2s var(--ease), color 0.2s, background 0.2s;
}
.tb:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.18); }
.tb-lock {
  color: var(--text);
  border-color: rgba(0, 240, 255, 0.25);
}
.tb-lock:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.15);
}
.tb-quiet { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; }
.tb[hidden] { display: none !important; }

.status-chip, .session-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
}
.session-chip { color: var(--cyan); border-color: rgba(0, 240, 255, 0.22); }
.session-chip[hidden], .status-chip[hidden] { display: none !important; }
.session-chip.is-warn { color: var(--warn); border-color: rgba(255, 193, 77, 0.35); }
.session-chip.is-critical { color: var(--danger); border-color: rgba(255, 92, 122, 0.4); }
.sec-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #556;
}
.status-chip.is-secure .sec-dot {
  background: var(--ok);
  box-shadow: 0 0 10px var(--ok);
}
.status-chip.is-secure { color: var(--ok); border-color: rgba(61, 255, 168, 0.28); }
.status-chip.is-warn .sec-dot { background: var(--warn); }
.status-chip.is-warn { color: var(--warn); }
.status-chip.is-off .sec-dot { background: var(--danger); }

.more-menu { position: relative; }
.more-menu[hidden] { display: none !important; }
.more-menu > summary {
  list-style: none;
  cursor: pointer;
  letter-spacing: 0.15em;
}
.more-menu > summary::-webkit-details-marker { display: none; }
.more-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
  min-width: 168px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(8, 10, 16, 0.98);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(0, 240, 255, 0.05);
  display: grid;
  gap: 2px;
}
.more-item {
  text-align: left;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
}
.more-item:hover { background: rgba(0, 240, 255, 0.08); }
.more-item[hidden] { display: none !important; }
.more-sep { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }

/* ── Gate ── */
.gate {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 40%, rgba(0, 240, 255, 0.06), transparent 55%);
}
.gate[hidden] { display: none !important; }
.gate-card {
  width: min(420px, 100%);
  padding: 36px 28px 28px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(165deg, rgba(14, 16, 28, 0.92), rgba(6, 8, 14, 0.96));
  box-shadow:
    0 0 0 1px rgba(0, 240, 255, 0.06),
    0 40px 100px rgba(0, 0, 0, 0.7),
    0 0 80px rgba(0, 240, 255, 0.04);
  backdrop-filter: blur(20px);
  text-align: center;
  animation: gate-in 0.55s var(--ease);
}
@keyframes gate-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.gate-mark {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
}
.gate-mark img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  position: relative;
  z-index: 1;
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.35);
}
.gate-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(0, 240, 255, 0.35);
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.2), inset 0 0 20px rgba(255, 43, 214, 0.08);
  animation: ring-spin 12s linear infinite;
}
@keyframes ring-spin {
  to { transform: rotate(360deg); }
}
.gate-card h1 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.gate-lead {
  margin: 0 0 20px;
  font-size: 0.92rem;
  color: var(--muted);
  font-weight: 500;
}

/* Mode picker — open vs create vs demo */
.gate-modes {
  display: grid;
  gap: 8px;
  margin: 0 0 20px;
  text-align: left;
}
.gate-mode {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.gate-mode strong {
  font-size: 0.88rem;
  font-weight: 700;
}
.gate-mode span {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.35;
}
.gate-mode:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
}
.gate-mode.is-on {
  border-color: rgba(0, 240, 255, 0.45);
  background: rgba(0, 240, 255, 0.07);
  box-shadow: 0 0 0 1px rgba(0, 240, 255, 0.08), 0 0 24px rgba(0, 240, 255, 0.08);
}
.gate-mode.is-on strong { color: var(--cyan); }
.gate-mode.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}
#gate-form-wrap.is-demo-only .field,
#gate-form-wrap.is-demo-only .check {
  display: none;
}
.gate-card .field {
  text-align: left;
  margin-bottom: 14px;
}
.gate-card .field > span {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.pass-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}
.field input,
.field select,
.search-bar input,
.search-bar select,
.composer-row select,
.composer-row input,
.pass-row input,
.form-more input {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.45);
  color: var(--text);
  padding: 0 14px;
  font: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus,
.pass-row input:focus,
.search-bar input:focus,
.composer-row input:focus,
.composer-row select:focus {
  border-color: rgba(0, 240, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.1);
}
.icon-btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.16); }
.strength {
  height: 3px;
  margin-top: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.strength i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--danger), var(--warn), var(--ok));
  transition: width 0.25s var(--ease);
}
.check, .checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  font-size: 0.84rem;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}
.check input, .checkbox-field input {
  width: 15px;
  height: 15px;
  accent-color: var(--cyan);
}
.primary {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(180deg, #5efbff, var(--cyan));
  color: #021018;
  font-weight: 700;
  font-size: 0.92rem;
  box-shadow: 0 0 28px rgba(0, 240, 255, 0.28);
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s;
}
.primary:hover { filter: brightness(1.05); }
.primary:active { transform: scale(0.98); }
.primary.block, .ghost.block { width: 100%; margin-bottom: 10px; }
.ghost {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}
.ghost:hover { border-color: rgba(255, 255, 255, 0.18); }
.ghost.block { display: flex; align-items: center; justify-content: center; }
.primary .spinner, .ghost .spinner { display: none; }
.primary.is-busy .btn-label, .ghost.is-busy .btn-label { opacity: 0.5; }
.gate-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 8px;
}
.text-btn, .linkish {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  min-height: 0;
}
.text-btn:hover, .linkish:hover { color: var(--cyan); }
.danger-t { color: var(--danger) !important; }
.hint {
  min-height: 1.2em;
  margin: 12px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.hint.error { color: var(--danger); }
.hint.ok { color: var(--ok); }
.gate-meta {
  margin: 10px 0 0;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  opacity: 0.8;
}
.gate-probe {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 16px;
  font-size: 0.75rem;
  color: var(--muted);
}
.gate-probe[hidden] { display: none !important; }
.gate-probe.is-done { color: var(--ok); }
.gate-probe.is-warn { color: var(--warn); }
.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Panel / sidebar ── */
.panel {
  position: absolute;
  top: 64px;
  left: 16px;
  bottom: 16px;
  width: min(340px, calc(100% - 32px));
  z-index: 20;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: linear-gradient(180deg, rgba(10, 12, 20, 0.94), rgba(6, 8, 14, 0.97));
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 40px rgba(0, 240, 255, 0.03);
  backdrop-filter: blur(18px);
  overflow: hidden;
  animation: panel-in 0.4s var(--ease);
}
@keyframes panel-in {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: none; }
}
.panel[hidden], .panel.is-collapsed { display: none !important; }

.panel-chrome {
  flex-shrink: 0;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel-kicker {
  margin: 0 0 2px;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
}
.panel-title h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.count-pill {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--cyan);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(0, 240, 255, 0.22);
  background: rgba(0, 240, 255, 0.06);
}
.search-bar {
  display: grid;
  grid-template-columns: 1fr 72px;
  gap: 6px;
  margin-bottom: 10px;
}
.search-bar input, .search-bar select {
  min-height: 38px;
  font-size: 0.84rem;
  border-radius: 10px;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 52px;
  overflow: auto;
  margin-bottom: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
  cursor: pointer;
}
.chip i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chip, var(--cyan));
}
.chip.is-on, .chip:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--chip, var(--cyan)) 45%, transparent);
}
.chip em { font-style: normal; opacity: 0.5; font-family: var(--mono); }
.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 0 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}
.bulk-bar[hidden] { display: none !important; }

/* Key list = hero of sidebar */
.key-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.key-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.key-list li:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line);
}
.key-list li.is-active {
  background: rgba(0, 240, 255, 0.06);
  border-color: rgba(0, 240, 255, 0.28);
  box-shadow: inset 0 0 0 1px rgba(0, 240, 255, 0.05);
}
.key-list li.is-fav .label { color: #fff; }
.key-list li.empty {
  cursor: default;
  opacity: 0.7;
  padding: 24px 12px;
  text-align: center;
}
.key-list li.empty:hover { background: transparent; border-color: transparent; }
.key-list .meta { min-width: 0; }
.key-list .label {
  font-weight: 600;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.key-list .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}
.key-list .star { color: #ffc14d; font-size: 0.75rem; }
.key-list .idx {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--muted);
  opacity: 0.5;
}
.key-list .provider {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--cyan);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.85;
}
.key-list .mask, .key-list .env-line, .key-list .notes-line {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  grid-column: 1 / -1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.key-list .tags {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.key-list .tag {
  font-size: 0.6rem;
  font-family: var(--mono);
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 43, 214, 0.1);
  border: 1px solid rgba(255, 43, 214, 0.2);
  color: #f9a8e8;
}
.key-list .actions {
  display: flex;
  flex-direction: column;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.15s;
}
.key-list li:hover .actions,
.key-list li.is-active .actions { opacity: 1; }
.key-list .actions button {
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
}
.key-list .actions button:hover { color: var(--text); }
.key-list .actions .danger { color: var(--danger); border-color: rgba(255, 92, 122, 0.3); }
.key-list .multi-cb {
  width: 13px;
  height: 13px;
  accent-color: var(--cyan);
}
.key-list .health {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.key-list .health.ok { background: var(--ok); }
.key-list .health.warn { background: var(--warn); }
.key-list .health.bad { background: var(--danger); }
.quick-add { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
.quick-add .ghost, .ghost.mini {
  min-height: 28px;
  padding: 0 10px;
  font-size: 0.72rem;
  border-radius: 999px;
  border: 1px solid var(--line);
}

/* Composer at bottom */
.panel-composer {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  padding: 10px 12px 12px;
  background: rgba(0, 0, 0, 0.25);
}
.composer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.composer-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 6px;
}
.composer-row select, .composer-row input,
.key-form .pass-row { margin-bottom: 6px; }
.composer-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.composer-actions .primary {
  flex: 1;
  min-height: 38px;
  font-size: 0.82rem;
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.18);
}
.composer-actions .ghost {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.78rem;
}
.form-more { margin: 4px 0 0; }
.form-more > summary {
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 0 8px;
  list-style: none;
}
.form-more > summary::-webkit-details-marker { display: none; }
.form-more[open] > summary { color: var(--cyan); }
.form-more input { margin-bottom: 6px; min-height: 36px; font-size: 0.82rem; }
.detect-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: 10px;
  border: 1px solid rgba(61, 255, 168, 0.25);
  background: rgba(61, 255, 168, 0.06);
  font-size: 0.75rem;
}
.detect-banner[hidden] { display: none !important; }
.detect-banner strong { color: var(--ok); display: block; }
.detect-banner span { color: var(--muted); font-family: var(--mono); font-size: 0.68rem; }
.field-hint {
  margin: 0 0 4px;
  font-size: 0.68rem;
  font-family: var(--mono);
  color: var(--muted);
  min-height: 0;
  text-align: left;
}
.field-hint.validate.ok { color: var(--ok); }
.field-hint.validate.warn { color: var(--warn); }
.field-hint.validate.error { color: var(--danger); }
.docs-link {
  font-size: 0.72rem;
  color: var(--cyan);
  text-decoration: none;
}
.docs-link[hidden] { display: none !important; }
.panel-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.panel-fab {
  position: absolute;
  left: 16px;
  bottom: 48px;
  z-index: 25;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(0, 240, 255, 0.3);
  background: rgba(8, 10, 16, 0.92);
  color: var(--cyan);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  backdrop-filter: blur(10px);
}
.panel-fab[hidden] { display: none !important; }

/* HUD / toast / footer */
.hud {
  position: absolute;
  right: 16px;
  bottom: 40px;
  z-index: 15;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  background: rgba(3, 4, 10, 0.7);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.hud[hidden] { display: none !important; }
.hud .sep { color: var(--magenta); margin: 0 6px; opacity: 0.7; }
.toast {
  position: absolute;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(8, 10, 16, 0.95);
  border: 1px solid rgba(0, 240, 255, 0.3);
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.25s var(--ease);
}
.toast[hidden] { display: none !important; }
.toast.ok { border-color: rgba(61, 255, 168, 0.35); }
.toast.warn { border-color: rgba(255, 193, 77, 0.4); }
.toast.error { border-color: rgba(255, 92, 122, 0.4); }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.bottom {
  position: absolute;
  left: 16px;
  bottom: 12px;
  z-index: 15;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.7rem;
  color: var(--muted);
  font-family: var(--mono);
}
kbd {
  font-family: var(--mono);
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}
.legend {
  position: absolute;
  right: 16px;
  top: 64px;
  z-index: 15;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(5, 6, 10, 0.75);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 140px;
}
.legend[hidden] { display: none !important; }
.leg-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 600;
}
.leg-item i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tooltip {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(8, 10, 16, 0.95);
  border: 1px solid rgba(0, 240, 255, 0.25);
  font-size: 0.78rem;
  max-width: 220px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.tooltip[hidden] { display: none !important; }
.tooltip strong { display: block; }
.tooltip span, .tooltip code { color: var(--cyan); font-family: var(--mono); font-size: 0.7rem; }
.tooltip small { color: var(--muted); font-size: 0.65rem; }

/* Dialogs */
.sheet, dialog {
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 16px;
  background: #0a0c14;
  color: var(--text);
  padding: 0;
  max-width: 420px;
  width: min(420px, 94vw);
}
.sheet-wide { max-width: 720px; width: min(720px, 96vw); }
.sheet-sm { max-width: 320px; padding: 20px; }
dialog::backdrop { background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(4px); }
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.sheet-head h3, dialog h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.1rem;
}
.muted { color: var(--muted); font-size: 0.82rem; margin: 4px 0 0; }
.sheet-actions {
  display: flex;
  gap: 8px;
  padding: 12px 18px 18px;
}
.sec-dialog-score {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
}
.sec-score-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 50%, #0a0c14 56%, transparent 58%),
    conic-gradient(from 200deg, var(--ok), var(--cyan), var(--magenta), var(--ok));
}
.sec-score-ring.lg { width: 64px; height: 64px; }
.sec-score-ring b { font-family: var(--display); font-size: 1.1rem; }
.sec-check-list {
  list-style: none;
  margin: 0;
  padding: 0 18px 12px;
  display: grid;
  gap: 6px;
  max-height: 40vh;
  overflow: auto;
}
.sec-check-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
}
.sec-check-list .chk {
  grid-row: span 2;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 800;
}
.sec-check-list .chk.ok { background: rgba(61, 255, 168, 0.12); color: var(--ok); }
.sec-check-list .chk.bad { background: rgba(255, 92, 122, 0.12); color: var(--danger); }
.sec-check-list strong { font-size: 0.84rem; }
.sec-check-list span { font-size: 0.7rem; color: var(--muted); font-family: var(--mono); grid-column: 2; }
.audit-list {
  padding: 8px 18px 18px;
  max-height: 50vh;
  overflow: auto;
  display: grid;
  gap: 6px;
}
.audit-row {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 0.78rem;
}
.audit-row time { font-family: var(--mono); font-size: 0.65rem; color: var(--muted); }
.audit-row strong { color: var(--cyan); font-family: var(--mono); font-size: 0.72rem; }
.audit-empty { text-align: center; color: var(--muted); padding: 24px; }
.pack-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  padding: 12px 18px 0;
}
.pack-card {
  text-align: left;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 43, 214, 0.2);
  background: rgba(255, 43, 214, 0.05);
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 3px;
  font-weight: 600;
  min-height: 0;
}
.pack-card strong { font-size: 0.8rem; font-family: var(--display); }
.pack-card span { font-size: 0.65rem; color: var(--muted); font-weight: 500; }
.pack-card em { font-style: normal; font-size: 0.62rem; color: var(--cyan); font-family: var(--mono); }
.preset-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 18px 8px;
}
.preset-toolbar input {
  flex: 1;
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #070a12;
  color: var(--text);
  padding: 0 12px;
  font: inherit;
}
#preset-cat-chips { padding: 0 18px 8px; }
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  padding: 8px 18px 18px;
  overflow: auto;
  max-height: 42vh;
}
.preset-card {
  position: relative;
  text-align: left;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 3px;
  min-height: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.preset-card:hover {
  border-color: var(--pc, var(--cyan));
  box-shadow: 0 0 20px color-mix(in srgb, var(--pc, var(--cyan)) 18%, transparent);
}
.preset-card .swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pc, var(--cyan));
  box-shadow: 0 0 8px var(--pc, var(--cyan));
}
.preset-card strong { font-size: 0.84rem; }
.preset-card .pcat { font-size: 0.62rem; color: var(--muted); text-transform: uppercase; }
.preset-card code { font-family: var(--mono); font-size: 0.62rem; color: #a5b4fc; overflow: hidden; text-overflow: ellipsis; }
.preset-card .ug {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--magenta);
  text-transform: uppercase;
}
.shortcut-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 8px;
}
.shortcut-list li {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 0.88rem;
}
.shortcut-list kbd { color: var(--cyan); min-width: 2em; text-align: center; }
.block { width: 100%; }

@media (max-width: 720px) {
  .panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 52vh;
    border-radius: 18px 18px 0 0;
  }
  .hud { bottom: calc(52vh + 8px); }
  .topbar {
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  .brand-name { font-size: 0.72rem; }
  .gate-card { padding: 22px 16px 18px; width: min(100% - 24px, 28rem); }
  .composer-row { grid-template-columns: 1fr; }
  .brand-lockup { max-width: 58vw; }
}

/* ═══════════════════════════════════════════
   Design step-up — denser craft, quieter neon
   ═══════════════════════════════════════════ */

.scanlines {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 3;
  opacity: 0.035;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.35) 2px,
    rgba(0, 0, 0, 0.35) 3px
  );
  mix-blend-mode: multiply;
}

.vignette {
  background:
    radial-gradient(ellipse 70% 60% at 50% 42%, transparent 10%, rgba(3, 4, 10, 0.45) 55%, rgba(3, 4, 10, 0.94) 100%),
    linear-gradient(180deg, rgba(3, 4, 10, 0.65) 0%, transparent 14%, transparent 86%, rgba(3, 4, 10, 0.75) 100%);
}

/* Topbar glass strip */
.topbar {
  padding: 14px 18px;
  background: linear-gradient(180deg, rgba(3, 4, 10, 0.75) 0%, transparent 100%);
}
.brand-name {
  background: linear-gradient(90deg, #fff 0%, #a8f7ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand img {
  transition: box-shadow 0.35s var(--ease), transform 0.35s var(--ease);
}
.brand:hover img {
  transform: scale(1.04);
  box-shadow: 0 0 0 1px rgba(0, 240, 255, 0.5), 0 0 28px rgba(0, 240, 255, 0.35);
}

/* Gate card — product shot feel */
.gate-card {
  position: relative;
  overflow: hidden;
  padding: 40px 32px 30px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(0, 240, 255, 0.1), transparent 55%),
    linear-gradient(165deg, rgba(16, 18, 32, 0.96), rgba(5, 7, 14, 0.98));
  box-shadow:
    0 0 0 1px rgba(0, 240, 255, 0.05),
    0 50px 120px rgba(0, 0, 0, 0.75),
    0 0 100px rgba(0, 240, 255, 0.05);
}
.gate-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.55), transparent);
  opacity: 0.85;
}
.flow-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
}
.flow-steps li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  position: relative;
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  line-height: 1.25;
}
.flow-steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 9px;
  left: calc(50% + 14px);
  width: calc(100% - 28px);
  height: 1px;
  background: linear-gradient(90deg, rgba(196, 181, 253, 0.55), rgba(255, 255, 255, 0.08));
}
.flow-steps span {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(196, 181, 253, 0.4);
  display: inline-grid;
  place-items: center;
  font-size: 0.62rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.35);
}
.flow-steps .is-on { color: #e8efe6; }
.flow-steps .is-on span {
  background: #c4b5fd;
  color: #14101f;
  border-color: transparent;
  box-shadow: 0 0 12px rgba(196, 181, 253, 0.35);
}
.gate-eyebrow {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
  opacity: 0.85;
}
.gate-card h1 {
  font-size: clamp(1.6rem, 4vw, 1.9rem);
  letter-spacing: -0.04em;
  line-height: 1.05;
}
.gate-lead {
  max-width: 26ch;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.45;
}

.gate-modes { gap: 7px; margin-bottom: 22px; }
.gate-mode {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.32);
}
.gate-mode .gm-num {
  font-family: var(--mono);
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.06em;
  min-width: 1.5em;
}
.gate-mode .gm-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.gate-mode .gm-body strong {
  font-size: 0.9rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.gate-mode .gm-body span {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}
.gate-mode .gm-check {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  position: relative;
  flex-shrink: 0;
}
.gate-mode.is-on {
  border-color: rgba(0, 240, 255, 0.4);
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.09), rgba(0, 0, 0, 0.25));
  box-shadow: 0 0 0 1px rgba(0, 240, 255, 0.06), 0 0 28px rgba(0, 240, 255, 0.08);
}
.gate-mode.is-on .gm-num { color: var(--cyan); }
.gate-mode.is-on .gm-check {
  border-color: var(--cyan);
  background: rgba(0, 240, 255, 0.15);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.35);
}
.gate-mode.is-on .gm-check::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}
.gate-mode.is-recommended:not(.is-on) {
  border-color: rgba(61, 255, 168, 0.2);
}
.gate-mode.is-recommended:not(.is-on) .gm-body strong::after {
  content: " · start here";
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--ok);
  letter-spacing: 0;
}

.gate-form {
  text-align: left;
  animation: form-in 0.3s var(--ease);
}
@keyframes form-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.gate-form .field > span {
  letter-spacing: 0.14em;
  font-size: 0.64rem;
}
.gate-form .pass-row input {
  min-height: 48px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.5);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}
.gate-form .primary.block {
  min-height: 48px;
  margin-top: 4px;
  letter-spacing: 0.02em;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 0 32px rgba(0, 240, 255, 0.32),
    0 12px 28px rgba(0, 0, 0, 0.35);
}
.gate-form .primary.block:hover {
  filter: brightness(1.06);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12) inset,
    0 0 40px rgba(0, 240, 255, 0.4),
    0 14px 32px rgba(0, 0, 0, 0.4);
}
.gate-links {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.gate-meta {
  opacity: 0.7;
  line-height: 1.4;
}

/* Panel — quieter chrome, richer list */
.panel {
  border: 1px solid rgba(255, 255, 255, 0.07);
  background:
    linear-gradient(180deg, rgba(12, 14, 24, 0.97) 0%, rgba(6, 8, 14, 0.98) 100%);
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 0 1px rgba(0, 240, 255, 0.03);
}
.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.35), transparent);
  opacity: 0.6;
  pointer-events: none;
}
.panel-chrome {
  padding: 16px 14px 12px;
  background: linear-gradient(180deg, rgba(0, 240, 255, 0.03), transparent);
}
.panel-title h2 {
  font-size: 1.1rem;
  letter-spacing: -0.03em;
}
.count-pill {
  font-size: 0.68rem;
  padding: 3px 9px;
  background: rgba(0, 240, 255, 0.08);
}
.search-bar input {
  background: rgba(0, 0, 0, 0.4);
}
.search-bar input::placeholder {
  color: rgba(122, 132, 156, 0.75);
}

.key-list {
  padding: 6px 8px 10px;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 240, 255, 0.2) transparent;
}
.key-list li {
  padding: 11px 12px;
  border-radius: 11px;
  position: relative;
}
.key-list li.is-active {
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.1), rgba(0, 240, 255, 0.03));
  border-color: rgba(0, 240, 255, 0.3);
}
.key-list li.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 2px;
  border-radius: 2px;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}
.key-list .label {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.key-list .provider {
  font-size: 0.62rem;
  opacity: 0.75;
  margin-top: 1px;
}
.key-list .mask {
  opacity: 0.55;
  font-size: 0.66rem;
  margin-top: 2px;
}
.key-list .actions {
  gap: 4px;
}
.key-list .actions button {
  border-radius: 7px;
  font-size: 0.62rem;
  letter-spacing: 0.02em;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.key-list .actions button:hover {
  background: rgba(0, 240, 255, 0.1);
  border-color: rgba(0, 240, 255, 0.25);
  color: var(--cyan);
}

.panel-composer {
  padding: 12px 12px 14px;
  background:
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.2) 8%),
    rgba(0, 0, 0, 0.28);
  border-top-color: rgba(255, 255, 255, 0.06);
}
.composer-head {
  letter-spacing: 0.12em;
  font-size: 0.68rem;
  margin-bottom: 10px;
}
.composer-actions .primary {
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.2);
}

/* Empty list state */
.empty-meta {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 12px 8px 8px;
}
.empty-icon {
  font-size: 1.4rem;
  color: var(--cyan);
  opacity: 0.55;
  text-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
  margin-bottom: 4px;
}
.empty-rich .label {
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
  justify-content: center;
}
.empty-rich .provider {
  text-align: center;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
  opacity: 1;
}
.empty-seal {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 0.65rem;
  opacity: 0.7;
}
.empty-rich .quick-add {
  margin-top: 12px;
}
.empty-rich .ghost.mini {
  border-color: rgba(0, 240, 255, 0.15);
}
.empty-rich .ghost.mini:hover {
  border-color: rgba(0, 240, 255, 0.4);
  color: var(--cyan);
}

/* Toast + HUD polish */
.toast {
  backdrop-filter: blur(12px);
  border-color: rgba(0, 240, 255, 0.25);
  letter-spacing: 0.01em;
}
.hud {
  border-color: rgba(255, 255, 255, 0.06);
  letter-spacing: 0.04em;
}

/* Focus rings — accessibility + craft */
:focus-visible {
  outline: 2px solid rgba(0, 240, 255, 0.55);
  outline-offset: 2px;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* Slight idle breathing on gate mark */
.gate-ring {
  animation: ring-spin 18s linear infinite, ring-breathe 4s ease-in-out infinite;
}
@keyframes ring-breathe {
  0%, 100% { opacity: 0.75; box-shadow: 0 0 20px rgba(0, 240, 255, 0.18), inset 0 0 16px rgba(255, 43, 214, 0.06); }
  50% { opacity: 1; box-shadow: 0 0 32px rgba(0, 240, 255, 0.32), inset 0 0 22px rgba(255, 43, 214, 0.1); }
}
