@font-face {
  font-family: "Be Vietnam Pro";
  src: url("../fonts/BeVietnamPro-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Be Vietnam Pro";
  src: url("../fonts/BeVietnamPro-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Be Vietnam Pro";
  src: url("../fonts/BeVietnamPro-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Be Vietnam Pro";
  src: url("../fonts/BeVietnamPro-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --surface: #f7f9ff;
  --surface-low: #f0f4fb;
  --surface-container: #eaeef5;
  --surface-high: #e4e8f0;
  --card: #ffffff;
  --text: #171c21;
  --muted: #5d6472;
  --outline: #c3c9d8;
  --outline-soft: #e1e6ef;
  --primary: #0052cd;
  --primary-bright: #2c6bed;
  --primary-soft: #dae5ff;
  --success: #0a9d53;
  --success-soft: #e7f8ee;
  --warning: #ad6900;
  --warning-soft: #fff3d9;
  --danger: #ba1a1a;
  --danger-soft: #ffdad6;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --sidebar-width: 264px;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0;
  color: var(--text);
  background: var(--surface);
  font-family: "Be Vietnam Pro", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 80;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 24px 16px 16px;
  border-right: 1px solid var(--outline);
  background: var(--card);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
  color: var(--text);
  text-decoration: none;
}
.brand-symbol {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: var(--primary-bright);
  font-size: 20px;
  font-weight: 700;
}
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand strong { color: var(--primary); font-size: 20px; line-height: 1.2; letter-spacing: -.02em; }
.sidebar-brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.sidebar-nav { display: grid; gap: 4px; margin-top: 32px; }
.nav-section-label {
  margin: 0 12px 7px;
  color: #8a93a2;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.nav-section-label.admin-label { margin-top: 20px; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #424a58;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background-color .15s, color .15s, border-color .15s;
}
.sidebar-link:hover { color: var(--primary); background: var(--surface-low); }
.sidebar-link.active {
  color: var(--primary);
  border-color: #c9d9fa;
  background: var(--primary-soft);
  font-weight: 700;
}
.nav-icon {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  font-size: 19px;
  line-height: 1;
}
.sidebar-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 15px 12px;
  border-top: 1px solid var(--outline-soft);
}
.sidebar-status strong, .sidebar-status small { display: block; }
.sidebar-status strong { font-size: 11px; }
.sidebar-status small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.status-dot, .system-badge i, .worker-badge i {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: #20c267;
  box-shadow: 0 0 0 4px #e5f8ed;
}
.sidebar-overlay { display: none; }

.app-stage {
  display: flex;
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  flex-direction: column;
}
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--outline);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(12px);
}
.topbar-heading, .topbar-actions, .account-menu { display: flex; align-items: center; }
.topbar-heading { gap: 12px; min-width: 0; }
.topbar-heading h1 { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.3; }
.topbar-kicker { display: none; color: var(--primary); font-size: 9px; font-weight: 700; letter-spacing: .1em; }
.topbar-actions { gap: 12px; }
.global-search {
  display: flex;
  width: min(320px, 28vw);
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--outline);
  border-radius: 999px;
  background: var(--surface-low);
  color: #747d8d;
}
.global-search:focus-within { border-color: var(--primary-bright); }
.global-search span { font-size: 20px; line-height: 1; }
.global-search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12px; }
.system-badge, .worker-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid #c7ead4;
  border-radius: 999px;
  color: #087c43;
  background: #f3fbf6;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.system-badge i, .worker-badge i { width: 7px; height: 7px; flex-basis: 7px; box-shadow: none; }
.mobile-menu-button {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--outline);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}
.account-menu { gap: 8px; }
.account-chip {
  display: flex;
  max-width: 210px;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
}
.account-chip-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 1px solid #b9c8e6;
  border-radius: 50%;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 700;
}
.account-chip-name { overflow: hidden; max-width: 130px; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 600; }
.logout-button, .topbar-action {
  border: 1px solid var(--outline);
  border-radius: 8px;
  padding: 8px 10px;
  color: #4f5867;
  background: #fff;
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
}
.logout-button:hover, .topbar-action:hover { border-color: var(--primary); color: var(--primary); }
.topbar-action:not(.muted) { border-color: var(--primary-bright); color: #fff; background: var(--primary-bright); }
.account-menu form { margin: 0; }

.app-content { width: 100%; max-width: 1480px; margin: 0 auto; padding: 24px 28px 40px; flex: 1; }
.app-footer { padding: 16px 28px 22px; color: #7e8797; font-size: 10px; }

.page-heading { margin: 0 0 20px; }
.page-heading.compact { margin-bottom: 16px; }
.page-heading h1 { margin: 5px 0 4px; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.page-heading p { max-width: 760px; margin: 0; color: var(--muted); font-size: 13px; }
.eyebrow, .card-label {
  display: block;
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.eyebrow.dark { color: var(--muted); }

.hero-panel {
  position: relative;
  display: flex;
  min-height: 190px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  overflow: hidden;
  padding: 28px 32px;
  border-radius: var(--radius-lg);
  color: #fff;
  background: var(--primary-bright);
}
.hero-panel::after {
  position: absolute;
  right: -45px;
  bottom: -85px;
  width: 220px;
  height: 220px;
  border: 28px solid rgba(255,255,255,.14);
  border-radius: 44px;
  transform: rotate(20deg);
  content: "";
}
.hero-panel > * { position: relative; z-index: 1; }
.hero-panel .eyebrow { color: rgba(255,255,255,.78); }
.hero-panel h1 { margin: 8px 0; font-size: 32px; font-weight: 700; letter-spacing: -.025em; }
.hero-panel p { max-width: 680px; margin: 0; color: rgba(255,255,255,.82); font-size: 13px; }
.primary-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--primary-bright);
  border-radius: 9px;
  padding: 10px 17px;
  color: #fff;
  background: var(--primary-bright);
  font-weight: 700;
  text-decoration: none;
  transition: background-color .15s;
}
.primary-button:hover { border-color: #003fa3; color: #fff; background: #003fa3; }
.hero-panel .primary-button { border-color: #fff; color: var(--primary); background: #fff; white-space: nowrap; }
.hero-panel .primary-button:hover { color: #fff; background: rgba(255,255,255,.14); }

.subscription-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
  margin: 16px 0;
  padding: 17px 20px;
  border: 1px solid var(--outline);
  border-radius: var(--radius-md);
  background: var(--card);
}
.subscription-banner > div { display: grid; gap: 2px; }
.subscription-banner strong { color: var(--primary); font-size: 18px; }
.subscription-banner > span { color: var(--muted); font-size: 12px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 16px 0 20px; }
.stat-card {
  position: relative;
  min-height: 128px;
  padding: 18px;
  border: 1px solid var(--outline);
  border-radius: var(--radius-md);
  background: var(--card);
  transition: border-color .15s;
}
.stat-card:hover { border-color: var(--primary-bright); }
.stat-card::before {
  display: grid;
  width: 40px;
  height: 40px;
  margin-bottom: 10px;
  place-items: center;
  border-radius: 10px;
  color: var(--primary);
  background: var(--surface-container);
  content: "▦";
  font-size: 18px;
}
.stat-card.stat-green::before { color: var(--success); content: "●"; }
.stat-card.stat-amber::before { color: var(--warning); content: "↻"; }
.stat-card span, .stat-card strong, .stat-card small { display: block; }
.stat-card span { color: var(--muted); font-size: 11px; }
.stat-card strong { margin: 1px 0; font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-card small { color: #8a93a2; font-size: 9px; }
.stat-card.stat-green strong { color: var(--success); }
.stat-card.stat-amber strong { color: var(--warning); }

.accounts-panel, .info-panel, .settings-panel, .commerce-card, .table-card, .generated-keys {
  border: 1px solid var(--outline);
  border-radius: var(--radius-lg);
  background: var(--card);
}
.accounts-panel { overflow: hidden; }
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--outline-soft);
}
.section-heading h1, .section-heading h2 { margin: 0; font-size: 20px; font-weight: 700; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.account-row {
  display: grid;
  grid-template-columns: 44px minmax(160px, 1fr) minmax(190px, .8fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 78px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--outline-soft);
}
.account-row:last-child { border-bottom: 0; }
.account-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid #b8c9eb;
  border-radius: 50%;
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 700;
}
.account-info strong, .account-info span, .status-block small { display: block; }
.account-info span, .status-block small { color: var(--muted); font-size: 10px; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}
.status-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill.online { color: var(--success); background: var(--success-soft); }
.status-pill.warning { color: var(--warning); background: var(--warning-soft); }
.status-pill.idle { color: #6e7684; background: var(--surface-container); }
.status-block small { margin-top: 4px; }
.account-actions { display: flex; gap: 6px; }
.account-actions form { margin: 0; }
.empty-state { padding: 54px 22px; text-align: center; }
.empty-icon, .brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  margin: 0 auto 13px;
  place-items: center;
  border: 1px solid #b8c9eb;
  border-radius: 15px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 24px;
  font-weight: 700;
}
.empty-state h3 { margin: 0; font-size: 17px; }
.empty-state p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.soft-button, .danger-button, .small-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--outline);
  border-radius: 8px;
  padding: 7px 11px;
  color: #485364;
  background: var(--surface-low);
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
}
.soft-button:hover, .small-button:hover { border-color: var(--primary); color: var(--primary); }
.soft-button.start, .small-button:not(.secondary):not(.danger) { border-color: var(--primary); color: #fff; background: var(--primary); }
.danger-button, .small-button.danger { border-color: #efb6b2; color: var(--danger); background: #fff4f2; }
.small-button.secondary { color: #485364; background: var(--surface-low); }

.info-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 18px 20px;
}
.info-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; color: var(--primary); background: var(--primary-soft); font-size: 18px; }
.info-panel > div:nth-child(2) { flex: 1; }
.info-panel h3 { margin: 2px 0; font-size: 14px; }
.info-panel p { margin: 0; color: var(--muted); font-size: 11px; }

.commerce-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 16px 0; }
.commerce-card { padding: 22px; }
.commerce-card h2 { margin: 8px 0 4px; font-size: 22px; }
.commerce-card p { margin: 0; color: var(--muted); font-size: 12px; }
.plan-limits { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.plan-limits span { padding: 6px 9px; border-radius: 999px; color: var(--primary); background: var(--primary-soft); font-size: 10px; font-weight: 600; }
.stack-form { display: grid; gap: 8px; }
.stack-form label { margin-top: 5px; color: #4d5666; font-size: 11px; font-weight: 600; }
.stack-form input, .stack-form select, .table-input, .auth-form input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--outline);
  border-radius: 8px;
  padding: 10px 11px;
  outline: 0;
  color: var(--text);
  background: #fff;
}
.stack-form input:focus, .stack-form select:focus, .table-input:focus, .auth-form input:focus { border-color: var(--primary-bright); }
.plain-list { margin: 12px 0 0; padding-left: 18px; color: var(--muted); font-size: 11px; }
.plain-list li { margin: 7px 0; }
.generated-keys { display: grid; gap: 7px; margin: 16px 0; padding: 18px; border-color: #aad8bc; background: #f4fcf7; }
.generated-keys code, .admin-table code { display: block; padding: 6px 8px; border-radius: 6px; color: #174e91; background: #eef4ff; font-size: 10px; }
.flash-message { margin: 12px 0; padding: 11px 13px; border: 1px solid transparent; border-radius: 9px; font-size: 11px; }
.flash-message.success { border-color: #b5e5c8; color: #087c43; background: #f1fbf5; }
.flash-message.error { border-color: #efb6b2; color: var(--danger); background: #fff4f2; }
.validation-message, .field-error { color: var(--danger); font-size: 10px; }

.admin-menu-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.admin-hero-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(270px, .9fr); gap: 16px; }
.admin-license-hero {
  position: relative;
  min-height: 190px;
  overflow: hidden;
  padding: 27px 30px;
  border-radius: var(--radius-lg);
  color: #fff;
  background: var(--primary-bright);
}
.admin-license-hero::after {
  position: absolute;
  right: -30px;
  bottom: -50px;
  width: 165px;
  height: 165px;
  border: 24px solid rgba(255,255,255,.14);
  border-radius: 42px;
  transform: rotate(18deg);
  content: "";
}
.admin-license-hero .eyebrow { color: rgba(255,255,255,.75); }
.admin-license-hero h2 { margin: 9px 0 5px; font-size: 28px; font-weight: 700; }
.admin-license-hero p { max-width: 620px; margin: 0; color: rgba(255,255,255,.78); font-size: 12px; }
.admin-license-hero > div { position: absolute; bottom: 24px; left: 30px; z-index: 1; display: flex; gap: 9px; }
.hero-action { display: inline-flex; min-height: 38px; align-items: center; border: 1px solid rgba(255,255,255,.85); border-radius: 8px; padding: 8px 14px; color: #fff; font-size: 11px; font-weight: 700; text-decoration: none; }
.hero-action.primary { color: var(--primary); background: #fff; }
.system-status-card { padding: 22px 24px; border: 1px solid var(--outline); border-radius: var(--radius-lg); background: #fff; }
.system-status-card > span { color: var(--muted); font-size: 11px; }
.system-status-card > strong { display: flex; align-items: center; gap: 8px; margin: 6px 0 16px; color: var(--success); font-size: 14px; }
.system-status-card > strong i { width: 9px; height: 9px; border-radius: 50%; background: #20c267; }
.system-status-card dl { display: grid; gap: 10px; margin: 0; }
.system-status-card dl div { display: flex; justify-content: space-between; gap: 16px; font-size: 10px; }
.system-status-card dt { color: var(--muted); font-weight: 400; }
.system-status-card dd { margin: 0; font-weight: 700; }
.admin-menu-card {
  position: relative;
  display: grid;
  min-height: 120px;
  align-content: end;
  gap: 5px;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--outline);
  border-radius: var(--radius-md);
  color: inherit;
  background: var(--card);
  text-decoration: none;
}
.admin-menu-card::before {
  position: absolute;
  top: 16px;
  left: 18px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  color: var(--primary);
  background: var(--primary-soft);
  content: "→";
  font-weight: 700;
}
.admin-menu-card:hover { border-color: var(--primary-bright); color: inherit; }
.admin-menu-card strong { font-size: 13px; }
.admin-menu-card span { color: var(--muted); font-size: 10px; }
.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.admin-table th, .admin-table td { padding: 13px 14px; border-bottom: 1px solid var(--outline-soft); text-align: left; vertical-align: middle; white-space: nowrap; }
.admin-table th { color: #596273; background: var(--surface-low); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.admin-table tbody tr:hover { background: #fbfcff; }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table td strong, .admin-table td small { display: block; }
.admin-table td small { max-width: 230px; overflow: hidden; margin-top: 3px; color: #8b94a3; font-size: 9px; text-overflow: ellipsis; }
.table-input { width: 92px; padding: 7px 8px; font-size: 10px; }
.inline-form, .action-group { display: inline-flex; align-items: center; gap: 6px; margin: 0 5px 3px 0; }
.inline-form select { border: 1px solid var(--outline); border-radius: 8px; padding: 7px; color: #424b5b; background: #fff; font-size: 10px; }
.check-inline { color: #4f5867; font-size: 10px; white-space: nowrap; }
.check-inline input { accent-color: var(--primary); }

.settings-panel { max-width: 820px; margin: 0 auto; overflow: hidden; }
.manage-shell { width: 100%; }
.manage-heading { margin-bottom: 18px; padding-bottom: 17px; border-bottom: 1px solid var(--outline); }
.manage-heading h2 { margin: 5px 0 2px; font-size: 27px; font-weight: 700; }
.manage-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.manage-grid { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px; align-items: start; }
.manage-nav nav { display: grid; gap: 5px; }
.manage-nav a {
  display: block;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #485364;
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
}
.manage-nav a:hover { color: var(--primary); background: var(--surface-low); }
.manage-nav a.active { border-color: #c9d9fa; color: var(--primary); background: var(--primary-soft); }
.manage-content { min-width: 0; }
.manage-content .settings-panel { margin: 0; }
.settings-grid { padding: 8px 24px 20px; }
.setting-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 15px 0; border-bottom: 1px solid var(--outline-soft); font-size: 11px; }
.setting-row span { color: var(--muted); }
.setting-row code { overflow-wrap: anywhere; text-align: right; }
.settings-panel > .soft-button { margin: 0 24px 22px; }
.settings-form { display: grid; gap: 13px; padding: 20px 24px 24px; }
.settings-form.compact-form { padding: 18px 0 0; }
.form-field { display: grid; gap: 6px; }
.form-field label { color: #4f5867; font-size: 11px; font-weight: 600; }
.form-field input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  padding: 9px 11px;
  outline: 0;
  color: var(--text);
  background: #fff;
}
.form-field input:focus { border-color: var(--primary); }
.form-field input:disabled { color: #737d8d; background: var(--surface-low); }
.settings-actions { display: flex; flex-wrap: wrap; gap: 9px; padding: 0 24px 23px; }
.settings-actions form { margin: 0; }
.recovery-codes, .privacy-note { margin: 0 24px 22px; padding: 14px; border: 1px solid #c8d7f4; border-radius: 9px; background: #f5f8ff; font-size: 10px; }
.recovery-codes strong, .recovery-codes p { display: block; }
.recovery-codes p { margin: 3px 0 10px; color: var(--muted); }
.recovery-codes > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.recovery-codes code { padding: 5px 7px; border-radius: 5px; color: #174e91; background: #fff; text-align: center; }
.privacy-note { border-color: var(--outline); color: var(--muted); background: var(--surface-low); }
.authenticator-setup { padding: 20px 24px 24px; }
.authenticator-setup ol { margin: 0 0 16px; padding-left: 18px; color: var(--muted); font-size: 10px; }
.authenticator-setup li { margin: 5px 0; }
.authenticator-setup img { display: block; width: 220px; height: 220px; margin: 0 auto 12px; border: 1px solid var(--outline); border-radius: 12px; }
.setup-key { display: block; overflow-wrap: anywhere; padding: 10px; border-radius: 7px; color: #174e91; background: var(--surface-low); text-align: center; }

.guest-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 10%, rgba(44,107,237,.08), transparent 24%),
    var(--surface);
}
.guest-topbar {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--outline);
  background: rgba(255,255,255,.94);
}
.guest-content { min-height: calc(100vh - 72px); }
.auth-shell { display: grid; min-height: calc(100vh - 72px); place-items: center; padding: 34px 20px; }
.auth-card {
  width: min(450px, 100%);
  padding: 30px;
  border: 1px solid var(--outline);
  border-radius: var(--radius-lg);
  background: var(--card);
}
.auth-card h1 { margin: 7px 0; font-size: 27px; font-weight: 700; text-align: center; }
.auth-card .eyebrow { text-align: center; }
.auth-intro { margin: 0 auto 20px; color: var(--muted); font-size: 11px; text-align: center; }
.auth-form { display: grid; gap: 7px; }
.auth-form label { margin-top: 5px; color: #4f5867; font-size: 11px; font-weight: 600; }
.auth-form input { min-height: 43px; }
.auth-submit { width: 100%; margin-top: 10px; }
.check-row { display: flex; align-items: center; gap: 8px; }
.check-row input { width: 15px; min-height: 15px; accent-color: var(--primary); }
.auth-footer { margin: 18px 0 0; color: var(--muted); font-size: 11px; text-align: center; }
.auth-footer a { color: var(--primary); font-weight: 700; }
.request-id { color: var(--muted); font-size: 10px; text-align: center; }

.modal-shell { position: fixed; inset: 0; z-index: 1000; padding: 24px; overflow-y: auto; background: rgba(20,27,38,.62); backdrop-filter: blur(5px); }
.modal-card { position: relative; width: min(470px, 100%); margin: 4vh auto; padding: 27px; border: 1px solid var(--outline); border-radius: var(--radius-lg); background: #fff; text-align: center; }
.modal-close { position: absolute; top: 12px; right: 14px; border: 0; background: transparent; color: #747d8b; font-size: 24px; }
.modal-card h2 { margin: 6px 0; font-size: 21px; }
.modal-card > p { min-height: 20px; color: var(--muted); font-size: 11px; }
.qr-frame { display: grid; width: 272px; height: 272px; margin: 16px auto; padding: 12px; place-items: center; border: 1px solid var(--outline); border-radius: 14px; background: #fff; }
.qr-frame img { width: 100%; height: 100%; image-rendering: pixelated; }
.qr-loader { width: 40px; height: 40px; border: 4px solid var(--surface-container); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.qr-steps { margin: 16px 0 0; padding-left: 19px; color: var(--muted); text-align: left; font-size: 11px; }
.qr-steps li { margin: 5px 0; }
.two-factor { padding: 13px; border: 1px solid #f0d59d; border-radius: 10px; background: #fff9e9; text-align: left; }
.two-factor label { display: block; margin-bottom: 7px; font-size: 11px; font-weight: 700; }
.password-row { display: flex; gap: 7px; }
.password-row input { min-width: 0; flex: 1; border: 1px solid #d7c58f; border-radius: 8px; padding: 9px; }
.two-factor small { display: block; margin-top: 6px; color: #806630; font-size: 9px; }

@media (max-width: 1180px) {
  .system-badge { display: none; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-menu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .app-sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar-open .app-sidebar { transform: translateX(0); }
  .sidebar-overlay { position: fixed; inset: 0; z-index: 70; display: block; visibility: hidden; border: 0; background: rgba(17,24,34,.45); opacity: 0; transition: opacity .2s, visibility .2s; }
  .sidebar-open .sidebar-overlay { visibility: visible; opacity: 1; }
  .app-stage { width: 100%; margin-left: 0; }
  .mobile-menu-button { display: grid; place-items: center; }
  .topbar-kicker { display: block; }
  .global-search { width: 220px; }
  .commerce-grid { grid-template-columns: 1fr; }
  .admin-hero-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .app-topbar { min-height: 66px; padding: 10px 14px; }
  .topbar-heading h1 { max-width: 180px; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
  .global-search, .account-chip-name, .logout-button { display: none; }
  .app-content { padding: 16px 14px 30px; }
  .app-footer { padding: 14px; }
  .hero-panel { min-height: 0; align-items: flex-start; flex-direction: column; padding: 24px 20px; }
  .hero-panel h1 { font-size: 24px; }
  .hero-panel .primary-button { width: 100%; }
  .subscription-banner { grid-template-columns: 1fr; gap: 8px; }
  .subscription-banner .small-button { width: max-content; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { min-height: 118px; padding: 14px; }
  .stat-card strong { font-size: 21px; }
  .account-row { grid-template-columns: 42px 1fr; }
  .status-block, .account-actions { grid-column: 2; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .info-panel { align-items: flex-start; flex-wrap: wrap; }
  .info-panel .soft-button { margin-left: 52px; }
  .admin-menu-grid { grid-template-columns: 1fr; }
  .admin-license-hero { min-height: 220px; padding: 23px 20px; }
  .admin-license-hero h2 { font-size: 23px; }
  .admin-license-hero > div { right: 20px; bottom: 20px; left: 20px; flex-wrap: wrap; }
  .page-heading h1 { font-size: 23px; }
  .guest-topbar { padding: 12px 16px; }
  .guest-topbar .sidebar-brand small { display: none; }
  .auth-shell { padding: 24px 14px; }
  .auth-card { padding: 24px 18px; }
  .setting-row { flex-direction: column; gap: 5px; }
  .setting-row code { text-align: left; }
  .manage-grid { grid-template-columns: 1fr; }
  .manage-nav nav { display: flex; overflow-x: auto; padding-bottom: 3px; }
  .manage-nav a { flex: 0 0 auto; white-space: nowrap; }
  .manage-heading h2 { font-size: 23px; }
  .recovery-codes > div { grid-template-columns: 1fr; }
  .modal-card { padding: 24px 17px; }
  .qr-frame { width: 245px; height: 245px; }
}
