/* ─── Ferri Auth — Modern, Clean Design ─────────────────────────────── */

:root {
  color-scheme: dark;
  --bg: #0c0c12;
  --bg-soft: #111118;
  --card-bg: #191923;
  --card-border: rgba(255, 255, 255, 0.07);
  --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --text: #eeeef4;
  --text-secondary: #8888a2;
  --text-tertiary: #5e5e74;
  --accent: #4a72ff;
  --accent-hover: #5f83ff;
  --accent-subtle: rgba(74, 114, 255, 0.1);
  --danger: #f04444;
  --danger-subtle: rgba(240, 68, 68, 0.1);
  --success: #34d399;
  --success-subtle: rgba(52, 211, 153, 0.1);
  --input-bg: rgba(255, 255, 255, 0.04);
  --input-border: rgba(255, 255, 255, 0.08);
  --input-border-focus: rgba(255, 255, 255, 0.18);
  --focus-ring: rgba(74, 114, 255, 0.3);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --transition: 180ms ease;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f2f6;
  --bg-soft: #eaeaef;
  --card-bg: #ffffff;
  --card-border: rgba(0, 0, 0, 0.07);
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
  --text: #181820;
  --text-secondary: #6b6b82;
  --text-tertiary: #9898ae;
  --accent: #4a72ff;
  --accent-hover: #3b5ee8;
  --accent-subtle: rgba(74, 114, 255, 0.08);
  --danger: #dc2626;
  --success: #059669;
  --input-bg: rgba(0, 0, 0, 0.02);
  --input-border: rgba(0, 0, 0, 0.09);
  --input-border-focus: rgba(0, 0, 0, 0.18);
  --focus-ring: rgba(74, 114, 255, 0.2);
}

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

[hidden] { display: none !important; }

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

/* ─── Centered Auth Layout ───────────────────────────────────────── */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  padding: 24px;
  margin: 0 auto;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 40px 36px 36px;
  box-shadow: var(--card-shadow);
}

.auth-card.wide {
  max-width: 600px;
}

.auth-logo {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 1.25rem;
  margin-bottom: 24px;
  user-select: none;
}

.auth-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  line-height: 1.3;
}

.auth-card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  line-height: 1.3;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0 0 24px;
}

.auth-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--card-border);
  text-align: center;
}

.auth-footer p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.auth-footer a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* ─── Eyebrow ──────────────────────────────────────────────────────── */

.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: 0 0 4px;
}

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

form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

label {
  display: block;
}

label span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

input::placeholder, textarea::placeholder {
  color: var(--text-tertiary);
}

input:hover, select:hover, textarea:hover {
  border-color: var(--input-border-focus);
}

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

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

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238888a2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0;
  cursor: pointer;
}

.check-row input {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.check-row span {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-secondary);
  cursor: pointer;
}

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

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  color: white;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  text-decoration: none;
  line-height: 1.3;
}

.primary-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.primary-btn:active {
  transform: translateY(0);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  line-height: 1.3;
  white-space: nowrap;
}

.ghost-btn:hover {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: transparent;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  line-height: 1.3;
  white-space: nowrap;
}

.theme-toggle:hover {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: transparent;
}

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

.alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--danger-subtle);
  color: var(--danger);
  border: 1px solid rgba(240, 68, 68, 0.15);
  border-radius: var(--radius);
  margin-bottom: 4px;
}

.alert[data-type="success"] {
  background: var(--success-subtle);
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.15);
}

.success-card {
  padding: 20px;
  background: var(--success-subtle);
  border: 1px solid rgba(52, 211, 153, 0.15);
  border-radius: var(--radius-lg);
  margin-bottom: 4px;
}

.success-card h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
  color: var(--success);
}

.success-card p {
  margin: 0 0 16px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ─── Admin Dashboard ───────────────────────────────────────────────── */

.admin-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 32px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto 24px;
  padding: 20px 24px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--card-shadow);
}

.admin-header h1 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

.admin-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.admin-card {
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--card-shadow);
}

.table-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.table-heading h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
}

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

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--card-border);
  font-size: 0.9rem;
}

th {
  color: var(--text-tertiary);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom-width: 2px;
}

tr:last-child td {
  border-bottom: none;
}

.user-cell {
  display: flex;
  gap: 12px;
  align-items: center;
}

.user-cell strong {
  font-weight: 600;
}

.user-cell small {
  display: block;
  color: var(--text-tertiary);
  font-size: 0.82rem;
  margin-top: 2px;
}

.avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  font-size: 0.82rem;
  font-weight: 700;
}

.status-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--card-border);
  background: transparent;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  color: var(--text-secondary);
}

.status-pill:hover {
  background: var(--accent-subtle);
}

.status-pill.active {
  color: var(--success);
}

.status-pill.disabled {
  color: var(--danger);
}

.admin-card select {
  width: auto;
  min-width: 120px;
  font-size: 0.85rem;
  padding: 8px 32px 8px 12px;
}

/* ─── Settings Page ─────────────────────────────────────────────────── */

.settings-shell {
  width: min(960px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.settings-header .glass-panel {
  padding: 20px 24px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  min-height: auto;
}

.settings-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
  margin-top: 24px;
}

.settings-sidebar {
  position: sticky;
  top: 32px;
  padding: 8px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--card-shadow);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 2px;
}

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

.nav-item.active {
  color: var(--accent);
  background: var(--accent-subtle);
  font-weight: 600;
}

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

.settings-section {
  display: none;
}

.settings-section.active {
  display: block;
  animation: fadeIn 200ms ease both;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.settings-section > .glass-panel {
  padding: 24px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--card-shadow);
}

.settings-section h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.settings-section > .glass-panel > .muted {
  margin-bottom: 20px;
}

/* ─── Settings: Profile ─────────────────────────────────────────────── */

.profile-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.avatar-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

.avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-initials {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  font-size: 1.5rem;
}

.avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 200ms;
  cursor: pointer;
  color: white;
  font-size: 0.78rem;
  font-weight: 600;
}

.avatar-wrap:hover .avatar-overlay {
  opacity: 1;
}

.avatar-file-input {
  display: none;
}

/* ─── Settings: Appearance ──────────────────────────────────────────── */

.color-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}

.color-swatch:hover {
  transform: scale(1.12);
}

.color-swatch.selected {
  border-color: var(--text);
  transform: scale(1.08);
}

.accent-preview {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  background: var(--input-bg);
}

.accent-preview .primary-btn {
  width: auto;
  padding: 10px 20px;
}

/* ─── Settings: Security ────────────────────────────────────────────── */

.security-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
}

.security-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
}

.security-row strong {
  font-weight: 600;
  font-size: 0.95rem;
}

/* ─── Save Bar ──────────────────────────────────────────────────────── */

.save-bar {
  position: sticky;
  bottom: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  margin-top: 16px;
}

.save-bar .primary-btn {
  width: auto;
  padding: 10px 24px;
}

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

.utility-links {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.form-note {
  margin: 16px 0 0;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  text-align: center;
  line-height: 1.5;
}

.switch-line {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--card-border);
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.switch-line a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.switch-line a:hover {
  text-decoration: underline;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ─── button-group ─────────────────────────────────────────────────── */

.button-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ─── Tailnet / invite styles ───────────────────────────────────────── */

.tailnet-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.tailnet-btn.loading {
  pointer-events: none;
  opacity: 0.6;
}

.shield-icon {
  font-size: 2.5rem;
  text-align: center;
  display: block;
  margin-bottom: 16px;
}

/* ─── Glass panel compat ────────────────────────────────────────────── */

.glass-panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--card-shadow);
}

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

@media (max-width: 720px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .settings-sidebar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 6px;
    position: static;
  }
  .nav-item {
    white-space: nowrap;
    flex-shrink: 0;
  }
  .save-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .save-bar .primary-btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .auth-card {
    padding: 28px 24px;
  }
  .admin-page {
    padding: 16px;
  }
  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 20px;
  }
  .admin-actions {
    width: 100%;
  }
  .admin-actions > * {
    flex: 1;
    justify-content: center;
  }
  .admin-card {
    padding: 16px;
  }
  .settings-shell {
    width: calc(100vw - 20px);
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 24px 20px;
    border-radius: var(--radius-lg);
  }
}

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

/* ─── Accessibility ────────────────────────────────────────────────── */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button, a, input, select, textarea, [role="button"] {
  -webkit-tap-highlight-color: transparent;
}

img, svg, canvas, video {
  max-width: 100%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ─── Ferri Account Hub ─────────────────────────────────────────────── */

.account-page {
  --account-ink: #f6f5fb;
  --account-muted: #9694a5;
  --account-soft: #696879;
  --account-line: rgba(255, 255, 255, .09);
  --account-panel: rgba(25, 25, 34, .76);
  --account-panel-solid: #1a1a24;
  --account-glow: rgba(124, 92, 255, .18);
  overflow-x: hidden;
  background:
    radial-gradient(800px 430px at 76% -8%, rgba(110, 84, 235, .16), transparent 65%),
    radial-gradient(500px 350px at -4% 24%, rgba(49, 120, 222, .1), transparent 72%),
    #101116;
}

[data-theme="light"] .account-page {
  --account-ink: #22212b;
  --account-muted: #777587;
  --account-soft: #9996a5;
  --account-line: rgba(27, 24, 45, .1);
  --account-panel: rgba(255, 255, 255, .8);
  --account-panel-solid: #fff;
  --account-glow: rgba(92, 73, 208, .11);
  background:
    radial-gradient(800px 430px at 76% -8%, rgba(117, 93, 225, .14), transparent 65%),
    radial-gradient(500px 350px at -4% 24%, rgba(66, 140, 229, .09), transparent 72%),
    #f6f5fa;
}

.account-shell { width: min(1120px, calc(100% - 48px)); margin: 0 auto; padding: 28px 0 56px; }

.account-topbar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.ferri-mark { display: inline-flex; align-items: center; gap: 9px; color: var(--account-ink); font-size: 1.08rem; font-weight: 740; letter-spacing: -.045em; text-decoration: none; }
.ferri-mark:hover { color: var(--account-ink); text-decoration: none; }
.ferri-mark-symbol { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; background: linear-gradient(145deg, #9783ff, #6950e9); box-shadow: 0 6px 18px rgba(105, 80, 233, .35); color: white; font-family: Georgia, serif; font-size: 1.12rem; font-style: italic; line-height: 1; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; color: var(--account-muted); background: transparent; border: 1px solid var(--account-line); border-radius: 10px; cursor: pointer; transition: color .2s ease, border-color .2s ease, background .2s ease, transform .2s ease; }
.icon-button:hover { color: var(--account-ink); background: var(--account-panel); border-color: rgba(124, 92, 255, .45); transform: translateY(-1px); }
.icon-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.subtle-link { color: var(--account-muted); font-size: .82rem; font-weight: 560; text-decoration: none; transition: color .2s ease; }
.subtle-link:hover { color: var(--account-ink); text-decoration: none; }
.subtle-link span { font-size: 1rem; margin-left: 2px; }

.account-hero { padding: 76px 0 52px 282px; }
.account-kicker { margin: 0 0 11px; color: var(--accent); font-size: .69rem; font-weight: 750; letter-spacing: .115em; text-transform: uppercase; }
.account-hero h1 { max-width: 520px; margin: 0; color: var(--account-ink); font-size: clamp(2rem, 4.1vw, 3.45rem); font-weight: 680; letter-spacing: -.06em; line-height: 1.04; }
.account-hero > p:last-child { max-width: 390px; margin: 18px 0 0; color: var(--account-muted); font-size: 1rem; }

.account-layout { display: grid; grid-template-columns: 238px minmax(0, 1fr); gap: 44px; align-items: start; }
.account-sidebar { position: sticky; top: 24px; overflow: hidden; background: var(--account-panel); border: 1px solid var(--account-line); border-radius: 18px; box-shadow: 0 16px 50px rgba(0, 0, 0, .12); backdrop-filter: blur(18px); }
.account-user-summary { display: flex; align-items: center; gap: 11px; padding: 17px 16px 16px; border-bottom: 1px solid var(--account-line); }
.summary-avatar { display: grid; place-items: center; position: relative; width: 33px; height: 33px; overflow: hidden; flex: 0 0 33px; color: #fff; background: linear-gradient(140deg, var(--accent), #9c7dff); border-radius: 10px; font-size: .73rem; font-weight: 700; }
.summary-avatar img { width: 100%; height: 100%; object-fit: cover; }
.summary-copy { display: flex; min-width: 0; flex-direction: column; gap: 1px; }
.summary-copy strong { overflow: hidden; color: var(--account-ink); font-size: .8rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.summary-copy span { overflow: hidden; color: var(--account-soft); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.account-nav { display: flex; flex-direction: column; gap: 3px; padding: 9px; }
.account-nav-item { display: flex; align-items: center; width: 100%; gap: 10px; padding: 10px 11px; color: var(--account-muted); background: transparent; border: 0; border-radius: 10px; cursor: pointer; font: inherit; font-size: .84rem; font-weight: 570; text-align: left; text-decoration: none; transition: color .18s ease, background .18s ease, transform .18s ease; }
.account-nav-item:hover { color: var(--account-ink); background: rgba(255, 255, 255, .05); text-decoration: none; }
.account-nav-item.active { color: var(--account-ink); background: var(--accent-subtle); }
.account-nav-item svg, .sidebar-logout svg { width: 17px; height: 17px; flex: 0 0 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.65; }
.account-nav-item.active svg { color: var(--accent); }
.nav-soon { margin-left: auto; padding: 2px 6px; color: var(--account-soft); background: rgba(255, 255, 255, .055); border-radius: 5px; font-size: .59rem; font-weight: 700; letter-spacing: .045em; text-transform: uppercase; }
.sidebar-footer { padding: 9px; border-top: 1px solid var(--account-line); }
.sidebar-logout { display: flex; align-items: center; width: 100%; gap: 10px; padding: 10px 11px; color: var(--account-muted); background: transparent; border: 0; border-radius: 10px; cursor: pointer; font: inherit; font-size: .83rem; font-weight: 570; text-align: left; transition: background .18s ease, color .18s ease; }
.sidebar-logout:hover { color: #ef7777; background: rgba(230, 85, 85, .08); }

.account-content { min-width: 0; }
.account-section { display: none; }
.account-section.active { display: block; animation: account-panel-in .38s cubic-bezier(.22, 1, .36, 1) both; }
/* The hash targets keep account navigation usable before the script finishes loading. */
.account-section:target { display: block; animation: account-panel-in .38s cubic-bezier(.22, 1, .36, 1) both; }
body:has(.account-section:target) .account-section.active { display: none; }
body:has(.account-section:target) .account-section:target { display: block; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; margin: 3px 0 26px; }
.section-heading h2 { margin: 0; color: var(--account-ink); font-size: 1.65rem; font-weight: 660; letter-spacing: -.043em; line-height: 1.12; }
.section-heading > div > p:last-child { margin: 8px 0 0; color: var(--account-muted); font-size: .91rem; }
.account-card, .plan-current-card, .plan-teaser { background: var(--account-panel); border: 1px solid var(--account-line); border-radius: 18px; box-shadow: 0 12px 38px rgba(0, 0, 0, .08); backdrop-filter: blur(18px); }
.account-card { padding: 25px; }
.identity-card { margin-bottom: 16px; padding: 20px 25px; }
.avatar-editor { display: flex; align-items: center; gap: 17px; }
.profile-avatar { position: relative; width: 62px; height: 62px; padding: 0; overflow: hidden; flex: 0 0 62px; color: #fff; background: linear-gradient(140deg, var(--accent), #9c7dff); border: 0; border-radius: 18px; cursor: pointer; }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-initials { display: grid; width: 100%; height: 100%; place-items: center; font-size: 1.28rem; font-weight: 720; }
.avatar-edit-icon { display: grid; position: absolute; right: 4px; bottom: 4px; width: 21px; height: 21px; place-items: center; color: #fff; background: #22212e; border: 2px solid var(--account-panel-solid); border-radius: 7px; opacity: 0; transform: scale(.75); transition: opacity .2s ease, transform .2s ease; }
.profile-avatar:hover .avatar-edit-icon, .profile-avatar:focus-visible .avatar-edit-icon { opacity: 1; transform: scale(1); }
.avatar-edit-icon svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.avatar-editor strong, .card-intro h3, .preference-row h3, .color-choice h3, .session-card h3, .plan-current-card h3, .plan-teaser h3 { display: block; margin: 0; color: var(--account-ink); font-size: .95rem; font-weight: 660; letter-spacing: -.018em; }
.avatar-editor p, .card-intro p, .preference-row p, .color-choice p, .session-card p, .plan-current-card p, .plan-teaser p { margin: 4px 0 0; color: var(--account-muted); font-size: .78rem; line-height: 1.55; }
.text-action { margin: 8px 0 0; padding: 0; color: var(--accent); background: none; border: 0; cursor: pointer; font: inherit; font-size: .76rem; font-weight: 650; transition: color .2s ease, transform .2s ease; }
.text-action:hover { color: var(--accent-hover); transform: translateX(2px); }
.avatar-file-input { display: none; }
.card-intro { margin-bottom: 21px; }
.account-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 19px 18px; }
.account-form label { min-width: 0; }
.account-form label > span { margin: 0 0 7px; color: var(--account-muted); font-size: .75rem; font-weight: 620; }
.account-form label > span em { margin-left: 5px; color: var(--account-soft); font-size: .67rem; font-style: normal; font-weight: 500; }
.account-form input, .account-form textarea, .select-label select { border-color: var(--account-line); background: rgba(255, 255, 255, .035); border-radius: 10px; color: var(--account-ink); font-size: .86rem; transition: border-color .2s ease, box-shadow .2s ease, background .2s ease; }
[data-theme="light"] .account-form input, [data-theme="light"] .account-form textarea, [data-theme="light"] .select-label select { background: rgba(22, 20, 39, .025); }
.account-form input { height: 42px; padding: 10px 12px; }
.account-form textarea { padding: 10px 12px; min-height: 86px; }
.account-form small { display: block; margin-top: 6px; color: var(--account-soft); font-size: .67rem; line-height: 1.35; }
.form-span-full { grid-column: 1 / -1; }
.input-prefix { display: flex; align-items: center; height: 42px; overflow: hidden; margin: 0 !important; border: 1px solid var(--account-line); border-radius: 10px; background: rgba(255, 255, 255, .035); transition: border-color .2s ease, box-shadow .2s ease; }
.input-prefix:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.input-prefix i { padding-left: 12px; color: var(--account-soft); font-size: .86rem; font-style: normal; }
.input-prefix input { height: 40px; padding-left: 4px; background: transparent; border: 0; box-shadow: none !important; }
.account-form input:focus, .account-form textarea:focus, .select-label select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.account-save-bar { position: sticky; z-index: 3; bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 17px; padding: 10px 11px 10px 16px; color: var(--account-muted); background: rgba(31, 30, 42, .92); border: 1px solid rgba(255, 255, 255, .13); border-radius: 13px; box-shadow: 0 12px 36px rgba(0, 0, 0, .25); font-size: .76rem; opacity: 0; transform: translateY(9px); transition: opacity .18s ease, transform .18s ease; backdrop-filter: blur(18px); }
[data-theme="light"] .account-save-bar { background: rgba(255, 255, 255, .92); border-color: rgba(30, 28, 45, .12); }
.account-save-bar.is-visible { opacity: 1; transform: none; }
.account-save-bar .primary-btn { width: auto; padding: 8px 14px; border-radius: 8px; font-size: .76rem; }

.appearance-card { padding: 0; overflow: hidden; }
.preference-row, .color-choice { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 25px; }
.preference-divider { height: 1px; margin: 0 25px; background: var(--account-line); }
.select-label select { width: 126px; padding: 9px 32px 9px 12px; }
.color-grid { display: flex; gap: 9px; flex-wrap: nowrap; }
.color-swatch { width: 26px; height: 26px; padding: 0; background: var(--swatch); border: 2px solid transparent; border-radius: 50%; box-shadow: 0 0 0 1px rgba(255, 255, 255, .12); cursor: pointer; transition: transform .2s ease, box-shadow .2s ease; }
.color-swatch:hover { transform: scale(1.13); }
.color-swatch.selected { border-color: var(--account-panel-solid); box-shadow: 0 0 0 2px var(--swatch); transform: scale(1.06); }
.mini-preview { display: flex; align-items: center; gap: 8px; padding: 16px 25px; color: var(--account-soft); background: rgba(255, 255, 255, .025); font-size: .7rem; }
.preview-dot { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 10px var(--accent); }
.mini-preview button { margin-left: auto; padding: 5px 10px; color: #fff; background: var(--accent); border: 0; border-radius: 6px; font: inherit; font-size: .68rem; opacity: 1; }

.security-panel { margin-bottom: 16px; }
.form-spacer { display: block; }
.password-form { row-gap: 18px; }
.password-submit { width: auto; justify-self: start; padding: 10px 17px; font-size: .8rem; }
.session-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; }
.session-icon, .modal-icon { display: grid; width: 36px; height: 36px; place-items: center; color: var(--danger); background: rgba(239, 99, 99, .1); border-radius: 11px; }
.session-icon svg, .modal-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.danger-button { display: inline-flex; align-items: center; justify-content: center; min-height: 35px; padding: 8px 12px; color: #ff9a9a; background: rgba(236, 91, 91, .09); border: 1px solid rgba(236, 91, 91, .18); border-radius: 9px; cursor: pointer; font: inherit; font-size: .75rem; font-weight: 650; white-space: nowrap; transition: color .2s ease, background .2s ease, transform .2s ease; }
.danger-button:hover { color: #fff; background: #d95656; border-color: #d95656; transform: translateY(-1px); }

.plan-current-card { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 26px 27px; margin-bottom: 16px; }
.plan-label { display: block; margin-bottom: 8px; color: var(--account-soft); font-size: .66rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.plan-status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; color: #63c795; background: rgba(72, 194, 135, .1); border-radius: 999px; font-size: .68rem; font-weight: 650; }
.plan-status span { width: 5px; height: 5px; background: currentColor; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.plan-teaser { display: grid; grid-template-columns: 176px 1fr; min-height: 272px; overflow: hidden; }
.plan-teaser-orb { position: relative; background: radial-gradient(circle at 50% 45%, rgba(155, 132, 255, .85), rgba(93, 74, 190, .2) 36%, transparent 67%); }
.plan-teaser-orb::before, .plan-teaser-orb::after { position: absolute; border: 1px solid rgba(190, 179, 255, .25); border-radius: 50%; content: ""; }
.plan-teaser-orb::before { width: 118px; height: 118px; top: calc(50% - 59px); left: calc(50% - 59px); }
.plan-teaser-orb::after { width: 178px; height: 178px; top: calc(50% - 89px); left: calc(50% - 89px); border-color: rgba(190, 179, 255, .1); }
.plan-teaser-copy { align-self: center; padding: 36px 38px 36px 14px; }
.plan-teaser h3 { max-width: 330px; font-size: 1.3rem; letter-spacing: -.04em; }
.plan-teaser p { max-width: 410px; margin-top: 10px; font-size: .83rem; }
.interest-button { width: auto; margin-top: 22px; padding: 9px 13px; border-radius: 8px; font-size: .76rem; }

.account-modal { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 20px; }
.modal-scrim { position: absolute; inset: 0; background: rgba(8, 8, 14, .68); opacity: 0; transition: opacity .18s ease; backdrop-filter: blur(5px); }
.modal-card { position: relative; width: min(100%, 390px); padding: 28px; background: var(--account-panel-solid); border: 1px solid var(--account-line); border-radius: 19px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); opacity: 0; transform: translateY(12px) scale(.98); transition: opacity .2s ease, transform .2s cubic-bezier(.22, 1, .36, 1); }
.account-modal.is-open .modal-scrim, .account-modal.is-open .modal-card { opacity: 1; }
.account-modal.is-open .modal-card { transform: none; }
.modal-close { position: absolute; top: 12px; right: 12px; display: grid; width: 28px; height: 28px; place-items: center; padding: 0; color: var(--account-muted); background: transparent; border: 0; border-radius: 7px; cursor: pointer; font-size: 1.3rem; line-height: 1; transition: background .18s ease, color .18s ease; }
.modal-close:hover { color: var(--account-ink); background: rgba(255, 255, 255, .07); }
.modal-card h2 { margin: 15px 0 0; color: var(--account-ink); font-size: 1.23rem; letter-spacing: -.035em; }
.modal-card p { margin: 8px 0 0; color: var(--account-muted); font-size: .84rem; line-height: 1.55; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 23px; }
.modal-actions .ghost-btn { padding: 8px 12px; color: var(--account-muted); font-size: .76rem; }
.toast { position: fixed; z-index: 30; right: 24px; bottom: 24px; max-width: min(320px, calc(100vw - 48px)); padding: 11px 14px; color: var(--account-ink); background: var(--account-panel-solid); border: 1px solid var(--account-line); border-radius: 10px; box-shadow: 0 14px 38px rgba(0, 0, 0, .26); font-size: .78rem; font-weight: 570; opacity: 0; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease; }
.toast.visible { opacity: 1; transform: none; }

@keyframes account-panel-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes account-reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.account-reveal { animation: account-reveal .55s cubic-bezier(.22, 1, .36, 1) both; }
.account-hero.account-reveal { animation-delay: .05s; }
.account-sidebar.account-reveal { animation-delay: .11s; }

@media (max-width: 820px) {
  .account-hero { padding-left: 0; }
  .account-layout { grid-template-columns: 190px minmax(0, 1fr); gap: 24px; }
  .account-sidebar { border-radius: 15px; }
  .account-user-summary { padding-inline: 12px; }
  .account-nav { padding: 7px; }
  .account-nav-item { padding-inline: 8px; }
  .identity-card, .account-card { padding: 21px; }
  .preference-row, .color-choice { padding-inline: 21px; }
  .mini-preview { padding-inline: 21px; }
}

@media (max-width: 640px) {
  .account-shell { width: min(100% - 28px, 540px); padding-top: 18px; }
  .subtle-link { display: none; }
  .account-hero { padding: 53px 0 32px; }
  .account-hero h1 { font-size: 2.35rem; }
  .account-layout { display: block; }
  .account-sidebar { position: static; display: block; overflow: visible; margin-bottom: 32px; background: transparent; border: 0; box-shadow: none; backdrop-filter: none; }
  .account-user-summary, .sidebar-footer { display: none; }
  .account-nav { display: flex; flex-direction: row; gap: 5px; overflow-x: auto; padding: 0 0 3px; scrollbar-width: none; }
  .account-nav::-webkit-scrollbar { display: none; }
  .account-nav-item { width: auto; flex: 0 0 auto; padding: 9px 11px; background: var(--account-panel); border: 1px solid var(--account-line); }
  .account-nav-item.active { border-color: rgba(124, 92, 255, .35); }
  .account-nav-item span:not(.nav-soon) { font-size: .78rem; }
  .nav-soon { display: none; }
  .section-heading { margin-bottom: 20px; }
  .account-form { grid-template-columns: 1fr; gap: 17px; }
  .form-spacer { display: none; }
  .form-span-full { grid-column: auto; }
  .session-card { grid-template-columns: auto 1fr; }
  .session-card .danger-button { grid-column: 1 / -1; width: 100%; margin-top: 3px; }
  .plan-teaser { grid-template-columns: 1fr; }
  .plan-teaser-orb { height: 104px; }
  .plan-teaser-copy { padding: 29px 25px 27px; }
}

@media (max-width: 420px) {
  .account-card, .identity-card { padding: 19px; }
  .avatar-editor { align-items: flex-start; gap: 13px; }
  .profile-avatar { width: 54px; height: 54px; flex-basis: 54px; border-radius: 15px; }
  .preference-row, .color-choice { align-items: flex-start; flex-direction: column; gap: 14px; padding: 20px 19px; }
  .preference-divider { margin-inline: 19px; }
  .mini-preview { padding-inline: 19px; }
  .color-grid { gap: 10px; }
  .account-save-bar { align-items: stretch; flex-direction: column; }
  .account-save-bar .primary-btn { width: 100%; }
  .plan-current-card { align-items: flex-start; flex-direction: column; padding: 21px; }
}

/* --- Two-factor authentication (security-20260716) ------------------------ */
.twofa-status-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.twofa-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 700;
  background: var(--account-soft, rgba(255,255,255,0.06));
  border: 1px solid var(--card-border);
  color: var(--account-muted, inherit);
}
.twofa-pill.enabled { background: rgba(24,167,121,0.13); border-color: rgba(24,167,121,0.35); color: var(--success, #18a779); }
.twofa-note { font-size: 0.82rem; color: var(--account-muted, inherit); opacity: 0.85; }
.twofa-toggle { margin-left: auto; }
.twofa-setup { margin-top: 18px; }
.twofa-setup-grid { display: grid; grid-template-columns: 190px 1fr; gap: 20px; align-items: start; }
.twofa-qr-box {
  background: #fff; border-radius: var(--radius-lg, 14px); padding: 10px;
  border: 1px solid var(--card-border); width: 190px; height: 190px;
  display: flex; align-items: center; justify-content: center;
}
.twofa-qr-box img { width: 100%; height: 100%; display: block; }
.twofa-setup-steps { display: flex; flex-direction: column; gap: 9px; font-size: 0.88rem; }
.twofa-setup-steps p { margin: 0; color: var(--account-muted, inherit); }
.twofa-secret {
  display: block; padding: 9px 12px; border-radius: 10px;
  background: var(--account-soft, rgba(255,255,255,0.05)); border: 1px dashed var(--card-border);
  font-size: 0.82rem; letter-spacing: 0.08em; word-break: break-all; user-select: all;
}
.twofa-verify-form { display: flex; gap: 10px; flex-wrap: wrap; }
.twofa-verify-form input {
  flex: 0 1 150px; padding: 10px 13px; border-radius: 11px;
  border: 1px solid var(--card-border); background: transparent; color: inherit;
  font-size: 1rem; letter-spacing: 0.2em;
}
.twofa-backup { margin-top: 18px; padding: 16px; border-radius: var(--radius-lg, 14px); border: 1px solid rgba(24,167,121,0.35); background: rgba(24,167,121,0.07); }
.twofa-backup h4 { margin: 0 0 6px; }
.twofa-backup p { margin: 0 0 12px; font-size: 0.85rem; color: var(--account-muted, inherit); }
.backup-code-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.backup-code-list li { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88rem; padding: 7px 10px; border-radius: 9px; background: var(--account-soft, rgba(255,255,255,0.06)); border: 1px solid var(--card-border); text-align: center; user-select: all; }
.twofa-disable { margin-top: 18px; }
.twofa-disable p { font-size: 0.85rem; color: var(--account-muted, inherit); margin: 0 0 10px; }
.twofa-disable-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.twofa-disable-grid input { flex: 1 1 150px; padding: 10px 13px; border-radius: 11px; border: 1px solid var(--card-border); background: transparent; color: inherit; }

/* --- Sessions list --------------------------------------------------------- */
.session-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.session-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 4px; border-bottom: 1px solid var(--account-line, var(--card-border));
}
.session-row:last-child { border-bottom: none; }
.session-row-icon {
  width: 38px; height: 38px; flex: none; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: var(--account-soft, rgba(255,255,255,0.06)); border: 1px solid var(--card-border);
}
.session-row-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0.8; }
.session-row-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.session-row-info strong { font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-row-info span { font-size: 0.78rem; color: var(--account-muted, inherit); opacity: 0.85; }
.session-current-pill {
  display: inline-flex; padding: 2px 9px; border-radius: 999px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  background: rgba(24,167,121,0.13); color: var(--success, #18a779); width: fit-content;
}
.session-revoke {
  padding: 7px 14px; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
  background: transparent; border: 1px solid var(--card-border); color: inherit; cursor: pointer;
  transition: var(--transition, all .18s ease);
}
.session-revoke:hover { border-color: #d65858; color: #d65858; }
.session-loading { color: var(--account-muted, inherit); font-size: 0.85rem; }
@media (max-width: 640px) {
  .twofa-setup-grid { grid-template-columns: 1fr; }
  .twofa-qr-box { width: 170px; height: 170px; }
  .session-row { flex-wrap: wrap; }
}

/* --- Session card dual actions (security-20260716) ------------------------- */
.session-card-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.session-card-actions .ghost-btn { padding: 9px 16px; font-size: 0.8rem; border: 1px solid var(--card-border); border-radius: 999px; }
@media (max-width: 640px) {
  .session-card-actions { grid-column: 1 / -1; width: 100%; }
  .session-card-actions .ghost-btn, .session-card-actions .danger-button { flex: 1; }
}

/* --- Passkeys (security-20260716) ------------------------------------------ */
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 14px 0 2px; color: var(--text-tertiary, #888); font-size: 0.78rem; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--card-border); }
.passkey-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; margin-top: 12px; padding: 12px 18px;
  border-radius: 999px; border: 1px solid var(--card-border);
  background: transparent; color: inherit; font: inherit; font-weight: 650; font-size: 0.9rem;
  cursor: pointer; transition: var(--transition, all .18s ease);
}
.passkey-btn:hover { border-color: var(--accent, #7c5cff); color: var(--accent, #7c5cff); }
.passkey-btn:disabled { opacity: 0.6; cursor: wait; }
.passkey-list { list-style: none; margin: 0 0 14px; padding: 0; }
.passkey-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.passkey-note { font-size: 0.78rem; color: var(--account-muted, inherit); opacity: 0.8; }

/* --- Reactive "Remember this device" switch (security-20260716-2) ---------- */
.check-row { user-select: none; }
.check-row input {
  appearance: none;
  -webkit-appearance: none;
  width: 42px;
  height: 23px;
  margin: 0;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--account-soft, rgba(255, 255, 255, 0.08));
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .28s ease, border-color .28s ease, box-shadow .28s ease;
}
.check-row input::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 999px;
  background: var(--text-secondary, #cfcfd6);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform .3s cubic-bezier(.2, 1.4, .4, 1), width .16s ease, background .28s ease;
}
.check-row:hover input { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent); }
.check-row input:active::before { width: 21px; }                      /* thumb stretches while pressed */
.check-row input:checked { background: var(--accent); border-color: var(--accent); }
.check-row input:checked::before { transform: translateX(19px); background: #fff; }
.check-row input:checked:active::before { transform: translateX(15px); }
.check-row input:focus-visible { outline: 3px solid var(--focus-ring, #93c5fd); outline-offset: 2px; }
.check-row:has(input:checked) span { color: var(--text, inherit); }   /* label brightens when on */
.check-row span { transition: color .28s ease; }
@media (prefers-reduced-motion: reduce) {
  .check-row input, .check-row input::before, .check-row span { transition: none; }
}

/* ============================================================================
   Ferri Glass theme bridge — appended 2026-07-20
   Retargets ferri-auth onto the shared light/dark glass palette + adds card
   glass and button squish. Controller (ferri-theme.js) drives data-theme.
   ============================================================================ */
[data-theme="light"] {
  --bg: #f8fafc; --bg-soft: #e2e8f0;
  --card-bg: rgba(255, 255, 255, 0.72); --card-border: rgba(15, 23, 42, 0.10);
  --card-shadow: 0 10px 40px rgba(15, 23, 42, 0.10);
  --text: #1e293b; --text-secondary: #64748b; --text-tertiary: #94a3b8;
  --accent: #3b82f6; --accent-hover: #2f6fe0; --accent-subtle: rgba(59, 130, 246, 0.10);
  --danger: #dc2626; --danger-subtle: rgba(220, 38, 38, 0.10);
  --success: #16a34a; --success-subtle: rgba(22, 163, 74, 0.10);
  --input-bg: rgba(15, 23, 42, 0.03); --input-border: rgba(15, 23, 42, 0.10); --input-border-focus: rgba(59, 130, 246, 0.55);
  --focus-ring: rgba(59, 130, 246, 0.30);
}
[data-theme="dark"] {
  --bg: #07111f; --bg-soft: #0d1a2c;
  --card-bg: rgba(18, 28, 46, 0.62); --card-border: rgba(180, 210, 255, 0.16);
  --card-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
  --text: #eef6ff; --text-secondary: #9fb0c6; --text-tertiary: #6f7f95;
  --accent: #4aa3ff; --accent-hover: #8ed4ff; --accent-subtle: rgba(74, 163, 255, 0.14);
  --danger: #ff6b7a; --danger-subtle: rgba(255, 107, 122, 0.12);
  --success: #56d99b; --success-subtle: rgba(86, 217, 155, 0.12);
  --input-bg: rgba(255, 255, 255, 0.04); --input-border: rgba(180, 210, 255, 0.14); --input-border-focus: rgba(142, 212, 255, 0.55);
  --focus-ring: rgba(142, 212, 255, 0.30);
}
.auth-card {
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-radius: 24px;
}
.btn, button[type="submit"] { transition: transform .16s cubic-bezier(.34,1.56,.64,1), filter .16s ease, background .18s ease; }
.btn:active, button[type="submit"]:active { transform: scaleX(1.04) scaleY(0.94); }
