/* ==========================================================================
   DEVCONSOLE — dark terminal theme
   ========================================================================== */

:root {
  --bg:            #07090d;
  --bg-soft:       #0b0e14;
  --panel:         #0f141d;
  --panel-hover:   #141a26;
  --border:        #1d2633;
  --border-glow:   #2c3a4d;

  --text:          #d7e1ee;
  --text-dim:      #8093a8;
  --text-faint:    #4c5c70;

  --neon-cyan:     #22d3ee;
  --neon-green:    #34d399;
  --neon-amber:    #fbbf24;
  --neon-violet:   #a78bfa;
  --neon-pink:     #f472b6;
  --neon-red:      #f87171;
  --neon-blue:     #60a5fa;

  --mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  --sans: "Inter", "Segoe UI", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scrollbar-color: var(--border-glow) var(--bg-soft); }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  line-height: 1.55;
  overflow-x: hidden;
}

/* ---- CRT ambient overlay ------------------------------------------------ */
.crt {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(34,211,238,0.06), transparent 60%),
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.018) 0px,
      rgba(255,255,255,0.018) 1px,
      transparent 1px,
      transparent 3px
    );
  opacity: 0.9;
}

.hidden { display: none !important; }

/* ==========================================================================
   Screens
   ========================================================================== */
#screenLogin.screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#screenDashboard.screen {
  min-height: 100vh;
  display: block;
}

/* ==========================================================================
   Login
   ========================================================================== */
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 34px;
  box-shadow: 0 30px 90px -30px rgba(0, 0, 0, 0.95), 0 0 40px -18px rgba(34, 211, 238, 0.2);
}

.brand-standalone { text-align: center; margin-bottom: 28px; }

.brand-standalone .brand-block {
  font-size: 30px;
  color: var(--neon-cyan);
  text-shadow: 0 0 18px rgba(34, 211, 238, 0.9);
  animation: blink 5s step-start infinite;
}

.brand-standalone h1 {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #eaf6ff;
  margin-top: 6px;
  text-shadow: 0 0 22px rgba(34, 211, 238, 0.35), 0 0 2px rgba(34, 211, 238, 0.8);
}

.login-sub {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--neon-green);
  letter-spacing: 0.08em;
  margin-top: 4px;
}

.login-form { display: block; }

.login-err {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--neon-red);
  text-align: center;
  margin: -4px 0 10px;
  text-shadow: 0 0 10px rgba(248, 113, 113, 0.5);
}

.setup-notice {
  margin-top: 18px;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}

.setup-notice code {
  color: var(--neon-amber);
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.3);
  padding: 1px 6px;
  border-radius: 4px;
}

.setup-notice a { color: inherit; }

/* ---- setup.php messages ----------------------------------------------- */
.setup-msg {
  font-family: var(--mono);
  font-size: 12px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 8px;
}

.setup-ok  { color: var(--neon-green); border: 1px solid rgba(52,211,153,0.4); background: rgba(52,211,153,0.08); }
.setup-err { color: var(--neon-red);   border: 1px solid rgba(248,113,113,0.4); background: rgba(248,113,113,0.08); }

.setup-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  margin: 4px 0 16px;
  line-height: 1.5;
}

.login-note { font-family: var(--mono); font-size: 13px; color: var(--text-dim); }

.login-note p { margin-bottom: 8px; }

.login-note .dim { color: var(--text-faint); font-size: 12px; }

.login-note code, .setup-hint code {
  color: var(--neon-cyan);
  background: rgba(34, 211, 238, 0.07);
  border: 1px solid rgba(34, 211, 238, 0.25);
  padding: 1px 6px;
  border-radius: 4px;
}

.ok-dot { color: var(--neon-green); text-shadow: 0 0 8px rgba(52, 211, 153, 0.6); }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.field label .req { color: var(--text-faint); font-weight: 400; text-transform: none; letter-spacing: 0; }

.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea { resize: vertical; min-height: 72px; }

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.25), 0 0 22px -8px rgba(34, 211, 238, 0.4);
}

.field select { appearance: none; cursor: pointer; }

.field select option { background: var(--panel); color: var(--text); }

.field input::placeholder, .field textarea::placeholder { color: var(--text-faint); }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ---- emoji icon picker -------------------------------------------------- */
.icon-picker { position: relative; display: flex; gap: 8px; }

.icon-picker .icon-picker-trigger {
  width: 42px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
  color: var(--neon-violet);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-picker-trigger:hover {
  color: var(--neon-cyan);
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 0 18px -6px rgba(34, 211, 238, 0.6);
}

.icon-picker-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: min(340px, 100%);
  background: var(--panel);
  border: 1px solid var(--border-glow);
  border-radius: 10px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  box-shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.95), 0 0 30px -10px rgba(34, 211, 238, 0.3);
}

.emoji-tile {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
  background: var(--bg-soft);
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.emoji-tile:hover {
  transform: scale(1.12);
  border-color: rgba(34, 211, 238, 0.5);
  background: rgba(34, 211, 238, 0.08);
  box-shadow: 0 0 12px -3px rgba(34, 211, 238, 0.5);
}

@media (max-width: 480px) {
  .icon-picker-panel { grid-template-columns: repeat(6, 1fr); }
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-sm { padding: 6px 12px; font-size: 11px; border-radius: 7px; }

.btn-block { width: 100%; }

.btn-primary {
  color: #04121a;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
  box-shadow: 0 0 22px -8px rgba(34, 211, 238, 0.7);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 0 30px -6px rgba(34, 211, 238, 0.9);
  transform: translateY(-1px);
}

.btn-ghost {
  color: var(--text-dim);
  background: transparent;
  border-color: var(--border);
}

.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border-glow); }

.btn-danger {
  color: #fff;
  background: linear-gradient(135deg, var(--neon-red), #dc2626);
  box-shadow: 0 0 22px -8px rgba(248, 113, 113, 0.7);
}

.btn-danger-ghost {
  color: var(--neon-red);
  background: rgba(248, 113, 113, 0.07);
  border-color: rgba(248, 113, 113, 0.35);
}

.btn-danger-ghost:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.14);
  box-shadow: 0 0 20px -8px rgba(248, 113, 113, 0.6);
}

.btn-add {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--neon-green);
  background: rgba(52, 211, 153, 0.07);
  border: 1px solid rgba(52, 211, 153, 0.4);
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-add:hover {
  background: rgba(52, 211, 153, 0.14);
  box-shadow: 0 0 18px -6px rgba(52, 211, 153, 0.7);
}

.empty-btn { margin-top: 16px; }

/* ==========================================================================
   Icon buttons
   ========================================================================== */
.icon-btn {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.14s ease;
  line-height: 1;
}

.icon-btn:hover {
  color: var(--neon-cyan);
  border-color: rgba(34, 211, 238, 0.4);
  background: rgba(34, 211, 238, 0.08);
}

.icon-btn.icon-danger:hover {
  color: var(--neon-red);
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.1);
}

.icon-move { color: var(--neon-violet); text-shadow: 0 0 8px rgba(167, 139, 250, 0.5); }

.icon-move:hover {
  color: var(--neon-amber);
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.08);
  box-shadow: 0 0 14px -4px rgba(251, 191, 36, 0.5);
}

/* ==========================================================================
   Top bar
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 9, 13, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 10px 40px -18px rgba(0, 0, 0, 0.9);
}

.topbar-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-block {
  font-size: 24px;
  color: var(--neon-cyan);
  text-shadow: 0 0 18px rgba(34, 211, 238, 0.9);
  animation: blink 5s step-start infinite;
}

.brand-text h1 {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #eaf6ff;
  text-shadow: 0 0 22px rgba(34, 211, 238, 0.35), 0 0 2px rgba(34, 211, 238, 0.8);
}

.brand-sub {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--neon-green);
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--mono);
  flex-wrap: wrap;
}

.clock {
  font-size: 15px;
  color: var(--neon-amber);
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.45);
  letter-spacing: 0.06em;
}

.prompt-label {
  font-size: 12px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  background: var(--panel);
}

.prompt-label span { color: var(--neon-green); }

.admin-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
}

.sync-status {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: default;
}

.sync-status.saved {
  color: var(--neon-green);
  text-shadow: 0 0 10px rgba(52, 211, 153, 0.5);
}

.sync-status.saving {
  color: var(--neon-amber);
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
  animation: blink 1.4s step-start infinite;
}

.sync-status.error {
  color: var(--neon-red);
  text-shadow: 0 0 10px rgba(248, 113, 113, 0.55);
  cursor: pointer;
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 999px;
  padding: 3px 10px;
  background: rgba(248, 113, 113, 0.07);
}

.sync-status.error:hover {
  background: rgba(248, 113, 113, 0.14);
  box-shadow: 0 0 18px -6px rgba(248, 113, 113, 0.7);
}

/* ==========================================================================
   Layout
   ========================================================================== */
.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 28px 24px 70px;
}

/* ==========================================================================
   Search
   ========================================================================== */
.search-zone { margin-bottom: 42px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 6px 26px -14px rgba(0, 0, 0, 0.8);
}

.search-box:focus-within {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.25), 0 0 30px -6px rgba(34, 211, 238, 0.35);
}

.search-prompt {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--neon-green);
  font-size: 18px;
  text-shadow: 0 0 10px rgba(52, 211, 153, 0.6);
}

#search {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  caret-color: var(--neon-cyan);
}

#search::placeholder { color: var(--text-faint); }

.search-clear {
  cursor: pointer;
  color: var(--text-faint);
  font-size: 14px;
  border: none;
  background: transparent;
  display: none;
}
.search-clear.visible { display: inline; }
.search-clear:hover { color: var(--neon-red); }

.search-hint {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-faint);
  flex-wrap: wrap;
}

.hint-key {
  display: inline-block;
  border: 1px solid var(--border-glow);
  border-radius: 4px;
  padding: 1px 6px;
  margin-right: 5px;
  color: var(--text-dim);
  background: var(--bg-soft);
}

.hint-item.result-count { margin-left: auto; color: var(--neon-amber); }

/* ==========================================================================
   Sections
   ========================================================================== */
.section { margin-bottom: 52px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.section-head::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, var(--neon-cyan), transparent);
}

.section-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.section-title {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text);
}

.sec-glyph {
  color: var(--neon-cyan);
  font-size: 10px;
  text-shadow: 0 0 8px rgba(34, 211, 238, 0.8);
  margin-right: 6px;
}

/* ==========================================================================
   Status legend + badges
   ========================================================================== */
.status-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}

.status-legend .lg-item { display: inline-flex; align-items: center; gap: 6px; }
.status-legend .lg-dot { width: 8px; height: 8px; border-radius: 50%; }

.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid currentColor;
  line-height: 1.3;
}

.badge-status { text-transform: uppercase; }

.status-active  { color: var(--neon-green);  border-color: rgba(52,211,153,0.4);  background: rgba(52,211,153,0.08);  text-shadow: 0 0 8px rgba(52,211,153,0.5); }
.status-beta    { color: var(--neon-amber);  border-color: rgba(251,191,36,0.4);  background: rgba(251,191,36,0.08);  text-shadow: 0 0 8px rgba(251,191,36,0.5); }
.status-dev     { color: var(--neon-cyan);   border-color: rgba(34,211,238,0.4);  background: rgba(34,211,238,0.08);  text-shadow: 0 0 8px rgba(34,211,238,0.5); }
.status-archived{ color: var(--neon-red);    border-color: rgba(248,113,113,0.4); background: rgba(248,113,113,0.08); text-shadow: 0 0 8px rgba(248,113,113,0.5); }

/* ==========================================================================
   Cards
   ========================================================================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 20px 16px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-violet), transparent);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--border-glow);
  box-shadow: 0 14px 40px -18px rgba(0, 0, 0, 0.9), 0 0 24px -8px rgba(34, 211, 238, 0.25);
}

.card:hover::before { opacity: 1; }

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-bottom: 8px;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.card-arrow {
  font-family: var(--mono);
  color: var(--neon-cyan);
  font-size: 16px;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  margin-left: 6px;
}

.card:hover .card-arrow { opacity: 1; transform: translateX(0); }

.card-title {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  color: #eaf6ff;
  letter-spacing: 0.02em;
}

.card-desc {
  font-size: 13.5px;
  color: var(--text-dim);
  margin-bottom: 14px;
  flex: 1;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.tags { display: flex; gap: 6px; flex-wrap: wrap; }

.tag {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--neon-blue);
  border: 1px solid rgba(96, 165, 250, 0.35);
  background: rgba(96, 165, 250, 0.07);
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

.card-date {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-faint);
  white-space: nowrap;
}

/* ==========================================================================
   Tool groups
   ========================================================================== */
.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--mono);
}

.chip {
  background: var(--panel);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 13px;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover { border-color: var(--border-glow); color: var(--text); }

.chip.active {
  color: var(--neon-cyan);
  border-color: rgba(34, 211, 238, 0.6);
  background: rgba(34, 211, 238, 0.08);
  text-shadow: 0 0 8px rgba(34, 211, 238, 0.5);
  box-shadow: 0 0 14px -4px rgba(34, 211, 238, 0.4);
}

.tool-groups { display: grid; gap: 26px; }

.tool-group h3 {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--neon-violet);
  text-shadow: 0 0 12px rgba(167, 139, 250, 0.35);
}

.tool-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.tool-group-head h3 { margin-bottom: 0; }

.tool-count {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
}

.tool-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.tool-item {
  position: relative;
}

.tool-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 2px;
  z-index: 2;
}

.tool-actions .icon-btn {
  background: var(--bg-soft);
  border-color: var(--border);
}

.tool-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 15px;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
}

a.tool-row {
  display: flex;
}

.tool-row:hover {
  border-color: var(--border-glow);
  transform: translateX(3px);
  background: var(--panel-hover);
  box-shadow: 0 0 20px -10px rgba(167, 139, 250, 0.35);
}

.tool-glyph {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--neon-violet);
  background: rgba(167, 139, 250, 0.08);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 8px;
  text-shadow: 0 0 8px rgba(167, 139, 250, 0.6);
}

.tool-row:hover .tool-glyph {
  color: var(--neon-cyan);
  border-color: rgba(34, 211, 238, 0.5);
  text-shadow: 0 0 10px rgba(34, 211, 238, 0.7);
}

.tool-main { min-width: 0; }

.tool-name {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: block;
}

.tool-desc {
  font-size: 12px;
  color: var(--text-faint);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-item .tool-actions { opacity: 0.35; }
.tool-item:hover .tool-actions, .tool-item .tool-actions:focus-within { opacity: 1; }

.card-title-icon {
  font-size: 18px;
  line-height: 1;
  margin-right: 2px;
}

/* ==========================================================================
   My Tools (compact pinned cards)
   ========================================================================== */
.my-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.my-tool-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 12px 10px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.my-tool-card:hover {
  transform: translateY(-2px);
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.9), 0 0 18px -8px rgba(34, 211, 238, 0.35);
}

.my-tool-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  text-decoration: none;
  color: inherit;
}

.my-tool-icon {
  font-size: 26px;
  line-height: 1;
  color: var(--neon-violet);
  text-shadow: 0 0 10px rgba(167, 139, 250, 0.45);
}

.my-tool-card:hover .my-tool-icon {
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(34, 211, 238, 0.6);
}

.my-tool-name {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.my-tool-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 2px;
  z-index: 2;
  opacity: 0.35;
}

.my-tool-actions .icon-btn {
  background: var(--bg-soft);
  border-color: var(--border);
}

.my-tool-card:hover .my-tool-actions,
.my-tool-card .my-tool-actions:focus-within { opacity: 1; }

.my-tools-count {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--neon-violet);
  border: 1px solid rgba(167, 139, 250, 0.35);
  background: rgba(167, 139, 250, 0.07);
  border-radius: 999px;
  padding: 2px 9px;
}

.empty-state-sm { padding: 22px 20px; }

.empty-state-sm .empty-glyph {
  font-size: 22px;
  margin-bottom: 6px;
  color: var(--neon-violet);
}

/* ==========================================================================
   Empty state
   ========================================================================== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 14px;
}

.empty-glyph {
  display: block;
  font-size: 30px;
  color: var(--text-faint);
  margin-bottom: 10px;
}

.empty-state code {
  color: var(--neon-amber);
  background: rgba(251, 191, 36, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(3, 5, 8, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-card {
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border-glow);
  border-radius: 14px;
  box-shadow: 0 30px 90px -25px rgba(0, 0, 0, 0.95), 0 0 50px -18px rgba(34, 211, 238, 0.25);
  animation: modalIn 0.18s ease;
}

.modal-card-sm { max-width: 400px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--neon-cyan);
  text-shadow: 0 0 14px rgba(34, 211, 238, 0.35);
}

.modal-body { padding: 22px; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
}

.modal-err {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--neon-red);
  margin-top: 4px;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   Toast
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: #04121a;
  background: linear-gradient(135deg, var(--neon-green), var(--neon-cyan));
  padding: 10px 20px;
  border-radius: 999px;
  box-shadow: 0 0 34px -6px rgba(52, 211, 153, 0.8);
  animation: toastIn 0.2s ease;
}

.toast.toast-err {
  background: linear-gradient(135deg, var(--neon-red), #dc2626);
  color: #fff;
  box-shadow: 0 0 34px -6px rgba(248, 113, 113, 0.8);
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 20px 24px;
}

.footer-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-faint);
}

.footer-dots { letter-spacing: 4px; color: var(--neon-green); }

.code {
  font-family: var(--mono);
  color: var(--neon-cyan);
  background: rgba(34, 211, 238, 0.07);
  border: 1px solid rgba(34, 211, 238, 0.25);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
}

/* ==========================================================================
   Animations (first paint only, via body.anim)
   ========================================================================== */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

body:not(.anim) .card,
body:not(.anim) .tool-row,
body:not(.anim) .tool-group,
body:not(.anim) .my-tool-card {
  animation: none;
  opacity: 1;
  transform: none;
}

body.anim .card,
body.anim .tool-row,
body.anim .tool-group,
body.anim .my-tool-card {
  opacity: 0;
  transform: translateY(8px);
  animation: rise 0.4s ease forwards;
}

@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 820px) {
  .topbar-right { width: 100%; justify-content: flex-end; }
  .admin-controls { border-left: none; padding-left: 0; width: 100%; justify-content: flex-end; flex-wrap: wrap; }
}

@media (max-width: 700px) {
  .topbar-inner { padding: 14px 16px; }
  .brand-text h1 { font-size: 20px; }
  .clock { display: none; }
  .container { padding: 20px 16px 50px; }
  .card-grid { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .footer-inner { justify-content: center; }
  .footer-dots { display: none; }
  .field-row { grid-template-columns: 1fr; }
  .modal-card, .modal-card-sm { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .crt { display: none; }
  .brand-block { animation: none; }
  body.anim .card, body.anim .tool-row, body.anim .tool-group, body.anim .my-tool-card { animation: none; opacity: 1; transform: none; }
  .modal-card { animation: none; }
  .toast { animation: none; }
}