/* Unify QBank — Auth / Landing / Admin UI
   Layered on top of index.css. Mobile-first, fluid, premium. */

:root {
  --auth-bg-grad: radial-gradient(circle at 20% 10%, rgba(99,102,241,0.18), transparent 55%),
                  radial-gradient(circle at 80% 90%, rgba(168,85,247,0.16), transparent 55%),
                  linear-gradient(180deg, #0a0a14 0%, #050510 100%);
  --auth-card: rgba(20, 22, 38, 0.78);
  --auth-card-light: rgba(255, 255, 255, 0.92);
  --auth-border: rgba(255, 255, 255, 0.08);
  --auth-border-light: rgba(0, 0, 0, 0.08);
  --auth-radius: 18px;
  --accent-1: #8b5cf6;
  --accent-2: #6366f1;
  --accent-3: #ec4899;
  --success: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --shadow-glow: 0 20px 60px -20px rgba(139, 92, 246, 0.45);
}

body.light-theme {
  --auth-bg-grad: radial-gradient(circle at 20% 10%, rgba(99,102,241,0.08), transparent 55%),
                  radial-gradient(circle at 80% 90%, rgba(168,85,247,0.08), transparent 55%),
                  linear-gradient(180deg, #f7f8fc 0%, #eef0f7 100%);
  --auth-card: var(--auth-card-light);
  --auth-border: var(--auth-border-light);
}

/* ───────── Full-screen mount ───────── */
.auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--auth-bg-grad);
  z-index: 9000;
  overflow-y: auto;
  padding: 1.5rem;
  animation: authFade 320ms ease;
}
.auth-screen.hidden { display: none; }
@keyframes authFade {
  from { opacity: 0; transform: scale(0.99); }
  to { opacity: 1; transform: scale(1); }
}

/* ───────── Landing ───────── */
.landing-inner {
  width: 100%;
  max-width: 1100px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 3rem;
  align-items: center;
}
.landing-hero h1 {
  font-family: "Outfit", sans-serif;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 1.1rem;
  background: linear-gradient(120deg, #fff 0%, #c7d2fe 50%, #f9a8d4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
body.light-theme .landing-hero h1 {
  background: linear-gradient(120deg, #1e1b4b 0%, #6366f1 50%, #ec4899 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
.landing-hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(139, 92, 246, 0.14);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.3);
  margin-bottom: 1.2rem;
}
.landing-hero p.lead {
  font-size: 1.08rem;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.65;
  max-width: 520px;
  margin: 0 0 1.8rem;
}
body.light-theme .landing-hero p.lead { color: rgba(20, 22, 38, 0.7); }

.landing-cta-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}
.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 1.6rem;
  border-radius: 14px;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
  font-family: inherit;
}
.btn-cta.primary {
  background: linear-gradient(135deg, var(--accent-2) 0%, var(--accent-1) 50%, var(--accent-3) 100%);
  color: white;
  box-shadow: var(--shadow-glow);
}
.btn-cta.primary:hover { transform: translateY(-2px); box-shadow: 0 25px 70px -20px rgba(139, 92, 246, 0.6); }
.btn-cta.ghost {
  background: rgba(255, 255, 255, 0.06);
  color: white;
  border: 1px solid var(--auth-border);
}
body.light-theme .btn-cta.ghost { background: rgba(0,0,0,0.04); color: #1e1b4b; }
.btn-cta.ghost:hover { background: rgba(255,255,255,0.1); }

.landing-features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  max-width: 520px;
}
.landing-feature {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--auth-border);
  border-radius: 12px;
  transition: background 180ms ease;
}
.landing-feature:hover { background: rgba(255,255,255,0.06); }
.landing-feature .icon-wrap {
  width: 36px; height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(168,85,247,0.2));
  color: #c4b5fd;
}
.landing-feature h4 { margin: 0 0 0.15rem; font-size: 0.92rem; font-weight: 600; color: white; }
body.light-theme .landing-feature h4 { color: #1e1b4b; }
.landing-feature p { margin: 0; font-size: 0.8rem; color: rgba(255,255,255,0.6); line-height: 1.4; }
body.light-theme .landing-feature p { color: rgba(20,22,38,0.65); }

.landing-visual {
  position: relative;
  aspect-ratio: 1;
  max-width: 460px;
  margin: 0 auto;
}
.landing-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139,92,246,0.35) 0%, transparent 70%);
  filter: blur(60px);
  animation: pulse 6s ease-in-out infinite;
}
.landing-visual .visual-card {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--auth-card);
  border: 1px solid var(--auth-border);
  border-radius: 28px;
  backdrop-filter: blur(20px);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,0.6);
}
.visual-stat {
  font-size: clamp(2rem, 4vw, 3.4rem);
  font-weight: 800;
  font-family: "Outfit";
  background: linear-gradient(135deg, #6366f1, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.visual-stat-lbl { font-size: 0.85rem; color: rgba(255,255,255,0.6); margin-top: 0.25rem; }
body.light-theme .visual-stat-lbl { color: rgba(20,22,38,0.6); }
.visual-row { display: flex; gap: 1.5rem; margin-top: 1rem; }
.visual-mini-card {
  flex: 1;
  padding: 0.85rem 1rem;
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  border: 1px solid var(--auth-border);
}
.visual-mini-val { font-size: 1.3rem; font-weight: 700; color: white; }
body.light-theme .visual-mini-val { color: #1e1b4b; }
.visual-mini-lbl { font-size: 0.72rem; color: rgba(255,255,255,0.5); margin-top: 0.15rem; }

@keyframes pulse { 0%,100% { opacity: 0.5; } 50% { opacity: 0.85; } }

@media (max-width: 860px) {
  .landing-inner { grid-template-columns: 1fr; gap: 2rem; text-align: center; }
  .landing-hero p.lead { margin-left: auto; margin-right: auto; }
  .landing-cta-row { justify-content: center; }
  .landing-features { margin: 0 auto; grid-template-columns: 1fr; max-width: 360px; text-align: left; }
  .landing-visual { max-width: 320px; }
}

/* ───────── Auth (login/register) card ───────── */
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--auth-card);
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 2rem;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,0.5);
  animation: cardRise 360ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes cardRise { from { opacity:0; transform: translateY(14px); } to { opacity:1; transform: translateY(0); } }
.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.5rem;
  font-family: "Outfit";
  font-weight: 700;
  font-size: 1.4rem;
}
.auth-brand .brand-mark {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  display: flex; align-items: center; justify-content: center;
  color: white;
  box-shadow: var(--shadow-glow);
}
.auth-brand span.accent {
  background: linear-gradient(120deg, #6366f1, #ec4899);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.auth-tabs {
  display: flex;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 1.5rem;
  border: 1px solid var(--auth-border);
}
.auth-tab {
  flex: 1;
  padding: 0.55rem;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.6);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 9px;
  transition: all 220ms ease;
  font-family: inherit;
}
body.light-theme .auth-tab { color: rgba(20,22,38,0.55); }
.auth-tab.active {
  background: linear-gradient(135deg, var(--accent-2), var(--accent-1));
  color: white;
  box-shadow: 0 6px 18px -6px rgba(99,102,241,0.6);
}

.auth-pane { display: none; }
.auth-pane.active { display: block; animation: paneFade 240ms ease; }
@keyframes paneFade { from { opacity:0; transform: translateY(4px); } to { opacity:1; transform: translateY(0); } }

.auth-field { margin-bottom: 1rem; }
.auth-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
}
body.light-theme .auth-field label { color: rgba(20,22,38,0.7); }
.auth-field input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--auth-border);
  border-radius: 10px;
  color: white;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 180ms, background 180ms, box-shadow 180ms;
}
body.light-theme .auth-field input { color: #1e1b4b; background: rgba(0,0,0,0.025); }
.auth-field input:focus {
  outline: none;
  border-color: var(--accent-2);
  background: rgba(99,102,241,0.06);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}
.auth-field input.code-input {
  font-family: "JetBrains Mono", "Courier New", monospace;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-align: center;
  font-size: 1.05rem;
}

.auth-submit {
  width: 100%;
  padding: 0.85rem;
  border: none;
  border-radius: 11px;
  font-weight: 600;
  font-size: 1rem;
  color: white;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-1));
  cursor: pointer;
  font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  transition: transform 180ms, box-shadow 180ms;
  margin-top: 0.5rem;
}
.auth-submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 28px -10px rgba(139,92,246,0.6); }
.auth-submit:disabled { opacity: 0.65; cursor: not-allowed; }
.auth-submit.loading::after {
  content: "";
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.auth-error {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
  padding: 0.6rem 0.8rem;
  border-radius: 9px;
  font-size: 0.85rem;
  margin-bottom: 0.85rem;
}
.auth-error.hidden { display: none; }

.auth-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  font-size: 0.82rem;
}
.auth-link {
  background: none; border: none; color: var(--accent-2);
  cursor: pointer; font-weight: 500; font-family: inherit; font-size: inherit;
  padding: 0; text-decoration: underline; text-underline-offset: 3px;
}
.auth-link:hover { color: var(--accent-1); }

.auth-back-btn {
  position: absolute;
  top: 1.25rem; left: 1.25rem;
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--auth-border);
  color: white;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  transition: background 180ms;
}
.auth-back-btn:hover { background: rgba(255,255,255,0.12); }
body.light-theme .auth-back-btn { color: #1e1b4b; background: rgba(0,0,0,0.04); }

/* ───────── Header user chip ───────── */
.user-chip {
  position: relative;
  margin-left: 0.5rem;
}
.user-chip.hidden { display: none; }
.user-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem 0.35rem 0.35rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--auth-border);
  border-radius: 999px;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.86rem;
  transition: background 180ms;
}
.user-chip-btn:hover { background: rgba(255,255,255,0.1); }
.user-chip-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-chip-caret { width: 14px; height: 14px; opacity: 0.6; }
.avatar-circle {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.user-chip-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 220px;
  background: var(--auth-card);
  border: 1px solid var(--auth-border);
  border-radius: 12px;
  backdrop-filter: blur(20px);
  padding: 0.4rem;
  box-shadow: 0 20px 60px -20px rgba(0,0,0,0.5);
  z-index: 100;
  animation: menuPop 200ms cubic-bezier(0.16,1,0.3,1);
}
.user-chip-menu.hidden { display: none; }
@keyframes menuPop { from { opacity:0; transform: translateY(-6px); } to { opacity:1; transform: translateY(0); } }
.user-chip-menu-header { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--auth-border); margin-bottom: 0.3rem; }
.user-chip-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  text-align: left;
  transition: background 140ms;
}
.user-chip-item:hover { background: rgba(255,255,255,0.06); }
.user-chip-item.danger { color: #f87171; }
.user-chip-item i { width: 16px; height: 16px; }

@media (max-width: 600px) {
  .user-chip-name { max-width: 70px; font-size: 0.78rem; }
}

/* ───────── Admin Dashboard ───────── */
.admin-shell {
  background: var(--auth-bg-grad);
  position: fixed; inset: 0;
  overflow-y: auto;
  z-index: 9000;
  padding: 1.5rem;
}
.admin-shell.hidden { display: none; }
.admin-inner {
  max-width: 1200px;
  margin: 0 auto;
}
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.admin-title-row { display: flex; align-items: center; gap: 0.8rem; }
.admin-title-row h1 {
  font-family: "Outfit"; font-weight: 700; font-size: 1.6rem; margin: 0;
  background: linear-gradient(120deg, #fff, #c4b5fd);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
body.light-theme .admin-title-row h1 {
  background: linear-gradient(120deg, #1e1b4b, #6366f1);
  -webkit-background-clip: text; background-clip: text;
}
.admin-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.admin-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.admin-stat {
  background: var(--auth-card);
  border: 1px solid var(--auth-border);
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
  backdrop-filter: blur(20px);
  display: flex; align-items: center; gap: 0.85rem;
  transition: transform 200ms;
}
.admin-stat:hover { transform: translateY(-2px); }
.admin-stat .stat-icon {
  width: 42px; height: 42px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(236,72,153,0.18));
  color: #c4b5fd;
  flex-shrink: 0;
}
.admin-stat .stat-val { font-size: 1.6rem; font-weight: 700; font-family: "Outfit"; }
.admin-stat .stat-lbl { font-size: 0.78rem; color: rgba(255,255,255,0.55); }
body.light-theme .admin-stat .stat-lbl { color: rgba(20,22,38,0.6); }

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.admin-card {
  background: var(--auth-card);
  border: 1px solid var(--auth-border);
  border-radius: 16px;
  padding: 1.25rem;
  backdrop-filter: blur(20px);
}
.admin-card h2 {
  margin: 0 0 0.25rem;
  font-family: "Outfit";
  font-size: 1.1rem;
  font-weight: 600;
  display: flex; align-items: center; gap: 0.5rem;
}
.admin-card .subtitle {
  font-size: 0.82rem; color: rgba(255,255,255,0.55); margin-bottom: 1rem;
}
body.light-theme .admin-card .subtitle { color: rgba(20,22,38,0.6); }

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

/* Generate code form */
.gen-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}
.gen-form .full { grid-column: 1 / -1; }
.gen-form label {
  display: block; font-size: 0.75rem; font-weight: 600;
  color: rgba(255,255,255,0.65); margin-bottom: 0.3rem;
}
body.light-theme .gen-form label { color: rgba(20,22,38,0.7); }
.gen-form input, .gen-form select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--auth-border);
  border-radius: 8px;
  color: white;
  font-family: inherit;
  font-size: 0.88rem;
}
body.light-theme .gen-form input, body.light-theme .gen-form select { color: #1e1b4b; background: rgba(0,0,0,0.03); }
.gen-form input:focus, .gen-form select:focus { outline: none; border-color: var(--accent-2); }

#generatedCodesOut {
  margin-top: 0.9rem;
  padding: 0.8rem;
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.25);
  border-radius: 10px;
}
#generatedCodesOut.hidden { display: none; }
.generated-code-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.35rem 0;
}

/* Tables */
.admin-table-wrap {
  margin-top: 1rem;
  max-height: 480px;
  overflow-y: auto;
  border-radius: 10px;
  border: 1px solid var(--auth-border);
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th, .admin-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--auth-border);
}
.admin-table thead th {
  position: sticky; top: 0;
  background: rgba(20,22,38,0.95);
  backdrop-filter: blur(10px);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.55);
  z-index: 2;
}
body.light-theme .admin-table thead th { background: rgba(255,255,255,0.92); color: rgba(20,22,38,0.6); }
.admin-table tbody tr { transition: background 140ms; }
.admin-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.admin-table .muted { color: rgba(255,255,255,0.5); }
body.light-theme .admin-table .muted { color: rgba(20,22,38,0.55); }
.admin-table .small { font-size: 0.78rem; }

.code-pill {
  font-family: "JetBrains Mono", monospace;
  background: rgba(99,102,241,0.12);
  color: #c4b5fd;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
}
body.light-theme .code-pill { color: #4338ca; background: rgba(99,102,241,0.1); }

.badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge.small { font-size: 0.65rem; padding: 0.1rem 0.4rem; }
.badge-ok { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.badge-warn { background: rgba(245,158,11,0.15); color: #fcd34d; }
.badge-muted { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.6); }
.badge-admin { background: linear-gradient(135deg, rgba(139,92,246,0.25), rgba(236,72,153,0.25)); color: #f0abfc; }
.badge-user { background: rgba(99,102,241,0.15); color: #a5b4fc; }
.badge-self { background: rgba(99,102,241,0.2); color: #c7d2fe; margin-left: 0.3rem; font-size: 0.65rem; padding: 0.05rem 0.35rem; }

.loc-cell {
  display: flex; align-items: center; gap: 0.5rem;
  cursor: help;
  max-width: 200px;
}
.loc-flag { font-size: 1.15rem; line-height: 1; flex-shrink: 0; }
.loc-text { min-width: 0; overflow: hidden; }
.loc-text > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-cell { display: flex; align-items: center; gap: 0.6rem; }
.user-cell .avatar-circle { width: 32px; height: 32px; }
.user-name { font-weight: 500; }

.row-actions { display: flex; gap: 0.3rem; }
.btn-mini {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--auth-border);
  color: inherit;
  border-radius: 7px;
  cursor: pointer;
  transition: background 140ms, transform 140ms;
}
.btn-mini:hover { background: rgba(255,255,255,0.12); transform: translateY(-1px); }
.btn-mini.danger { color: #f87171; }
.btn-mini.danger:hover { background: rgba(239,68,68,0.12); }
.btn-mini i { width: 14px; height: 14px; }

.user-search-row {
  display: flex; gap: 0.5rem; align-items: center; margin-top: 0.5rem;
}
.user-search-row input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--auth-border);
  border-radius: 8px;
  color: inherit;
  font-family: inherit;
  font-size: 0.88rem;
}
body.light-theme .user-search-row input { color: #1e1b4b; }
.user-search-row input:focus { outline: none; border-color: var(--accent-2); }

/* ───────── Charts ───────── */
.admin-charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 900px) {
  .admin-charts-row { grid-template-columns: 1fr; }
}
.admin-chart-card { display: flex; flex-direction: column; }
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
  margin-top: 0.85rem;
  padding: 0.5rem 0.25rem 0;
  border-bottom: 1px dashed var(--auth-border);
}
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  position: relative;
  height: 100%;
}
.bar-fill {
  width: 100%;
  max-width: 26px;
  min-height: 2px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent-1));
  border-radius: 5px 5px 2px 2px;
  position: relative;
  transition: height 480ms cubic-bezier(0.16, 1, 0.3, 1);
  display: flex; justify-content: center;
}
.bar-fill.today { background: linear-gradient(180deg, var(--accent-3), var(--accent-1)); box-shadow: 0 0 12px rgba(236,72,153,0.4); }
.bar-fill .bar-val {
  position: absolute;
  top: -18px;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.7);
  font-weight: 600;
}
body.light-theme .bar-fill .bar-val { color: rgba(20,22,38,0.7); }
.bar-lbl {
  margin-top: 0.4rem;
  font-size: 0.65rem;
  color: rgba(255,255,255,0.45);
  font-family: "JetBrains Mono", monospace;
}
body.light-theme .bar-lbl { color: rgba(20,22,38,0.5); }

.activity-breakdown { margin-top: 0.85rem; }
.seg-bar {
  display: flex;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.05);
  margin-bottom: 0.9rem;
}
.seg { transition: flex 360ms ease; }
.seg-ok { background: linear-gradient(135deg, #10b981, #34d399); }
.seg-warm { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.seg-warn { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.seg-muted { background: rgba(255,255,255,0.15); }
.seg-legend { display: flex; flex-direction: column; gap: 0.45rem; }
.seg-legend-item {
  display: flex; align-items: center; gap: 0.55rem;
  font-size: 0.82rem;
}
.seg-dot {
  width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0;
}
.seg-lbl { flex: 1; opacity: 0.85; }
.seg-count { font-weight: 600; font-family: "JetBrains Mono", monospace; opacity: 0.9; }

/* ───────── Profile ───────── */
.profile-card {
  width: 100%;
  max-width: 560px;
  background: var(--auth-card);
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius);
  backdrop-filter: blur(24px);
  padding: 2rem;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,0.5);
  animation: cardRise 360ms cubic-bezier(0.16, 1, 0.3, 1);
}
.profile-header {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--auth-border);
  margin-bottom: 1.25rem;
}
.profile-avatar {
  width: 64px !important;
  height: 64px !important;
  font-size: 1.5rem !important;
  box-shadow: 0 14px 30px -10px rgba(139,92,246,0.45);
}
.profile-header h1 {
  margin: 0 0 0.2rem;
  font-family: "Outfit";
  font-size: 1.4rem;
  font-weight: 700;
}
.profile-meta-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}
.profile-section { margin-bottom: 1.5rem; }
.profile-section h3 {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex; align-items: center; gap: 0.5rem;
  color: rgba(255,255,255,0.85);
}
body.light-theme .profile-section h3 { color: rgba(20,22,38,0.85); }
.profile-section h3 i { width: 16px; height: 16px; opacity: 0.7; }
.profile-form-row {
  display: flex;
  gap: 0.5rem;
}
.profile-form-row input {
  flex: 1;
  padding: 0.7rem 0.9rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--auth-border);
  border-radius: 10px;
  color: white;
  font-family: inherit;
  font-size: 0.95rem;
}
body.light-theme .profile-form-row input { color: #1e1b4b; background: rgba(0,0,0,0.03); }
.profile-form-row input:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(99,102,241,0.18); }
.profile-success {
  background: rgba(16,185,129,0.12);
  border: 1px solid rgba(16,185,129,0.3);
  color: #6ee7b7;
  padding: 0.55rem 0.8rem;
  border-radius: 9px;
  font-size: 0.85rem;
  margin-top: 0.65rem;
}
.profile-success.hidden { display: none; }
.profile-section-danger {
  padding-top: 1.25rem;
  border-top: 1px solid var(--auth-border);
}
.profile-section-danger h3 { color: #f87171; }
@media (max-width: 600px) {
  .profile-card { padding: 1.5rem; }
  .profile-form-row { flex-direction: column; }
  .profile-form-row button { width: 100% !important; }
  .profile-avatar { width: 52px !important; height: 52px !important; font-size: 1.25rem !important; }
}

/* ───────── Toast ───────── */
.auth-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translate(-50%, 20px);
  background: rgba(20,22,38,0.95);
  color: white;
  padding: 0.7rem 1.1rem;
  border-radius: 10px;
  font-size: 0.88rem;
  border: 1px solid var(--auth-border);
  box-shadow: 0 14px 30px -10px rgba(0,0,0,0.6);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 260ms cubic-bezier(0.16,1,0.3,1);
}
.auth-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ───────── Mobile polish for main app ───────── */
@media (max-width: 600px) {
  .app-header {
    padding: 0.6rem 0.75rem !important;
    gap: 0.5rem;
  }
  .header-breadcrumb { font-size: 0.78rem; }
  .search-bar-container { max-width: 160px; }
  .search-bar-container input { font-size: 0.82rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 0.6rem !important; }
  .welcome-banner { padding: 1rem !important; }
  .welcome-banner h2 { font-size: 1.2rem !important; }
  .welcome-banner p { font-size: 0.85rem !important; }
  .floating-badge { width: 60px !important; height: 60px !important; }
  .content-card { padding: 1rem !important; }
  .dashboard-split { grid-template-columns: 1fr !important; gap: 1rem !important; }
  .auth-card { padding: 1.5rem; }
  .admin-shell { padding: 0.85rem; }
  .admin-card { padding: 1rem; }
  .gen-form { grid-template-columns: 1fr; }
  .admin-table { font-size: 0.78rem; }
  .admin-table th, .admin-table td { padding: 0.5rem 0.55rem; }
  .user-chip-btn .user-chip-name { display: none; }
}

/* Smoother scrolling everywhere */
html { scroll-behavior: smooth; }
.viewport-section { scroll-behavior: smooth; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
