:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0e14;
  --bg-elevated: #111820;
  --surface: #161d27;
  --surface-hover: #1c2532;
  --surface-active: #222d3d;
  --surface-inset: rgba(0, 0, 0, 0.2);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f0f4f8;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #38bdf8;
  --accent-dim: rgba(56, 189, 248, 0.12);
  --accent-hover: #7dd3fc;
  --accent-glow: rgba(56, 189, 248, 0.25);
  --accent-secondary: #818cf8;
  --success: #34d399;
  --success-dim: rgba(52, 211, 153, 0.12);
  --warning: #fbbf24;
  --warning-dim: rgba(251, 191, 36, 0.12);
  --danger: #f87171;
  --danger-dim: rgba(248, 113, 113, 0.12);
  --danger-border: rgba(248, 113, 113, 0.3);
  --danger-hover-bg: rgba(248, 113, 113, 0.2);
  --overlay: rgba(0, 0, 0, 0.65);
  --row-hover: rgba(255, 255, 255, 0.02);
  --badge-muted-bg: rgba(255, 255, 255, 0.05);
  --card-footer-bg: rgba(0, 0, 0, 0.15);
  --btn-primary-text: #0a0e14;
  --mfa-bg: linear-gradient(135deg, rgba(56, 189, 248, 0.08), rgba(129, 140, 248, 0.06));
  --mfa-border: rgba(56, 189, 248, 0.2);
  --auth-brand-bg:
    radial-gradient(ellipse 80% 60% at 20% 40%, rgba(56, 189, 248, 0.08), transparent),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(52, 211, 153, 0.05), transparent),
    var(--bg-elevated);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.5);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --font: 'DM Sans', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sidebar-width: 260px;
  --header-height: 72px;
  --transition: 150ms ease;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f1f5f9;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --surface-active: #f1f5f9;
  --surface-inset: #f1f5f9;
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #0284c7;
  --accent-dim: rgba(2, 132, 199, 0.1);
  --accent-hover: #0369a1;
  --accent-glow: rgba(2, 132, 199, 0.2);
  --accent-secondary: #6366f1;
  --success: #059669;
  --success-dim: rgba(5, 150, 105, 0.1);
  --warning: #d97706;
  --warning-dim: rgba(217, 119, 6, 0.1);
  --danger: #dc2626;
  --danger-dim: rgba(220, 38, 38, 0.1);
  --danger-border: rgba(220, 38, 38, 0.25);
  --danger-hover-bg: rgba(220, 38, 38, 0.12);
  --overlay: rgba(15, 23, 42, 0.45);
  --row-hover: rgba(15, 23, 42, 0.03);
  --badge-muted-bg: rgba(15, 23, 42, 0.06);
  --card-footer-bg: #f8fafc;
  --btn-primary-text: #ffffff;
  --mfa-bg: linear-gradient(135deg, rgba(2, 132, 199, 0.06), rgba(99, 102, 241, 0.05));
  --mfa-border: rgba(2, 132, 199, 0.22);
  --auth-brand-bg:
    radial-gradient(ellipse 80% 60% at 20% 40%, rgba(2, 132, 199, 0.07), transparent),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(5, 150, 105, 0.05), transparent),
    var(--bg-elevated);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 48px rgba(15, 23, 42, 0.12);
}

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

html { -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  transition: background var(--transition), color var(--transition);
}

.hidden { display: none !important; }

/* ─── Auth screens ─── */
.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem;
}

.auth-panel-brand {
  background: var(--auth-brand-bg);
  border-right: 1px solid var(--border);
}

.auth-panel-brand h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 1.5rem 0 0.75rem;
}

.auth-panel-brand p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 360px;
  line-height: 1.6;
}

.auth-logo {
  width: min(240px, 80%);
  height: auto;
}

.auth-panel-form {
  background: var(--bg);
  align-items: center;
  position: relative;
}

.auth-theme-toggle {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.text-muted { color: var(--text-muted); margin-bottom: 1.75rem; }

/* ─── App shell ─── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  height: 28px;
  width: auto;
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

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

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

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 2rem 0;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.content-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s infinite;
}

.sync-pill.publishing .sync-dot {
  background: var(--warning);
  box-shadow: 0 0 8px var(--warning);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.theme-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-strong);
}

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

.view-root {
  flex: 1;
  padding: 1.5rem 2rem 2rem;
  max-width: 1280px;
}

/* ─── Typography & layout helpers ─── */
h2.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack-sm { display: flex; flex-direction: column; gap: 0.5rem; }
.row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* ─── Cards & panels ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-padded { padding: 1.25rem 1.5rem; }

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.card-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.card-body { padding: 1.25rem 1.5rem; }

.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--card-footer-bg);
}

/* ─── Stats ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  transition: border-color var(--transition);
}

.stat-card:hover { border-color: var(--border-strong); }

.stat-card .stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
  background: var(--accent-dim);
  color: var(--accent);
}

.stat-card .stat-icon.success { background: var(--success-dim); color: var(--success); }
.stat-card .stat-icon.warning { background: var(--warning-dim); color: var(--warning); }

.stat-card .value {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat-card .label {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

/* ─── MFA code display ─── */
.mfa-card {
  background: var(--mfa-bg);
  border: 1px solid var(--mfa-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.mfa-code {
  font-family: var(--mono);
  font-size: 2.5rem;
  font-weight: 500;
  letter-spacing: 0.35em;
  color: var(--accent);
  margin: 0.75rem 0;
  text-align: center;
}

.mfa-timer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.mfa-progress-track {
  height: 3px;
  background: var(--border);
  border-radius: 999px;
  margin-top: 0.75rem;
  overflow: hidden;
}

.mfa-progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width 1s linear;
}

.mfa-timer strong { color: var(--warning); }

/* ─── App download ─── */
.app-download-card { margin-bottom: 1.5rem; }

.app-download-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.app-download-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-download-unavailable code {
  font-family: var(--mono);
  font-size: 0.8rem;
  background: var(--surface-inset);
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-sm);
}

.app-download-login {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* ─── Forms ─── */
.field { display: block; }

.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

input, select, textarea {
  display: block;
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

input::placeholder { color: var(--text-muted); }

textarea {
  min-height: 120px;
  font-family: var(--mono);
  font-size: 0.8rem;
  resize: vertical;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-hover);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), transform 80ms ease;
}

.btn:hover { border-color: var(--border-strong); background: var(--surface-active); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--btn-primary-text);
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-danger {
  background: var(--danger-dim);
  border-color: var(--danger-border);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-hover-bg);
  border-color: var(--danger);
}

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

.btn-ghost:hover {
  background: var(--surface);
  color: var(--text);
}

.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; }
.btn-block { width: 100%; }

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}

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

.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

label.btn {
  cursor: pointer;
}

label.btn input[type="file"] { display: none; }

/* ─── Tables ─── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

th {
  background: var(--surface-inset);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--row-hover); }

td.actions {
  white-space: nowrap;
}

td.actions .btn-group { justify-content: flex-end; }

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--surface-active);
  color: var(--text-secondary);
}

.badge-success { background: var(--success-dim); color: var(--success); }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-danger { background: var(--danger-dim); color: var(--danger); }
.badge-muted { background: var(--badge-muted-bg); color: var(--text-muted); font-weight: 500; text-transform: none; letter-spacing: 0; }

/* ─── Empty & loading states ─── */
.empty-state {
  text-align: center;
  padding: 3.5rem 2rem;
  color: var(--text-muted);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.empty-state p { font-size: 0.875rem; max-width: 320px; margin: 0 auto; }

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  gap: 1rem;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Drag & drop ─── */
.dnd-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.dnd-column h3 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.dnd-list {
  min-height: 240px;
  background: var(--bg);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 0.5rem;
}

.dnd-list.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.dnd-item {
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: grab;
  font-size: 0.875rem;
  transition: border-color var(--transition);
}

.dnd-item:hover { border-color: var(--border-strong); }
.dnd-item.dragging { opacity: 0.45; }
.dnd-item:last-child { margin-bottom: 0; }

/* ─── Code preview ─── */
.apdu-preview {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  max-height: 360px;
  overflow: auto;
  color: var(--text-secondary);
}

/* ─── Invite token box ─── */
.token-box {
  margin-top: 1.25rem;
  padding: 1.25rem;
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 0 24px var(--accent-glow);
}

.token-value {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--accent);
  word-break: break-all;
  margin: 0.5rem 0;
  user-select: all;
}

/* ─── Back link ─── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  padding: 0;
  margin-bottom: 1rem;
  transition: color var(--transition);
}

.back-link:hover { color: var(--accent); }

/* ─── Transaction cards ─── */
.tx-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.tx-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.tx-card-title { font-weight: 600; }
.tx-card-meta { font-size: 0.8rem; color: var(--text-muted); }

/* ─── Modal ─── */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(4px);
}

.modal {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: modalIn 0.2s ease;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 1rem; font-weight: 600; }

.modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ─── Toasts ─── */
#toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  padding: 0.75rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.875rem;
  animation: toastIn 0.25s ease;
  pointer-events: auto;
  max-width: 360px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ─── Tabs ─── */
.tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  width: fit-content;
  margin-bottom: 1.25rem;
}

.tabs button {
  padding: 0.45rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.tabs button.active, .tabs button:hover {
  background: var(--surface);
  color: var(--text);
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-panel-brand { display: none; }
  .auth-panel-form { padding: 2rem 1.5rem; }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 0.5rem;
  }

  .nav-item { white-space: nowrap; }

  .sidebar-footer { display: none; }

  .app-main { margin-left: 0; }

  .content-header, .view-root { padding-left: 1rem; padding-right: 1rem; }

  .dnd-container { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .mfa-code { font-size: 1.75rem; letter-spacing: 0.2em; }
}
