/* Zama Console design system */
:root {
  --bg: #ffffff;
  --bg-secondary: #f4f6f8;
  --bg-tertiary: #e9edf1;
  --text: #17212b;
  --text-secondary: #53616d;
  --text-muted: #7f8b96;
  --border: #dbe2e8;
  --border-hover: #b7c3cc;
  --accent: #132c3a;
  --accent-hover: #1d4659;
  --accent-soft: #e6f0f3;
  --ink-soft: #edf2f4;
  --focus: rgba(29, 70, 89, .18);
  --danger: #dc3545;
  --danger-bg: #fff5f5;
  --danger-border: #fecaca;
  --radius-sm: 7px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 3px rgba(19, 44, 58, .06);
  --shadow-md: 0 8px 24px rgba(19, 44, 58, .08);
  --shadow-lg: 0 18px 48px rgba(19, 44, 58, .14);
  --transition: 150ms ease;
}

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

body {
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background: var(--bg-secondary);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea { font: inherit; }
a { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---- Layout ---- */
.page-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.page-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 28px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.topbar-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topbar-logo-icon svg { width: 18px; height: 18px; }
.topbar-logo-icon img { width: 23px; height: 23px; object-fit: contain; }
.topbar-logo-image { display: block; width: 142px; height: 42px; object-fit: contain; object-position: left center; }

.topbar-logo-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .01em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-avatar {
  position: relative;
}

.topbar-avatar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.topbar-avatar-btn:hover { background: var(--bg-secondary); }

.topbar-avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.topbar-avatar-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.topbar-avatar-chevron {
  color: var(--text-muted);
  transition: transform var(--transition);
}

.topbar-avatar.open .topbar-avatar-chevron { transform: rotate(180deg); }

/* Dropdown */
.dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 280px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 150ms ease;
  z-index: 200;
}

.topbar-avatar.open .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.dropdown-header-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.dropdown-account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.dropdown-account:hover { background: var(--bg-secondary); }

.dropdown-account.active {
  background: var(--bg-secondary);
}

.dropdown-account-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dropdown-account-info { flex: 1; min-width: 0; }

.dropdown-account-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-account-email {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-account-check {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--accent);
  opacity: 0;
}

.dropdown-account.active .dropdown-account-check { opacity: 1; }

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  transition: background var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
}

.dropdown-item:hover { background: var(--bg-secondary); }

.dropdown-item svg {
  flex-shrink: 0;
  color: var(--text-secondary);
}

.dropdown-item--danger {
  color: var(--danger);
}

.dropdown-item--danger svg { color: var(--danger); }

/* ---- Content ---- */
.content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: linear-gradient(135deg, #f4f6f8 0%, #eef3f4 55%, #f8fafb 100%);
}

/* ---- Card ---- */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
}

.card--wide { max-width: 520px; }

.card-header {
  text-align: center;
  margin-bottom: 28px;
}

.card-logo {
  width: 156px;
  height: 54px;
  background: transparent;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.card-logo svg { width: 22px; height: 22px; }
.card-logo img { width: 156px; height: 54px; object-fit: contain; }

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---- Form ---- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus);
}

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

.form-input--error {
  border-color: var(--danger);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group { flex: 1; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
  text-decoration: none;
  white-space: nowrap;
  outline: none;
}

.btn:active { transform: scale(0.98); }

.btn--full { width: 100%; }

.btn--primary {
  background: var(--accent);
  color: #ffffff;
}

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

.btn--secondary {
  background: var(--bg-secondary);
  color: var(--text);
}

.btn--secondary:hover { background: var(--bg-tertiary); }

.btn--danger {
  background: var(--danger);
  color: #ffffff;
}

.btn--danger:hover { background: #c82333; }

.btn--warning {
  background: #e65100;
  color: #ffffff;
}

.btn--warning:hover { background: #bf360c; }

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

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

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.btn-row .btn { flex: 1; }

/* ---- Error ---- */
.error-msg {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
}

/* ---- Links ---- */
.link-row {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.link-row a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
}

.link-row a:hover { color: var(--text); }

.link-row .link-sep {
  margin: 0 8px;
  color: var(--border);
}

/* ---- Account card ---- */
.account-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.account-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

.account-card-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.account-card-info {
  flex: 1;
  min-width: 0;
}

.account-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.account-card-email {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.account-card-arrow {
  flex-shrink: 0;
  color: var(--text-muted);
}

/* ---- Progress ---- */
.progress {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  justify-content: center;
}

.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  transition: all 200ms ease;
}

.progress-dot.active {
  background: var(--accent);
  width: 24px;
  border-radius: 4px;
}

.progress-dot.done { background: var(--accent); }

/* ---- Separator ---- */
.separator {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

/* ---- Divider text ---- */
.divider-text {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0;
  font-size: 12px;
  color: var(--text-muted);
}

.divider-text::before,
.divider-text::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---- Avatar upload ---- */
.avatar-upload {
  text-align: center;
  margin: 20px 0;
}

.avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 14px;
  border: 2px solid var(--border);
  transition: border-color var(--transition);
}

.avatar-preview:hover { border-color: var(--border-hover); }

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

.avatar-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition);
}

.avatar-upload-label:hover { background: var(--bg-tertiary); }

.avatar-upload-label svg {
  width: 16px;
  height: 16px;
}

.avatar-upload input { display: none; }

.skip-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.skip-link:hover { color: var(--text-secondary); }

/* ---- Footer ---- */
.page-footer {
  text-align: center;
  padding: 16px 20px;
  font-size: 12px;
  color: var(--text-muted);
}

.page-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.page-footer a:hover { color: var(--text); }

/* Shared console shell */
.layout, .admin-layout { background: #f4f6f8; }
.sidebar, .admin-sidebar {
  background: rgba(255,255,255,.96);
  border-color: var(--border);
}
.sidebar-profile { background: linear-gradient(145deg, #f8fbfc, #eef4f5); }
.sidebar-avatar { border: 3px solid #fff; box-shadow: 0 3px 12px rgba(19,44,58,.12); }
.sidebar-nav a, .admin-sidebar a { border-left-width: 4px; }
.sidebar-nav a.active, .admin-sidebar a.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-left-color: #4a91a4;
}
.main, .admin-main { padding-top: 34px; }
.main h1, .admin-main h1 { letter-spacing: -.02em; font-size: 26px; }
.stat-card, .admin-stat-card, .admin-card {
  background: rgba(255,255,255,.96);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.stat-card:hover, .admin-stat-card:hover, .admin-action-card:hover { border-color: #9eb8c2; box-shadow: var(--shadow-md); }
.admin-action-card { background: rgba(255,255,255,.96); }

/* OAuth consent */
.consent-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background: radial-gradient(circle at 15% 10%, #dcecef 0, transparent 34%), linear-gradient(135deg, #edf3f4, #f9fbfb);
}
.consent-shell { width: min(100%, 860px); }
.consent-brand { display: flex; align-items: center; gap: 10px; margin: 0 0 22px 4px; color: var(--accent); font-weight: 700; letter-spacing: .02em; }
.consent-brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--accent); color: white; }
.consent-brand-mark img { width: 25px; height: 25px; object-fit: contain; }
.consent-brand-image { display: block; width: 166px; height: 54px; object-fit: contain; object-position: left center; }
.consent-panel { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr); overflow: hidden; background: #fff; border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg); }
.consent-main { padding: clamp(28px, 5vw, 56px); }
.consent-aside { padding: 34px 28px; background: var(--accent); color: #eef7f8; }
.consent-eyebrow { color: #5f98a7; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 12px; }
.consent-title { color: var(--text); font-size: clamp(27px, 4vw, 40px); line-height: 1.08; letter-spacing: -.04em; margin-bottom: 16px; }
.consent-copy { color: var(--text-secondary); font-size: 15px; max-width: 52ch; }
.consent-client { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 700; }
.consent-client-dot { width: 9px; height: 9px; border-radius: 50%; background: #5f98a7; }
.consent-scope-title { margin: 32px 0 12px; color: var(--text); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.consent__list { display: grid; gap: 10px; list-style: none; }
.consent__list li { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border: 1px solid var(--border); border-radius: 9px; color: var(--text-secondary); font-size: 13px; }
.consent__list li::before { content: "✓"; color: #3c8192; font-weight: 700; }
.consent__buttons { display: flex; gap: 10px; margin-top: 30px; }
.consent__buttons form { flex: 1; }
.consent__buttons .btn { width: 100%; }
.consent-aside h2 { font-size: 15px; margin-bottom: 18px; }
.consent-aside p { color: #bdd0d5; font-size: 13px; }
.consent-aside-list { display: grid; gap: 16px; margin-top: 26px; }
.consent-aside-item { display: flex; gap: 11px; font-size: 13px; }
.consent-aside-item strong { display: block; color: #fff; margin-bottom: 2px; }
.consent-aside-item span { color: #bdd0d5; }

/* Dedicated account chooser, intentionally free of application navigation. */
.accounts-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 24px 22px;
  background: #fff;
}
.accounts-toolbar { width: min(100%, 760px); display: flex; justify-content: flex-end; min-height: 40px; }
.accounts-language { position: relative; }
.accounts-language .lang-btn { height: 36px; padding: 0 10px; border: 0; background: transparent; color: var(--text-secondary); }
.accounts-card { width: min(100%, 450px); margin: auto; padding: 38px 36px 34px; text-align: center; }
.accounts-brand { width: 168px; height: 58px; margin: 0 auto 28px; }
.accounts-brand img { width: 100%; height: 100%; object-fit: contain; }
.accounts-card h1 { margin: 0 0 8px; color: var(--text); font-size: 26px; font-weight: 500; letter-spacing: -.025em; }
.accounts-subtitle { margin: 0 0 30px; color: var(--text-secondary); font-size: 15px; }
.accounts-footer { display: flex; gap: 12px; align-items: center; color: var(--text-muted); font-size: 12px; }
.accounts-footer a { color: var(--text-secondary); text-decoration: none; }
.accounts-footer a:hover { color: var(--accent); text-decoration: underline; }

/* Navigation is a compact application bar, not a permanent side rail. */
.layout, .admin-layout { display: block; min-height: auto; }
.sidebar, .admin-sidebar {
  width: 100%;
  height: auto;
  min-height: 0;
  position: static;
  border-right: 0;
  border-bottom: 1px solid var(--border);
  overflow: visible;
  box-shadow: 0 2px 10px rgba(19,44,58,.04);
}
.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 28px;
}
.sidebar-avatar { width: 40px; height: 40px; margin: 0; flex: 0 0 auto; }
.sidebar-name { font-size: 13px; }
.sidebar-email { margin-top: 0; font-size: 11px; }
.sidebar-profile::after { content: ""; flex: 1; }
.sidebar-nav, .admin-sidebar-nav {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 7px 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar, .admin-sidebar-nav::-webkit-scrollbar { display: none; }
.sidebar-nav a, .admin-sidebar a {
  flex: 0 0 auto;
  border: 0;
  border-radius: 7px;
  padding: 8px 11px;
  white-space: nowrap;
  font-size: 12px;
  text-decoration: none;
  gap: 12px;
}
.sidebar-nav a.active, .admin-sidebar a.active { border: 0; }
.sidebar-section, .admin-sidebar-section { padding: 0 8px; font-size: 9px; white-space: nowrap; }
.main, .admin-main { max-width: 1120px; margin: 0 auto; padding: 34px 32px; }
.admin-main { overflow-x: auto; }
.mobile-toggle, .sidebar-overlay { display: none !important; }

@media (max-width: 700px) {
  .topbar { height: 58px; }
  .topbar-logo-image { width: 116px; height: 34px; }
  .topbar { padding: 0 14px; }
  .sidebar-profile { padding: 11px 16px; }
  .sidebar-nav, .admin-sidebar-nav { padding: 6px 12px; }
  .main, .admin-main { padding: 22px 16px 32px; }
  .main h1, .admin-main h1 { font-size: 22px; }
  .stat-grid, .admin-stat-grid { display: block; margin-bottom: 16px; }
  .card {
    max-width: none;
    padding: 24px 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }
  .card-logo, .card-logo img { width: 142px; height: 48px; }
  .account-card {
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
    padding: 14px 0;
    margin-bottom: 0;
  }
  .stat-card, .admin-stat-card, .admin-action-card, .admin-card {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    text-align: left;
  }
  .stat-card:last-child, .admin-stat-card:last-child, .admin-action-card:last-child, .admin-card:last-child { border-bottom: 0; }
  .admin-actions { display: block; }
  .admin-table { min-width: 620px; }
  .profile-header { padding: 0 0 18px; border-radius: 0; box-shadow: none; border: 0; border-bottom: 1px solid var(--border); }
  .consent-page { padding: 18px 12px; }
  .consent-brand-image { width: 140px; height: 44px; }
  .consent-main { padding: 26px 20px; }
  .accounts-page { padding: 18px 16px; }
  .accounts-toolbar { min-height: 34px; }
  .accounts-card { padding: 28px 0 24px; }
  .accounts-brand { width: 154px; height: 52px; margin-bottom: 24px; }
  .accounts-card h1 { font-size: 24px; }
}

/* Account pages use a quiet Google-style menu: a real list on desktop,
   collapsed behind one control on narrow screens. */
.layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); align-items: start; max-width: 1180px; margin: 0 auto; background: transparent; }
.layout .sidebar { position: sticky; top: 88px; width: 248px; border: 0; box-shadow: none; background: transparent; }
.layout .sidebar-profile { display: block; padding: 20px 18px 18px; background: #fff; border: 1px solid var(--border); border-radius: 14px; }
.layout .sidebar-avatar { width: 48px; height: 48px; margin-bottom: 10px; }
.layout .sidebar-nav { display: block; padding: 14px 0; overflow: visible; }
.layout .sidebar-nav a { display: flex; width: 100%; padding: 10px 14px; border-radius: 8px; }
.layout .sidebar-section { padding: 16px 14px 7px; }
.layout .main { max-width: 760px; width: 100%; padding: 32px 42px; }
.account-menu-toggle { display: none; }

@media (max-width: 760px) {
  .layout { display: block; max-width: 100%; }
  .layout .sidebar { position: static; width: auto; margin: 0 16px; border-bottom: 1px solid var(--border); }
  .layout .sidebar-profile { display: flex; align-items: center; gap: 12px; padding: 14px 0; border: 0; border-radius: 0; background: transparent; }
  .layout .sidebar-avatar { width: 40px; height: 40px; margin: 0; }
  .layout .sidebar-name { font-size: 14px; }
  .layout .sidebar-email { font-size: 11px; }
  .layout .account-menu-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 11px 0; border: 0; border-top: 1px solid var(--border); background: transparent; color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; }
  .layout .account-menu-toggle svg { width: 16px; transition: transform var(--transition); }
  .layout .sidebar.mobile-open .account-menu-toggle svg { transform: rotate(180deg); }
  .layout .sidebar-nav { display: none; padding: 6px 0 14px; }
  .layout .sidebar.mobile-open .sidebar-nav { display: block; }
  .layout .sidebar-nav a { padding: 10px 8px; }
  .layout .sidebar-section { padding: 12px 8px 5px; }
  .layout .main { max-width: 100%; padding: 24px 16px 36px; }
  .mobile-menu { display: none !important; }
}

/* Account workspace: desktop sidebar, mobile drawer. */
.layout {
  position: relative;
  display: grid;
  grid-template-columns: 248px minmax(0, 760px);
  gap: 34px;
  justify-content: center;
  align-items: start;
  width: min(100%, 1120px);
  max-width: none;
  margin: 0 auto;
  padding: 34px 28px 56px;
  background: transparent;
}
.layout .sidebar {
  position: sticky;
  top: 96px;
  width: 248px;
  height: auto;
  min-height: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}
.layout .sidebar-profile {
  display: block;
  padding: 20px 18px 18px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.layout .sidebar-profile::after { display: none; }
.layout .sidebar-avatar { width: 52px; height: 52px; margin: 0 0 12px; }
.layout .sidebar-name { font-size: 15px; font-weight: 700; }
.layout .sidebar-email { font-size: 12px; }
.layout .sidebar-nav {
  display: block;
  padding: 14px 0;
  overflow: visible;
}
.layout .sidebar-nav a {
  display: flex;
  width: 100%;
  min-height: 40px;
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
}
.layout .sidebar-nav a.active { background: #e7f0fb; color: #1557a6; }
.layout .sidebar-section { padding: 16px 14px 7px; }
.layout .main {
  width: 100%;
  max-width: none;
  min-width: 0;
  padding: 0;
}
.account-mobile-trigger, .account-sidebar-backdrop { display: none; }
.account-header-trigger { display: none; }

/* Mobile account navigation is a drawer below the global header. */
@media (max-width: 820px) {
  .topbar { position: sticky; z-index: 300; }
  .layout { position: relative; z-index: 1; }
  .account-mobile-trigger {
    position: sticky;
    top: 72px;
    z-index: 180;
    width: 100%;
    justify-content: space-between;
    margin: 0 0 18px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(19,44,58,.08);
  }
  .layout .sidebar {
    top: 64px;
    bottom: 0;
    z-index: 260;
    padding-top: 20px;
  }
  .account-sidebar-backdrop {
    z-index: 250;
    top: 64px;
  }
}

@media (max-width: 820px) {
  .layout {
    display: block;
    width: 100%;
    padding: 18px 16px 42px;
  }
  .account-mobile-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    margin-bottom: 14px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
  }
  .account-mobile-trigger svg { width: 17px; height: 17px; }
  .layout .sidebar {
    position: fixed;
    z-index: 210;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(292px, 86vw);
    padding: 18px 16px;
    background: #fff;
    box-shadow: 16px 0 38px rgba(19,44,58,.16);
    transform: translateX(-105%);
    transition: transform 180ms ease;
    overflow-y: auto;
  }
  .layout .sidebar.mobile-open { transform: translateX(0); }
  .layout .sidebar-profile { border: 0; padding: 10px 4px 18px; border-bottom: 1px solid var(--border); border-radius: 0; }
  .layout .sidebar-nav { padding: 14px 0; }
  .account-sidebar-backdrop {
    position: fixed;
    z-index: 200;
    inset: 0;
    background: rgba(12, 26, 34, .34);
  }
  .layout .sidebar.mobile-open + .account-sidebar-backdrop { display: block; }
  .layout .main { padding: 0; }
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .topbar { padding: 0 14px; }
  .topbar-avatar-name { display: none; }
  .card { padding: 28px 20px; }
  .card--wide { padding: 28px 20px; }
  .form-row { flex-direction: column; gap: 0; }
  .dropdown { width: calc(100vw - 28px); right: -8px; }
  .btn-row { flex-direction: column; gap: 8px; }
  .content { padding: 16px; }
  .consent-panel { display: block; border-radius: 16px; }
  .consent-aside { padding: 24px; }
  .consent__buttons { flex-direction: column-reverse; }
}

@media (max-width: 360px) {
  .card { border-radius: 0; border-left: none; border-right: none; }
}

/* ---- Search Bar ---- */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 500;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  backdrop-filter: blur(2px);
}

.search-overlay.active { display: flex; }

.search-box {
  background: var(--bg);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.search-input-wrap svg { width: 20px; height: 20px; color: var(--text-muted); flex-shrink: 0; }

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: transparent;
}

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

/* Final mobile drawer contract: always below the 64px global header. */
@media (max-width: 820px) {
  .topbar { position: sticky !important; top: 0; z-index: 300 !important; }
  .layout { position: relative; z-index: 1; }
  .account-header-trigger {
    position: static !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    background: #fff;
    color: var(--text);
    box-shadow: 0 3px 12px rgba(19,44,58,.08);
  }
  .account-header-trigger svg { width: 17px; height: 17px; }
  .layout .sidebar {
    position: fixed !important;
    top: 58px !important;
    left: 0;
    margin: 0 !important;
    bottom: 0;
    z-index: 260 !important;
    width: 80vw;
    height: calc(100vh - 58px);
    max-height: none;
    transform: translateX(-105%);
    overflow-y: auto;
  }
  .layout .sidebar.mobile-open { transform: translateX(0); }
  .account-sidebar-backdrop {
    position: fixed !important;
    top: 58px !important;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 250 !important;
  }
  .layout .sidebar.mobile-open + .account-sidebar-backdrop { display: block !important; }
}

.search-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 6px;
}

/* Account navigation is always an independent drawer, never page content. */
.account-header-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--text);
  cursor: pointer;
  box-shadow: none;
}
.account-header-trigger svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.account-switcher { position: relative; }
.account-header-session { display: inline-flex; align-items: center; gap: 8px; max-width: 240px; padding: 4px 8px 4px 4px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); cursor: pointer; font-size: 13px; }
.account-header-session:hover { background: var(--bg-secondary); }
.account-header-session img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.account-header-session span { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-header-session svg { width: 15px; height: 15px; color: var(--text-muted); }
.account-switcher .dropdown { top: calc(100% + 10px); right: 0; width: 330px; }
.account-switcher.open .dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.account-switcher-heading { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.account-switcher-heading img { width: 30px; height: 30px; object-fit: contain; }
.account-switcher-heading strong { font-size: 14px; font-weight: 600; }
.account-switcher-list { padding: 8px; }
.account-switcher-list .dropdown-account { padding: 10px; }
.account-switcher-list .dropdown-account-img { width: 40px; height: 40px; }
.account-switcher-actions { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.account-switcher-action { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: 1; padding: 9px 8px; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 12px; text-decoration: none; }
.account-switcher-action:hover { background: var(--bg-secondary); color: var(--text); }
.account-switcher-action svg { width: 15px; height: 15px; }
.account-switcher-action--danger { color: var(--danger); }
.layout {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 32px 32px 56px;
}
.layout .sidebar {
  position: fixed;
  top: 64px;
  left: 0;
  bottom: 0;
  z-index: 260;
  display: flex;
  flex-direction: column;
  width: 320px;
  height: calc(100vh - 64px);
  margin: 0;
  padding: 14px 18px;
  background: #fff;
  border-right: 1px solid var(--border);
  box-shadow: none;
  transform: translateX(-105%);
  transition: transform 180ms ease;
  overflow-y: auto;
}
.layout .sidebar.mobile-open { transform: translateX(0); }
.layout .sidebar-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.layout .account-menu-toggle { display: none; }
.layout .main { max-width: 980px; margin: 0 auto; padding: 0; }
.account-sidebar-backdrop {
  position: fixed;
  top: 64px;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 250;
  display: none;
  background: rgba(12, 26, 34, .26);
}
.layout .sidebar.mobile-open + .account-sidebar-backdrop { display: block; }
.account-drawer-footer { flex: 0 0 auto; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.account-drawer-control + .account-drawer-control { margin-top: 14px; }
.account-drawer-control-label { display: block; margin-bottom: 7px; color: var(--text-muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.account-language-dropdown { position: relative; }
.account-language-trigger, .account-session-trigger { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text-secondary); cursor: pointer; font-size: 12px; text-align: left; }
.account-language-trigger { justify-content: space-between; }
.account-language-trigger svg, .account-session-trigger > svg { width: 14px; height: 14px; margin-left: auto; }
.account-language-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 5px); display: none; padding: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); z-index: 300; }
.account-language-dropdown.open .account-language-menu { display: block; }
.account-language-menu a { display: block; padding: 7px 9px; color: var(--text-secondary); font-size: 12px; text-decoration: none; border-radius: 5px; }
.account-language-menu a:hover, .account-language-menu a.active { color: var(--text); background: var(--bg-secondary); }
.account-session-trigger img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.account-drawer-session-menu { position: absolute; right: 0; bottom: calc(100% + 8px); left: 0; display: none; padding: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); z-index: 310; }
.account-drawer-session-menu.open { display: block; }
.account-drawer-session-menu .dropdown-account { padding: 9px; }
.account-drawer-session-menu .dropdown-account-img { width: 36px; height: 36px; }

@media (max-width: 820px) {
  .account-header-session { display: none; }
  .layout { padding: 18px 16px 42px; }
  .layout .sidebar { top: 58px; width: 80vw; height: calc(100vh - 58px); padding: 20px 16px; }
  .layout .main { max-width: 100%; }
  .account-sidebar-backdrop { top: 58px; }
}

.search-results:empty { display: none; }

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background var(--transition);
}

.search-result-item:hover { background: var(--bg-secondary); }

.search-result-icon {
  width: 32px;
  height: 32px;
  background: var(--bg-secondary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.search-result-icon svg { width: 16px; height: 16px; color: var(--text-secondary); }

/* Final account responsive rules must follow the legacy component rules. */
@media (max-width: 760px) {
  .layout .sidebar { display: block; }
  .layout .sidebar:not(.mobile-open) .sidebar-nav { display: none; }
  .layout .stat-grid { display: block; }
  .layout .stat-card,
  .layout .session-card,
  .layout .app-card,
  .layout .admin-card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    margin: 0;
    padding: 14px 0;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
  }
  .layout .stat-card-icon { margin: 0; flex: 0 0 auto; }
  .layout .stat-card-value { margin-left: auto; }
  .layout .stat-card-label { margin: 0; }
  .layout .profile-header { background: transparent; }
  .layout .field-group,
  .layout .field-row { border-bottom-color: var(--border); }
}

.search-result-text { flex: 1; min-width: 0; }

.search-result-title { font-size: 13px; font-weight: 500; color: var(--text); }

.search-result-section { font-size: 11px; color: var(--text-muted); }

.search-empty {
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.search-hint {
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-hint kbd {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: inherit;
}

/* ---- Toggle Switch ---- */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-tertiary);
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--transition);
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ---- Stat Cards ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.stat-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-sm); }

.stat-card-icon {
  width: 36px;
  height: 36px;
  background: var(--bg-secondary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.stat-card-icon svg { color: var(--text-secondary); }

.stat-card-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---- Timeline ---- */
.timeline { position: relative; padding-left: 24px; }

.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}

.timeline-item {
  position: relative;
  padding: 12px 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 18px;
  width: 10px;
  height: 10px;
  background: var(--bg);
  border: 2px solid var(--accent);
  border-radius: 50%;
  z-index: 1;
}

.timeline-item--danger::before { border-color: var(--danger); }
.timeline-item--success::before { border-color: #2e7d32; }

.timeline-time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
  margin-bottom: 4px;
}

.timeline-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.timeline-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ---- Section Tabs (Security) ---- */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  min-width: 0;
  padding: 8px 14px;
  border: none;
  background: transparent;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Alert Inline ---- */
.alert-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
}

.alert-inline svg { flex-shrink: 0; }

.alert-inline--success { background: #e8f5e9; color: #1e8449; border: 1px solid #a5d6a7; }
.alert-inline--danger { background: #fff5f5; color: #c0392b; border: 1px solid #fecaca; }
.alert-inline--info { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }
.alert-inline--warning { background: #fff8e1; color: #e65100; border: 1px solid #ffe082; }

/* ---- Session Card ---- */
.session-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 10px;
  transition: border-color var(--transition);
}

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

.session-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.session-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.session-card-icon img { width: 100%; height: 100%; }

.session-card-title { font-size: 14px; font-weight: 500; color: var(--text); }

.session-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.session-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.session-card-meta svg { }

.session-card-actions {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ---- App Card ---- */
.app-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 10px;
}

.app-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.app-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
}

.app-card-icon img { width: 100%; height: 100%; }

.app-card-name { font-size: 15px; font-weight: 600; color: var(--text); }

.app-card-url { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.app-card-scopes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.scope-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  color: var(--text-secondary);
}

.app-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

/* ---- Code Block ---- */
.code-block {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 13px;
  color: var(--text);
  letter-spacing: 0.05em;
  word-break: break-all;
  margin: 10px 0;
}

/* Account sections: restrained settings workspace */
.layout .main > h1 { margin-top: 0; margin-bottom: 6px; }
.layout .main > .sub { max-width: 62ch; margin-bottom: 26px; }
.layout .tabs {
  display: flex;
  gap: 4px;
  padding: 0 0 8px;
  margin: 0 0 22px;
  background: transparent;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.layout .tabs::-webkit-scrollbar { display: none; }
.layout .tab-btn {
  flex: 0 0 auto;
  min-width: max-content;
  padding: 9px 13px;
  border: 0;
  border-radius: 6px;
  color: var(--text-muted);
  background: transparent;
  box-shadow: none;
}
.layout .tab-btn:hover { color: var(--text); background: var(--bg-secondary); }
.layout .tab-btn.active { color: var(--accent); background: var(--accent-soft); box-shadow: none; }
.layout .tab-panel > div {
  background: #fff !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  padding: 24px !important;
  box-shadow: none !important;
}
.layout .tab-panel > div + div { margin-top: 14px; }
.layout .tab-panel .alert-inline { margin-top: 16px; }
.layout .session-card,
.layout .app-card {
  border-radius: 10px;
  box-shadow: none;
  border-color: var(--border);
}
.layout .session-card:hover,
.layout .app-card:hover { border-color: var(--border-hover); }
.layout .scope-tag { border-radius: 6px; }
.layout .app-card-footer { gap: 16px; flex-wrap: wrap; }

@media (max-width: 600px) {
  .layout .main > h1 { font-size: 23px; }
  .layout .tab-panel > div { padding: 18px !important; }
  .layout .tab-btn { padding: 8px 10px; font-size: 11px; }
  .layout .app-card-header { align-items: flex-start; }
  .layout .app-card-footer { align-items: flex-start; flex-direction: column; }
  .layout .session-card-header { align-items: flex-start; }
}

/* ---- Confirm Dialog ---- */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 600;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}

.confirm-overlay.active { display: flex; }

.confirm-box {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.confirm-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.confirm-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg-secondary);
  border-radius: 50%;
  cursor: pointer;
  transition: background var(--transition);
  color: var(--text-secondary);
}

.modal-close:hover { background: var(--bg-tertiary); }
.modal-close svg { }

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ---- Profile Page ---- */
.profile-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 28px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}

.profile-avatar-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  cursor: pointer;
}

.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--border);
  transition: border-color var(--transition);
}

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

.profile-avatar-wrap:hover .profile-avatar {
  border-color: var(--accent);
}

.profile-avatar-edit {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 28px;
  height: 28px;
  background: var(--accent);
  border: 2px solid var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background var(--transition);
}

.profile-avatar-wrap:hover .profile-avatar-edit {
  background: var(--accent-hover);
}

.profile-avatar-edit svg { }

.profile-info { flex: 1; }

.profile-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.profile-email {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.profile-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--bg-secondary);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.profile-badge svg { }

/* ---- Field Row ---- */
.field-group {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.field-group:last-child { border-bottom: none; }

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}

.field-value {
  font-size: 14px;
  color: var(--text);
  font-weight: 400;
}

.field-value--empty {
  color: var(--text-muted);
  font-style: italic;
}

.field-action {
  flex-shrink: 0;
}

/* ---- Stepper (for verification) ---- */
.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.stepper-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.stepper-step.active {
  color: var(--text);
  font-weight: 600;
}

.stepper-step.done {
  color: #2e7d32;
}

.stepper-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.stepper-step.active .stepper-dot {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.stepper-step.done .stepper-dot {
  background: #e8f5e9;
  color: #2e7d32;
  border-color: #2e7d32;
}

.stepper-line {
  flex: 1;
  height: 1px;
  background: var(--border);
  min-width: 20px;
}

.stepper-step.done + .stepper-line {
  background: #2e7d32;
}

/* ---- Code Input ---- */
.code-input-group {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 20px 0;
}

.code-input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  font-family: monospace;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition);
  color: var(--text);
  background: var(--bg);
}

.code-input:focus {
  border-color: var(--accent);
}

.code-input.filled {
  border-color: #2e7d32;
  background: #f0faf0;
}

@media (max-width: 480px) {
  .profile-header { flex-direction: column; text-align: center; padding: 24px 20px; }
  .profile-badges { justify-content: center; }
  .modal { margin: 10px; max-height: 95vh; }
  .code-input { width: 40px; height: 48px; font-size: 18px; }
}

/* ---- Language Switcher ---- */
.lang-switcher { position: relative; }
.lang-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg);
  cursor: pointer; font-size: 12px; color: var(--text-muted);
  transition: all var(--transition); font-family: inherit;
}
.lang-btn:hover { border-color: var(--border-hover); color: var(--text); }
.lang-dropdown {
  display: none; position: absolute; top: 100%; right: 0;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); min-width: 130px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08); z-index: 1000; margin-top: 4px;
}
.lang-switcher.open .lang-dropdown { display: block; }
.lang-dropdown a {
  display: block; padding: 8px 14px; font-size: 13px;
  color: var(--text-secondary); text-decoration: none;
  transition: background var(--transition);
}
.lang-dropdown a:hover { background: var(--bg-secondary); color: var(--text); }
