/* ── Deep Violet ────────────────────────────────────────────────────────────── */
:root {
  --base:     #09090b;
  --mantle:   #0f0f12;
  --crust:    #060609;
  --surface0: #18181b;
  --surface1: #27272a;
  --surface2: #3f3f46;
  --overlay0: #52525b;
  --overlay1: #71717a;
  --subtext0: #a1a1aa;
  --subtext1: #d4d4d8;
  --text:     #fafafa;
  --mauve:    #8b5cf6;
  --blue:     #6366f1;
  --green:    #22c55e;
  --red:      #ef4444;
  --yellow:   #eab308;
  --peach:    #f97316;
  --teal:     #14b8a6;
  --accent-rgb: 139, 92, 246;
  --blue-rgb:   99, 102, 241;
  --accent: #8b5cf6;
  --accent-bright: #a78bfa;
  --accent-dim: #7c3aed;
}

/* ── Aged Manuscript (light) ──────────────────────────────────────────────── */
[data-theme="manuscript"] {
  --base:     #e3d5ab;
  --mantle:   #f4eddb;
  --crust:    #d6c48f;
  --surface0: #ece2c6;
  --surface1: #cdb98c;
  --surface2: #bda871;
  --overlay0: #9a8b66;
  --overlay1: #7c6e4c;
  --subtext0: #6b5d3f;
  --subtext1: #463a22;
  --text:     #2f2616;
  --mauve:    #9a6f1c;
  --blue:     #7e6a22;
  --green:    #5f7a2e;
  --red:      #a4462b;
  --yellow:   #b07d12;
  --peach:    #c0902f;
  --teal:     #5e8b7e;
  --accent-rgb: 154, 111, 28;
  --blue-rgb:   126, 106, 34;
  --accent: #9a6f1c;
  --accent-bright: #c0902f;
  --accent-dim: #b07d12;
}
[data-theme="manuscript"] body {
  background:
    radial-gradient(ellipse 72% 56% at 50% 34%, rgba(255,250,232,0.5), transparent 76%),
    linear-gradient(180deg, #ebdebc 0%, #e4d6ad 55%, #d9c694 100%);
  background-attachment: fixed;
}
[data-theme="manuscript"] h1,
[data-theme="manuscript"] h2 { font-family: 'Cinzel', serif; }
[data-theme="manuscript"] .au-add-btn:hover { background: #6b4d10; border-color: #6b4d10; }

/* ── Theme toggle button ──────────────────────────────────────────────────── */
.theme-toggle {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 9000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--mantle);
  border: 1px solid var(--surface2);
  color: var(--mauve);
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  transition: transform .15s, box-shadow .15s, background .15s, border-color .15s;
}
.theme-toggle:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0,0,0,0.4); border-color: var(--mauve); }
.theme-toggle:active { transform: translateY(0); }
.theme-toggle svg { width: 20px; height: 20px; }
[data-theme="manuscript"] .theme-toggle { box-shadow: 0 6px 20px rgba(86,62,24,0.25); }

/* ── Scrollbars ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface1); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: var(--overlay0); }

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--base);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Typography ────────────────────────────────────────────────────────────── */
h1 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--mauve);
}
h2 {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--overlay1);
  margin-bottom: 14px;
  margin-top: 24px;
}
h2:first-child { margin-top: 0; }

/* ── Login ─────────────────────────────────────────────────────────────────── */
#login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-box {
  background: var(--mantle);
  border: 1px solid var(--surface1);
  border-radius: 20px;
  padding: 44px 40px;
  width: 340px;
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb),0.08), 0 24px 64px rgba(0,0,0,0.6);
}
.login-box h1 { margin-bottom: 28px; text-align: center; }
.login-box input {
  width: 100%;
  padding: 10px 14px;
  background: var(--base);
  border: 1px solid var(--surface1);
  color: var(--text);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 10px;
  transition: border-color .15s;
}
.login-box input:focus {
  outline: none;
  border-color: var(--mauve);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.15);
}
.login-err {
  color: var(--red);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 10px;
  display: none;
}

.btn-discord {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  background: #5865f2;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.btn-discord:hover { background: #4752c4; }

/* ── Main Layout ───────────────────────────────────────────────────────────── */
#main {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  margin-top: 70px;
}


.logout {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--overlay0);
  cursor: pointer;
  letter-spacing: 1px;
  transition: color .15s;
}
.logout:hover { color: var(--red); }

/* ── Health bar ────────────────────────────────────────────────────────────── */
.health-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 6px 28px;
  background: var(--crust);
  border-bottom: 1px solid var(--surface0);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.5px;
  position: sticky;
  top: 70px;
  z-index: 100;
}
.health-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--overlay0);
}
.health-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--surface1);
  transition: background 0.3s;
}
.health-item.ok .health-dot { background: var(--green); }
.health-item.err .health-dot { background: var(--red); }
.health-item.ok { color: var(--subtext0); }
.health-sep { flex: 1; }
.health-uptime { color: var(--overlay0); }

/* ── Week chart ────────────────────────────────────────────────────────────── */
.chart-wrap {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 4px;
}
.chart-yaxis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-bottom: 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--overlay0);
  text-align: right;
  flex-shrink: 0;
  min-width: 28px;
}
.week-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 80px;
  padding: 0 2px;
  flex: 1;
}
.month-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 60px;
  padding: 0 2px;
  flex: 1;
}
.week-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex: 1;
  height: 100%;
}
.week-bar {
  width: 100%;
  background: rgba(var(--accent-rgb),0.25);
  border-radius: 4px 4px 0 0;
  transition: background 0.15s;
  min-height: 3px;
}
.week-bar:hover { background: rgba(var(--accent-rgb),0.5); }
.week-bar-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--overlay0);
  text-align: center;
  white-space: nowrap;
}


/* ── Floating Pill Tabs ────────────────────────────────────────────────────── */
.tabs-bar {
  display: flex;
  justify-content: center;
  padding: 10px 24px 0;
  flex-shrink: 0;
}
.tabs {
  display: flex;
  gap: 2px;
  background: var(--mantle);
  border: 1px solid var(--surface1);
  border-radius: 9999px;
  padding: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.tab {
  padding: 7px 20px;
  border-radius: 9999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--subtext0);
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.tab:hover:not(.active) {
  background: var(--surface0);
  color: var(--text);
}
.tab.active {
  background: var(--mauve);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(var(--accent-rgb),0.35);
}

/* ── Panels ────────────────────────────────────────────────────────────────── */
.panel {
  display: none;
  padding: 28px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}
.panel.active {
  display: block;
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Status indicator ──────────────────────────────────────────────────────── */
.ss {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--overlay0);
  margin-left: 6px;
}
.ss.ok { color: var(--green); }
.ss.err { color: var(--red); }

/* ── Stats ─────────────────────────────────────────────────────────────────── */
.stat-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}
.stat-row-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.stat {
  background: rgba(41,44,60,0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--surface1);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  text-align: center;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
  cursor: default;
}
.stat:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--accent-rgb),0.4);
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb),0.15), 0 8px 32px rgba(var(--accent-rgb),0.15);
}
.stat-primary {
  border-color: rgba(var(--accent-rgb),0.3);
  background: rgba(var(--accent-rgb),0.05);
  padding: 18px 16px;
}
.stat-primary .stat-val {
  font-size: 42px !important;
}
.stat-val {
  font-size: 26px;
  font-weight: 700;
  color: var(--mauve);
  line-height: 1;
  margin-bottom: 5px;
}
.stat-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--overlay0);
}

/* ── Tables ────────────────────────────────────────────────────────────────── */
.week-table {
  border-collapse: collapse;
  font-size: 13px;
  width: 100%;
}
.week-table th:first-child,
.week-table td:first-child { width: 50%; }
.week-table th:not(:first-child),
.week-table td:not(:first-child) { width: 25%; }
.week-table th {
  text-align: left;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--overlay0);
  font-weight: normal;
  padding: 6px 20px 6px 0;
}
.week-table td { padding: 6px 20px 6px 0; color: var(--subtext1); }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 8px;
}
table.data th {
  text-align: left;
  padding: 8px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--overlay0);
  font-weight: normal;
  border-bottom: 1px solid var(--surface0);
}
table.data td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--surface0);
  vertical-align: middle;
}
table.data tr:hover > td { background: rgba(var(--accent-rgb),.04); }

.hl { color: var(--mauve); font-weight: 500; }
.dim { color: var(--overlay0); font-size: 12px; }

/* ── Travel table ──────────────────────────────────────────────────────────── */
.travel-wrap { overflow-x: auto; }
table.travel {
  border-collapse: collapse;
  font-size: 12px;
}
table.travel th, table.travel td {
  padding: 4px 8px;
  text-align: center;
  border: 1px solid var(--surface0);
  min-width: 76px;
}
table.travel th {
  background: var(--mantle);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--overlay0);
  font-weight: normal;
}
table.travel td.self { background: var(--crust); color: var(--surface1); }
table.travel input {
  background: transparent;
  border: none;
  color: var(--text);
  text-align: center;
  width: 60px;
  padding: 4px;
  font-size: 12px;
  font-family: inherit;
}
table.travel input:focus { outline: 1px solid var(--mauve); border-radius: 3px; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  background: var(--surface0);
  border: 1px solid var(--surface1);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  transition: background .15s, border-color .15s, color .15s, transform .08s, box-shadow .15s;
}
.btn:active { transform: scale(0.96); }
.btn:hover {
  background: var(--surface1);
  border-color: var(--mauve);
  color: var(--mauve);
}
.btn-save {
  background: rgba(34,197,94,.12);
  border-color: rgba(34,197,94,.3);
  color: var(--green);
}
.btn-save:hover {
  background: rgba(34,197,94,.2);
  border-color: var(--green);
}
.btn-del {
  background: rgba(239,68,68,.1);
  border-color: rgba(239,68,68,.3);
  color: var(--red);
}
.btn-del:hover {
  background: rgba(239,68,68,.2);
  border-color: var(--red);
}
.btn-add {
  background: rgba(var(--blue-rgb),.1);
  border-color: rgba(var(--blue-rgb),.3);
  color: var(--blue);
}
.btn-add:hover {
  background: rgba(var(--blue-rgb),.2);
  border-color: var(--blue);
}
.mini-btn { padding: 4px 10px; font-size: 11px; }

/* ── Inputs ────────────────────────────────────────────────────────────────── */
input[type="text"].ifield, input[type="number"].ifield, select.ifield, .ifield {
  background: var(--mantle);
  border: 1px solid var(--surface1);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input[type="text"].ifield:focus, input[type="number"].ifield:focus, select.ifield:focus, .ifield:focus {
  outline: none;
  border-color: var(--mauve);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.12);
}
select.ifield { padding: 8px 10px; }

.tfield {
  width: 100%;
  background: var(--mantle);
  border: 1px solid var(--surface1);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 12px;
  transition: border-color .15s, box-shadow .15s;
  line-height: 1.5;
}
.tfield:focus {
  outline: none;
  border-color: var(--mauve);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.12);
}

.field-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--overlay1);
  display: block;
  margin-bottom: 6px;
}

/* ── Card boxes ────────────────────────────────────────────────────────────── */
.card-box {
  background: rgba(41,44,60,0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--surface1);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

/* ── Add row ───────────────────────────────────────────────────────────────── */
.add-row {
  display: none;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  background: var(--mantle);
  border: 1px solid var(--surface1);
  border-radius: 12px;
  padding: 16px;
  margin-top: 10px;
  margin-bottom: 14px;
}
.add-row label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--overlay1);
  display: block;
  margin-bottom: 5px;
}
.field { display: flex; flex-direction: column; }

/* ── Hint ──────────────────────────────────────────────────────────────────── */
.hint { margin-top: 10px; font-size: 12px; color: var(--overlay0); }
.hint code {
  background: var(--surface0);
  border: 1px solid var(--surface1);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--subtext1);
}

/* ── Tags ──────────────────────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 2px 10px;
  background: rgba(var(--blue-rgb),.1);
  border: 1px solid rgba(var(--blue-rgb),.25);
  border-radius: 9999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--blue);
  margin: 2px;
}
.tag .x { margin-left: 6px; cursor: pointer; color: var(--overlay0); }
.tag .x:hover { color: var(--red); }

/* ── Analytics dashboard grid ──────────────────────────────────────────────── */
.analytics-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.analytics-col-main { position: relative; z-index: 1; }

/* ── Admin side handles ─────────────────────────────────────────────────────── */
.admin-handles-wrap {
  display: none;
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 900;
}
.admin-handle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  cursor: pointer;
  padding: 24px 10px;
  background: var(--mantle);
  border: 1px solid var(--surface1);
  border-right: none;
  border-radius: 14px 0 0 14px;
  box-shadow: -4px 0 20px rgba(0,0,0,0.3);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  user-select: none;
}
.admin-handle span:last-child {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--overlay1);
  font-weight: 600;
  transform: rotate(180deg);
  transition: color 0.2s;
}
.admin-handle:hover {
  background: var(--surface0);
  border-color: var(--mauve);
  box-shadow: -4px 0 24px rgba(var(--accent-rgb),0.2);
}
.admin-handle:hover span:last-child { color: var(--mauve); }
.admin-handle.active { border-color: rgba(var(--accent-rgb),0.3); }
.admin-handle-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--surface1);
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}
.admin-handle-maintenance .admin-handle-dot.active {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.2);
  animation: dotPulseRed 2s ease-in-out infinite;
}
.admin-handle-notice .admin-handle-dot.active {
  background: var(--blue);
  box-shadow: 0 0 0 3px rgba(var(--blue-rgb),0.2);
  animation: dotPulseBlue 2s ease-in-out infinite;
}

/* ── Admin drawers ──────────────────────────────────────────────────────────── */
.admin-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.admin-drawer-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.admin-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  height: 100vh;
  background: var(--mantle);
  border-left: 1px solid var(--surface1);
  box-shadow: -8px 0 60px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.admin-drawer-overlay.open .admin-drawer {
  transform: translateX(0);
}

/* ── Ban rows ──────────────────────────────────────────────────────────────── */
.ban-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--surface0);
}
.ban-row:last-child { border-bottom: 0; }
.ban-meta {
  font-family: 'JetBrains Mono', monospace;
  color: var(--overlay0);
  font-size: 11px;
  margin-bottom: 6px;
}
.ban-body { display: flex; align-items: flex-start; gap: 10px; }
.ban-content { flex: 1; min-width: 0; }
.ban-msg {
  flex: 1;
  min-width: 0;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--base);
  border: 1px solid var(--surface0);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
}
.ban-reason { display: block; color: var(--overlay0); }
.ban-evidence { margin-top: 6px; }
.ban-evidence-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--overlay0);
  margin-bottom: 3px;
}
/* Hostile payloads may be huge and space-less: contain + scroll, never break layout. */
.ban-evidence-text {
  margin: 0;
  max-width: 100%;
  min-width: 0;
  max-height: 160px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  background: var(--base);
  border: 1px solid var(--surface0);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Toggle ────────────────────────────────────────────────────────────────── */
.toggle-label { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle-input { display: none; }
.toggle-track {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--surface1);
  border-radius: 9999px;
  transition: background .2s;
  flex-shrink: 0;
}
.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--overlay0);
  border-radius: 50%;
  transition: transform .2s, background .2s;
}
.toggle-input:checked + .toggle-track { background: rgba(var(--accent-rgb),.35); }
.toggle-input:checked + .toggle-track .toggle-thumb { transform: translateX(20px); background: var(--mauve); }

/* ── Projects layout ───────────────────────────────────────────────────────── */





/* ── Task cards ────────────────────────────────────────────────────────────── */
.ptask {
  background: var(--mantle);
  border: 1px solid var(--surface1);
  border-left: 3px solid var(--ptask-accent, var(--surface1));
  border-radius: 14px;
  margin-bottom: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.ptask:hover { box-shadow: 0 6px 28px rgba(0,0,0,0.3); }
.ptask-mine { background: linear-gradient(135deg, color-mix(in srgb, var(--ptask-accent) 5%, var(--mantle)) 0%, var(--mantle) 60%); }
.ptask-head { padding: 22px 26px 18px; }
.ptask-body {
  padding: 16px 26px 20px;
  border-top: 1px solid var(--surface0);
  background: rgba(0,0,0,0.08);
}
.ptask-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.ptask-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.2s;
}
.ptask:hover .ptask-actions { opacity: 1; }
.ptask-type-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid;
}
.ptask-status-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid;
  color: var(--overlay0);
  border-color: var(--surface1);
  background: var(--surface0);
}
.ptask-done-chip { color: var(--green) !important; border-color: rgba(166,209,137,0.3) !important; background: rgba(166,209,137,0.08) !important; }
.ptask-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 8px;
}
.ptask-title-done { opacity: 0.4; text-decoration: line-through; }
.ptask-desc {
  font-size: 13px;
  color: var(--subtext0);
  line-height: 1.6;
  white-space: pre-wrap;
  margin-bottom: 14px;
}
.ptask-footer-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--overlay0);
  margin-bottom: 10px;
}
.ptask-progress { color: var(--subtext0); }
.ptask-progress-bar {
  height: 3px;
  background: var(--surface0);
  border-radius: 9999px;
  overflow: hidden;
}
.ptask-progress-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.4s ease;
  opacity: 0.8;
}

/* ── Todos ─────────────────────────────────────────────────────────────────── */
.ptodo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  transition: background 0.15s;
}
.ptodo:hover { background: var(--surface0); }
.ptodo input[type=checkbox] { accent-color: var(--mauve); flex-shrink: 0; }
.ptodo-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--overlay0);
  flex-shrink: 0;
  width: 18px;
}
.ptodo-text { flex: 1; font-size: 13px; color: var(--text); }
.ptodo-done .ptodo-text { text-decoration: line-through; color: var(--overlay0); }

/* ── Comments ──────────────────────────────────────────────────────────────── */

/* ── Project subtabs ───────────────────────────────────────────────────────── */

/* ── Admin lock ────────────────────────────────────────────────────────────── */
body[data-admin-locked="1"] .panel { filter: saturate(0.7); }
body[data-admin-locked="1"] .panel::before {
  content: "Read-only mode: owner lock is active";
  display: block;
  padding: 8px 14px;
  margin-bottom: 14px;
  border: 1px solid rgba(229,200,144,.3);
  background: rgba(229,200,144,.08);
  color: var(--yellow);
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: .5px;
}

/* ── Changelog cards ───────────────────────────────────────────────────────── */
.cl-card {
  background: var(--mantle);
  border: 1px solid var(--surface1);
  border-left: 3px solid var(--surface1);
  border-radius: 14px;
  padding: 28px 32px;
  margin-bottom: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.cl-card:hover {
  border-left-color: var(--mauve);
  box-shadow: 0 6px 28px rgba(0,0,0,0.28);
}
.cl-card.cl-latest {
  border-left-color: var(--mauve);
  background: linear-gradient(135deg, rgba(var(--accent-rgb),0.04) 0%, transparent 60%);
}
.cl-latest-badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--crust);
  background: var(--mauve);
  border-radius: 4px;
  padding: 2px 7px;
  margin-bottom: 10px;
  font-weight: 600;
}
.cl-card-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
}
.cl-version {
  font-family: 'JetBrains Mono', monospace;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 8px;
}
.cl-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--overlay0);
}
.cl-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.cl-card:hover .cl-card-actions { opacity: 1; }
.cl-action-btn {
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: 7px;
  color: var(--subtext0);
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.5px;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.cl-action-btn:hover { background: var(--surface1); color: var(--text); }
.cl-action-del:hover { border-color: var(--red); color: var(--red); background: rgba(239,68,68,0.08); }
.cl-action-save:hover { border-color: var(--green); color: var(--green); background: rgba(166,209,137,0.08); }
.cl-bullets {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 2px;
}
.cl-bullets li {
  padding: 9px 12px;
  color: var(--subtext1);
  font-size: 13px;
  border-radius: 8px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  transition: background 0.15s;
}
.cl-bullets li:hover { background: var(--surface0); color: var(--text); }
.cl-bullets li.cl-cat { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--mauve); text-transform: uppercase; letter-spacing: 1.5px; padding: 4px 12px 2px; opacity: 0.7; }
.cl-bullets li.cl-text { color: var(--subtext0); font-style: italic; }
.cl-bullet-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--mauve);
  opacity: 0.7;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

/* ── Changelog vertical handle ─────────────────────────────────────────────── */
#cl-handle {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  cursor: pointer;
  padding: 28px 10px;
  background: var(--mantle);
  border: 1px solid var(--surface1);
  border-right: none;
  border-radius: 14px 0 0 14px;
  box-shadow: -4px 0 20px rgba(0,0,0,0.3);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, padding 0.2s;
  z-index: 900;
  user-select: none;
  gap: 16px;
}
#cl-handle.visible { display: flex; }
#cl-handle:hover {
  background: var(--surface0);
  border-color: var(--mauve);
  box-shadow: -4px 0 24px rgba(var(--accent-rgb),0.2);
  padding: 28px 14px;
}
#cl-handle span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--mauve);
  font-weight: 600;
  transform: rotate(180deg);
}

/* ── Project drawer handle ──────────────────────────────────────────────────── */

/* ── Project drawer ─────────────────────────────────────────────────────────── */




/* ── Changelog Drawer ──────────────────────────────────────────────────────── */
#cl-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
#cl-drawer-overlay.open {
  opacity: 1;
  pointer-events: all;
}
#cl-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 50vw;
  min-width: 480px;
  height: 100vh;
  background: var(--mantle);
  border-left: 1px solid var(--surface1);
  box-shadow: -8px 0 60px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
#cl-drawer-overlay.open #cl-drawer {
  transform: translateX(0);
}
.cl-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 32px 32px 24px;
  border-bottom: 1px solid var(--surface0);
}
.cl-drawer-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.cl-drawer-sub {
  font-size: 12px;
  color: var(--overlay0);
}
.cl-drawer-close {
  background: none;
  border: none;
  color: var(--overlay0);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  line-height: 1;
}
.cl-drawer-close:hover { color: var(--text); background: var(--surface0); }
.cl-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.cl-drawer-label {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--overlay0);
  font-weight: 500;
  margin-bottom: 10px;
}
.cl-ver-wrap {
  display: flex;
  align-items: stretch;
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.cl-ver-wrap:focus-within { border-color: var(--mauve); }
.cl-ver-prefix {
  padding: 0 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 700;
  color: var(--mauve);
  background: var(--surface1);
  display: flex;
  align-items: center;
}
.cl-ver-input {
  background: transparent;
  border: none;
  outline: none;
  font-size: 22px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
  padding: 14px 16px;
  flex: 1;
  width: 0;
}
.cl-ver-input::placeholder { color: var(--surface1); }
.cl-today-btn {
  background: none;
  border: 1px solid var(--surface1);
  border-radius: 6px;
  color: var(--mauve);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.cl-today-btn:hover { background: var(--surface0); border-color: var(--mauve); }
.cl-date-pills {
  display: flex;
  align-items: stretch;
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.cl-date-pills:focus-within { border-color: var(--mauve); }
.cl-date-pills input,
.cl-date-pills select {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  padding: 12px 14px;
  -moz-appearance: textfield;
  appearance: textfield;
}
.cl-date-pills input[type=number]::-webkit-inner-spin-button { display: none; }
.cl-date-pills input[type=number] { text-align: center; }
.cl-date-pills input:first-child { width: 64px; }
.cl-month-wrap { flex: 1; position: relative; }
.cl-month-display {
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.cl-month-display.placeholder { color: var(--overlay0); }
.cl-month-drop {
  display: none;
  position: fixed;
  background: var(--crust);
  border: 1px solid var(--surface1);
  border-radius: 8px;
  z-index: 2000;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.cl-month-drop.open { display: block; }
.cl-month-opt {
  padding: 9px 14px;
  font-size: 13px;
  color: var(--subtext1);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.cl-month-opt:hover { background: var(--surface0); color: var(--text); }
.cl-month-opt.selected { color: var(--mauve); background: var(--surface0); }
.cl-date-pills input:last-child { width: 80px; text-align: center; }
.cl-date-sep {
  width: 1px;
  background: var(--surface1);
  align-self: stretch;
}
.cl-drawer-entries { flex: 1; display: flex; flex-direction: column; }
.cl-drawer-textarea {
  flex: 1;
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  padding: 14px;
  resize: vertical;
  min-height: 180px;
  outline: none;
  transition: border-color 0.15s;
  line-height: 1.7;
}
.cl-drawer-textarea:focus { border-color: var(--mauve); }
.cl-drawer-textarea::placeholder { color: var(--overlay0); }
.cl-drawer-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 32px;
  border-top: 1px solid var(--surface0);
  background: var(--crust);
}
.cl-drawer-footer .ss { margin-right: auto; }
.cl-drawer-footer .btn {
  flex-shrink: 0;
  padding: 12px 28px;
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.5px;
  border-radius: 10px;
  font-weight: 500;
}
.cl-drawer-footer .btn-save {
  padding: 12px 32px;
  font-size: 13px;
  letter-spacing: 0.8px;
  background: var(--mauve);
  color: var(--crust);
  border: none;
  box-shadow: 0 4px 16px rgba(var(--accent-rgb),0.3);
  transition: opacity 0.15s, box-shadow 0.15s;
}
.cl-drawer-footer .btn-save:hover {
  opacity: 0.9;
  box-shadow: 0 6px 20px rgba(var(--accent-rgb),0.45);
}

/* ── Maintenance drawer redesign ───────────────────────────────────────────── */
.maint-form-section {
  padding: 20px 0;
  border-bottom: 1px solid var(--surface0);
}
.maint-form-section:last-child { border-bottom: none; }
.maint-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.maint-indefinite-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
}
.maint-form-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.maint-form-hint {
  font-size: 12px;
  color: var(--overlay0);
  line-height: 1.4;
}
.maint-form-optional {
  font-size: 10px;
  font-weight: 400;
  color: var(--overlay0);
  letter-spacing: 0.5px;
}
.maint-timer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.maint-timer-sep {
  color: var(--overlay0);
  font-size: 13px;
}

/* ── Maintenance preview panel ──────────────────────────────────────────────── */
#maint-preview-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 420px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 60px 48px;
  overflow-y: auto;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s 0.1s;
}
#drawer-maintenance.open #maint-preview-panel { opacity: 1; }
.maint-preview-page {
  background: #0d1119;
  border: 1px solid rgba(61,142,255,0.1);
  border-radius: 16px;
  padding: 48px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  flex: 1;
  justify-content: center;
}
.maint-preview-title {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  letter-spacing: 4px;
  color: #3d8eff;
  margin: 0;
}
.maint-preview-msg {
  color: rgba(232,234,239,0.6);
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
  max-width: 320px;
}
.maint-preview-timer {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: #e8eaef;
  margin: 0;
  font-variant-numeric: tabular-nums;
  display: none;
}
.maint-preview-timer.visible { display: block; }
.maint-preview-indefinite {
  font-size: 11px;
  color: rgba(232,234,239,0.4);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 0;
  display: none;
}
.maint-preview-indefinite.visible { display: block; }

/* ── Notice preview ────────────────────────────────────────────────────────── */
.notice-preview-wrap {
  background: #13161c;
  border: 1px solid #2a3445;
  border-radius: 10px;
  padding: 24px 20px 20px;
  text-align: center;
  margin-top: 8px;
  position: relative;
}
.notice-preview-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 3px;
  color: rgba(232,234,239,0.4);
  margin: 0 0 10px;
  text-transform: uppercase;
}
.notice-preview-text {
  color: rgba(232,234,239,0.72);
  font-size: 13px;
  line-height: 1.7;
  margin: 0;
  font-style: italic;
}
.notice-preview-text.has-content { font-style: normal; }

/* ── Changelog preview panel ───────────────────────────────────────────────── */
#cl-preview-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 50vw;
  height: 100vh;
  padding: 60px 48px;
  overflow-y: auto;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s 0.1s;
  display: flex;
  flex-direction: column;
  gap: 20px;
  --gold:      #3d8eff;
  --gold-dim:  rgba(61,142,255,0.55);
  --gold-dark: rgba(61,142,255,0.2);
  --text-dim:  #a5adce;
  --text-muted:#737994;
}
#cl-drawer-overlay.open #cl-preview-panel { opacity: 1; }
.cl-preview-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--overlay0);
}

/* Frontend changelog styles scoped to preview */
#cl-preview-panel .cl-entry {
  position: relative;
  border-bottom: 1px solid rgba(61,142,255,0.07);
  background: rgba(12,16,26,0.6);
  border-radius: 8px;
  overflow: hidden;
}
#cl-preview-panel .cl-timeline-line { display: none; }
#cl-preview-panel .cl-entry-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px;
  cursor: default;
}
#cl-preview-panel .cl-header-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
#cl-preview-panel .cl-header-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
#cl-preview-panel .cl-marker {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border: 1px solid var(--gold-dim);
  background: var(--gold);
  border-radius: 2px;
  transform: rotate(45deg);
  box-shadow: 0 0 10px rgba(61,142,255,0.4);
}
#cl-preview-panel .cl-ver {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.5px;
}
#cl-preview-panel .cl-date {
  font-size: 12px;
  color: var(--text-muted);
}
#cl-preview-panel .cl-tag {
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 2px 8px;
  border: 1px solid rgba(61,142,255,0.3);
  color: rgba(61,142,255,0.7);
  border-radius: 2px;
}
#cl-preview-panel .cl-tag.latest-tag {
  border-color: rgba(61,142,255,0.5);
  color: #3d8eff;
  background: rgba(61,142,255,0.08);
}
#cl-preview-panel .cl-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  transform: rotate(90deg);
}
#cl-preview-panel .cl-entry-body {
  max-height: 3000px;
}
#cl-preview-panel .cl-items {
  margin: 0;
  padding: 4px 24px 18px 44px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.7;
  list-style: none;
}
#cl-preview-panel .cl-items li {
  position: relative;
  padding-left: 14px;
  margin-bottom: 2px;
}
#cl-preview-panel .cl-items li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--gold-dim);
  font-size: 16px;
  line-height: 1.4;
}
#cl-preview-panel .cl-items li.cl-cat {
  padding-left: 0;
  margin-top: 10px;
  margin-bottom: 4px;
  font-family: 'Cinzel', serif;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(61,142,255,0.55);
  font-weight: 600;
}
#cl-preview-panel .cl-items li.cl-cat::before { display: none; }
#cl-preview-panel .cl-items li.cl-cat:first-child { margin-top: 0; }
#cl-preview-panel .cl-items li.cl-text { padding-left: 0; color: rgba(232,234,239,0.45); margin-bottom: 6px; }
#cl-preview-panel .cl-items li.cl-text::before { display: none; }
#cl-preview-panel .cl-contributors { display: flex; gap: 5px; flex-wrap: wrap; }
#cl-preview-panel .cl-contrib {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  padding: 2px 8px 2px 6px;
  border: 1px solid;
  border-radius: 2px;
  opacity: 0.85;
  letter-spacing: 0.2px;
}
#cl-preview-panel .cl-contrib-initial {
  font-family: 'Cinzel', serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  opacity: 0.8;
}
#cl-preview-panel .cl-contrib-name { font-size: 10px; font-weight: 500; }

/* ── Accordion cards ───────────────────────────────────────────────────────── */
.acc-card {
  background: rgba(41,44,60,0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--surface1);
  border-left: 3px solid var(--acc-color, var(--surface1));
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
  transition: background 0.3s, box-shadow 0.2s;
}
.acc-maintenance { --acc-color: var(--red); }
.acc-notice      { --acc-color: var(--blue); }
.acc-bans        { --acc-color: var(--peach); }

.acc-card.tinted-maintenance { background: rgba(239,68,68,0.07); }
.acc-card.tinted-notice      { background: rgba(var(--blue-rgb),0.07); }

.acc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.acc-header:hover { background: rgba(255,255,255,0.03); }

.acc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--surface1);
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}
.acc-maintenance .acc-dot.active {
  background: var(--red);
  animation: dotPulseRed 2s ease-in-out infinite;
}
.acc-notice .acc-dot.active {
  background: var(--blue);
  animation: dotPulseBlue 2s ease-in-out infinite;
}
.acc-bans .acc-dot.active { background: var(--peach); }
@keyframes dotPulseRed {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
  50%       { box-shadow: 0 0 0 5px rgba(239,68,68,0); }
}
@keyframes dotPulseBlue {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--blue-rgb),0.5); }
  50%       { box-shadow: 0 0 0 5px rgba(var(--blue-rgb),0); }
}

.acc-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--overlay1);
  flex: 1;
  font-weight: 500;
}
.acc-ss {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--overlay0);
  letter-spacing: 0.5px;
}
.acc-ss.ok  { color: var(--green); }
.acc-ss.err { color: var(--red); }

.acc-chevron {
  color: var(--overlay0);
  font-size: 18px;
  line-height: 1;
  transition: transform 0.25s ease;
}
.acc-card.open .acc-chevron { transform: rotate(180deg); }

.acc-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1);
}
.acc-card.open .acc-body { max-height: 600px; }

.acc-body-inner {
  padding: 4px 18px 18px;
  border-top: 1px solid var(--surface0);
}

.acc-maintenance .tfield:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.12);
}
.acc-notice .tfield:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(var(--blue-rgb),0.12);
}

/* ── Skeleton loaders ──────────────────────────────────────────────────────── */
@keyframes skeletonPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}
.skel {
  background: var(--surface0);
  border-radius: 6px;
  animation: skeletonPulse 1.4s ease-in-out infinite;
}
.skel-stat { height: 38px; width: 80px; margin: 0 auto 6px; border-radius: 8px; }
.skel-label { height: 10px; width: 60px; margin: 0 auto; }
.skel-row { height: 14px; width: 100%; margin-bottom: 8px; }
.skel-row:last-child { margin-bottom: 0; width: 70%; }

/* ── Toast notifications ───────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--crust);
  border: 1px solid var(--surface1);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  font-size: 13px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.3px;
  pointer-events: all;
  animation: toastIn 0.25s cubic-bezier(0.34,1.56,0.64,1) both;
  max-width: 340px;
}
.toast.out { animation: toastOut 0.2s ease-in forwards; }
.toast-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.toast.ok .toast-dot { background: var(--green); }
.toast.err .toast-dot { background: var(--red); }
.toast.info .toast-dot { background: var(--blue); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(20px) scale(0.95); }
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .tabs-bar { padding: 12px 12px 0; }
  .tabs { flex-wrap: wrap; border-radius: 16px; }
  .panel { padding: 16px; }
}

/* Comments panel */
.cm-section-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.cm-section-header h2 { margin: 0; }
.cm-phrase-row { display: flex; gap: 8px; margin-bottom: 12px; }
.cm-phrase-row input { flex: 1; background: var(--surface0); border: 1px solid var(--surface1); border-radius: 6px; padding: 7px 12px; color: var(--text); font-size: 13px; font-family: inherit; }
.cm-phrase-row input:focus { outline: none; border-color: var(--mauve); }
.cm-phrase-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 24px; }
.cm-phrase-chip { display: inline-flex; align-items: center; gap: 6px; background: rgba(243,139,168,0.08); border: 1px solid rgba(243,139,168,0.2); border-radius: 20px; padding: 3px 10px; font-size: 12px; color: var(--red); }
.cm-phrase-chip button { background: none; border: none; color: rgba(243,139,168,0.6); cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }
.cm-phrase-chip button:hover { color: var(--red); }
.cm-divider { border: none; border-top: 1px solid var(--surface0); margin: 20px 0; }
.cm-row { display: flex; align-items: flex-start; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--surface0); }
.cm-row:last-child { border-bottom: none; }
.cm-row-body { flex: 1; min-width: 0; }
.cm-row-meta { font-size: 13px; color: var(--text); margin-bottom: 4px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cm-row-meta strong { color: var(--mauve); }
.cm-row-meta time { font-size: 11px; color: var(--overlay0); }
.cm-row-msg { font-size: 13px; color: var(--subtext0); font-style: italic; }
.cm-row-fp { font-size: 10px; color: var(--surface2); margin-top: 4px; font-family: 'JetBrains Mono', monospace; }
.cm-row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.cm-btn-danger { color: var(--red) !important; border-color: rgba(243,139,168,0.25) !important; }

/* ── Users panel ───────────────────────────────────────────────────────────── */
.au-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.au-card {
  background: var(--mantle);
  border: 1px solid var(--surface1);
  border-radius: 14px;
  padding: 24px;
}
.au-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.au-card-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.au-card-sub { font-size: 12px; color: var(--overlay1); }
.au-add-row { display: flex; gap: 8px; }
input[type="text"].au-input {
  flex: 1;
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: 8px;
  padding: 9px 14px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input[type="text"].au-input:focus { outline: none; border-color: var(--mauve); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.1); }
select.au-select {
  width: auto;
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.au-add-btn { background: var(--mauve); border-color: var(--mauve); color: #fff; font-weight: 600; padding: 9px 18px; }
.au-add-btn:hover { background: #7c3aed; border-color: #7c3aed; color: #fff; }
.au-member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--surface0);
}
.au-member-row:last-child { border-bottom: none; padding-bottom: 0; }
.au-member-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mauve), var(--blue));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff;
  flex-shrink: 0;
}
.au-member-info { flex: 1; min-width: 0; }
.au-member-name { font-size: 14px; font-weight: 500; color: var(--text); }
.au-member-id { font-size: 11px; color: var(--overlay0); font-family: 'JetBrains Mono', monospace; margin-top: 1px; }
.au-role-badge {
  font-size: 11px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase;
  padding: 3px 10px; border-radius: 9999px;
}
.au-role-helper { background: rgba(var(--blue-rgb),0.15); color: var(--blue); }
.au-role-owner  { background: rgba(var(--accent-rgb),0.15); color: var(--mauve); }

/* ── Changelog timeline (mirrors main site) ────────────────────────────────── */
#changelogs-list { position: relative; }
.cl-entry { position: relative; border-bottom: 1px solid var(--surface0); }
.cl-entry:last-child { border-bottom: none; }
.cl-timeline-line { position: absolute; left: 27px; top: 46px; bottom: 0; width: 1px; background: rgba(var(--accent-rgb),0.15); pointer-events: none; }
.cl-entry:last-child .cl-timeline-line { display: none; }
.cl-entry-header { display: flex; align-items: center; gap: 10px; padding: 14px 20px; cursor: pointer; user-select: none; transition: background .12s; }
.cl-entry-header:hover { background: rgba(var(--accent-rgb),0.04); }
.cl-header-main { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cl-header-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cl-marker { width: 10px; height: 10px; flex-shrink: 0; border: 1px solid rgba(var(--accent-rgb),0.3); background: var(--surface0); border-radius: 2px; transform: rotate(45deg); transition: box-shadow .15s; }
.cl-entry.latest .cl-marker { background: var(--mauve); border-color: rgba(var(--accent-rgb),0.6); box-shadow: 0 0 10px rgba(var(--accent-rgb),0.4); }
.cl-ver { font-family: 'Cinzel', serif; font-size: 14px; font-weight: 600; color: var(--mauve); letter-spacing: 0.5px; }
.cl-entry .cl-date { font-size: 12px; color: var(--overlay1); }
.cl-tag { font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; padding: 2px 8px; border: 1px solid rgba(var(--accent-rgb),0.3); color: rgba(var(--accent-rgb),0.7); border-radius: 2px; }
.cl-tag.latest-tag { border-color: rgba(var(--accent-rgb),0.5); color: var(--mauve); background: rgba(var(--accent-rgb),0.08); }
.cl-chevron { margin-left: 4px; color: var(--overlay0); flex-shrink: 0; transition: transform .2s; }
.cl-entry.expanded .cl-chevron { transform: rotate(90deg); }
.cl-entry-body { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.cl-entry.expanded .cl-entry-body { max-height: 3000px; }
.cl-items { margin: 0; padding: 4px 24px 18px 52px; font-size: 13px; color: var(--subtext0); line-height: 1.7; list-style: none; }
.cl-items li { position: relative; padding-left: 14px; margin-bottom: 2px; }
.cl-items li::before { content: '·'; position: absolute; left: 0; color: rgba(var(--accent-rgb),0.5); font-size: 16px; line-height: 1.4; }
.cl-items li.cl-cat { padding-left: 0; margin-top: 10px; margin-bottom: 4px; font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: rgba(var(--accent-rgb),0.6); font-weight: 600; }
.cl-items li.cl-cat::before { display: none; }
.cl-items li.cl-cat:first-child { margin-top: 0; }
.cl-items li.cl-text { padding-left: 0; }
.cl-items li.cl-text::before { display: none; }
.cl-admin-actions { display: flex; gap: 6px; }
.cl-contrib { display:inline-flex;align-items:center;gap:5px;font-size:10px;padding:2px 8px 2px 6px;border:1px solid;border-radius:2px;opacity:0.85;letter-spacing:0.2px; }
.cl-contrib-initial { font-family:'Cinzel',serif;font-size:9px;font-weight:700;letter-spacing:0.5px;opacity:0.8; }
.cl-contrib-name { font-size:10px;font-weight:500; }
.cl-contributors { display:flex;gap:5px;flex-wrap:wrap; }

/* ── Theme switch transitions ──────────────────────────────────────────────── */
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 0.4s; animation-timing-function: ease; }
[data-transition="to-manuscript"]::view-transition-old(root) { animation: none; }
[data-transition="to-manuscript"]::view-transition-new(root) {
  animation: vt-unroll 0.95s cubic-bezier(0.36, 0.06, 0.18, 1) forwards;
  transform-origin: left center;
  filter: drop-shadow(14px 0 18px rgba(34,18,4,0.42)) drop-shadow(3px 0 0 rgba(120,84,32,0.5));
}
@keyframes vt-unroll { 0% { clip-path: inset(0 100% 0 0); } 100% { clip-path: inset(0 0% 0 0); } }
[data-transition="to-slate"]::view-transition-new(root) { animation: none; }
[data-transition="to-slate"]::view-transition-old(root) {
  z-index: 10;
  animation: vt-roll-back 0.9s cubic-bezier(0.36, 0.06, 0.18, 1) forwards;
  transform-origin: right center;
  filter: drop-shadow(14px 0 18px rgba(34,18,4,0.42)) drop-shadow(3px 0 0 rgba(120,84,32,0.5));
}
@keyframes vt-roll-back { 0% { clip-path: inset(0 0% 0 0); } 100% { clip-path: inset(0 100% 0 0); } }

/* ══ Aged Manuscript: visitor previews (match parchment main-site theme) ════════ */
[data-theme="manuscript"] .maint-preview-page {
  background:
    radial-gradient(ellipse 72% 56% at 50% 36%, rgba(255,250,232,0.5), transparent 76%),
    linear-gradient(180deg, #ebdebc 0%, #e4d6ad 55%, #d9c694 100%);
  border: 1px solid rgba(95,74,38,0.22);
}
[data-theme="manuscript"] .maint-preview-title {
  font-family: 'EB Garamond', serif;
  color: #9a6f1c;
  text-shadow: 0 1px 2px rgba(86,62,24,0.18), 0 -1px 0 rgba(255,250,232,0.45);
}
[data-theme="manuscript"] .maint-preview-msg { font-family: 'Spectral', serif; color: #5b4d34; }
[data-theme="manuscript"] .maint-preview-timer { color: #2f2616; }
[data-theme="manuscript"] .maint-preview-indefinite { color: #8a7a59; }

[data-theme="manuscript"] .notice-preview-wrap {
  background: rgba(247,239,219,0.88);
  border: 1px solid rgba(95,74,38,0.22);
}
[data-theme="manuscript"] .notice-preview-label { font-family: 'EB Garamond', serif; color: rgba(154,111,28,0.8); }
[data-theme="manuscript"] .notice-preview-text { font-family: 'Spectral', serif; color: #5b4d34; }

[data-theme="manuscript"] #cl-preview-panel {
  --gold: #9a6f1c; --gold-dim: rgba(154,111,28,0.55); --gold-dark: rgba(154,111,28,0.2);
  --text-dim: #5b4d34; --text-muted: #8a7a59;
}
[data-theme="manuscript"] #cl-preview-panel .cl-entry {
  background: rgba(247,239,219,0.82);
  border-bottom: 1px solid rgba(95,74,38,0.12);
}
[data-theme="manuscript"] #cl-preview-panel .cl-marker {
  background: #9a6f1c; border-color: rgba(154,111,28,0.55);
  box-shadow: 0 0 10px rgba(154,111,28,0.4);
}
[data-theme="manuscript"] #cl-preview-panel .cl-ver { font-family: 'EB Garamond', serif; color: #9a6f1c; }
[data-theme="manuscript"] #cl-preview-panel .cl-tag { border-color: rgba(154,111,28,0.3); color: rgba(154,111,28,0.75); }
[data-theme="manuscript"] #cl-preview-panel .cl-tag.latest-tag {
  border-color: rgba(154,111,28,0.5); color: #9a6f1c; background: rgba(154,111,28,0.08);
}
[data-theme="manuscript"] #cl-preview-panel .cl-items { font-family: 'Spectral', serif; }
[data-theme="manuscript"] #cl-preview-panel .cl-items li::before { color: rgba(154,111,28,0.55); }
[data-theme="manuscript"] #cl-preview-panel .cl-items li.cl-cat { font-family: 'EB Garamond', serif; color: rgba(154,111,28,0.6); }
[data-theme="manuscript"] #cl-preview-panel .cl-items li.cl-text { color: rgba(47,38,22,0.55); }

/* ══ Changelog quote lines ═════════════════════════════════════════════════════ */
.cl-bullets li.cl-quote,
#cl-preview-panel .cl-items li.cl-quote {
  position: relative;
  font-family: 'Spectral', Georgia, serif;
  font-style: italic;
  font-size: 14px;
  line-height: 1.65;
  padding: 7px 12px 7px 28px;
  margin: 6px 0;
  border-left: 2px solid;
}
.cl-bullets li.cl-quote::before,
#cl-preview-panel .cl-items li.cl-quote::before {
  content: '\201C';
  position: absolute;
  left: 7px; top: 5px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 26px; line-height: 1;
  opacity: 0.55;
}
/* Changelog manager cards (admin chrome accent) */
.cl-bullets li.cl-quote { color: var(--subtext0); border-left-color: rgba(var(--accent-rgb), 0.45); background: rgba(var(--accent-rgb), 0.04); }
.cl-bullets li.cl-quote::before { color: var(--mauve); }
.cl-bullets li.cl-quote:hover { background: rgba(var(--accent-rgb), 0.07); color: var(--subtext1); }
/* Live preview (matches visitor theme) */
#cl-preview-panel .cl-items li.cl-quote { color: var(--text-dim); border-left-color: var(--gold-dim); }
#cl-preview-panel .cl-items li.cl-quote::before { color: var(--gold); }
[data-theme="manuscript"] #cl-preview-panel .cl-items li.cl-quote::before { font-family: 'EB Garamond', Georgia, serif; }

/* ══ Aged Manuscript: glass surfaces → cream parchment ═════════════════════════ */
[data-theme="manuscript"] .stat,
[data-theme="manuscript"] .card-box,
[data-theme="manuscript"] .acc-card {
  background: rgba(247, 239, 219, 0.88);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-color: rgba(95, 74, 38, 0.2);
  box-shadow: 0 2px 10px rgba(86, 62, 24, 0.12);
}
[data-theme="manuscript"] .stat-primary {
  background: rgba(154, 111, 28, 0.08);
  border-color: rgba(154, 111, 28, 0.3);
}
[data-theme="manuscript"] .stat:hover {
  border-color: rgba(154, 111, 28, 0.42);
  box-shadow: 0 0 0 1px rgba(154, 111, 28, 0.15), 0 8px 28px rgba(86, 62, 24, 0.18);
}
[data-theme="manuscript"] .acc-card.tinted-maintenance { background: rgba(164, 70, 43, 0.08); }
[data-theme="manuscript"] .acc-card.tinted-notice { background: rgba(126, 106, 34, 0.1); }

/* Town Square admin (Review 173) */
/* Floating "All Proposals" panel over the dimmed area, left of the drawer. */
/* Centered in the empty area left of the 420px drawer, ~85% of that space. */
.poll-float {
  position: fixed;
  top: 50%;
  left: calc((100vw - 420px) / 2);
  width: calc((100vw - 420px) * 0.85);
  height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--mantle);
  border: 1px solid var(--surface1);
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.97);
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1;
}
.admin-drawer-overlay.open .poll-float { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.poll-float-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--surface1); }
.padm-tabs { display: flex; gap: 8px; margin-top: 12px; }
/* Tabs use the standard admin .btn; the selected one gets a mauve-accent state. */
.padm-tab.active { background: var(--surface2); border-color: var(--mauve); color: var(--mauve); }
.poll-float-body { flex: 1; padding: 10px 22px 18px; overflow-y: auto; }
@media (max-width: 900px) { .poll-float { display: none; } }

#poll-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; align-items: start; }
.poll-item {
  padding: 14px 16px;
  border: 1px solid var(--surface1);
  border-radius: 10px;
  background: var(--surface0);
}
.poll-item-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.poll-item-head strong { font-size: 13px; font-weight: 600; line-height: 1.4; }
.poll-item-status { margin: 6px 0; }
.poll-verdict { font-size: 0.75em; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.poll-v-pass { color: #1d3a16; background: #b7e0a0; }
.poll-v-reject { color: #4a1410; background: #e6b3a6; }
.poll-v-tie { color: #3a300f; background: #e6d29a; }

/* Map Review queue */
.tab-badge {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px;
  font-size: 0.7em; font-weight: 700; line-height: 18px; text-align: center;
  color: #fff; background: #d9534f; border-radius: 999px; vertical-align: middle;
}
.mr-hint { opacity: .6; font-size: .85em; margin: 0 0 14px; }
.mr-card {
  border: 1px solid var(--surface1); border-radius: 12px;
  background: var(--surface0); padding: 16px; margin-bottom: 14px;
}
.mr-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.mr-card-title { font-weight: 700; font-size: 1.05em; }
.mr-card-meta { opacity: .6; font-size: .8em; margin-top: 2px; }
.mr-counts { display: flex; gap: 6px; flex-wrap: wrap; }
.mr-chip {
  font-size: .72em; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: rgba(var(--accent-rgb),0.12); color: var(--text);
  border: 1px solid rgba(var(--accent-rgb),0.25);
}
.mr-note { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: rgba(var(--accent-rgb),0.06); border: 1px solid rgba(var(--accent-rgb),0.18); }
.mr-note-label { font-size: .65em; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; opacity: .6; padding-top: 2px; }
.mr-note-text { font-size: .9em; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.mr-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.mr-json {
  margin-top: 12px; padding: 12px; max-height: 320px; overflow: auto;
  background: var(--crust, #000); border: 1px solid var(--surface1); border-radius: 8px;
  font-size: .75em; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}

/* Game Data Pills */
.gd-pills {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  margin-bottom: 30px;
  padding: 10px;
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: 12px;
  overflow-x: auto;
  align-items: center;
}
.gd-pill {
  background: transparent;
  color: var(--overlay0);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s;
}
.gd-pill:hover {
  background: rgba(255,255,255,.05);
  color: var(--text);
}
.gd-pill.active {
  background: var(--surface1);
  color: var(--text);
  border-color: var(--surface2);
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.gd-sub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.gd-sub-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--text);
}

/* Map Editor RBAC Rules */
body.role-map-editor .btn-save,
body.role-map-editor .btn-del,
body.role-map-editor .btn[onclick^="edit"],
body.role-map-editor .btn[onclick^="add"],
body.role-map-editor .btn[onclick^="openAdd"],
body.role-map-editor .btn[onclick^="delete"],
body.role-map-editor .btn[onclick^="ban"],
body.role-map-editor .btn[onclick^="save"],
body.role-map-editor .btn[onclick^="report"],
body.role-map-editor .btn[onclick^="create"],
body.role-map-editor .btn[onclick^="approveMap"],
body.role-map-editor .btn[onclick^="rejectMap"],
body.role-map-editor .btn[onclick^="endPoll"] {
  display: none !important;
}

body.role-map-editor #panel-changelog .btn-save,
body.role-map-editor #panel-changelog .btn-del,
body.role-map-editor #panel-changelog .btn[onclick^="edit"],
body.role-map-editor #panel-changelog .btn[onclick^="add"],
body.role-map-editor #panel-changelog .btn[onclick^="delete"] {
  display: inline-block !important;
}

/* ------------------------------------
   PREMIUM MAP CITY DATA UI
------------------------------------ */

.cd-premium-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1100px;
  margin: 0 auto;
  animation: fadeIn 0.4s ease-out;
}

.cd-premium-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid var(--surface2);
  padding-bottom: 16px;
}

.cd-header-content h2 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px 0;
  letter-spacing: -0.5px;
  color: var(--text);
}

.cd-header-content p {
  margin: 0;
  font-size: 14px;
  opacity: 0.7;
  line-height: 1.5;
  color: var(--text);
}

.cd-premium-refresh {
  background: var(--surface1);
  border: 1px solid var(--surface2);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: all 0.2s;
}

.cd-premium-refresh:hover {
  background: var(--text);
  color: var(--base);
  transform: rotate(15deg);
}

.cd-premium-card {
  background: var(--surface0);
  border: 1px solid var(--surface2);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  position: relative;
}

.cd-premium-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--mauve), var(--blue));
  opacity: 0.8;
}

.cd-premium-card-inner {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.cd-split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 768px) {
  .cd-split-layout {
    grid-template-columns: 1fr;
  }
}

.cd-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cd-input-group.cd-full-width {
  max-width: 400px;
}

.cd-input-group label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text);
  opacity: 0.8;
  margin-left: 4px;
}

.cd-select-wrapper {
  position: relative;
}

.cd-select-wrapper select,
.cd-input-group textarea {
  width: 100%;
  background: var(--mantle);
  border: 1px solid var(--surface2);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  color: var(--text);
  transition: all 0.2s ease;
  font-family: inherit;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.cd-select-wrapper select {
  appearance: none;
  cursor: pointer;
  padding-right: 40px;
}

.cd-select-wrapper select:focus,
.cd-input-group textarea:focus {
  outline: none;
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.3), inset 0 2px 4px rgba(0,0,0,0.1);
  background: var(--base);
}

.cd-select-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  opacity: 0.5;
  pointer-events: none;
  color: var(--text);
}

.cd-input-group textarea {
  resize: vertical;
  line-height: 1.6;
}

.cd-input-hint {
  font-size: 12px;
  opacity: 0.5;
  margin-left: 4px;
  font-style: italic;
  color: var(--text);
}

.cd-premium-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
  padding-top: 24px;
  border-top: 1px dashed var(--surface2);
}

.cd-btn-save {
  background: linear-gradient(135deg, var(--mauve), var(--blue));
  color: var(--text);
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.2s, filter 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(var(--accent-rgb), 0.2);
}

.cd-btn-save:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 8px 20px rgba(var(--accent-rgb), 0.3);
}

.cd-btn-save:active {
  transform: translateY(0);
}

.cd-status-indicator {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  opacity: 0.8;
}

body.role-map-editor .cd-premium-footer {
  display: none !important;
}

/* ------------------------------------
   MANUSCRIPT THEME FONTS FOR CITY DATA
------------------------------------ */
[data-theme="manuscript"] .cd-header-content p,
[data-theme="manuscript"] .cd-select-wrapper select,
[data-theme="manuscript"] .cd-input-group textarea,
[data-theme="manuscript"] .cd-input-hint {
  font-family: 'Spectral', serif;
}

[data-theme="manuscript"] .cd-input-group label,
[data-theme="manuscript"] .cd-btn-save {
  font-family: 'EB Garamond', serif;
}

