/* ============================================================
   TapFingers Admin — Glassmorphic Premium
   Atmospheric gradients · frosted glass · vibrant accents
   ============================================================ */

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

:root {
  /* Base */
  --bg:           #07071a;

  /* Glass surfaces (translucent — work over the gradient bg) */
  --surface:      rgba(22, 22, 44, 0.55);
  --surface-2:    rgba(34, 34, 62, 0.65);
  --surface-3:    rgba(46, 46, 78, 0.7);
  --input-bg:     rgba(10, 10, 25, 0.6);

  /* Borders (rgba — visible over glass) */
  --border:       rgba(255, 255, 255, 0.08);
  --border-2:     rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.22);

  /* Text */
  --text:         #f4f4fa;
  --text-2:       #b4b4cc;
  --text-3:       #7a7a96;

  /* Vibrant accent — violet → pink */
  --accent:           #a855f7;
  --accent-2:         #ec4899;
  --accent-grad:      linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
  --accent-grad-soft: linear-gradient(135deg, rgba(168,85,247,.18), rgba(236,72,153,.18));
  --accent-soft:      rgba(168, 85, 247, .15);
  --accent-glow:      rgba(168, 85, 247, .45);

  /* Secondary accent — blue → cyan */
  --cyan:        #06b6d4;
  --cyan-grad:   linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);

  /* Status */
  --success:     #10b981;
  --warning:     #f59e0b;
  --danger:      #ef4444;
  --info:        #3b82f6;

  /* Layout */
  --sidebar-w:   256px;
  --radius:      14px;
  --radius-sm:   8px;
  --radius-lg:   20px;

  /* Shadows / glow */
  --shadow:      0 8px 32px rgba(0, 0, 0, .35);
  --shadow-lg:   0 24px 60px rgba(0, 0, 0, .5);
}

html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss03';
  min-height: 100vh;
  display: flex;
  position: relative;
  background-color: var(--bg);
  overflow-x: hidden;
}

/* Ambient gradient atmosphere — the heart of the look */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(900px 600px at 8% 0%,   rgba(168, 85, 247, 0.22) 0%, transparent 55%),
    radial-gradient(800px 700px at 100% 12%, rgba(236, 72, 153, 0.18) 0%, transparent 55%),
    radial-gradient(700px 600px at 90% 100%, rgba(6, 182, 212, 0.16)  0%, transparent 55%),
    radial-gradient(600px 500px at 0% 90%,  rgba(59, 130, 246, 0.14) 0%, transparent 55%);
}
/* Subtle noise/grain to soften gradients */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: .035;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' seed='5'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
small { font-size: 12px; color: var(--text-3); }
code {
  background: var(--surface-2);
  color: var(--accent-2);
  padding: 1.5px 7px;
  border-radius: 5px;
  font-size: 12px;
  font-family: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
  border: 1px solid var(--border);
}
kbd {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255,255,255,.08);
  color: var(--text-2);
  border: 1px solid var(--border-2);
  line-height: 1.4;
}

::selection { background: rgba(168, 85, 247, .35); color: #fff; }

/* ─── Sidebar (Glass) ─────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  background: rgba(12, 12, 28, 0.55);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 10;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 18px 18px;
  position: relative;
}
.sidebar-close {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
  width: 32px; height: 32px;
  border-radius: 7px;
  margin-left: auto;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.sidebar-close:hover { color: var(--danger); background: rgba(239,68,68,.12); }

/* Mobile topbar — hidden on desktop */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(10, 10, 26, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 9;
}
.mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mobile-brand-name {
  font-size: 14px;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 0%, #d8c8ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hamburger {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border-2);
  color: var(--text);
  width: 38px; height: 38px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
}
.hamburger:hover { background: rgba(168,85,247,.15); border-color: var(--accent); }
.hamburger:active { transform: scale(.96); }

/* Sidebar backdrop (mobile drawer overlay) */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 18, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 49;
  opacity: 0;
  transition: opacity .25s;
}
.sidebar-backdrop.is-open { opacity: 1; }
body.is-sidebar-open { overflow: hidden; }
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--accent-grad);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; color: #fff;
  letter-spacing: .4px;
  box-shadow:
    0 8px 22px var(--accent-glow),
    inset 0 1px 0 rgba(255,255,255,.25);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
  background: linear-gradient(135deg, #fff 0%, #d8c8ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub  { font-size: 11px; color: var(--text-3); margin-top: 2px; font-weight: 500; letter-spacing: .04em; }

.sidebar-search {
  display: flex;
  align-items: center;
  gap: 9px;
  width: calc(100% - 28px);
  margin: 0 14px 16px;
  padding: 9px 11px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}
.sidebar-search:hover {
  border-color: var(--border-2);
  background: rgba(255,255,255,.06);
  color: var(--text-2);
}
.sidebar-search svg { flex-shrink: 0; opacity: .7; }
.sidebar-search span { flex: 1; text-align: left; }
.sidebar-search kbd { margin-left: auto; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-3);
  padding: 4px 10px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  transition: all .18s;
}
.nav-item:hover {
  background: rgba(255,255,255,.04);
  color: var(--text);
  transform: translateX(2px);
}
.nav-item.is-active {
  background: var(--accent-grad-soft);
  color: var(--text);
  border: 1px solid rgba(168,85,247,.25);
  padding: 8px 10px;
}
.nav-item.is-active::before {
  content: '';
  position: absolute;
  left: -14px; top: 6px; bottom: 6px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--accent-grad);
  box-shadow: 0 0 12px var(--accent-glow);
}
.nav-item.is-active .nav-icon {
  color: #fff;
  opacity: 1;
  filter: drop-shadow(0 0 6px var(--accent-glow));
}
.nav-icon { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; transition: opacity .18s; }
.nav-item:hover .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 12px 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-chip {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.admin-chip:hover, .admin-chip.is-active { background: rgba(255,255,255,.05); }
.admin-avatar {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--accent-grad);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12.5px; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.2);
}
.admin-info { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1; }
.admin-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-role { font-size: 10.5px; color: var(--text-3); text-transform: capitalize; margin-top: 2px; }

.logout-form { margin: 0; }
.logout-btn {
  width: 100%;
  display: flex; align-items: center; gap: 11px;
  background: transparent;
  border: none;
  color: var(--text-3);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  transition: all .15s;
}
.logout-btn:hover { background: rgba(239,68,68,.08); color: var(--danger); }
.logout-btn svg { flex-shrink: 0; opacity: .7; }

/* ─── Main content ────────────────────────────────────────── */

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 36px 44px;
  min-width: 0;
  max-width: 1500px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.page-header h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.022em;
  background: linear-gradient(135deg, #fff 0%, #c9b8ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ─── Stat cards ─────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  position: relative;
  padding: 22px 22px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  transition: transform .25s, border-color .25s;
}
.stat-card:hover { transform: translateY(-3px); border-color: var(--border-2); }

/* Each stat card gets a corner glow that shifts by position */
.stat-card::after {
  content: '';
  position: absolute;
  inset: auto -40% -50% auto;
  width: 200px; height: 200px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 65%);
  opacity: .55;
  pointer-events: none;
  transition: opacity .25s;
}
.stat-card:hover::after { opacity: .8; }
.stat-card:nth-child(2)::after { background: radial-gradient(circle, rgba(236,72,153,.45) 0%, transparent 65%); }
.stat-card:nth-child(3)::after { background: radial-gradient(circle, rgba(6,182,212,.45)  0%, transparent 65%); }
.stat-card:nth-child(4)::after { background: radial-gradient(circle, rgba(59,130,246,.45) 0%, transparent 65%); }
.stat-card:nth-child(5)::after { background: radial-gradient(circle, rgba(245,158,11,.45) 0%, transparent 65%); }
.stat-card--warn { border-color: rgba(239,68,68,.4); }
.stat-card--warn::after { background: radial-gradient(circle, rgba(239,68,68,.55) 0%, transparent 65%) !important; }

.stat-label {
  font-size: 11.5px;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.stat-value {
  font-size: 34px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.025em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}
.stat-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 8px;
  font-weight: 500;
}
.stat-icon { font-size: 18px; opacity: .7; }

/* ─── Cards ──────────────────────────────────────────────── */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color .2s;
}
.card:hover { border-color: var(--border-2); }
.card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(255,255,255,.025), transparent);
}
.card-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.005em;
}

/* ─── Tables ─────────────────────────────────────────────── */

/* Horizontal-scroll container so wide tables never overflow the viewport on
   phones — they scroll within the card instead of pushing the page sideways. */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.table th {
  padding: 12px 22px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: rgba(255,255,255,.015);
}
.table td {
  padding: 13px 22px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-2);
}
.table td strong { color: var(--text); font-weight: 600; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: rgba(168, 85, 247, .06); }
.table tbody tr:last-child td { border-bottom: none; }
.row-disabled td { opacity: .4; }
.row-clickable { cursor: pointer; }
.row-clickable:hover { background: rgba(168, 85, 247, .1); }
.empty {
  text-align: center !important;
  color: var(--text-3) !important;
  padding: 44px 16px !important;
  font-style: italic;
}

/* ─── Badges ─────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}
.badge-success { background: rgba(16,185,129,.10); color: var(--success); border-color: rgba(16,185,129,.30); }
.badge-danger  { background: rgba(239,68,68,.10); color: var(--danger);   border-color: rgba(239,68,68,.30); }
.badge-warning { background: rgba(245,158,11,.10); color: var(--warning); border-color: rgba(245,158,11,.30); }
.badge-info    { background: rgba(59,130,246,.10); color: var(--info);    border-color: rgba(59,130,246,.30); }
.badge-muted   { background: rgba(255,255,255,.05); color: var(--text-3); border-color: var(--border-2); }
.badge-muted::before { box-shadow: none; opacity: .6; }

/* ─── Buttons ────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.1;
  transition: all .18s;
  white-space: nowrap;
  user-select: none;
  position: relative;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  border: none;
  box-shadow:
    0 6px 20px var(--accent-glow),
    inset 0 1px 0 rgba(255,255,255,.25);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow:
    0 10px 28px var(--accent-glow),
    inset 0 1px 0 rgba(255,255,255,.3);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: rgba(255,255,255,.08);
  color: var(--text);
  border-color: rgba(255,255,255,.22);
  backdrop-filter: blur(10px);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: #fff;
  background: rgba(168,85,247,.18);
  box-shadow: 0 4px 14px rgba(168,85,247,.25);
}

.btn-success { background: rgba(16,185,129,.12); color: var(--success); border-color: rgba(16,185,129,.32); }
.btn-success:hover { background: rgba(16,185,129,.22); }
.btn-warning { background: rgba(245,158,11,.12); color: var(--warning); border-color: rgba(245,158,11,.32); }
.btn-warning:hover { background: rgba(245,158,11,.22); }
.btn-danger  { background: rgba(239,68,68,.10); color: var(--danger);   border-color: rgba(239,68,68,.30); }
.btn-danger:hover  { background: rgba(239,68,68,.20); }

.btn-sm { padding: 5px 11px; font-size: 11.5px; border-radius: 6px; }
.btn-full { width: 100%; }

/* ─── Forms ──────────────────────────────────────────────── */

.form-vertical { padding: 22px; }
.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}
.form-group label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .05em;
  display: flex;
  align-items: center;
}
.form-group label small {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--text-3);
  margin-left: 6px;
}
.form-group input,
.form-group select {
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: all .18s;
}
.form-group input::placeholder { color: var(--text-3); }
.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
  background: rgba(168,85,247,.05);
  box-shadow: 0 0 0 4px rgba(168,85,247,.15);
}

/* ── SVG icon field (shop items) ──────────────────────────────────────────── */
.form-group textarea {
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.5;
  outline: none;
  resize: vertical;
  transition: all .18s;
}
.form-group textarea::placeholder { color: var(--text-3); }
.form-group textarea:focus {
  border-color: var(--accent);
  background: rgba(168,85,247,.05);
  box-shadow: 0 0 0 4px rgba(168,85,247,.15);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-row .form-group { margin-bottom: 16px; }
.svg-field {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 10px;
  align-items: stretch;
}
.svg-field textarea { width: 100%; }
.svg-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--input-bg);
  border: 1px dashed var(--border-2, var(--border));
  border-radius: var(--radius-sm);
  padding: 8px;
  overflow: hidden;
}
.svg-preview svg { width: 100%; height: 100%; max-width: 72px; max-height: 72px; }
.svg-preview-empty { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
@media (max-width: 560px) {
  .svg-field { grid-template-columns: 1fr; }
  .svg-preview { min-height: 80px; }
}

/* ── Toggle switch (e.g. random colors) ───────────────────────────────────── */
.switch-field {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .18s;
}
.switch-field:hover { border-color: var(--border-2); }
.switch-field:has(.switch-input:checked) {
  border-color: var(--accent);
  background: var(--accent-grad-soft);
}
.switch-field__text { display: flex; flex-direction: column; gap: 3px; }
.switch-field__title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.switch-field__hint  { font-size: 11.5px; color: var(--text-3); line-height: 1.35; }

.switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  flex: none;
  position: relative;
  width: 48px;
  height: 27px;
  border-radius: 999px;
  background: rgba(255,255,255,.10);
  border: 1px solid var(--border-2);
  transition: all .2s ease;
}
.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,.4);
  transition: transform .22s cubic-bezier(.4,.0,.2,1);
}
.switch-input:checked + .switch-track {
  background: var(--accent-grad);
  border-color: transparent;
  box-shadow: 0 0 12px var(--accent-glow);
}
.switch-input:checked + .switch-track .switch-thumb { transform: translateX(21px); }
.switch-input:focus-visible + .switch-track { box-shadow: 0 0 0 4px rgba(168,85,247,.25); }

/* ── Colour field (e.g. track color) ──────────────────────────────────────── */
.color-field { display: flex; align-items: center; gap: 10px; }
.color-field input[type="text"] { flex: 1; }

/* Live TrackIcon (destroy-burst) preview, recoloured via CSS mask so the shape
   takes whatever track colour is chosen. Sits beside the hex input. */
.track-preview {
  flex: none;
  width: 44px;
  height: 40px;
  background-color: var(--text-2);
  -webkit-mask: url(/img/track-icon.svg) center / contain no-repeat;
  mask: url(/img/track-icon.svg) center / contain no-repeat;
  transition: background-color .15s;
}

/* Compact TrackIcon swatch for the shop table's "Track" column. */
.track-cell {
  display: inline-block;
  width: 30px;
  height: 28px;
  vertical-align: middle;
  background-color: var(--text-2);
  -webkit-mask: url(/img/track-icon.svg) center / contain no-repeat;
  mask: url(/img/track-icon.svg) center / contain no-repeat;
}
.track-cell--rainbow {
  background: conic-gradient(from 0deg, #ff4d4d, #ffb84d, #fff24d, #4dff77, #4dd2ff, #4d6bff, #d24dff, #ff4d4d);
}

/* Table thumbnail */
.shop-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}
.shop-icon svg { width: 100%; height: 100%; max-width: 32px; max-height: 32px; }
.shop-icon--empty { color: var(--text-3); }

.search-form { display: flex; gap: 8px; align-items: center; }
.search-form input {
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  min-width: 280px;
  outline: none;
  transition: all .18s;
}
.search-form input::placeholder { color: var(--text-3); }
.search-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(168,85,247,.15);
}

/* ─── Pagination ─────────────────────────────────────────── */

.pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,.01);
}
.page-info { color: var(--text-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ─── Alerts ─────────────────────────────────────────────── */

.alert {
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 22px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 11px;
  backdrop-filter: blur(10px);
}
.alert::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  box-shadow: 0 0 10px currentColor;
}
.alert-success { background: rgba(16,185,129,.08); border-color: rgba(16,185,129,.3); color: var(--success); }
.alert-error   { background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.3); color: var(--danger); }

/* ─── Utility ────────────────────────────────────────────── */

.actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

/* Refined, uniform action buttons that read as one polished group */
.actions .btn-sm,
.actions summary.btn-sm {
  height: 40px;
  padding: 0 20px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .15px;
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
  transition: transform .15s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.actions .btn-sm:hover,
.actions summary.btn-sm:hover { transform: translateY(-1.5px); }
.actions .btn-sm:active,
.actions summary.btn-sm:active { transform: translateY(0); }

/* Neutral actions stay quiet; colored ones glow on hover so they pop */
.actions .btn-secondary {
  background: rgba(255,255,255,.045);
  border-color: rgba(255,255,255,.12);
}
.actions .btn-secondary:hover {
  background: rgba(168,85,247,.16);
  border-color: var(--accent);
  box-shadow: 0 5px 16px rgba(168,85,247,.28), inset 0 1px 0 rgba(255,255,255,.1);
}
.actions .btn-success:hover {
  box-shadow: 0 5px 16px rgba(16,185,129,.3), inset 0 1px 0 rgba(255,255,255,.1);
}
.actions .btn-warning:hover {
  box-shadow: 0 5px 16px rgba(245,158,11,.3), inset 0 1px 0 rgba(255,255,255,.1);
}
.actions .btn-danger:hover {
  box-shadow: 0 5px 16px rgba(239,68,68,.3), inset 0 1px 0 rgba(255,255,255,.1);
}

.text-muted { color: var(--text-3); display: block; font-size: 11.5px; margin-top: 3px; }

/* ─── Login ──────────────────────────────────────────────── */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-body::before {
  content: '';
  position: fixed;
  inset: -20%;
  pointer-events: none;
  background:
    radial-gradient(800px 600px at 30% 20%, rgba(168, 85, 247, 0.35) 0%, transparent 55%),
    radial-gradient(700px 500px at 70% 80%, rgba(236, 72, 153, 0.28) 0%, transparent 55%),
    radial-gradient(600px 500px at 10% 90%, rgba(6, 182, 212, 0.2)   0%, transparent 55%);
  animation: aurora 18s ease-in-out infinite;
}
/* soft grid texture over the aurora */
.login-body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, #000 0%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, #000 0%, transparent 80%);
}
@keyframes aurora {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33%      { transform: translate3d(3%, -2%, 0) scale(1.05); }
  66%      { transform: translate3d(-2%, 2%, 0) scale(1.03); }
}
.login-card {
  position: relative;
  z-index: 1;
  background: rgba(20, 20, 40, 0.55);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 44px 40px 32px;
  width: 100%;
  max-width: 410px;
  box-shadow: var(--shadow-lg);
  animation: card-in .6s cubic-bezier(.2, .8, .2, 1) both;
}
/* gradient hairline along the card's top edge */
.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(168,85,247,.7), rgba(236,72,153,.7), transparent);
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.login-logo {
  position: relative;
  width: 60px; height: 60px;
  border-radius: 18px;
  background: var(--accent-grad);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  color: #fff;
  font-size: 0;
  box-shadow:
    0 12px 30px var(--accent-glow),
    inset 0 1px 0 rgba(255,255,255,.25);
  animation: logo-float 4.5s ease-in-out infinite;
}
/* pulsing glow halo behind the logo */
.login-logo::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 24px;
  background: var(--accent-grad);
  filter: blur(18px);
  opacity: .55;
  z-index: -1;
  animation: logo-pulse 4.5s ease-in-out infinite;
}
.login-logo::after {
  content: 'TF';
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .5px;
}
@keyframes logo-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
@keyframes logo-pulse {
  0%, 100% { opacity: .45; transform: scale(1); }
  50%      { opacity: .7;  transform: scale(1.08); }
}
.login-title {
  text-align: center;
  font-size: 23px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -.015em;
  background: linear-gradient(135deg, #fff 0%, #d8c8ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.login-sub {
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  margin-bottom: 28px;
}
.login-form .btn { margin-top: 8px; letter-spacing: .02em; }

/* dedicated login submit button — shine sweep + sliding arrow */
.login-btn {
  position: relative;
  overflow: hidden;
  height: 46px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius);
}
.login-btn svg {
  width: 17px; height: 17px;
  transition: transform .22s ease;
}
.login-btn:hover svg { transform: translateX(4px); }
/* light sweep that crosses the button on hover */
.login-btn::after {
  content: '';
  position: absolute;
  top: 0; left: -120%;
  width: 70%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.4), transparent);
  transform: skewX(-18deg);
  transition: left .55s ease;
}
.login-btn:hover::after { left: 130%; }

/* input with leading icon */
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon svg {
  position: absolute;
  left: 13px;
  width: 17px; height: 17px;
  color: var(--text-3);
  pointer-events: none;
  transition: color .18s;
}
.input-icon input { width: 100%; padding-left: 40px !important; }
.input-icon:focus-within svg { color: var(--accent); }

.login-foot {
  text-align: center;
  margin-top: 22px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
  opacity: .7;
}

@media (prefers-reduced-motion: reduce) {
  .login-body::before,
  .login-card,
  .login-logo,
  .login-logo::before { animation: none; }
}

/* ─── Profile rows ───────────────────────────────────────── */

.profile-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.profile-row:last-child { border-bottom: none; }
.profile-label {
  min-width: 130px;
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ─── Inline reset-password ──────────────────────────────── */

.inline-details { display: inline-block; position: relative; }
.inline-details summary { cursor: pointer; list-style: none; }
.inline-details summary::-webkit-details-marker { display: none; }
.inline-pw-form {
  display: flex; gap: 6px;
  margin-top: 6px; padding: 10px;
  background: rgba(20, 20, 40, .9);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  position: absolute;
  right: 0; z-index: 10;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
}
.inline-pw-form input {
  padding: 6px 10px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 5px;
  font-size: 12px;
  width: 170px;
  outline: none;
}
.inline-pw-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ─── Error page ─────────────────────────────────────────── */

.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60vh;
  gap: 16px;
}
.error-page h1 {
  font-size: 80px;
  font-weight: 800;
  letter-spacing: -.04em;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.error-page p { color: var(--text-2); font-size: 15px; }

/* ─── Tabs ───────────────────────────────────────────────── */

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--text-2);
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, transform .12s;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.tab:active { transform: scale(.97); }
.tab.is-active {
  background: var(--accent-grad);
  color: #fff;
  box-shadow:
    0 4px 14px var(--accent-glow),
    inset 0 1px 0 rgba(255, 255, 255, .2);
}

.tab-count {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .08);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  min-width: 22px;
  text-align: center;
}
.tab.is-active .tab-count {
  background: rgba(255, 255, 255, .22);
  color: #fff;
}

.tabs-empty {
  text-align: center;
  color: var(--text-3);
  padding: 44px 16px;
  font-style: italic;
  font-size: 13px;
}

@media (max-width: 540px) {
  .tab { padding: 9px 12px; font-size: 13px; }
}

/* ─── Custom Select ──────────────────────────────────────── */

.select-wrap {
  position: relative;
}
.select-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}
.select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: border-color .18s, background .18s, box-shadow .18s;
  text-align: left;
  line-height: 1.4;
}
.select-trigger:hover { border-color: var(--border-2); background: rgba(255,255,255,.03); }
.select-trigger:focus-visible,
.select-wrap.is-open .select-trigger {
  border-color: var(--accent);
  background: rgba(168,85,247,.06);
  box-shadow: 0 0 0 4px rgba(168,85,247,.15);
}
.select-value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.select-value.is-placeholder { color: var(--text-3); font-weight: 400; }
.select-chevron {
  width: 14px; height: 14px;
  opacity: .55;
  transition: transform .25s cubic-bezier(.16,1,.3,1), opacity .15s, color .15s;
  flex-shrink: 0;
}
.select-wrap.is-open .select-chevron {
  transform: rotate(180deg);
  opacity: 1;
  color: var(--accent-2);
}

.select-panel {
  position: fixed;
  background: rgba(26, 26, 52, 0.95);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, .55),
    0 0 0 1px rgba(255, 255, 255, .02),
    inset 0 1px 0 rgba(255, 255, 255, .04);
  padding: 5px;
  z-index: 200;
  max-height: 280px;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(-6px) scale(.97);
  transform-origin: top center;
  pointer-events: none;
  transition: opacity .18s, transform .2s cubic-bezier(.16, 1, .3, 1);
}
.select-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.select-panel.flip-up { transform-origin: bottom center; }

.select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-2);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .12s, color .12s;
}
.select-option:hover,
.select-option.is-focused {
  background: rgba(168, 85, 247, .12);
  color: var(--text);
  outline: none;
}
.select-option.is-selected {
  background: var(--accent-grad-soft);
  color: var(--text);
}
.select-option.is-selected::after {
  content: '';
  width: 14px; height: 14px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ec4899' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
  flex-shrink: 0;
}
.select-option:disabled { opacity: .4; cursor: not-allowed; }

.select-panel::-webkit-scrollbar { width: 6px; }
.select-panel::-webkit-scrollbar-track { background: transparent; }
.select-panel::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, .35);
  border-radius: 6px;
}

@media (max-width: 540px) {
  .select-trigger { font-size: 16px; padding: 12px 14px; }
  .select-option { padding: 11px 13px; font-size: 14px; }
  .select-panel { max-height: 50vh; }
}

/* ─── Modal ──────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 18, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s;
  padding: 24px;
}
.modal-backdrop.is-open { opacity: 1; pointer-events: auto; }

.modal {
  background: rgba(24, 24, 48, 0.92);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(.97);
  transition: transform .25s cubic-bezier(.16,1,.3,1);
}
.modal-backdrop.is-open .modal { transform: translateY(0) scale(1); }

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.005em;
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  width: 30px; height: 30px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  transition: all .15s;
}
.modal-close:hover { color: var(--danger); background: rgba(239,68,68,.12); }

.modal-body { overflow-y: auto; flex: 1; }
.modal-body .form-vertical { padding: 22px; margin: 0; }
.modal-body .form-vertical .form-group:last-of-type { margin-bottom: 0; }

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: rgba(0,0,0,.15);
}

body.is-modal-open { overflow: hidden; }

/* ─── Danger / delete confirmation modal ─────────────────── */
.modal--danger {
  position: relative;
  max-width: 420px;
  text-align: center;
  border-color: rgba(239, 68, 68, .28);
}
/* Soft red aura bleeding from the top edge */
.danger-modal-glow {
  position: absolute;
  top: -150px; left: 50%;
  width: 340px; height: 340px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(239,68,68,.4) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}
.danger-modal-body {
  position: relative;
  z-index: 1;
  padding: 36px 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Pulsing danger badge */
.danger-icon {
  position: relative;
  width: 80px; height: 80px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 22px;
}
.danger-icon::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(239,68,68,.28), rgba(239,68,68,.06));
  border: 1px solid rgba(239,68,68,.45);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}
.danger-icon__ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(239,68,68,.55);
  animation: danger-pulse 2.2s ease-out infinite;
}
.danger-icon__ring--2 { animation-delay: 1.1s; }
.danger-icon svg {
  position: relative; z-index: 2;
  width: 34px; height: 34px;
  color: #fff;
  filter: drop-shadow(0 4px 12px rgba(239,68,68,.7));
  animation: danger-bob 2.6s ease-in-out infinite;
}
@keyframes danger-pulse {
  0%   { transform: scale(1);    opacity: .7; }
  100% { transform: scale(1.85); opacity: 0; }
}
@keyframes danger-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-3px) rotate(-5deg); }
}

.danger-modal-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
  margin-bottom: 10px;
}
.danger-modal-text {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.65;
  max-width: 300px;
}
.danger-chip {
  display: inline-block;
  font-family: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  background: rgba(239,68,68,.18);
  border: 1px solid rgba(239,68,68,.36);
  padding: 1px 9px;
  border-radius: 6px;
}

.danger-modal-footer {
  position: relative;
  z-index: 1;
  justify-content: center;
  border-top: none;
  background: transparent;
  padding: 4px 32px 30px;
  gap: 10px;
}
.danger-modal-footer .btn { min-width: 124px; padding: 11px 18px; }

.btn-delete-confirm {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: #fff;
  border: none;
  box-shadow: 0 8px 22px rgba(239,68,68,.42), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn-delete-confirm:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(239,68,68,.58), inset 0 1px 0 rgba(255,255,255,.3);
}
.btn-delete-confirm:active { transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .danger-icon__ring, .danger-icon svg { animation: none; }
}

/* ─── Scrollbar ──────────────────────────────────────────── */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, .25);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(168, 85, 247, .5); background-clip: padding-box; }

/* ─── Responsive ─────────────────────────────────────────── */

@media (max-width: 1200px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .main-content { padding: 28px 32px; }
}

/* Tablet + mobile: sidebar becomes a drawer */
@media (max-width: 880px) {
  body { display: block; }

  .mobile-topbar { display: flex; }

  .sidebar {
    width: 288px;
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.16, 1, .3, 1);
    box-shadow: 18px 0 60px rgba(0, 0, 0, .5);
    z-index: 50;
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-backdrop.is-open { display: block; }
  .sidebar-close { display: inline-flex; }

  .main-content {
    margin-left: 0;
    max-width: none;
    padding: 22px 22px 60px;
  }

  .page-header { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 22px; }
  .page-header h1 { font-size: 24px; }
  .page-header .btn-primary { width: 100%; }

  .search-form { width: 100%; }
  .search-form input { min-width: 0; flex: 1; font-size: 16px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 22px; }
  .stat-card { padding: 16px 18px; }
  .stat-value { font-size: 26px; }
  .stat-label { font-size: 11px; }

  .dashboard-grid { grid-template-columns: 1fr; gap: 16px; }

  .table th { padding: 10px 14px; font-size: 10px; }
  .table td { padding: 10px 14px; font-size: 12.5px; }

  .card-header { padding: 14px 16px; }
  .card-header h2 { font-size: 14px; }

  /* Prevent iOS zoom on input focus */
  .form-group input, .form-group select, .form-group textarea { font-size: 16px; }
  .inline-pw-form input { font-size: 14px; }

  .form-vertical { padding: 18px; }

  .pagination { padding: 12px 16px; flex-wrap: wrap; justify-content: center; }

  .actions { gap: 5px; }
  .actions .btn-sm,
  .actions summary.btn-sm { height: 32px; padding: 0 11px; font-size: 11px; }

  /* Hide inline reset-PW popover on mobile (clips off-screen). Use a regular details flow instead */
  .inline-pw-form { position: static; margin-top: 8px; flex-wrap: wrap; }
  .inline-pw-form input { width: 100%; min-width: 0; }
}

/* Phone portrait */
@media (max-width: 540px) {
  .main-content { padding: 18px 16px 60px; }

  .stats-grid { grid-template-columns: 1fr; }

  .table th, .table td { padding: 9px 12px; }

  /* Track-color field: let the hex input shrink and the Clear button wrap below
     instead of squashing, so the row stays usable on narrow phones. */
  .color-field { flex-wrap: wrap; gap: 8px; }
  .color-field input[type="text"] { flex: 1 1 140px; min-width: 0; }
  .color-field .btn { flex: 0 0 auto; }
  .track-preview { width: 40px; height: 36px; }

  .page-header h1 { font-size: 22px; }

  .alert { padding: 11px 14px; font-size: 12.5px; }

  /* Modal becomes a bottom sheet on phones */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(100%);
  }
  .modal-backdrop.is-open .modal { transform: translateY(0); }
  .modal-body { -webkit-overflow-scrolling: touch; }

  /* Add a small "drag handle" affordance at top of bottom sheet */
  .modal-header { padding-top: 20px; }
  .modal-header::before {
    content: '';
    position: absolute;
    top: 7px;
    left: 50%;
    transform: translateX(-50%);
    width: 38px; height: 4px;
    border-radius: 4px;
    background: rgba(255,255,255,.18);
  }
  .modal-header { position: relative; }

  /* Login card edge-to-edge feel */
  .login-card { padding: 28px 22px; border-radius: var(--radius); }
}

/* Tiny phones */
@media (max-width: 360px) {
  .mobile-brand-name { display: none; }
  .actions { flex-direction: column; align-items: stretch; }
  .actions .btn-sm, .actions form, .actions .inline-details { width: 100%; }
  .actions .btn-sm { justify-content: center; }
}

/* ─── Command palette (sidebar search) ───────────────────────── */
.cmd-palette {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(4, 4, 14, .6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 14vh 16px 16px;
  justify-content: center;
  align-items: flex-start;
}
.cmd-palette.is-open { display: flex; }
.cmd-box {
  width: 100%;
  max-width: 560px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: cmdIn .16s ease;
}
@keyframes cmdIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.cmd-input-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-3);
}
.cmd-input-row input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
}
.cmd-input-row input::placeholder { color: var(--text-3); }
.cmd-input-row kbd {
  font-size: 10px;
  padding: 3px 6px;
  border-radius: 5px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border-2);
  color: var(--text-3);
}
.cmd-results {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 52vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.cmd-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-2);
}
.cmd-item.is-active { background: var(--accent-soft); color: var(--text); }
.cmd-item-icon { width: 18px; text-align: center; opacity: .8; flex: none; }
.cmd-item-label { flex: 1; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-item-hint {
  flex: none;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
}
.cmd-empty { padding: 20px 12px; text-align: center; color: var(--text-3); font-style: italic; }

@media (max-width: 540px) {
  .cmd-palette { padding: 8vh 12px 12px; }
  .cmd-item-hint { display: none; }
}
