:root,
html[data-theme="light"] {
  --sidebar-width: 260px;
  --sidebar-collapsed: 76px;
  --sidebar-bg: #111827;
  --sidebar-text: #e5e7eb;
  --frame-bg: #f3f4f6;
  --topbar-bg: #111827;
  --topbar-text: #fff;
  --topbar-muted: #e5e7eb;
  --card-bg: #fff;
  --card-border: #e5e7eb;
  --text: #212529;
  --muted: #6c757d;
  --accent: #2563eb;
  --table-stripe: rgba(0, 0, 0, 0.03);
  --input-bg: #fff;
  color-scheme: light;
}

html[data-theme="dark"] {
  --sidebar-bg: #020617;
  --sidebar-text: #e2e8f0;
  --frame-bg: #0f172a;
  --topbar-bg: #020617;
  --topbar-text: #f8fafc;
  --topbar-muted: #cbd5e1;
  --card-bg: #1e293b;
  --card-border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --table-stripe: rgba(255, 255, 255, 0.04);
  --input-bg: #0f172a;
  color-scheme: dark;
}

html[data-theme="forest"] {
  --sidebar-bg: #0c2f24;
  --sidebar-text: #e8f0ea;
  --frame-bg: #eef4ef;
  --topbar-bg: #0f3d2e;
  --topbar-text: #f8f5ea;
  --topbar-muted: #e8c872;
  --card-bg: #f7fbf7;
  --card-border: #c9d9cc;
  --text: #143226;
  --muted: #4d6b5c;
  --accent: #0f3d2e;
  --table-stripe: rgba(15, 61, 46, 0.05);
  --input-bg: #fff;
  color-scheme: light;
}

html { font-size: 14px; height: 100%; }
@media (min-width: 768px) { html { font-size: 16px; } }

body.app-body {
  margin: 0;
  min-height: 100%;
  background: var(--frame-bg);
  color: var(--text);
}

a { color: var(--accent); }
h1 { font-size: 1.5rem; font-weight: 650; margin: 0 0 0.75rem; }
h2 { font-size: 1.15rem; font-weight: 650; }
img { max-width: 100%; }

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease, transform 0.2s ease;
  overflow: hidden;
}
.app-sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar-brand { display: flex; align-items: center; gap: 0.5rem; padding: 0.9rem 0.85rem; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.sidebar-brand-link { display: flex; align-items: center; gap: 0.65rem; color: #fff; text-decoration: none; min-width: 0; flex: 1; }
.sidebar-mark {
  width: 2rem; height: 2rem; border-radius: 0.5rem; background: #2563eb; color: #fff;
  display: grid; place-items: center; font-weight: 700; flex: none; font-size: 0.78rem;
}
.sidebar-brand-copy { display: flex; flex-direction: column; min-width: 0; }
.sidebar-brand-text { font-weight: 650; white-space: nowrap; }
.sidebar-role { font-size: 0.7rem; font-weight: 500; color: #9ca3af; letter-spacing: 0.04em; text-transform: uppercase; }
.app-sidebar.collapsed .sidebar-brand-text,
.app-sidebar.collapsed .sidebar-label,
.app-sidebar.collapsed .sidebar-section,
.app-sidebar.collapsed .sidebar-role { display: none; }
.sidebar-nav { padding: 0.75rem 0.6rem 1.5rem; overflow: auto; flex: 1; }
.sidebar-section { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: #9ca3af; padding: 0.85rem 0.7rem 0.35rem; }
.sidebar-link {
  display: flex; align-items: center; gap: 0.7rem; color: #d1d5db; text-decoration: none;
  padding: 0.55rem 0.7rem; border-radius: 0.55rem; margin-bottom: 0.15rem; white-space: nowrap;
}
.sidebar-link:hover, .sidebar-link.active { background: rgba(37, 99, 235, 0.28); color: #fff; }
.sidebar-ico { width: 1.25rem; text-align: center; flex: none; }

.app-frame { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left 0.2s ease; }
.app-sidebar.collapsed ~ .app-frame { margin-left: var(--sidebar-collapsed); }
.app-body.no-sidebar .app-frame { margin-left: 0; }

.app-topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 0.75rem;
  min-height: 3.5rem; padding: 0.5rem 1.25rem; background: var(--topbar-bg); color: var(--topbar-text);
}
.topbar-brand { display: flex; align-items: center; gap: 0.5rem; color: var(--topbar-text); text-decoration: none; font-weight: 600; white-space: nowrap; }
.topbar-brand:hover { color: var(--topbar-text); }
.topbar-user { margin-left: auto; }
.topbar-title { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-account { display: flex; align-items: center; gap: 0.75rem; }
.topbar-link { color: var(--topbar-muted); text-decoration: none; white-space: nowrap; }
.page-nav { display: flex; align-items: center; gap: 0.4rem; flex: none; }
.page-nav-page { margin: 0 0 1rem; }
.theme-form { margin: 0; }
.theme-select { width: auto; min-width: 7.5rem; background: rgba(255, 255, 255, 0.12); color: var(--topbar-text); border-color: rgba(255, 255, 255, 0.28); }
.theme-select option { color: #111827; }
.app-topbar .sidebar-toggle { border: 0; background: transparent; color: var(--topbar-text); width: 2rem; height: 2rem; border-radius: 0.4rem; display: grid; place-items: center; padding: 0; }
.app-topbar .sidebar-toggle:hover { background: rgba(255, 255, 255, 0.08); }
.sidebar-toggle-icon, .sidebar-toggle-icon::before, .sidebar-toggle-icon::after { display: block; width: 14px; height: 2px; background: currentColor; position: relative; }
.sidebar-toggle-icon::before, .sidebar-toggle-icon::after { content: ""; position: absolute; left: 0; }
.sidebar-toggle-icon::before { top: -5px; }
.sidebar-toggle-icon::after { top: 5px; }

.app-content { flex: 1; padding: 1.25rem 1.5rem 2rem; }
.app-footer { padding: 0.75rem 1.5rem 1.25rem; font-size: 0.8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.35rem 0.55rem; align-items: center; }
.app-footer a { color: inherit; text-underline-offset: 0.15em; }
.footer-sep { opacity: 0.55; }

.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); width: var(--sidebar-width) !important; }
  .app-sidebar.mobile-open { transform: translateX(0); }
  .app-frame, .app-sidebar.collapsed ~ .app-frame { margin-left: 0; }
  .app-sidebar.collapsed .sidebar-brand-text,
  .app-sidebar.collapsed .sidebar-label,
  .app-sidebar.collapsed .sidebar-role,
  .app-sidebar.collapsed .sidebar-section { display: revert; }
  .app-sidebar.mobile-open ~ .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 1030; }
}

.activation-hero {
  background: linear-gradient(135deg, #0f3d2e 0%, #163a5f 58%, #111827 100%);
  color: #fff; border-radius: 1rem; padding: 1.75rem 1.5rem 1.5rem; margin-bottom: 1.75rem;
}
.activation-kicker { letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.75rem; opacity: 0.8; margin-bottom: 0.35rem; }
.activation-title { font-size: clamp(1.6rem, 3vw, 2.35rem); font-weight: 700; margin-bottom: 0.65rem; color: #fff; }
.activation-lead { max-width: 42rem; opacity: 0.92; margin-bottom: 1.25rem; }
.activation-card, .card, .panel, .plan, .provider {
  background: var(--card-bg); border: 1px solid var(--card-border); color: var(--text); border-radius: 0.85rem;
}
.activation-card, .card, .panel, .plan { padding: 1.1rem 1.15rem; }
.activation-card-tag {
  display: inline-block; font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase;
  background: #0f3d2e; color: #e8c872; border-radius: 999px; padding: 0.15rem 0.55rem; margin-bottom: 0.55rem;
}
.text-muted, .note, .lede { color: var(--muted) !important; }
.card h2, .panel h2, .plan h2 { margin-top: 0; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; margin: 0 0 1rem; }
.metric .note { font-size: 0.8rem; }
.metric strong { display: block; font-size: 1.5rem; font-weight: 650; }
.grid-3, .grid-2, .split { display: grid; gap: 1rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.split { grid-template-columns: 1.15fr 0.85fr; align-items: start; }
.bars { display: grid; gap: 0.65rem; }
.bar-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 0.65rem; align-items: center; }
.bar { height: 8px; border-radius: 999px; background: var(--card-border); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }
.actions, .row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.stack { display: grid; gap: 0.9rem; }

.button, button.button, .button-secondary {
  display: inline-flex; align-items: center; justify-content: center; border-radius: 0.375rem;
  padding: 0.35rem 0.75rem; text-decoration: none; border: 1px solid transparent;
  font: 600 0.875rem/1.4 inherit; cursor: pointer;
}
.button { background: var(--accent); color: #fff; }
.button:hover { filter: brightness(1.08); color: #fff; }
.button-secondary { background: transparent; border-color: var(--card-border); color: var(--text); }
.button.clay { background: #b84322; border-color: #b84322; color: #fff; }
.text-button { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; }

label { display: grid; gap: 0.35rem; font-weight: 600; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--input-bg);
  border: 1px solid var(--card-border); border-radius: 0.5rem; padding: 0.5rem 0.7rem;
}
input[type="radio"], input[type="checkbox"], input[type="hidden"] { width: auto; }
textarea { min-height: 110px; resize: vertical; }
.form-grid { display: grid; gap: 0.9rem; }
.field-error, .validation-summary-errors { color: #b91c1c; }
.validation-summary-errors ul { margin: 0.4rem 0; padding-left: 1.1rem; }
.honeypot { position: absolute; left: -10000px; height: 0; overflow: hidden; }
.inline { display: flex; gap: 0.65rem; align-items: center; }
.days { display: grid; gap: 0.5rem; }
.day { display: grid; grid-template-columns: 140px 1fr 1fr; gap: 0.5rem; align-items: center; }
.day label, .check { font-weight: 500; }
.check { display: flex; gap: 0.5rem; align-items: center; }
.roles { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }
.roles label { border: 1px solid var(--card-border); border-radius: 0.75rem; padding: 0.75rem; font-weight: 500; background: var(--card-bg); }
.code input { font-size: 1.4rem; letter-spacing: 0.4em; text-align: center; }
.demo { background: rgba(232, 200, 114, 0.16); border: 1px dashed #e2c48a; border-radius: 0.85rem; padding: 0.9rem; }
.demo code { font-family: Consolas, monospace; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--card-border); vertical-align: top; }
tbody tr:nth-child(even) { background: var(--table-stripe); }
.providers { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.provider { overflow: hidden; display: grid; grid-template-columns: 148px 1fr; }
.provider img, .portrait { width: 100%; height: 100%; object-fit: cover; background: #d9e3db; min-height: 180px; }
.provider div, .portrait-wrap { padding: 0.9rem; }
.stars { color: #8d5b12; letter-spacing: 0.08em; }
.rate { font-size: 1.35rem; font-weight: 650; }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0; margin: 0.5rem 0; list-style: none; }
.chips li, .badge { border-radius: 999px; padding: 0.2rem 0.5rem; background: var(--table-stripe); border: 1px solid var(--card-border); font-size: 0.85rem; }
.badge.pending, .badge.pendingreview { background: #fff3d6; }
.badge.approved { background: #e5f6ef; }
.badge.rejected { background: #fdece7; }
.workflow { margin: 0; padding-left: 1.1rem; }
.workflow .current { font-weight: 700; }
.decline { display: flex; gap: 0.5rem; align-items: center; }
.decline input { width: 220px; }
.map { height: 360px; border-radius: 0.75rem; border: 1px solid var(--card-border); margin: 0.75rem 0; background: var(--card-bg); }
.camera { background: #111827; border-radius: 0.85rem; overflow: hidden; }
.camera video, .camera img { width: 100%; display: block; max-height: 320px; object-fit: cover; }
.camera-bar { display: flex; justify-content: space-between; gap: 0.5rem; align-items: center; padding: 0.65rem; color: #f8f5ea; }
.captcha { display: flex; gap: 0.75rem; align-items: center; }
.review-photos { display: grid; grid-template-columns: 240px 1fr; gap: 0.75rem; }
.review-photos img { width: 100%; border-radius: 0.75rem; background: #d9e3db; }
.mail { white-space: pre-wrap; font-family: Consolas, monospace; background: var(--table-stripe); padding: 0.65rem; border-radius: 0.65rem; }
.kicker { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.75rem; color: var(--topbar-muted); }

body.auth-shell { background: #07111f; color: #e2e8f0; }
body.auth-shell .app-frame { position: relative; z-index: 2; min-height: 100vh; background: transparent; }
body.auth-shell .app-footer { position: relative; z-index: 3; justify-content: center; color: #94a3b8; text-align: center; }
body.auth-shell .app-footer a { color: #cbd5e1; }
.auth-backdrop {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(37, 99, 235, 0.35), transparent 55%),
    radial-gradient(900px 500px at 90% 110%, rgba(14, 165, 233, 0.22), transparent 50%),
    linear-gradient(160deg, #07111f 0%, #0b1b33 45%, #10243f 100%);
}
.auth-backdrop::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 50% 45%, #000 20%, transparent 78%);
}
.auth-stage { min-height: calc(100vh - 5.5rem); display: flex; align-items: flex-start; justify-content: center; padding: 1.5rem 1rem 1rem; }
.auth-card {
  width: min(420px, 100%); margin: 0.5rem auto; background: rgba(255, 255, 255, 0.96); color: #0f172a;
  border-radius: 1.15rem; box-shadow: 0 24px 80px rgba(2, 6, 23, 0.45); padding: 1.75rem 1.65rem 1.85rem; position: relative; z-index: 3;
}
.auth-card:has(.split) { width: min(920px, 100%); }
html[data-theme="dark"] .auth-card { background: rgba(15, 23, 42, 0.94); color: #e2e8f0; }
.auth-brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: inherit; margin-bottom: 1rem; }
.auth-brand strong { display: block; }
.auth-brand small { display: block; color: #64748b; font-size: 0.78rem; }

.app-toast-host {
  position: fixed; top: 1rem; right: 1rem; z-index: 2000; display: flex; flex-direction: column; gap: 0.65rem;
  width: min(26rem, calc(100vw - 1.5rem)); pointer-events: none;
}
.app-toast {
  pointer-events: auto; display: grid; grid-template-columns: 0.35rem 1fr auto; align-items: start; gap: 0.7rem;
  padding: 0.85rem 0.85rem 0.85rem 0; border-radius: 0.85rem; background: #fff; color: #0f172a;
  border: 1px solid #e2e8f0; box-shadow: 0 16px 40px rgba(15, 23, 42, 0.28); animation: app-toast-in 0.22s ease-out;
}
html[data-theme="dark"] .app-toast { background: #1e293b; color: #e2e8f0; border-color: #334155; }
.app-toast-bar { align-self: stretch; border-radius: 0.85rem 0 0 0.85rem; }
.app-toast.success .app-toast-bar { background: #16a34a; }
.app-toast.error .app-toast-bar { background: #dc2626; }
.app-toast.warning .app-toast-bar { background: #d97706; }
.app-toast.info .app-toast-bar { background: #2563eb; }
.app-toast-title { font-weight: 700; font-size: 0.82rem; letter-spacing: 0.02em; text-transform: uppercase; margin-bottom: 0.15rem; }
.app-toast.success .app-toast-title { color: #15803d; }
.app-toast.error .app-toast-title { color: #b91c1c; }
.app-toast.warning .app-toast-title { color: #b45309; }
.app-toast-text { font-size: 0.92rem; line-height: 1.35; word-break: break-word; }
.app-toast-close { border: 0; background: transparent; color: #64748b; width: 1.75rem; height: 1.75rem; border-radius: 0.4rem; line-height: 1; font-size: 1.1rem; }
@keyframes app-toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 800px) {
  .grid-3, .grid-2, .split, .providers, .provider, .review-photos, .roles, .day, .metrics, .bar-row { grid-template-columns: 1fr; }
  .activation-hero { padding: 1.25rem 1rem 1.15rem; }
  .topbar-title { display: none; }
}
