/* ---------- Tokens ---------- */
:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --border: #e3e6ee;
  --text: #161a26;
  --text-muted: #5d6478;
  --accent: #4f46e5;
  --accent-strong: #4338ca;
  --accent-soft: #eef0ff;
  --danger: #c2334a;
  --danger-soft: #fdecef;
  --success: #12805c;
  --success-soft: #e5f6ef;
  --warning: #9a6200;
  --warning-soft: #fdf3e1;
  --header-bg: #ffffff;
  --header-text: var(--text);
  --header-muted: var(--text-muted);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 4px 16px rgba(16, 24, 40, 0.06);
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

/* Admin areas share the User dashboard's dark palette. */
.theme-admin,
.theme-super {
  --bg: #020617;
  --surface: #0F172A;
  --surface-2: #0F172A;
  --border: #1E293B;
  --text: #FFFFFF;
  --text-muted: #94A3B8;
  --accent: #FFFFFF;
  --accent-strong: #E2E8F0;
  --accent-soft: rgba(148, 163, 184, .12);
  --danger: #F87171;
  --danger-soft: rgba(248, 113, 113, .1);
  --success: #4ADE80;
  --success-soft: rgba(74, 222, 128, .1);
  --warning: #FACC15;
  --warning-soft: rgba(250, 204, 21, .12);
  --header-bg: #0F172A;
  --header-text: #FFFFFF;
  --header-muted: #94A3B8;
  color-scheme: dark;
  background: #020617;
  color: #FFFFFF;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--accent); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -0.01em; }
.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;
}
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }

/* ---------- Forms ---------- */
.form { display: grid; gap: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 6px; align-content: start; }
.field label { font-weight: 600; font-size: 14px; }
.field .hint { color: var(--text-muted); font-size: 13px; }
.field .optional { color: var(--text-muted); font-weight: 400; }
.input {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-height: 42px;
  transition: border-color .15s, box-shadow .15s;
}
.input:hover { border-color: #c9cede; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.field.has-error .input { border-color: var(--danger); }
.field.has-error .input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 25%, transparent); }
.field-error { color: var(--danger); font-size: 13px; min-height: 0; }
.field-error:empty { display: none; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 64px; }
.password-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 13px; font-weight: 600;
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
}
.password-toggle:hover { background: var(--accent-soft); }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }
select.input { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%235d6478' stroke-width='1.6' d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 14px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  padding: 10px 16px; min-height: 42px; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); }
.theme-admin .btn-primary, .theme-super .btn-primary { background: #2563EB; color: #FFFFFF; }
.theme-admin .btn-primary:hover:not(:disabled), .theme-super .btn-primary:hover:not(:disabled) { background: #1D4ED8; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--danger-soft); }
.btn-success-ghost { background: transparent; color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.btn-success-ghost:hover:not(:disabled) { background: var(--success-soft); }
.btn-sm { min-height: 32px; padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Alerts ---------- */
.alert { border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; border: 1px solid transparent; }
.alert[hidden] { display: none; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 20%, transparent); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 20%, transparent); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 20%, transparent); }

/* ---------- App shell ---------- */
.app-header {
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.theme-admin .app-header, .theme-super .app-header { border-bottom-color: transparent; }
.app-header-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 24px; height: 64px;
  display: flex; align-items: center; gap: 24px;
}
.app-nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.app-nav a {
  color: var(--header-muted); padding: 8px 12px; border-radius: 8px; font-size: 14px; white-space: nowrap;
}
.app-nav a:hover { color: var(--header-text); background: color-mix(in srgb, var(--header-text) 8%, transparent); text-decoration: none; }
.app-nav a[aria-current="page"] { color: var(--header-text); background: color-mix(in srgb, var(--header-text) 12%, transparent); }
.app-user { display: flex; align-items: center; gap: 12px; }
.app-user .who { text-align: right; line-height: 1.2; }
.app-user .who strong { display: block; font-size: 14px; }
.app-user .who span { font-size: 12px; color: var(--header-muted); }
.app-header .btn-secondary { background: transparent; color: var(--header-text); border-color: color-mix(in srgb, var(--header-text) 22%, transparent); }
.app-header .btn-secondary:hover:not(:disabled) { background: color-mix(in srgb, var(--header-text) 10%, transparent); }

.page { max-width: 1180px; margin: 0 auto; padding: 32px 24px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; }
.page-head p { color: var(--text-muted); margin: 6px 0 0; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: 6px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 20px 22px; }
.card-head { padding: 16px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head h2 { font-size: 16px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 24px; }
.grid-sidebar { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); align-items: start; }
.card-narrow { max-width: 620px; }

.stat { padding: 18px 20px; }
.stat .label { color: var(--text-muted); font-size: 13px; font-weight: 500; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .value-sm { font-size: 18px; margin-top: 10px; }
.stat .sub { font-size: 12px; color: var(--text-muted); }

.details { display: grid; grid-template-columns: max-content 1fr; gap: 12px 24px; margin: 0; }
.details dt { color: var(--text-muted); font-size: 14px; }
.details dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

.welcome {
  background: linear-gradient(120deg, var(--accent-soft), var(--surface) 70%);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 24px;
  display: flex; gap: 18px; align-items: center;
}
.avatar {
  flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 18px;
}
.welcome h1 { font-size: 22px; }
.welcome p { margin: 4px 0 0; color: var(--text-muted); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active { background: var(--success-soft); color: var(--success); }
.badge-inactive { background: var(--surface-2); color: var(--text-muted); }
.badge-role-user { background: #eef0ff; color: #4338ca; }
.badge-role-admin { background: #e3f5f2; color: #0b6f65; }
.badge-role-super_admin { background: #f3ecff; color: #6d28d9; }

/* ---------- Toolbar + table ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; }
.toolbar .input { min-height: 36px; padding: 6px 10px; width: auto; }
.toolbar input[type="search"] { min-width: 220px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 22px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 600; background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
td .primary { font-weight: 600; }
td .secondary { color: var(--text-muted); font-size: 13px; }
td.actions { text-align: right; }
td[data-label="Phone"], td[data-label="Created"], td[data-label="Registered"] { white-space: nowrap; }
td.actions .btn { margin: 3px 0 3px 6px; }
.muted { color: var(--text-muted); }

.state { padding: 48px 22px; text-align: center; color: var(--text-muted); }
.state strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.state .spinner { margin: 0 auto 12px; color: var(--accent); width: 22px; height: 22px; }

/* ---------- Toast ---------- */
.toast-region { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 50; max-width: calc(100vw - 40px); }
.toast {
  background: #161a26; color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.18);
  font-size: 14px; animation: toast-in .2s ease-out;
}
.toast.error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Registration loading overlay ---------- */
.loading-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 24px;
  background: color-mix(in srgb, #0d0b24 55%, transparent);
  backdrop-filter: blur(6px);
  animation: fade-in .25s ease-out;
}
.loading-overlay[hidden] { display: none; }
.loading-card {
  width: 100%; max-width: 400px; background: var(--surface); border-radius: 18px; padding: 36px 32px 30px;
  text-align: center; box-shadow: 0 24px 60px rgba(13, 11, 36, .35);
}
.loader-ring {
  width: 64px; height: 64px; margin: 0 auto 22px; position: relative;
}
.loader-ring::before, .loader-ring::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
}
.loader-ring::before { border: 4px solid var(--accent-soft); }
.loader-ring::after {
  border: 4px solid transparent; border-top-color: var(--accent); border-right-color: #a855f7;
  animation: spin .9s cubic-bezier(.5, .15, .5, .85) infinite;
}
.loader-ring.done::after { animation: none; border-color: var(--success); }
.loader-ring .check {
  position: absolute; inset: 0; display: grid; place-items: center; color: var(--success);
  opacity: 0; transform: scale(.6); transition: opacity .25s, transform .25s;
}
.loader-ring.done .check { opacity: 1; transform: scale(1); }
.loading-message {
  font-size: 17px; font-weight: 600; min-height: 26px;
  transition: opacity .3s ease, transform .3s ease;
}
.loading-message.leaving { opacity: 0; transform: translateY(-6px); }
.loading-message.entering { opacity: 0; transform: translateY(6px); }
.loading-sub { color: var(--text-muted); font-size: 13px; margin: 6px 0 22px; }
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress-bar {
  height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #a855f7);
  transition: width .9s ease;
}
.steps { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.steps span { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: background .3s; }
.steps span.on { background: var(--accent); }
@keyframes fade-in { from { opacity: 0; } }

/* ---------- Error pages ---------- */
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; text-align: center; }
.error-page .code { font-size: 64px; font-weight: 800; color: var(--accent); line-height: 1; }
.error-page h1 { font-size: 22px; margin: 12px 0 8px; }
.error-page p { color: var(--text-muted); margin: 0 0 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-sidebar { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .app-header-inner { height: auto; flex-wrap: wrap; padding: 12px 16px; gap: 10px; }
  .app-nav { order: 3; flex-basis: 100%; }
  .app-user { margin-left: auto; }
  .app-user .who { display: none; }
  .page { padding: 24px 16px 48px; }
  .form-row { grid-template-columns: 1fr; }
  .toolbar { width: 100%; }
  .toolbar input[type="search"] { min-width: 0; flex: 1; }
  th, td { padding: 10px 14px; }
  .card-head, .card-body { padding-left: 16px; padding-right: 16px; }
  .details { grid-template-columns: 1fr; gap: 2px; }
  .details dd { margin-bottom: 10px; }
  /* Stack table rows as cards on small screens */
  table.responsive thead { display: none; }
  table.responsive tr { display: grid; gap: 4px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
  table.responsive td { padding: 0; border: 0; }
  table.responsive td[data-label]::before { content: attr(data-label) ": "; color: var(--text-muted); font-size: 12px; }
  table.responsive td.actions { text-align: left; margin-top: 6px; }
  table.responsive td.actions .btn { margin: 3px 6px 3px 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Logo placeholder (reusable; see LOGO_SRC in public/js/ui.js) ---------- */
.logo {
  display: inline-grid; place-items: center; flex: none; overflow: hidden;
  width: 56px; height: 56px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-muted); font-size: 12px; font-weight: 700; letter-spacing: .12em;
}
.logo img { width: 100%; height: 100%; object-fit: contain; }
.logo-sm { width: 34px; height: 34px; border-radius: 9px; font-size: 8px; letter-spacing: .08em; }
.logo-lg { width: 96px; height: 96px; border-radius: 16px; font-size: 13px; }
.app-header .logo { border-color: color-mix(in srgb, var(--header-text) 20%, transparent); background: color-mix(in srgb, var(--header-text) 8%, transparent); color: var(--header-muted); }
.brand-link { display: inline-flex; border-radius: 10px; }

/* ---------- Dark theme tokens (login, registration and the user area) ---------- */
.auth-dark,
.app-dark {
  --bg: #020617;
  --surface: #0F172A;
  --surface-2: #0F172A;
  --border: #1E293B;
  --text: #FFFFFF;
  --text-muted: #94A3B8;
  --accent: #FFFFFF;
  --accent-strong: #E2E8F0;
  --accent-soft: rgba(148, 163, 184, .12);
  --danger: #F87171;
  --danger-soft: rgba(248, 113, 113, .1);
  --success: #4ADE80;
  --success-soft: rgba(74, 222, 128, .1);
  --warning: #FACC15;
  --warning-soft: rgba(250, 204, 21, .12);
  --focus: 0 0 0 3px rgba(148, 163, 184, .28);
  color-scheme: dark;
  background: #020617;
  color: #FFFFFF;
}
.theme-admin .badge-role-user, .theme-admin .badge-role-admin, .theme-admin .badge-role-super_admin,
.theme-super .badge-role-user, .theme-super .badge-role-admin, .theme-super .badge-role-super_admin {
  background: #1E293B;
  color: #CBD5E1;
}
.auth-center { min-height: 100vh; display: grid; place-items: center; padding: 48px 16px; }
.auth-panel { width: 100%; max-width: 420px; }
.auth-panel-wide { max-width: 520px; }
.auth-head { text-align: center; margin-bottom: 28px; }
.auth-head .logo {
  margin-bottom: 24px;
  width: auto;          
  height: 120px;        
  border: none;     
  background: none;    
  border-radius: 0;
  overflow: visible;
}
.auth-head .logo img { width: auto; height: 100%; }
.auth-head h1 { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.auth-head p { margin: 0; color: var(--text-muted); }
.auth-box { background: rgba(15, 23, 42, .45); border: 1px solid var(--border); border-radius: 16px; padding: 28px; }
.auth-foot { margin-top: 24px; text-align: center; color: var(--text-muted); font-size: 14px; }
.auth-dark a { color: #FFFFFF; text-decoration: underline; text-decoration-color: #475569; text-underline-offset: 3px; }
.auth-dark a:hover { text-decoration-color: #FFFFFF; }
.auth-dark .input { background: #0F172A; border-color: #1E293B; color: #FFFFFF; border-radius: 10px; }
.auth-dark .input::placeholder { color: #94A3B8; opacity: .75; }
.auth-dark .input:hover { border-color: #334155; }
.auth-dark .input:focus { border-color: #94A3B8; }
.auth-dark .btn-primary { background: #FFFFFF; color: #020617; border-radius: 10px; }
.auth-dark .btn-primary:hover:not(:disabled) { background: #E2E8F0; }
.auth-dark .alert-error { color: #FCA5A5; border-color: rgba(248, 113, 113, .25); }
.auth-dark .alert-success { color: #86EFAC; border-color: rgba(74, 222, 128, .25); }
.auth-dark .field-error { color: #FCA5A5; }
.auth-dark .field.has-error .input { border-color: #F87171; }
.auth-dark .password-toggle { color: #CBD5E1; }
.auth-dark .loading-overlay { background: rgba(2, 6, 23, .82); }
.auth-dark .loading-card { background: #0F172A; border: 1px solid #1E293B; box-shadow: 0 24px 60px rgba(0, 0, 0, .5); }
.auth-dark .loader-ring::before { border-color: #1E293B; }
.auth-dark .loader-ring::after { border-top-color: #FFFFFF; border-right-color: #94A3B8; }
.auth-dark .progress { background: #1E293B; }
.auth-dark .progress-bar { background: linear-gradient(90deg, #94A3B8, #FFFFFF); }
.auth-dark .steps span { background: #1E293B; }
.auth-dark .steps span.on { background: #FFFFFF; }
@media (max-width: 480px) {
  .auth-box { padding: 20px; border-radius: 14px; }
  .auth-head h1 { font-size: 23px; }
}

/* ---------- Admin codes ---------- */
.admin-code {
  font-family: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 13px; font-weight: 600; letter-spacing: .04em;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; white-space: nowrap;
}
.code-cell { display: inline-flex; align-items: center; gap: 6px; }
.code-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.code-card h2 { font-size: 15px; margin-bottom: 4px; }
.code-card p { margin: 0; color: var(--text-muted); font-size: 14px; max-width: 520px; }
.code-card .code-big { font-size: 22px; padding: 8px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }
.code-card .code-actions { display: flex; align-items: center; gap: 10px; }
.code-reveal { margin-top: 16px; padding: 14px; border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 10px; background: var(--accent-soft); }
.code-reveal[hidden] { display: none; }
.code-reveal .label { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.code-reveal .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.code-reveal .admin-code { font-size: 18px; padding: 6px 10px; background: var(--surface); }
.unassigned { color: var(--text-muted); font-style: italic; }
.filter-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-banner[hidden] { display: none; }
.filter-banner .meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--text-muted); font-size: 14px; }
.filter-banner .meta strong { color: var(--text); }
.grid-stats-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-stats-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grid-stats-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Admin-managed AG profiles ---------- */
.ag-management-grid { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 20px; padding: 20px; }
.ag-create-panel { padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.ag-create-panel h3, .ag-list-panel h3 { font-size: 15px; margin-bottom: 16px; }
.ag-create-panel .form { gap: 14px; }
.ag-list-panel { min-width: 0; }
.ag-contact-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
@media (max-width: 900px) { .ag-management-grid { grid-template-columns: minmax(0, 1fr); } }
.ag-approval-gate h2 { margin-bottom: 8px; }
.ag-approval-gate p { margin: 0; color: var(--text-muted); }
.ag-approval-gate[hidden] { display: none; }
.ag-approval-locked > :not(.page-head):not(#ag-approval-gate) { display: none; }

/* ---------- Confirmation dialog ---------- */
.dialog {
  border: 1px solid var(--border); border-radius: 14px; padding: 0; max-width: 440px; width: calc(100% - 32px);
  background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(16, 24, 40, .3);
}
.dialog::backdrop { background: rgba(2, 6, 23, .55); }
.dialog form { padding: 22px 22px 18px; }
.dialog h2 { font-size: 17px; margin-bottom: 8px; }
.dialog p { margin: 0 0 20px; color: var(--text-muted); font-size: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- User area: dark layout with left sidebar (same tokens as the login page) ---------- */
.user-layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 8px;
  background: #0F172A; border-right: 1px solid #1E293B; padding: 20px 14px;
}
.sidebar-logo { display: flex; padding: 4px 8px 20px; margin-bottom: 8px; border-bottom: 1px solid #1E293B; }
.sidebar-logo:focus-visible { border-radius: 10px; }
.sidebar .logo { background: #020617; } /* keep the placeholder visible on the #0F172A sidebar */
.side-nav { display: grid; gap: 4px; }
.side-link {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border: 0; border-radius: 10px; background: transparent;
  color: #94A3B8; font: inherit; font-size: 14px; font-weight: 500; text-align: left; text-decoration: none;
  cursor: pointer; transition: background-color .15s ease, color .15s ease;
}
.side-link:hover { background: rgba(30, 41, 59, .55); color: #FFFFFF; text-decoration: none; }
.side-link[aria-current="page"] { background: #1E293B; color: #FFFFFF; }
.side-link svg { width: 18px; height: 18px; flex: none; }
.side-link:disabled { opacity: .6; cursor: progress; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid #1E293B; }
.user-main { padding: 0 56px 48px; outline: none; }
.user-main h1 { color: #FFFFFF; font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
.mobile-bar { display: none; }
.menu-toggle {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid #1E293B; border-radius: 10px; background: transparent; color: #FFFFFF; cursor: pointer;
}
.menu-toggle:hover { background: #1E293B; }
.menu-toggle svg { width: 20px; height: 20px; }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(2, 6, 23, .7); }
.sidebar-backdrop[hidden] { display: none; }

@media (max-width: 860px) {
  .user-layout { grid-template-columns: minmax(0, 1fr); }
  .mobile-bar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 30; height: 60px; padding: 0 16px;
    background: #0F172A; border-bottom: 1px solid #1E293B;
  }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 50; width: 272px; max-width: 85vw; height: 100%;
    transform: translateX(-100%); visibility: hidden;
    transition: transform .2s ease, visibility 0s linear .2s;
  }
  .sidebar.open { transform: none; visibility: visible; transition: transform .2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .5); }
  .user-main { padding: 0 16px 32px; }
  .user-main h1 { font-size: 28px; }
}

/* ---------- Registration approval overlay (user area) ---------- */
.approval-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 24px;
  background: rgba(2, 6, 23, .55);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.approval-overlay[hidden] { display: none; }
.approval-card {
  width: 100%; max-width: 460px; text-align: center;
  background: #0F172A; border: 1px solid #1E293B; border-radius: 16px;
  padding: 32px 28px 28px; box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.approval-icon {
  width: 56px; height: 56px; margin: 0 auto 20px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(148, 163, 184, .12); color: #FFFFFF;
}
.approval-icon .spinner { width: 24px; height: 24px; border-width: 2.5px; }
.approval-icon svg { width: 28px; height: 28px; }
.approval-card.declined .approval-icon { background: rgba(248, 113, 113, .12); color: #F87171; }
.approval-card h2 { font-size: 22px; color: #FFFFFF; margin-bottom: 10px; }
.approval-card p { color: #94A3B8; margin: 0 0 16px; }
.approval-card .approval-meta { font-size: 13px; margin-bottom: 22px; }
.approval-card .approval-meta:empty { display: none; }
@media (max-width: 480px) { .approval-card { padding: 26px 20px 22px; } .approval-card h2 { font-size: 20px; } }

/* ---------- Approval badges, request list ---------- */
.badge-approval-pending { background: var(--warning-soft); color: var(--warning); }
.badge-approval-approved { background: var(--success-soft); color: var(--success); }
.badge-approval-declined { background: var(--danger-soft); color: var(--danger); }
.section-gap { margin-bottom: 24px; }
.stat-link { color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.stat-link:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.stat-link .sub { color: var(--accent); font-weight: 600; }
.count-pill {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; margin-left: 6px;
  border-radius: 999px; background: var(--warning-soft); color: var(--warning); font-size: 12px; font-weight: 700; vertical-align: 2px;
}
.count-pill[hidden] { display: none; }
#requests-title:focus { outline: none; }

/* ---------- User dashboard: main value card and decorative demo debit card ---------- */
.dash-grid {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px;
  align-items: start; max-width: 1400px;
}
.dash-main {
  background: linear-gradient(125deg, #1E3A8A 0%, #112653 45%, #020617 100%);
  color: #FFFFFF; border: 1px solid #26385E; border-radius: 20px; padding: 40px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 22px; min-width: 0;
}
.dash-eyebrow { font-size: 16px; font-weight: 600; letter-spacing: .01em; color: #FFFFFF; }
.dash-asterisk { color: #FACC15; margin-left: 2px; }
.dash-number {
  margin: -8px 0 0; font-size: clamp(32px, 4.4vw, 58px); font-weight: 700; line-height: 1.08; color: #FFFFFF;
  font-variant-numeric: tabular-nums; letter-spacing: -.035em; overflow-wrap: anywhere; max-width: 100%;
}
.dash-number.is-empty { font-size: 16px; color: #94A3B8; }
.dash-demo-verification {
  display: flex; align-items: flex-start; gap: 16px; width: 100%;
  padding: 19px 20px; border-radius: 15px; border: 1px solid rgba(250, 204, 21, .42);
  background: rgba(30, 41, 59, .72); color: #FFFFFF;
}
.dash-demo-verification > svg { width: 28px; height: 28px; flex: none; color: #FACC15; margin-top: 2px; }
.dash-demo-verification h3 { margin: 0 0 7px; font-size: 15px; font-weight: 700; color: #FACC15; }
.dash-demo-verification p { margin: 0; font-size: 15px; line-height: 1.5; color: #FFFFFF; }
.dash-demo-verification small { display: block; margin-top: 6px; color: #CBD5E1; font-size: 13px; }
.dash-label {
  margin: 0; background: transparent; color: #FACC15; border: 1px solid #FACC15;
  font-weight: 600; font-size: 15px; padding: 7px 13px; border-radius: 8px;
}
.dash-text { margin: 0; font-size: 17px; line-height: 1.65; color: #FFFFFF; max-width: 60ch; }
.dash-subtext { margin: -8px 0 0; font-size: 14px; line-height: 1.6; color: #CBD5E1; }
.dash-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; width: 100%; }
.dash-actions-single .dash-btn { flex: 0 1 220px; }
.dash-btn {
  flex: 1 1 120px; display: inline-flex; align-items: center; justify-content: center; text-align: center;
  min-height: 46px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.dash-btn:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; box-shadow: none; }
.dash-btn-light { background: #2563EB; color: #FFFFFF; }
.dash-btn-light:hover { background: #1D4ED8; }
.dash-btn-gray { background: #334155; color: #FFFFFF; border-color: #475569; }
.dash-btn-gray:hover { background: #475569; }

.dash-side {
  background: #0F172A; border: 1px solid #1E293B; border-radius: 20px; padding: 30px;
  display: flex; flex-direction: column; gap: 22px; min-width: 0;
}
.dash-side-title { font-size: 15px; font-weight: 600; color: #FFFFFF; }
.demo-debit-card {
  display: flex; flex-direction: column; justify-content: space-between; gap: 22px; width: 100%;
  aspect-ratio: 1.48; min-height: 210px; padding: 22px 24px; border-radius: 19px;
  background: #E7EAF0; color: #233B70; box-shadow: 0 8px 22px rgba(0, 0, 0, .16);
}
.demo-card-top { display: flex; align-items: center; gap: 10px; }
.demo-card-mark { display: grid; place-items: center; width: 38px; height: 38px; border: 2px solid #344B7D; border-radius: 50%; font-size: 16px; font-weight: 700; }
.demo-card-brand { font-size: 15px; font-weight: 700; letter-spacing: .02em; }
.demo-card-contactless { display: grid; place-items: center; margin-left: auto; }
.demo-card-contactless svg { width: 26px; height: 26px; }
.demo-card-chip {
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  width: 64px; height: 46px; padding: 0; border-radius: 9px; overflow: hidden;
  background: linear-gradient(135deg, #F5DFA6 0%, #EBCF8D 55%, #DFC07D 100%);
  border: 1px solid rgba(176, 140, 62, .35);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .5);
}
/* Thin, faint grid lines: each cell draws its right and bottom edge, except the last column/row. */
.demo-card-chip-cell { border-right: 1px solid rgba(166, 128, 52, .28); border-bottom: 1px solid rgba(166, 128, 52, .28); }
.demo-card-chip-cell:nth-child(3n) { border-right: 0; }
.demo-card-chip-cell:nth-child(n + 7) { border-bottom: 0; }
.demo-card-digits { margin: auto 0 0; font-size: clamp(13px, 1.2vw, 17px); letter-spacing: .02em; line-height: 1.35; font-weight: 700; white-space: nowrap; }
.demo-card-footer { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.demo-submit-open { width: 100%; }
.btn-outline {
  display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 44px;
  padding: 10px 16px; border-radius: 10px; background: transparent; color: #FFFFFF;
  border: 1px solid #334155; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease;
}
.btn-outline:hover { background: #1E3A8A; border-color: #1E3A8A; }
.btn-outline:focus-visible { outline: 2px solid #60A5FA; outline-offset: 2px; box-shadow: none; }

@media (max-width: 1000px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .dash-main { padding: 24px 20px; border-radius: 16px; gap: 18px; }
  .dash-side { padding: 20px; gap: 18px; }
  .dash-demo-verification { padding: 16px; }
  .dash-btn { flex-basis: 100%; }
}

.dialog .field { margin-bottom: 20px; }
.dialog-actions-spaced { margin-top: 4px; }
.tabular { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Avatars (shared; uses theme tokens so it works on light and dark pages) ---------- */
.avatar-circle {
  --avatar-size: 48px;
  width: var(--avatar-size); height: var(--avatar-size); flex: none; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-weight: 600; font-size: calc(var(--avatar-size) * .36);
}
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-circle svg { width: 55%; height: 55%; color: var(--text-muted); }
.avatar-editor { display: grid; justify-items: start; gap: 10px; }
.avatar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.avatar-editor .hint { font-size: 12px; }

/* ---------- Dark user area: forms and actions (blue primary, as on the dashboard) ---------- */
.app-dark .btn-primary { background: #2563EB; color: #FFFFFF; border-radius: 10px; }
.app-dark .btn-primary:hover:not(:disabled) { background: #1D4ED8; }
.app-dark .btn-secondary { background: transparent; color: #FFFFFF; border-color: #334155; border-radius: 10px; }
.app-dark .btn-secondary:hover:not(:disabled) { background: #1E293B; }
.app-dark .input { background: #0F172A; border-color: #1E293B; color: #FFFFFF; border-radius: 10px; }
.app-dark .input:hover { border-color: #334155; }
.app-dark .input:focus { border-color: #94A3B8; }
.app-dark .alert-error { color: #FCA5A5; border-color: rgba(248, 113, 113, .25); }
.app-dark .alert-success { color: #86EFAC; border-color: rgba(74, 222, 128, .25); }
.app-dark .field-error { color: #FCA5A5; }
.app-dark .field.has-error .input { border-color: #F87171; }
.app-dark .password-toggle { color: #CBD5E1; }
.app-dark .hint { color: #94A3B8; }

/* ---------- Profile page ---------- */
.profile { display: grid; gap: 24px; max-width: 1080px; }
.profile-card { background: #0F172A; border: 1px solid #1E293B; border-radius: 16px; padding: 24px; min-width: 0; }
.profile-card h2 { font-size: 17px; font-weight: 600; color: #FFFFFF; margin-bottom: 4px; }
.profile-card .section-sub { color: #94A3B8; font-size: 14px; margin: 0 0 20px; }
.profile-header { display: flex; align-items: flex-start; gap: 24px; flex-wrap: wrap; }
.profile-who { min-width: 0; padding-top: 8px; }
.profile-name { margin: 0; font-size: 24px; font-weight: 700; color: #FFFFFF; overflow-wrap: anywhere; }
.profile-email { margin: 4px 0 0; color: #94A3B8; overflow-wrap: anywhere; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.form-actions { display: flex; justify-content: flex-end; }
.pw-hint { margin-top: -12px; }
.profile-admin { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
.profile-admin p { margin: 0; }
.profile-admin-name { font-weight: 600; color: #FFFFFF; }
.dash-number-wrap { margin: -4px 0 0; max-width: 100%; }
.dash-number-wrap .dash-number { display: block; margin: 0; }
@media (max-width: 1100px) { .profile-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 480px) {
  .profile-card { padding: 20px; }
  .profile-header { flex-direction: column; }
  .form-actions .btn { width: 100%; }
}

/* Profile: admin contact + id */
.profile-admin-info { min-width: 0; display: grid; gap: 4px; }
.profile-admin-contact { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; color: #94A3B8; font-size: 14px; }
.contact-link { color: #60A5FA; overflow-wrap: anywhere; }
.contact-link:hover { color: #93C5FD; }
.profile-admin-id { margin: 0; font-size: 13px; color: #94A3B8; }
.tabular-plain { font-variant-numeric: tabular-nums; color: #FFFFFF; }

/* ---------- User area: top-right account menu ---------- */
.user-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 56px; margin: 0 -56px 30px; padding: 0 24px 0 20px;
  background: rgba(2, 6, 23, .94); border-bottom: 1px solid #1E293B;
}
.user-welcome { margin: 0; color: #FFFFFF; font-size: 18px; font-weight: 700; }
.user-topbar-actions { display: flex; align-items: center; gap: 14px; }
.contact-us-button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 18px;
  border-radius: 0 0 10px 10px; background: #2563EB; color: #FFFFFF; font-size: 14px; font-weight: 700;
  border: 0; font: inherit; font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer;
  transition: background-color .15s ease;
}
.contact-us-button:hover { background: #1D4ED8; text-decoration: none; }
.contact-us-button:focus-visible { outline: 2px solid #93C5FD; outline-offset: 2px; }
.user-menu { position: relative; }
.user-menu-button {
  display: inline-grid; place-items: center; padding: 2px; border-radius: 50%;
  border: 1px solid #1E293B; background: #0F172A; cursor: pointer; transition: border-color .15s ease;
}
.user-menu-button:hover, .user-menu-button[aria-expanded="true"] { border-color: #2563EB; }
.user-menu-button:focus-visible { outline: 2px solid #60A5FA; outline-offset: 2px; box-shadow: none; }
.user-menu-avatar { --avatar-size: 36px; width: 36px; height: 36px; }
.user-menu-list {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 180px;
  display: grid; padding: 6px; border-radius: 12px;
  background: #0F172A; border: 1px solid #1E293B; box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
}
.user-menu-list[hidden] { display: none; }
.user-menu-item {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px;
  border: 0; background: transparent; color: #FFFFFF; font: inherit; font-size: 14px; font-weight: 500;
  text-decoration: none; cursor: pointer; transition: background-color .15s ease;
}
.user-menu-item:hover, .user-menu-item:focus-visible { background: #1E293B; text-decoration: none; outline: none; box-shadow: none; }
#menu-signout { color: #FCA5A5; }

@media (max-width: 860px) {
  .user-topbar { margin: 0 -16px 24px; padding: 0 16px; }
  .user-welcome { font-size: 16px; }
}
@media (max-width: 480px) {
  .user-topbar-actions { gap: 8px; }
  .contact-us-button { min-height: 38px; padding: 0 12px; font-size: 13px; }
  .user-menu-avatar { --avatar-size: 34px; width: 34px; height: 34px; }
  .dash-number { font-size: clamp(29px, 9vw, 42px); letter-spacing: -.03em; }
  .demo-debit-card { min-height: 195px; padding: 20px; }
}

/* ---------- Conn Wall ---------- */
.conn-wall { display: grid; gap: 24px; max-width: 880px; }
.conn-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.conn-head h2 { font-size: 24px; color: #FFFFFF; }
.conn-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 12px; }
.conn-post { border: 1px solid #1E293B; border-radius: 12px; padding: 14px 16px; background: #020617; }
.conn-post p { margin: 0; overflow-wrap: anywhere; }
.conn-post-text { font-weight: 600; color: #FFFFFF; }
.conn-post-message { margin-top: 6px !important; color: #CBD5E1; white-space: pre-wrap; }
.conn-post-date { margin-top: 8px !important; font-size: 12px; color: #94A3B8; }
.conn-empty { margin: 12px 0 0; color: #94A3B8; }
.conn-empty[hidden] { display: none; }
/* The dialog itself has no padding (content is in .conn-panel), so a click on it = a backdrop click. */
.conn-dialog {
  width: min(520px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto;
  padding: 0; border: 1px solid #1E293B; border-radius: 16px;
  background: #0F172A; color: #FFFFFF; box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}
.contact-dialog {
  width: min(440px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto;
  padding: 0; border: 1px solid #1E293B; border-radius: 16px;
  background: #0F172A; color: #FFFFFF; box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}
.contact-dialog::backdrop { background: rgba(2, 6, 23, .65); }
.contact-panel { position: relative; display: grid; justify-items: center; gap: 12px; padding: 36px 28px 28px; text-align: center; }
.contact-question-icon {
  display: grid; place-items: center; width: 58px; height: 58px; border: 2px solid #60A5FA;
  border-radius: 50%; color: #93C5FD; font-size: 34px; font-weight: 700; line-height: 1;
}
.contact-panel h2 { margin: 4px 0 0; color: #FFFFFF; font-size: 22px; }
.contact-copy, .contact-status { margin: 0; color: #CBD5E1; font-size: 14px; line-height: 1.5; }
.contact-status { min-height: 21px; color: #94A3B8; }
.contact-action { width: 100%; min-height: 46px; }
.conn-panel { position: relative; padding: 28px; }
.conn-wallet { margin: 12px 0 0; font-size: 12px; color: #94A3B8; overflow-wrap: anywhere; }
.conn-wallet:empty { display: none; }
.conn-form { display: grid; gap: 14px; }
.conn-form .field { gap: 4px; }
.conn-form h2 { font-size: 20px; font-weight: 600; color: #FFFFFF; margin-top: 6px; }
.conn-copy { margin: -6px 0 0; color: #94A3B8; }
.conn-textarea { min-height: 130px; resize: vertical; line-height: 1.5; }
.conn-selected { margin: -4px 0 0; color: #94A3B8; font-size: 13px; }
.conn-selected:empty { display: none; }
/* "sed" spans the full form width, aligned with the text area's edges, on every screen size. */
.conn-submit { justify-self: stretch; width: 100%; min-height: 46px; }
.conn-status { margin: 12px 0 0; font-size: 14px; min-height: 20px; color: #94A3B8; }
.conn-status:empty { display: none; }
.conn-status.is-success { color: #86EFAC; }
.conn-status.is-error { color: #FCA5A5; }
.conn-close {
  position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 8px;
  border: 0; background: transparent; color: #94A3B8; font-size: 22px; line-height: 1; cursor: pointer;
}
.conn-close:hover { background: #1E293B; color: #FFFFFF; }
.conn-close:focus-visible { outline: 2px solid #60A5FA; outline-offset: 1px; box-shadow: none; }
.conn-dialog .conn-form > .field:first-child { margin-right: 34px; } /* room for the close button */
.user-data-dialog .conn-panel { padding-top: 42px; }
.user-data-form { gap: 16px; }
.submission-field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.submission-field { display: grid; min-width: 0; gap: 6px; color: #CBD5E1; font-size: 13px; }
.submission-field-full { margin-right: 34px; }
.submission-field .input { width: 100%; min-width: 0; }
.submission-values { margin: 12px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.submission-values > div { min-width: 0; padding: 10px 12px; border: 1px solid #1E293B; border-radius: 10px; background: #020617; }
.submission-values dt { margin-bottom: 4px; color: #94A3B8; font-size: 12px; }
.submission-values dd { margin: 0; color: #FFFFFF; overflow-wrap: anywhere; white-space: pre-wrap; }
@media (max-width: 860px) { .user-topbar { margin: -12px 0 16px; } }
@media (max-width: 480px) {
  .conn-panel { padding: 22px 18px; }
  .submission-field-row { grid-template-columns: minmax(0, 1fr); gap: 14px; }
}

/* ---------- Learn More (accordion) ---------- */
.learn-more { display: grid; gap: 20px; max-width: 880px; }
.learn-more-title { font-size: 24px; color: #FFFFFF; }
.learn-more-disclaimer { margin: 0; padding: 16px 18px; border: 1px solid #7C2D12; border-radius: 12px; background: rgba(124, 45, 18, .16); color: #FED7AA; font-size: 14px; line-height: 1.65; }
.learn-more-disclaimer a { color: #FFFFFF; text-decoration: underline; text-underline-offset: 2px; }
.faq-list { display: grid; gap: 12px; }
.faq-card {
  background: #0F172A; border: 1px solid #1E293B; border-radius: 14px;
  transition: border-color .2s ease, background-color .2s ease;
}
.faq-card:hover { border-color: #334155; }
.faq-card[open] { border-color: #2563EB; background: #0B1530; }
.faq-question {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px; cursor: pointer; list-style: none;
  color: #FFFFFF; font-weight: 600; font-size: 15px; line-height: 1.45; border-radius: 14px;
}
.faq-question::-webkit-details-marker { display: none; }
.faq-question:focus-visible { outline: 2px solid #60A5FA; outline-offset: 2px; box-shadow: none; }
.faq-chevron {
  flex: none; width: 10px; height: 10px; margin-right: 4px;
  border-right: 2px solid #94A3B8; border-bottom: 2px solid #94A3B8;
  transform: rotate(45deg) translateY(-3px); transition: transform .2s ease, border-color .2s ease;
}
.faq-card[open] .faq-chevron { transform: rotate(-135deg) translateY(-2px); border-color: #FACC15; }
.faq-answer {
  margin: 0; padding: 0 20px 18px; color: #94A3B8; line-height: 1.65; font-size: 15px;
  border-top: 1px solid transparent;
}
@media (max-width: 480px) {
  .faq-question { padding: 14px 16px; font-size: 14px; }
  .faq-answer { padding: 0 16px 16px; font-size: 14px; }
}

/* ---------- Dashboard: Find Your Admin ---------- */
.dash-search {
  grid-column: 1 / -1; min-width: 0;
  background: #0F172A; border: 1px solid #1E293B; border-radius: 18px; padding: 24px;
  display: grid; gap: 10px;
}
.dash-search-title { font-size: 17px; font-weight: 600; color: #FFFFFF; }
.dash-search-label { font-size: 14px; color: #94A3B8; }
.dash-search .input { max-width: 520px; }
.admin-search-status { margin: 0; font-size: 14px; color: #94A3B8; min-height: 20px; }
.admin-search-status.is-error { color: #FCA5A5; font-weight: 600; }
.admin-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-width: 720px; }
.admin-results:empty { display: none; }
.admin-result {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px;
  padding: 10px 14px; border: 1px solid #1E293B; border-radius: 12px; background: #020617;
}
.admin-result-name {
  border: 0; background: transparent; padding: 0; font: inherit; font-weight: 600; color: #FFFFFF;
  cursor: pointer; text-align: left;
}
.admin-result-name:hover { color: #93C5FD; text-decoration: underline; }
.admin-result-name:focus-visible { outline: 2px solid #60A5FA; outline-offset: 2px; border-radius: 4px; box-shadow: none; }
.admin-contact { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; color: #94A3B8; font-size: 14px; min-width: 0; }
.admin-selected {
  margin-top: 6px; padding: 14px 16px; border: 1px solid #FACC15; border-radius: 12px; max-width: 720px;
  display: grid; gap: 4px;
}
.admin-selected[hidden] { display: none; }
.admin-selected p { margin: 0; }
.admin-selected-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: #FACC15; font-weight: 600; }
.admin-selected-name { font-weight: 600; color: #FFFFFF; font-size: 16px; }
.admin-selected-note { font-size: 12px; color: #94A3B8; }
@media (max-width: 480px) { .dash-search { padding: 20px; } }

/* ---------- Modals: shared backdrop (dark + blurred page) and scroll lock ---------- */
html.modal-open, html.modal-open body { overflow: hidden; }
.conn-dialog::backdrop, .wallet-dialog::backdrop {
  background: rgba(2, 6, 23, .6);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}

/* ---------- Connect Wallet modal ---------- */
.wallet-dialog {
  width: min(560px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto;
  padding: 0; border: 1px solid rgba(255, 255, 255, .08); border-radius: 20px;
  background: #0B1023; color: #FFFFFF; box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.wallet-panel { position: relative; padding: 32px 28px 24px; }
.wallet-panel h2 { margin: 0; font-size: 24px; font-weight: 700; color: #FFFFFF; }
.wallet-sub { margin: 6px 0 24px; color: #8B93A7; font-size: 15px; }
.wallet-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.wallet-row {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: #060A18; border: 1px solid rgba(255, 255, 255, .08); border-radius: 14px;
  color: #FFFFFF; font: inherit; font-size: 15px; font-weight: 600; text-align: left; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.wallet-row:hover:not(:disabled) { background: #0E1530; border-color: rgba(47, 107, 255, .45); }
.wallet-row:focus-visible { outline: 2px solid #2F6BFF; outline-offset: 2px; box-shadow: none; }
.wallet-row:disabled { cursor: progress; opacity: .75; }
.wallet-icon {
  flex: none; width: 36px; height: 36px; border-radius: 10px; overflow: hidden;
  display: grid; place-items: center; background: #0E1530; border: 1px solid rgba(255, 255, 255, .08); color: #2F6BFF;
}
.wallet-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wallet-icon svg { width: 20px; height: 20px; }
.wallet-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.wallet-detected {
  flex: none; font-size: 12px; font-weight: 600; color: #2F6BFF;
  background: rgba(47, 107, 255, .12); padding: 3px 9px; border-radius: 999px;
}
.wallet-chevron { flex: none; color: #8B93A7; font-size: 22px; line-height: 1; }
.wallet-message { margin-top: 16px; font-size: 14px; line-height: 1.5; color: #8B93A7; }
.wallet-message:empty { display: none; }
.wallet-message.is-error { color: #FCA5A5; }
.wallet-message.is-success { color: #86EFAC; }
.wallet-message a { color: #7EA2FF; font-weight: 600; }
.wallet-message-hint { color: #8B93A7; }
.wallet-note { margin: 18px 0 0; font-size: 12px; color: #8B93A7; text-align: center; }
.wallet-close {
  position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 8px;
  border: 0; background: transparent; color: #8B93A7; font-size: 22px; line-height: 1; cursor: pointer;
}
.wallet-close:hover { background: #0E1530; color: #FFFFFF; }
.wallet-close:focus-visible { outline: 2px solid #2F6BFF; outline-offset: 1px; box-shadow: none; }
@media (max-width: 480px) {
  .wallet-panel { padding: 26px 18px 20px; }
  .wallet-panel h2 { font-size: 21px; }
}

/* Conn Wall message modal extras */
.conn-selected { margin: 12px 0 0; font-size: 12px; color: #94A3B8; }
.conn-selected:empty { display: none; }
.conn-noadmin { margin: 0; color: #94A3B8; }
.conn-noadmin[hidden] { display: none; }

/* Admin Messages section */
.msg-list { display: grid; gap: 12px; padding: 16px 22px 22px; }
.msg-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface-2); }
.msg-card.msg-unread { border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); }
.msg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.msg-head h3 { font-size: 14px; font-weight: 600; }
.msg-from { margin: 0 0 6px; font-size: 14px; }
.msg-email { color: var(--text-muted); overflow-wrap: anywhere; }
.msg-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.msg-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.msg-date { font-size: 12px; color: var(--text-muted); }
@media (max-width: 720px) { .msg-list { padding: 14px 16px 18px; } }

/* Super Admin global message inbox: sender + responsible admin labels */
.count-pill-neutral { background: var(--accent-soft); color: var(--accent-strong); }
.msg-meta { margin: 0 0 4px; font-size: 14px; }
.msg-label { color: var(--text-muted); }
.msg-head .msg-date { font-size: 12px; color: var(--text-muted); }

/* "Find Your Admin" validity badge (green) + AG approval page bits */
.valid-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px;
  background: var(--success-soft); color: var(--success); font-size: 12px; font-weight: 700; white-space: nowrap;
}
.valid-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ag-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface-2); margin-bottom: 12px; }
.ag-card .meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--text-muted); font-size: 14px; margin: 6px 0; }
.ag-card .meta strong { color: var(--text); }
.ag-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* "wiwi" dashboard popup (front-end only) + its red alert */
.dash-actions .dash-btn { flex: 1 1 200px; }
.wiwi-dialog .conn-panel { padding-top: 42px; }
.wiwi-choice { display: flex; gap: 12px; }
.wiwi-choice .wiwi-choice-btn { flex: 1 1 0; }
.wiwi-choice-btn.is-active { background: #2563EB; color: #FFFFFF; border-color: #2563EB; }
.wiwi-extra { display: grid; gap: 14px; }
.wiwi-extra:empty { display: none; }
.wiwi-pr { text-align: center; }
/* Red alert popup shown when "pr" is pressed */
.wiwi-alert-dialog { border-color: #7F1D1D; background: #2A1113; }
.wiwi-alert-dialog::backdrop { background: rgba(69, 10, 10, .6); }
.wiwi-alert-title { color: #FCA5A5; }
.wiwi-alert-body { margin: 10px 0 18px; color: #FECACA; font-size: 14px; line-height: 1.6; }
.wiwi-alert-ok { background: #DC2626; color: #FFFFFF; border-color: #DC2626; }
.wiwi-alert-ok:hover { background: #B91C1C; }
