/* ============================================================
   CARDS // TRACKER — "dark ops" security console theme
   ============================================================ */

:root {
  /* Palette */
  --bg-0: #0a0d12;            /* page background */
  --bg-1: #0f141b;            /* panels */
  --bg-2: #131a24;            /* raised surfaces, inputs */
  --line: rgba(34, 211, 238, 0.14);   /* 1px cyan borders */
  --line-strong: rgba(34, 211, 238, 0.35);
  --accent: #22d3ee;          /* electric cyan */
  --accent-dim: rgba(34, 211, 238, 0.12);
  --danger: #ff4d4f;          /* closing soon ONLY */
  --danger-dim: rgba(255, 77, 79, 0.10);
  --safe: #34d399;            /* finished / ok */
  --safe-dim: rgba(52, 211, 153, 0.12);
  --text-1: #e5e7eb;
  --text-2: #8b95a5;
  --radius: 10px;
  --font-sans: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', Consolas, monospace;
  --glow-accent: 0 0 0 1px var(--line-strong), 0 0 18px rgba(34, 211, 238, 0.18);
  --shadow-panel: 0 1px 0 rgba(255,255,255,0.03) inset, 0 10px 30px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg-0);
  color: var(--text-1);
  min-height: 100vh;
  font-size: 14.5px;
  position: relative;
}

/* Subtle grid + scanline texture */
body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(34, 211, 238, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, 0.025) 1px, transparent 1px);
  background-size: 42px 42px;
}
body::after {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.012) 0 1px, transparent 1px 3px);
}

.container { max-width: 1100px; margin: 0 auto; padding: 20px 16px; position: relative; z-index: 1; }

/* Mono utility — numbers, dates, credentials */
.mono, .cred-value, td.num, .badge, .nav-badge, .finished-tag { font-family: var(--font-mono); }

/* ---------- Top nav ---------- */
.topbar {
  position: relative; z-index: 2;
  background: rgba(15, 20, 27, 0.85);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.topbar-inner {
  max-width: 1100px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.logo-mark {
  width: 34px; height: 34px; border-radius: 8px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong);
  background: linear-gradient(135deg, rgba(34,211,238,0.16), rgba(34,211,238,0.03));
  color: var(--accent);
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.15);
}
.logo-mark svg { width: 18px; height: 18px; }
.topbar h1 { font-size: 0.95rem; margin: 0; font-family: var(--font-mono); letter-spacing: 0.08em; }
.topbar h1 a { color: var(--text-1); text-decoration: none; }
.topbar h1 a span { color: var(--accent); }
.topbar .spacer { flex: 1; }
.topbar nav { display: flex; align-items: center; gap: 4px; }
.topbar nav a {
  color: var(--text-2); text-decoration: none; font-size: 0.82rem;
  padding: 7px 12px; border-radius: 6px; position: relative;
  letter-spacing: 0.06em; text-transform: uppercase; font-weight: 500;
  display: inline-flex; align-items: center; gap: 7px;
  transition: color 0.15s;
}
.topbar nav a:hover { color: var(--text-1); }
.topbar nav a.active { color: var(--accent); }
.topbar nav a.active::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: 1px; height: 2px;
  background: var(--accent); border-radius: 2px;
  box-shadow: 0 0 8px var(--accent), 0 0 18px rgba(34,211,238,0.6);
}
.nav-badge {
  display: inline-block; min-width: 20px; text-align: center;
  background: var(--accent-dim); color: var(--accent);
  border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 1px 7px; font-size: 0.72rem; font-weight: 700;
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.2);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text-1);
  padding: 8px 14px; border-radius: 8px; font-size: 0.86rem; cursor: pointer;
  font-family: var(--font-sans); font-weight: 500;
  transition: border-color 0.15s, background 0.15s, transform 0.08s, box-shadow 0.15s;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { border-color: var(--line-strong); background: #16202c; }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn:focus-visible { outline: none; box-shadow: var(--glow-accent); }
.btn-primary {
  background: linear-gradient(135deg, rgba(34,211,238,0.22), rgba(34,211,238,0.08));
  border-color: var(--line-strong); color: var(--accent); font-weight: 600;
}
.btn-primary:hover { background: linear-gradient(135deg, rgba(34,211,238,0.32), rgba(34,211,238,0.14)); box-shadow: 0 0 16px rgba(34,211,238,0.2); }
.btn-danger { color: var(--danger); border-color: rgba(255,77,79,0.3); }
.btn-danger:hover { background: var(--danger-dim); border-color: rgba(255,77,79,0.55); }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-icon { padding: 6px 7px; }
.btn.copied { color: var(--safe); border-color: rgba(52,211,153,0.5); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn:disabled:hover { background: var(--bg-2); border-color: var(--line); }

/* Row image-picker popover */
.image-popover {
  position: fixed; z-index: 250;
  background: rgba(15, 20, 27, 0.97); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 10px;
  box-shadow: 0 0 24px rgba(34,211,238,0.15), 0 14px 40px rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  max-width: 280px;
}
.image-popover-title {
  font-size: 0.68rem; color: var(--text-2); text-transform: uppercase;
  letter-spacing: 0.1em; margin-bottom: 8px; font-weight: 600;
}
.image-popover-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.image-popover-grid img {
  width: 56px; height: 56px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--line); cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.image-popover-grid img:hover {
  border-color: var(--accent); box-shadow: 0 0 12px rgba(34,211,238,0.3);
}

/* ---------- Inputs ---------- */
input[type="text"], input[type="number"], input[type="password"], textarea, select {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 0.9rem; font-family: var(--font-sans);
  background: var(--bg-2); color: var(--text-1);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="number"], input[type="password"] { font-family: var(--font-mono); }
input::placeholder, textarea::placeholder { color: #5b6675; }
input:focus, textarea:focus {
  outline: none; border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12), 0 0 14px rgba(34,211,238,0.1);
}
label {
  display: block; font-size: 0.7rem; color: var(--text-2); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: 0.09em; font-weight: 600;
}
.field { margin-bottom: 14px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

/* ---------- Summary stats ---------- */
.summary { display: flex; gap: 12px; flex-wrap: wrap; margin: 4px 0 18px; position: relative; }
.summary::before {
  content: ''; position: absolute; left: 50%; top: -60px; transform: translateX(-50%);
  width: 620px; height: 200px; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(34,211,238,0.07), transparent 65%);
}
.summary .stat {
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 20px; flex: 1; min-width: 160px; position: relative;
  box-shadow: var(--shadow-panel);
}
.summary .stat .num { font-size: 1.7rem; font-weight: 700; font-family: var(--font-mono); color: var(--text-1); }
.summary .stat .lbl {
  color: var(--text-2); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; margin-top: 2px;
}
.summary .stat.warn .num { color: var(--danger); text-shadow: 0 0 12px rgba(255,77,79,0.35); }
.summary .stat:last-child .num { color: var(--safe); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { flex: 1; min-width: 220px; }
.toolbar h2 { font-size: 1rem; font-family: var(--font-mono); letter-spacing: 0.05em; }

/* ---------- Table panel ---------- */
.table-wrap {
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-panel); overflow-x: auto; position: relative;
  max-height: calc(100vh - 290px); overflow-y: auto;
}
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 11px 14px; text-align: left; font-size: 0.88rem; }
thead th {
  background: #0c1118; color: var(--text-2); font-weight: 600; font-size: 0.68rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 2;
}
tbody tr { border-bottom: 1px solid rgba(139, 149, 165, 0.07); position: relative; transition: background 0.15s, box-shadow 0.15s, transform 0.12s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover {
  background: rgba(34, 211, 238, 0.04);
  box-shadow: inset 2px 0 0 var(--accent), 0 0 18px rgba(34,211,238,0.06);
  transform: translateY(-1px);
}
td.num, th.num { text-align: center; }
td.num { color: var(--text-1); }

/* Closing-soon rows: pulsing red left border, stronger as days → 0 */
tbody tr.closing { background: var(--danger-dim); }
tbody tr.closing:hover { background: rgba(255, 77, 79, 0.16); box-shadow: inset 2px 0 0 var(--danger); }
tbody tr.closing td:first-child { position: relative; }
tbody tr.closing td:first-child::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--danger);
  animation: pulse-border 2.2s ease-in-out infinite;
}
tbody tr.closing.urgent td:first-child::before { animation-duration: 0.9s; box-shadow: 0 0 10px var(--danger); }

@keyframes pulse-border { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.badge {
  display: inline-block; background: var(--danger); color: #0a0d12; border-radius: 5px;
  padding: 3px 9px; font-size: 0.72rem; font-weight: 700; white-space: nowrap;
  letter-spacing: 0.03em;
  animation: badge-blink 2.4s ease-in-out infinite;
}
tr.urgent .badge, .view-head .badge { animation-duration: 1.1s; }
@keyframes badge-blink { 0%, 100% { box-shadow: 0 0 4px rgba(255,77,79,0.4); } 50% { box-shadow: 0 0 14px rgba(255,77,79,0.85); } }

/* Permanent account-number badge */
.acc-badge {
  display: inline-block; font-family: var(--font-mono); font-weight: 700;
  font-size: 0.78rem; color: var(--accent);
  background: var(--accent-dim); border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 7px; letter-spacing: 0.04em;
}
.credit-cell, th.credit-col { text-align: right; }
.credit-cell { font-family: var(--font-mono); }
.na-badge {
  display: inline-block; font-family: var(--font-mono); font-size: 0.78rem;
  color: var(--text-2); background: rgba(139, 149, 165, 0.1);
  border: 1px solid rgba(139, 149, 165, 0.25); border-radius: 6px; padding: 2px 9px;
  cursor: help;
}
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--accent); }
.sort-arrow { color: var(--accent); }

.card-link { color: var(--accent); text-decoration: none; font-weight: 600; }
.card-link:hover { text-decoration: underline; text-shadow: 0 0 10px rgba(34,211,238,0.4); }
.muted { color: var(--text-2); }
.actions-cell { white-space: nowrap; }
.actions-cell .btn { margin-left: 4px; }

/* Days-remaining cycle progress bar */
.cycle-cell { min-width: 120px; }
.cycle-bar {
  height: 3px; border-radius: 2px; background: rgba(139,149,165,0.15);
  margin-top: 6px; overflow: hidden;
}
.cycle-bar i {
  display: block; height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, rgba(34,211,238,0.5), var(--accent));
  width: 0; transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
tr.closing .cycle-bar i { background: linear-gradient(90deg, rgba(255,77,79,0.5), var(--danger)); }

.empty-state {
  text-align: center; padding: 48px 20px; color: var(--text-2);
  display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 0.9rem;
}
.empty-state svg { width: 34px; height: 34px; opacity: 0.5; }

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(4, 6, 10, 0.7);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
  animation: overlay-in 0.18s ease-out;
}
.modal {
  background: rgba(15, 20, 27, 0.92);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(34,211,238,0.06), 0 24px 60px rgba(0,0,0,0.6), 0 0 40px rgba(34,211,238,0.05);
  backdrop-filter: blur(14px);
  width: 100%; max-width: 540px; max-height: 92vh; overflow-y: auto; padding: 22px;
  animation: modal-in 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.modal-overlay.closing { animation: overlay-out 0.15s ease-in forwards; }
.modal-overlay.closing .modal { animation: modal-out 0.15s ease-in forwards; }
@keyframes overlay-in { from { opacity: 0; } }
@keyframes overlay-out { to { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: scale(0.95) translateY(10px); } }
@keyframes modal-out { to { opacity: 0; transform: scale(0.96) translateY(8px); } }

.modal h2 {
  margin: 0 0 16px; font-size: 0.95rem; font-family: var(--font-mono);
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-1);
}
.modal .modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.hidden { display: none !important; }
.error-msg { color: var(--danger); font-size: 0.83rem; margin-top: 8px; min-height: 1.2em; font-family: var(--font-mono); }
.ok-msg { color: var(--safe); font-size: 0.83rem; min-height: 1.2em; margin-top: 8px; }

/* ---------- View modal ---------- */
.modal-wide { max-width: 880px; }
.view-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.view-head h2 { margin: 0; font-size: 1rem; }
.view-head .spacer { flex: 1; }
.view-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .view-grid { grid-template-columns: 1fr; } }
.view-section {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  background: rgba(19, 26, 36, 0.5);
}
.view-section h3 {
  margin: 0 0 12px; font-size: 0.68rem; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.12em; font-weight: 600;
}
.pre-wrap { white-space: pre-wrap; }
.copy-all-wrap { margin-top: 14px; text-align: right; }

.info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px dashed rgba(139,149,165,0.12); gap: 10px;
}
.info-row:last-child { border-bottom: none; }
.info-row .k { color: var(--text-2); font-size: 0.78rem; flex-shrink: 0; text-transform: uppercase; letter-spacing: 0.06em; }
.info-row .v { font-weight: 600; display: flex; align-items: center; gap: 6px; word-break: break-word; font-size: 0.88rem; }
.cred-value { direction: ltr; unicode-bidi: embed; color: var(--accent); font-size: 0.85rem; }

textarea.notes { min-height: 130px; resize: vertical; font-family: var(--font-mono); font-size: 0.84rem; }
.save-hint { font-size: 0.72rem; color: var(--text-2); min-height: 1.1em; margin-top: 5px; font-family: var(--font-mono); }

/* ---------- Panels (details / settings pages) ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 800px) { .detail-grid { grid-template-columns: 1fr; } }
.panel {
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-panel); padding: 18px;
}
.panel h3 {
  margin: 0 0 14px; font-size: 0.7rem; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.12em; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.panel h3 svg { width: 14px; height: 14px; color: var(--accent); }

/* ---------- Images ---------- */
.dropzone {
  border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 20px;
  text-align: center; color: var(--text-2); font-size: 0.83rem; margin-bottom: 12px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.dropzone svg { width: 20px; height: 20px; opacity: 0.6; }
.dropzone:hover { border-color: var(--accent); }
.dropzone.dragover {
  border-color: var(--accent); background: var(--accent-dim); color: var(--accent);
  box-shadow: 0 0 20px rgba(34,211,238,0.15) inset;
}
.dropzone-sm { padding: 12px; font-size: 0.78rem; margin-bottom: 10px; flex-direction: row; justify-content: center; }
.paste-hint { font-size: 0.74rem; color: var(--text-2); }
kbd {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 6px; font-size: 0.72rem; font-family: var(--font-mono); color: var(--accent);
}
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.thumbs-sm { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
.thumb {
  position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; aspect-ratio: 1;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.thumb:hover { border-color: var(--line-strong); box-shadow: 0 0 14px rgba(34,211,238,0.12); }
.thumb img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.thumb .del {
  position: absolute; top: 4px; right: 4px;
  background: rgba(10, 13, 18, 0.85); color: var(--danger);
  border: 1px solid rgba(255,77,79,0.4); border-radius: 6px;
  width: 24px; height: 24px; cursor: pointer; font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
}
.thumb .del svg { width: 12px; height: 12px; }
.thumb .del:hover { background: rgba(255,77,79,0.2); }
.thumb .copy-img {
  position: absolute; top: 4px; left: 4px;
  background: rgba(10, 13, 18, 0.85); color: var(--accent);
  border: 1px solid var(--line-strong); border-radius: 6px;
  width: 24px; height: 24px; cursor: pointer; font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
}
.thumb .copy-img svg { width: 12px; height: 12px; }
.thumb .copy-img:hover { background: var(--accent-dim); }
.thumb .copy-img.copied { color: var(--safe); border-color: rgba(52,211,153,0.5); }
.thumb.pending { outline: 2px dashed var(--accent); outline-offset: -2px; }

.lightbox {
  position: fixed; inset: 0; background: rgba(4, 6, 10, 0.92); z-index: 200;
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out;
  animation: overlay-in 0.15s ease-out;
}
.lightbox img {
  max-width: 95%; max-height: 92%; border-radius: 8px;
  border: 1px solid var(--line-strong);
  box-shadow: 0 0 60px rgba(34,211,238,0.15), 0 20px 60px rgba(0,0,0,0.7);
  animation: modal-in 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.lightbox-copy {
  position: absolute; bottom: 22px; right: 50%; transform: translateX(50%);
  cursor: pointer;
}

/* ---------- Toggle switch ---------- */
.switch-row {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  text-transform: none; letter-spacing: normal; font-size: 0.86rem; font-weight: 500;
  color: var(--text-1); margin-bottom: 0;
}
.switch { position: relative; display: inline-block; width: 38px; height: 21px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch i {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--line);
  transition: background 0.18s, border-color 0.18s;
}
.switch i::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px;
  border-radius: 50%; background: var(--text-2);
  transition: transform 0.18s, background 0.18s;
}
.switch input:checked + i {
  background: rgba(52, 211, 153, 0.2); border-color: rgba(52, 211, 153, 0.55);
}
.switch input:checked + i::after {
  transform: translateX(17px); background: var(--safe);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
}
.switch input:focus-visible + i { box-shadow: var(--glow-accent); }

.toggle-group {
  display: flex; flex-wrap: wrap; gap: 8px 22px;
  border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px;
  background: var(--bg-2);
}

/* ---------- Status pills ---------- */
.pill {
  display: inline-block; border-radius: 999px; padding: 3px 12px;
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.04em; font-family: var(--font-mono);
}
.pill-on {
  background: var(--safe-dim); color: var(--safe);
  border: 1px solid rgba(52, 211, 153, 0.4);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.12);
}
.pill-off {
  background: rgba(139, 149, 165, 0.1); color: var(--text-2);
  border: 1px solid rgba(139, 149, 165, 0.25);
}

/* ---------- Safe description preview ---------- */
.desc-preview {
  margin: 0; padding: 12px 14px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.6;
  color: var(--text-1); white-space: pre-wrap; word-break: break-word;
  max-height: 180px; overflow-y: auto;
}

/* ---------- Finished ---------- */
.finished-tag {
  display: inline-block; background: var(--safe-dim); color: var(--safe);
  border: 1px solid rgba(52,211,153,0.4); border-radius: 999px;
  padding: 3px 12px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.05em;
  box-shadow: 0 0 12px rgba(52,211,153,0.12);
}

/* ---------- Settings ---------- */
.settings-panel { max-width: 640px; }
.settings-panel .panel { margin-bottom: 16px; }
.settings-panel p.muted { font-size: 0.84rem; line-height: 1.5; }

/* ---------- Lock screen ---------- */
.lock-screen {
  position: fixed; inset: 0; background: var(--bg-0); z-index: 500;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.lock-screen::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(34,211,238,0.06), transparent 55%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.012) 0 1px, transparent 1px 3px);
}
.lock-box {
  background: rgba(15, 20, 27, 0.9); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-panel), 0 0 50px rgba(34,211,238,0.06);
  backdrop-filter: blur(10px);
  padding: 34px 30px; width: 100%; max-width: 400px; text-align: center; position: relative;
  animation: modal-in 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.lock-box.shake { animation: lock-shake 0.4s ease-in-out; }
@keyframes lock-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); } 40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); } 80% { transform: translateX(4px); }
}
.lock-box .lock-icon {
  width: 44px; height: 44px; margin: 0 auto 14px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); background: var(--accent-dim); color: var(--accent);
  box-shadow: 0 0 20px rgba(34,211,238,0.2);
}
.lock-box .lock-icon svg { width: 20px; height: 20px; }
.lock-box h2 { margin: 0 0 6px; font-size: 0.95rem; font-family: var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.lock-box p { color: var(--text-2); margin: 0 0 18px; font-size: 0.84rem; }
.lock-box form { display: flex; flex-direction: column; gap: 12px; }
.lock-box input {
  text-align: center; font-family: var(--font-mono); letter-spacing: 0.2em;
  caret-color: var(--accent);
  animation: caret-glow 1.2s step-end infinite;
}
@keyframes caret-glow { 0%, 100% { box-shadow: none; } }

/* ---------- User chip / roles / admin panel ---------- */
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  margin-left: 10px; padding: 4px 6px 4px 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg-2);
  font-size: 0.8rem; color: var(--text-1);
}
.user-chip > svg { width: 13px; height: 13px; color: var(--text-2); }
.role-tag {
  font-family: var(--font-mono); font-size: 0.66rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  border-radius: 5px; padding: 2px 7px;
}
.role-admin { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--line-strong); }
.role-full { background: var(--safe-dim); color: var(--safe); border: 1px solid rgba(52,211,153,0.4); }
.role-member { background: rgba(139,149,165,0.12); color: var(--text-2); border: 1px solid rgba(139,149,165,0.3); }

.pill-danger {
  background: var(--danger-dim); color: var(--danger);
  border: 1px solid rgba(255,77,79,0.4);
}
tr.user-disabled td { opacity: 0.55; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--bg-1); color: var(--text-2);
  padding: 8px 16px; border-radius: 8px; cursor: pointer;
  font-family: var(--font-mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em;
  transition: color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.tab svg { width: 14px; height: 14px; }
.tab:hover { color: var(--text-1); border-color: var(--line-strong); }
.tab.active {
  color: var(--accent); border-color: var(--line-strong);
  box-shadow: 0 0 14px rgba(34,211,238,0.15);
  background: var(--accent-dim);
}
.tab-panel { animation: fade-up 0.3s cubic-bezier(0.22, 1, 0.36, 1) both; }
.limit-input { width: 72px; padding: 5px 8px; text-align: center; font-family: var(--font-mono); font-size: 0.8rem; }

select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg-2); color: var(--text-1); font-family: var(--font-mono); font-size: 0.88rem;
}

/* ---------- Registration card ---------- */
.register-card {
  max-width: 480px; text-align: left; padding: 44px 42px;
}
.register-card .lock-icon, .register-card h2, .register-card > p { text-align: center; margin-left: auto; margin-right: auto; }
.register-card h2 { font-size: 1.1rem; }
.register-card > p { margin-bottom: 26px; }
.register-card form { gap: 0; }
.reg-field { margin-bottom: 20px; }
.reg-field label { margin-bottom: 7px; }
.reg-field input {
  padding: 13px 15px; font-size: 0.95rem; text-align: left; letter-spacing: normal;
  animation: none;
}
.reg-field input.mono { font-family: var(--font-mono); font-size: 0.86rem; }
.reg-hint { font-size: 0.76rem; color: var(--text-2); margin-top: 6px; line-height: 1.5; }
.btn-big { width: 100%; padding: 13px 18px; font-size: 0.95rem; margin-top: 6px; }
.register-card .error-msg { text-align: center; margin-top: 12px; }

/* Long invite codes: mono, wrap cleanly (admin referrals table) */
.code-value {
  font-family: var(--font-mono); color: var(--accent); font-size: 0.78rem;
  word-break: break-all; letter-spacing: 0.02em;
}

/* ---------- Invite Codes modal: wide, no horizontal scroll ---------- */
.modal-invite { max-width: 800px; }

.invite-table {
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; /* deliberately NOT overflow-x: auto — rows must fit */
}
.invite-table table {
  min-width: 0; width: 100%; table-layout: fixed; border-collapse: collapse;
}
.invite-table th, .invite-table td { padding: 9px 12px; }
/* Fixed narrow columns keep Status/Redeemed/Created/Actions always visible;
   the code column takes the remaining flexible width. */
.invite-table .col-status { width: 78px; }
.invite-table .col-redeemed { width: 110px; }
.invite-table .col-created { width: 96px; }
.invite-table .col-actions { width: 92px; white-space: nowrap; }
.invite-table .col-redeemed { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The 32-char code truncates with an ellipsis instead of widening the row;
   the full code lives in the title tooltip and in the copy button. */
.invite-code-cell { overflow: hidden; }
.code-ellipsis {
  display: block; font-family: var(--font-mono); color: var(--accent);
  font-size: 0.78rem; letter-spacing: 0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 22px; right: 22px;
  background: rgba(15, 20, 27, 0.95); color: var(--text-1);
  border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 10px 18px; font-size: 0.84rem; z-index: 300;
  font-family: var(--font-mono);
  box-shadow: 0 0 20px rgba(34,211,238,0.15), 0 10px 30px rgba(0,0,0,0.5);
  animation: toast-in 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes toast-in { from { opacity: 0; transform: translateX(30px); } }

/* ---------- Entry animations ---------- */
.anim-up { animation: fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } }
tbody tr.row-in { animation: fade-up 0.4s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* ---------- Scramble reveal ---------- */
.scrambling { color: var(--accent); text-shadow: 0 0 8px rgba(34,211,238,0.5); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .container { padding: 14px 12px; }
  .summary .stat { min-width: 130px; padding: 12px 16px; }
}
