/* ============================================================
   X Quote Tool — Modern Dashboard UI
   ============================================================ */

:root {
  --bg: #07070a;
  --bg-elevated: #0f0f14;
  --surface: #141419;
  --surface-2: #1c1c24;
  --surface-hover: #22222c;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #f4f4f5;
  --text-muted: #71717a;
  --text-subtle: #52525b;
  --accent: #6366f1;
  --accent-2: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.35);
  --cyan: #22d3ee;
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.1);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.1);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.1);
  --info-bg: rgba(99, 102, 241, 0.1);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.25);
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  --sidebar-w: 248px;
  --bottom-nav-h: 64px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }

/* ---- Background ---- */
.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(ellipse 50% 40% at 100% 0%, rgba(34, 211, 238, 0.08), transparent 50%),
    radial-gradient(ellipse 40% 35% at 0% 100%, rgba(129, 140, 248, 0.1), transparent 50%);
}

/* ---- Auth Screen ---- */
.auth-screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 3rem;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 2.5rem;
}

.auth-copy h1 {
  margin: 0.25rem 0 0;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  background: linear-gradient(135deg, #fff 0%, #c7d2fe 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.auth-lead {
  margin: 1.25rem 0 0;
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 36ch;
  line-height: 1.65;
}

.auth-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.75rem;
}

.auth-highlights span {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, #4f46e5 100%);
  border-radius: 12px;
  box-shadow: 0 8px 24px var(--accent-glow);
  flex-shrink: 0;
}

.brand-icon-lg { width: 52px; height: 52px; font-size: 1.25rem; border-radius: 14px; }
.brand-icon-sm { width: 36px; height: 36px; font-size: 0.95rem; border-radius: 10px; }

.auth-card {
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.auth-card-head h2 {
  margin: 0.75rem 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-card-head p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.auth-lock {
  display: inline-flex;
  padding: 0.3rem 0.65rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
  background: var(--info-bg);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 999px;
}

.auth-error {
  margin: 0;
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: var(--radius-xs);
}

.auth-note {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-subtle);
  text-align: center;
  line-height: 1.5;
}

/* ---- App Shell ---- */
.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.85rem;
  background: rgba(15, 15, 20, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  z-index: 40;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.65rem 1.25rem;
}

.brand-text { min-width: 0; }

.brand-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  padding: 0 0.35rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
  text-align: left;
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.nav-item-active {
  color: #fff;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.22) 0%, rgba(99, 102, 241, 0.08) 100%);
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.25);
}

.nav-icon {
  font-size: 1rem;
  width: 1.25rem;
  text-align: center;
  opacity: 0.85;
}

.sidebar-footer {
  padding: 0.85rem 0.65rem 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0 0.25rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-subtle);
  flex-shrink: 0;
  transition: background 0.2s, box-shadow 0.2s;
}

.status-dot.running {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
  animation: pulse-dot 1.8s ease-in-out infinite;
}

.status-dot-sm { width: 7px; height: 7px; }

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25); }
  50% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.08); }
}

.btn-logout { width: 100%; }

/* ---- Mobile Topbar ---- */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  padding: 0 1rem;
  align-items: center;
  gap: 0.65rem;
  background: rgba(15, 15, 20, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 35;
}

.mobile-title {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.mobile-logout {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.mobile-logout:hover { color: var(--text); border-color: var(--border-strong); }

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  padding: 1.5rem 1.75rem calc(1.5rem + var(--safe-bottom));
}

.page { display: none; }
.page-active { display: block; }

.page-header {
  margin-bottom: 1.25rem;
}

.page-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.page-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.page-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ---- Stat Strip ---- */
.stat-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 4.5rem;
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat-success { color: var(--success); }
.stat-danger { color: var(--danger); }
.stat-warning { color: var(--warning); }

.stat-divider {
  width: 1px;
  height: 2.25rem;
  background: var(--border);
  flex-shrink: 0;
}

.progress-wrap {
  flex: 1;
  min-width: 160px;
  margin-left: auto;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--cyan) 100%);
  border-radius: 999px;
  transition: width 0.4s var(--ease);
}

/* ---- Panels ---- */
.panel {
  padding: 1.15rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.panel-head {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 0.85rem;
}

.panel-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.token-value-cell {
  max-width: 16rem;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.panel-head-buttons {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 340px) 1fr;
  gap: 1rem;
  align-items: start;
}

.config-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.activity-panel {
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

.activity-panel .panel-head { flex-shrink: 0; }

.activity-list {
  flex: 1;
  overflow-y: auto;
  max-height: 420px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-right: 0.25rem;
}

.activity-list::-webkit-scrollbar { width: 5px; }
.activity-list::-webkit-scrollbar-thumb {
  background: var(--surface-2);
  border-radius: 999px;
}

.activity-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  border-left: 3px solid var(--accent);
}

.activity-item.success { border-left-color: var(--success); background: var(--success-bg); }
.activity-item.error { border-left-color: var(--danger); background: var(--danger-bg); }
.activity-item.warn { border-left-color: var(--warning); background: var(--warning-bg); }
.activity-item.info { border-left-color: var(--accent-2); background: var(--info-bg); }

.activity-time {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-subtle);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  padding-top: 0.1rem;
}

.activity-title {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.4;
}

.activity-lines { margin-top: 0.25rem; }

.activity-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.table-panel { padding-bottom: 0.85rem; }

.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  max-width: 640px;
}

/* ---- Forms ---- */
.label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.input,
.textarea,
select.input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:hover,
.textarea:hover,
select.input:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.input:focus,
.textarea:focus,
select.input:focus {
  border-color: rgba(99, 102, 241, 0.55);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.input:disabled,
.textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.mono,
.input.mono,
.textarea.mono {
  font-family: var(--mono);
  font-size: 0.82rem;
}

.hint {
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  color: var(--text-subtle);
  line-height: 1.45;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem;
}

.flex-1 { flex: 1; min-width: 0; }
.mt-sm { margin-top: 0.5rem; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.target-field { width: 100%; }

.toggle-row {
  display: flex;
  gap: 0.35rem;
  padding: 0.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
}

.toggle-pill {
  flex: 1;
  padding: 0.45rem 0.75rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.toggle-pill:hover:not(:disabled) { color: var(--text); }

.toggle-pill-active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.toggle-pill:disabled { opacity: 0.5; cursor: not-allowed; }

.import-box {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.callout {
  padding: 0.85rem 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--info-bg);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-xs);
  line-height: 1.55;
}

.callout strong { color: var(--accent-2); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s, opacity 0.15s;
}

.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, #4f46e5 100%);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.btn-secondary {
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.18);
}

.btn-danger {
  color: #fff;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.btn-block { width: 100%; }

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
}

.btn-icon:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-hover);
}

/* ---- Tables ---- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.data-table th,
.data-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table th {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-elevated);
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background 0.12s;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tr.dragging { opacity: 0.45; }
.data-table tr.drag-over td { background: rgba(99, 102, 241, 0.08); }

.token-drag-handle {
  cursor: grab;
  color: var(--text-subtle);
  user-select: none;
  width: 2rem;
  text-align: center;
}

.token-drag-handle:active { cursor: grabbing; }

.link-accent {
  color: var(--cyan);
  text-decoration: none;
  word-break: break-all;
}

.link-accent:hover { text-decoration: underline; }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  padding: 0.2rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: lowercase;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.badge-danger {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: rgba(248, 113, 113, 0.25);
}

.badge-warning {
  color: var(--warning);
  background: var(--warning-bg);
  border-color: rgba(251, 191, 36, 0.25);
}

/* ---- Empty & Shimmer ---- */
.empty-state {
  margin: 0;
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-subtle);
}

.shimmer-table {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.shimmer-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--surface-2) 0%,
    rgba(255, 255, 255, 0.06) 50%,
    var(--surface-2) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.shimmer-line.title { width: 40%; height: 14px; }
.shimmer-line.text { width: 85%; }
.shimmer-line.short { width: 55%; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- Bottom Nav (Mobile) ---- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(15, 15, 20, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 40;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.35rem 0;
  font-family: inherit;
  font-size: 1.1rem;
  color: var(--text-subtle);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.15s;
}

.bottom-nav-item small {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.bottom-nav-item:hover { color: var(--text-muted); }

.bottom-nav-active {
  color: var(--accent-2);
}

.bottom-nav-active small { color: var(--accent-2); }

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: calc(1.25rem + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  max-width: min(90vw, 420px);
  padding: 0.75rem 1.15rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  animation: toast-in 0.25s var(--ease);
}

.toast.info {
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.15);
}

.toast.error {
  border-color: rgba(248, 113, 113, 0.35);
  box-shadow: 0 8px 32px rgba(248, 113, 113, 0.12);
}

.toast.warning {
  border-color: rgba(251, 191, 36, 0.35);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .auth-screen {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 1.5rem 1.25rem;
    align-content: start;
  }

  .auth-copy { text-align: center; }
  .brand-row { justify-content: center; }
  .auth-lead { max-width: none; margin-left: auto; margin-right: auto; }
  .auth-highlights { justify-content: center; }

  .sidebar { display: none; }

  .mobile-topbar { display: flex; }

  .main-content {
    margin-left: 0;
    padding: calc(56px + 1rem) 1rem calc(var(--bottom-nav-h) + 1rem + var(--safe-bottom));
  }

  .bottom-nav { display: flex; }

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

  .progress-wrap {
    width: 100%;
    margin-left: 0;
    margin-top: 0.25rem;
  }

  .stat-strip {
    padding: 0.85rem 1rem;
  }

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

  .toast {
    bottom: calc(var(--bottom-nav-h) + 1rem + var(--safe-bottom));
  }
}

@media (max-width: 480px) {
  .stat-divider { display: none; }
  .stat-item { min-width: calc(50% - 0.5rem); }
  .form-row .btn { width: 100%; }
}

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

/* ── Debug Gallery ─────────────────────────────── */
.debug-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  padding: 4px;
}
.debug-card {
  background: var(--surface, #1a1a2e);
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.debug-card img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  cursor: zoom-in;
  display: block;
  background: #000;
}
.debug-card-meta {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.debug-card-label {
  font-size: 11px;
  color: var(--text-muted, #888);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.debug-card-del {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--danger, #e53935);
  color: var(--danger, #e53935);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 11px;
  cursor: pointer;
}
.debug-card-del:hover { background: var(--danger, #e53935); color: #fff; }
.debug-lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; cursor: zoom-out;
}
.debug-lightbox img { max-width: 94vw; max-height: 94vh; border-radius: 8px; }
