/* ---------- Fonts + base ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Accent + derived text-on-accent (set by theme.js) */
  --accent: #ffffff;
  --accent-fg: #000000;

  /* The entire dark palette is derived from --accent by mixing with black.
     When accent is white, the site stays neutral. Pick red and everything
     picks up a warm red tint; pick blue and it goes cool. */
  --bg:      color-mix(in srgb, var(--accent) 3%,  #050506);
  --bg-2:    color-mix(in srgb, var(--accent) 5%,  #08080a);
  --panel:   color-mix(in srgb, var(--accent) 7%,  #0e0e12);
  --panel-2: color-mix(in srgb, var(--accent) 9%,  #131318);
  --panel-3: color-mix(in srgb, var(--accent) 12%, #191920);
  --line:    color-mix(in srgb, var(--accent) 18%, #22222a);
  --line-2:  color-mix(in srgb, var(--accent) 25%, #2b2b32);

  --fg: #ffffff;
  --muted: color-mix(in srgb, var(--accent) 8%, #8a8a92);
  --muted-2: color-mix(in srgb, var(--accent) 8%, #5a5a62);

  --danger-bg: #2a1416;
  --danger-fg: #ff6b6b;
  --danger-line: #4a1e22;
  --live-bg: #1c2b1c;
  --live-fg: #7dd67d;

  /* syntax */
  --tok-key: #d9a066;
  --tok-str: #c98a5b;
  --tok-num: #e5a06a;
  --tok-bool: #7aa2f7;
  --tok-null: #8a8a92;
  --tok-punct: #cfcfd6;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  background: var(--panel-2);
  color: var(--fg);
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.02em;
  transition: background .15s, border-color .15s, color .15s;
}
button:hover { background: var(--panel-3); border-color: var(--line-2); }
button:disabled { opacity: .5; cursor: not-allowed; }

button.primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}
button.primary:hover { filter: brightness(0.9); }

button.ghost {
  background: transparent;
  color: var(--muted);
}
button.ghost:hover { background: var(--panel-2); color: var(--fg); }

button.danger {
  background: var(--danger-bg);
  color: var(--danger-fg);
  border-color: var(--danger-line);
}
button.danger:hover { background: #3a1a1e; border-color: #5a2429; }

input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  background: var(--panel-2);
  color: var(--fg);
  border: 1px solid var(--line);
  padding: 10px 12px;
  width: 100%;
  border-radius: 8px;
  outline: none;
  transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--fg); }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 32px;
  border-radius: 14px;
}
.login-card .eyebrow {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .06em;
  margin-bottom: 4px;
}
.login-card h1 {
  margin: 0 0 24px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.field { margin-bottom: 14px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}
.error-box {
  border: 1px solid var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger-fg);
  padding: 10px 12px;
  margin-bottom: 16px;
  font-size: 13px;
  border-radius: 8px;
}
.hint {
  margin-top: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- App shell ---------- */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex: 0 0 220px;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand {
  padding: 22px 20px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar .brand .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.sidebar nav { flex: 1; padding: 12px 10px; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  margin-bottom: 2px;
}
.sidebar nav a:hover { background: var(--panel); color: var(--fg); }
.sidebar nav a.active {
  background: var(--panel-2);
  color: var(--fg);
  box-shadow: inset 3px 0 0 var(--accent);
}
.sidebar nav a .ico {
  width: 16px; height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: .8;
}
.sidebar .foot {
  padding: 14px;
  border-top: 1px solid var(--line);
}
.sidebar .foot .user {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.sidebar .foot .user strong { color: var(--fg); font-weight: 600; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  padding: 56px 32px;
}
.main-inner {
  width: 100%;
  max-width: 900px;
}

/* Page header (welcome back / big title) */
.page-head { margin-bottom: 28px; text-align: center; }
.page-head .eyebrow {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .02em;
  margin-bottom: 6px;
}
.page-head h1 {
  margin: 0;
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.page-head .sub {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Session panel (the big rounded card) ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.panel .panel-head {
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
}
.panel .panel-head .right {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .04em;
}
.panel .panel-head .right.live::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--live-fg);
  margin-right: 8px;
  vertical-align: middle;
  box-shadow: 0 0 6px var(--live-fg);
}

/* Session card row inside the panel */
.session-row {
  padding: 16px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}
.session-row .avatar {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2a2a30, #17171b);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--fg);
  flex-shrink: 0;
}
.session-row .meta { flex: 1; min-width: 0; }
.session-row .meta .title {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.session-row .meta .sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.session-row .tag {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .1em;
  font-weight: 600;
}
.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--live-bg);
  color: var(--live-fg);
  border: 1px solid #294029;
  letter-spacing: .02em;
}

/* ---------- Code editor ---------- */
.code-editor {
  display: flex;
  background: color-mix(in srgb, var(--accent) 5%, #0b0b0e);
  min-height: 420px;
  height: 480px;
  font-family: 'JetBrains Mono', ui-monospace, 'Menlo', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.6;
  position: relative;
}
.code-editor .gutter {
  width: 56px;
  padding: 16px 10px 16px 8px;
  overflow: hidden;
  color: color-mix(in srgb, var(--accent) 15%, #4a4a52);
  text-align: right;
  background: color-mix(in srgb, var(--accent) 5%, #0b0b0e);
  border-right: 1px solid var(--line);
  user-select: none;
  flex-shrink: 0;
  position: relative;
}
.code-editor .gutter-inner {
  will-change: transform;
  white-space: pre;
}
.code-editor .code-wrap {
  position: relative;
  flex: 1;
  overflow: hidden;
}
.code-editor pre.highlight,
.code-editor textarea.raw {
  margin: 0;
  padding: 16px 18px;
  border: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  white-space: pre;
  word-wrap: normal;
  tab-size: 2;
  position: absolute;
  inset: 0;
  overflow: auto;
}
.code-editor pre.highlight {
  color: var(--tok-punct);
  pointer-events: none;
  scrollbar-width: none;
  background: transparent;
}
.code-editor pre.highlight::-webkit-scrollbar { display: none; }
.code-editor textarea.raw {
  background: transparent;
  color: transparent;
  caret-color: #fff;
  resize: none;
  outline: none;
}
.code-editor textarea.raw::-webkit-scrollbar { width: 10px; height: 10px; }
.code-editor textarea.raw::-webkit-scrollbar-thumb {
  background: #2a2a30; border-radius: 5px;
}
.code-editor textarea.raw::-webkit-scrollbar-track { background: transparent; }

.tok-key   { color: var(--tok-key); }
.tok-str   { color: var(--tok-str); }
.tok-num   { color: var(--tok-num); }
.tok-bool  { color: var(--tok-bool); }
.tok-null  { color: var(--tok-null); }
.tok-punct { color: var(--tok-punct); }

/* Bottom action bar inside panel */
.panel-foot {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--panel);
}
.panel-foot .left, .panel-foot .right {
  display: flex; align-items: center; gap: 10px;
}
.panel-foot .status {
  font-size: 12px;
  color: var(--muted);
  margin-left: 4px;
}
.panel-foot .status.ok { color: var(--live-fg); }
.panel-foot .status.err { color: var(--danger-fg); }

/* Stat cards row (whitelist / executions / active setup) */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 22px;
  min-height: 108px;
}
.stat-card .label {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .04em;
  margin-bottom: 10px;
}
.stat-card .value {
  font-size: 30px;
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 6px;
}
.stat-card .value.strong { font-weight: 700; }
.stat-card .note {
  font-size: 12px;
  color: var(--muted);
}

/* License key panel */
.license-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 20px;
  overflow: hidden;
}
.license-panel .license-head {
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.license-panel .license-head .label,
.license-panel .license-head .hint {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 500;
}
.license-panel .license-key {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.license-panel .license-key .key {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  letter-spacing: 4px;
  color: var(--muted);
  user-select: none;
  transition: color .15s, letter-spacing .15s;
}
.license-panel:hover .license-key .key {
  color: var(--fg);
  letter-spacing: 2px;
  user-select: text;
}
.icon-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover {
  background: var(--panel-2);
  color: var(--fg);
  border-color: var(--line-2);
}

/* Legacy dashboard cards (kept for backward compat, not used on new dashboard) */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 8px;
}
.card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 18px 20px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  color: var(--fg);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .18s, transform .18s;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { border-color: var(--danger-line); color: var(--danger-fg); }
.toast.ok  { border-color: #2c4a2c; color: var(--live-fg); }

/* Small screens */
@media (max-width: 820px) {
  .sidebar { width: 68px; flex-basis: 68px; }
  .sidebar .brand span:not(.dot) { display: none; }
  .sidebar nav a span:not(.ico) { display: none; }
  .sidebar .foot .user { display: none; }
  .main { padding: 24px; }
  .page-head h1 { font-size: 32px; }
  .stat-row { grid-template-columns: 1fr; }
}

/* ---------- Settings page ---------- */
.settings-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
}
.settings-panel .settings-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.settings-panel .settings-head .hint {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.settings-panel .settings-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.kv:last-child { border-bottom: 0; padding-bottom: 0; }
.kv .k {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.kv .v { font-size: 14px; font-weight: 500; word-break: break-all; text-align: right; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; letter-spacing: 1px; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.reset-form {
  margin-top: 4px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.reset-form label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.reset-form textarea {
  min-height: 90px;
  resize: vertical;
  font-family: inherit;
}
.reset-form .counter {
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 6px;
  text-align: right;
}

/* Color picker */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.color-picker-row input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: none;
  cursor: pointer;
}
.color-picker-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.color-picker-row input[type="color"]::-webkit-color-swatch { border: none; border-radius: 6px; }
.color-picker-row input[type="color"]::-moz-color-swatch { border: none; border-radius: 6px; }
.color-picker-row .swatch-label {
  font-size: 13px;
  color: var(--muted);
}

/* Hover-to-reveal for masked values (license, HWID, etc.) */
.reveal-row .masked,
.mono.masked {
  color: var(--muted);
  letter-spacing: 3px;
  transition: color .15s, letter-spacing .15s;
  user-select: none;
  cursor: default;
}
.reveal-row:hover .masked,
.mono.masked:hover,
.reveal-row .masked.revealed,
.mono.masked.revealed {
  color: var(--fg);
  letter-spacing: 1px;
  user-select: text;
  cursor: text;
}

/* Wider inner column for admin */
.main-inner.main-wide { max-width: 1080px; }

/* Empty-state text */
.empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: 10px;
}

/* Mini pills for statuses */
.mini-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--panel-2);
  vertical-align: middle;
  margin-left: 4px;
}
.mini-pill.live { color: var(--live-fg); background: var(--live-bg); border-color: #294029; }
.mini-pill.warn { color: #f0c674; background: #2a2415; border-color: #4a3f22; }
.mini-pill.bad  { color: var(--danger-fg); background: var(--danger-bg); border-color: var(--danger-line); }
.mini-pill.muted { color: var(--muted); }

.type-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 500;
  color: var(--fg);
  margin: 0 4px;
}

.danger-outline {
  background: transparent;
  color: var(--danger-fg);
  border-color: var(--danger-line);
}
.danger-outline:hover { background: var(--danger-bg); }

/* ---------- Admin tabs ---------- */
.admin-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.admin-tab {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 10px 16px;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  font-weight: 500;
}
.admin-tab:hover { color: var(--fg); background: transparent; }
.admin-tab.active {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

/* Ticket rows */
.ticket {
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.ticket-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.ticket-title { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ticket-date { color: var(--muted); font-size: 12px; }
.ticket-meta {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.ticket-meta .k { text-transform: uppercase; letter-spacing: .04em; margin-right: 4px; }
.ticket-meta strong, .ticket-meta .mono { color: var(--fg); }
.ticket-reason {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}
.ticket-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* User rows */
.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.user-main { display: flex; gap: 12px; align-items: center; min-width: 0; flex: 1; }
.user-info { min-width: 0; }
.user-info .user-name { font-size: 15px; font-weight: 600; }
.user-info .user-sub  {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.user-info .user-sub .k { text-transform: uppercase; letter-spacing: .04em; }
.user-info .user-license {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: 2px;
}
.user-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.user-actions button { padding: 6px 12px; font-size: 12px; }

/* ---------- Forums list ---------- */
.forum-list { display: flex; flex-direction: column; gap: 12px; }
.forum-post {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}
.forum-post-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.forum-post-author { display: flex; gap: 10px; align-items: center; }
.forum-post-author .avatar {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--panel-3), var(--panel-2));
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 12px;
}
.forum-post-author .name { font-size: 14px; font-weight: 600; }
.forum-post-author .date { font-size: 11px; color: var(--muted); }
.forum-post-title {
  margin: 4px 0 8px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.forum-post-body {
  color: #dcdce0;
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- Saved configs section ---------- */
.configs-panel { margin-bottom: 20px; }

.plus-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  border-radius: 8px;
}
.plus-btn:hover { background: var(--panel-2); color: var(--fg); }

.configs-body { padding: 16px 20px; }

.new-config-form {
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.new-config-form .field { margin-bottom: 10px; }
.new-config-form .field:last-of-type { margin-bottom: 4px; }
.new-config-form label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.configs-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.config-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  min-height: 130px;
  transition: border-color .15s, transform .1s;
}
.config-card:hover { border-color: var(--line-2); }
.config-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.config-card-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  word-break: break-word;
  min-width: 0;
}
.config-card-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  word-break: break-word;
  margin-bottom: 12px;
}
.config-card-desc.muted-text { color: var(--muted-2); font-style: italic; }
.config-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.config-card-meta {
  display: flex;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  align-items: center;
}
.config-card-foot button.primary {
  padding: 6px 12px;
  font-size: 12px;
}
.config-card .icon-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.pill.offline { background: #2a1a1a; color: #b56565; border-color: #4a2222; }

/* --- confirm modal --- */
.cp-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center; justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}
.cp-modal-backdrop.open { display: flex; }
.cp-modal {
  min-width: 320px; max-width: 440px;
  background: #141414;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 22px 22px 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.cp-modal-title {
  font-size: 16px; font-weight: 600;
  color: #eee; margin-bottom: 8px;
}
.cp-modal-body {
  font-size: 13px; color: #aaa; line-height: 1.5;
  margin-bottom: 18px;
}
.cp-modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
}
.cp-modal-actions .btn { padding: 8px 16px; font-size: 13px; }

/* --- editor lock overlay: blurs the entire panel body when not injected --- */
.panel { position: relative; }
.panel-lock { display: none; }
.panel--locked .session-row,
.panel--locked .code-editor,
.panel--locked .panel-foot { filter: blur(6px); pointer-events: none; user-select: none; }
.panel--locked .panel-lock {
  display: flex;
  align-items: center; justify-content: center;
  position: absolute;
  left: 0; right: 0;
  top: 46px; bottom: 0;
  background: rgba(10, 10, 10, 0.55);
  backdrop-filter: blur(2px);
  z-index: 4;
  border-radius: 0 0 12px 12px;
}
.editor-lock-inner {
  text-align: center;
  color: #ccc;
  padding: 24px 28px;
  background: rgba(20, 20, 20, 0.92);
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  max-width: 340px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.editor-lock-inner svg { color: #b56565; margin-bottom: 10px; }
.editor-lock-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: #eee; }
.editor-lock-sub   { font-size: 12px; color: #999; line-height: 1.5; }

/* --- config loaded banner --- */
.config-loaded-banner {
  position: fixed;
  top: 24px; left: 50%; transform: translate(-50%, -20px);
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px;
  background: #172817;
  color: #7dd67d;
  border: 1px solid #2c4a2c;
  border-radius: 999px;
  font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  z-index: 10000;
  transition: opacity .25s ease, transform .25s ease;
}
.config-loaded-banner.show { opacity: 1; transform: translate(-50%, 0); }
.config-loaded-banner.hide { opacity: 0; transform: translate(-50%, -20px); }

/* --- import row --- */
.import-row { display: flex; gap: 8px; align-items: center; }
.import-row input {
  flex: 1;
  background: #111; border: 1px solid #2a2a2a; color: #eee;
  padding: 10px 12px; border-radius: 8px; font-size: 13px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.import-row input:focus { outline: none; border-color: #444; }

/* --- config code display + action row --- */
.config-code { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #888; }
.config-code .code-label { text-transform: uppercase; letter-spacing: .05em; }
.config-code code {
  background: #191919; border: 1px solid #2a2a2a; padding: 2px 8px;
  border-radius: 6px; color: #ccc; font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.config-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.config-card-actions .btn,
.config-card-actions button { padding: 6px 12px; font-size: 12px; }
.btn.danger, button.danger {
  background: #2a1616; color: #ff6b6b; border: 1px solid #4a1e22;
}
.btn.danger:hover, button.danger:hover { background: #3a1c1c; }

.pill.live { background: var(--live-bg); color: var(--live-fg); border-color: #294029; }

/* --- global page fade-in transition --- */
main, .main-inner, .login-wrap, .configs-panel { animation: pageFadeIn 0.35s ease; }
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
a { transition: color 0.15s ease; }
.btn, button { transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease; }
.btn:active, button:active { transform: scale(0.97); }

/* --- redesigned top strip (compact, differentiated from Cider) --- */
.topbar-strip {
  display: flex; align-items: stretch; gap: 14px;
  margin-bottom: 14px;
}
.user-chip {
  flex: 0 0 auto;
  min-width: 200px;
  padding: 14px 18px;
  background: #121212;
  border: 1px solid #232323;
  border-radius: 12px;
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
}
.user-chip-name {
  font-size: 18px; font-weight: 700; color: #fff;
  letter-spacing: -0.01em;
}
.user-chip-role {
  font-size: 11px; color: #7aa2ff; text-transform: uppercase; letter-spacing: 0.08em;
}
.topbar-stats {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.mini-stat {
  background: #121212;
  border: 1px solid #232323;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.mini-stat-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: #777;
}
.mini-stat-value {
  font-size: 18px; font-weight: 700; color: #f0f0f0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mini-stat-note {
  font-size: 11px; color: #888;
}

/* --- license row (inline, small) --- */
.license-inline {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  margin-bottom: 14px;
  background: linear-gradient(90deg, #0f0f0f, #131313);
  border: 1px solid #262626;
  border-radius: 12px;
}
.license-inline-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: #666;
}
.license-inline-key {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px; color: #ccc;
  flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  filter: blur(4px);
  transition: filter 0.15s ease;
}
.license-inline:hover .license-inline-key { filter: none; }
.license-inline-hint { font-size: 11px; color: #555; }

/* --- new editor strip header --- */
.editor-strip {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #1e1e1e;
}
.editor-strip-left,
.editor-strip-right {
  display: flex; align-items: center; gap: 10px;
}
.dot-live {
  width: 8px; height: 8px; border-radius: 50%;
  background: #b56565;
  box-shadow: 0 0 6px rgba(181, 101, 101, 0.6);
}
.editor-panel-v2.online .dot-live {
  background: #7dd67d;
  box-shadow: 0 0 8px rgba(125, 214, 125, 0.7);
}
.editor-strip-title {
  font-size: 13px; font-weight: 600; color: #eee;
}
.editor-strip-status {
  font-size: 12px; color: #888;
}
.editor-strip-live {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: #999;
}
.editor-panel-v2.online .editor-strip-live { color: #7dd67d; }

@media (max-width: 900px) {
  .topbar-strip { flex-direction: column; }
  .topbar-stats { grid-template-columns: repeat(2, 1fr); }
}

/* --- match editor panel color to top-strip mini-stat cards --- */
.editor-panel-v2 {
  background: #121212;
  border-color: #232323;
}
.editor-panel-v2 .code-editor {
  background: #121212;
}
.editor-panel-v2 .code-wrap { background: transparent; }
.editor-panel-v2 .gutter    { background: #121212; border-right: 1px solid #1e1e1e; }
.editor-panel-v2 .panel-foot,
.editor-panel-v2 .editor-strip { background: #121212; }
.editor-panel-v2 .highlight { background: transparent; }
.editor-panel-v2 .raw { background: transparent; color: transparent; caret-color: #eee; }

/* --- editor search box (top-right of editor strip) --- */
.editor-search {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: #0e0e0e;
  border: 1px solid #232323;
  border-radius: 8px;
  color: #888;
  transition: border-color 0.15s ease;
}
.editor-search:focus-within { border-color: #3a3a3a; color: #ccc; }
.editor-search input {
  background: transparent; border: 0; outline: none;
  color: #eee; font-size: 12px; width: 140px;
  font-family: inherit;
}
.editor-search input::placeholder { color: #666; }
.editor-search-count {
  font-size: 10px; color: #666; font-family: 'JetBrains Mono', ui-monospace, monospace;
  min-width: 30px; text-align: right;
}

/* --- search hit highlights inside the JSON editor --- */
.highlight mark.search-hit {
  background: rgba(255, 200, 0, 0.28);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
  box-shadow: 0 0 0 1px rgba(255, 200, 0, 0.4);
}
.highlight mark.search-hit.active {
  background: rgba(255, 200, 0, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 200, 0, 0.9);
}
