/* ==============================================================
   Obsidian Portal — Components
   Terminal-brutalist. No radius. No shadow. No gradient. No scale.
   ============================================================== */

/* ── DESIGN SYSTEM HARD ENFORCEMENT ──────────────────────────
   Border-radius: 0 everywhere.
   Exceptions: 3px on progress bars, 50% on status dots.
   Box-shadow: none everywhere.
   Exceptions: green glow on live-status dot, inset ring on login card.
   No gradients. No transforms on hover.
   ─────────────────────────────────────────────────────────── */

/* Zero-radius everything */
*, *::before, *::after { border-radius: 0 !important; }

/* Only allowed non-zero radii */
.live-dot,
.status-dot,
.snd-token-avatar,
.snd-rcpt-dot,
.snd-token-avatar *,
.status-badge.live::before { border-radius: 50% !important; }

.snd-prog-fill,
.snd-cp-fill,
[class*="prog-fill"],
progress { border-radius: var(--r-bar) !important; }

::-webkit-scrollbar-thumb { border-radius: 3px !important; }

/* Zero shadow everywhere */
*, *::before, *::after { box-shadow: none !important; }

/* Only allowed box-shadows */
.live-dot.active,
.live-dot[data-live="true"]  { box-shadow: 0 0 6px var(--green) !important; }
.status-badge.live::before   { box-shadow: 0 0 6px var(--green) !important; }
.login-card                  { box-shadow: 0 0 0 1px var(--border2) !important; }

/* Remove all gradients — override common inline patterns */
.sender-live-bar,
.snd-identity-sel,
[class*="gradient"] { background-image: none !important; }

/* No transforms on hover — only color/bg/border/opacity */
*:hover { transform: none !important; }

/* Header: 48px per spec */
.app-header { height: 48px !important; }
.app-nav    { top: 48px !important; }

/* Font: IBM Plex Sans everywhere */
body, .app-header, .app-nav, .panel-card, .settings-card,
.btn, .form-input, .form-select, .form-textarea, .nav-link, .tab-btn {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
}

/* Transitions: only allowed properties */
* { transition-property: color, background-color, border-color, opacity !important; }

/* ─────────────────────────────────────────────────────────── */

/* ── Scrollbars ───────────────────────────────────────────── */

::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: var(--border2); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── Animations (entry only, opacity-first) ───────────────── */

@keyframes view-in     { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in    { from { opacity: 0; } to { opacity: 1; } }
@keyframes overlay-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes toast-in    { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out   { from { opacity: 1; } to { opacity: 0; } }
@keyframes pulse-once  { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }

/* ── Shared radius / elevation ────────────────────────────── */

.btn,
.icon-btn,
.form-input,
.form-select,
.form-textarea,
.role-badge,
.preview-tab,
.antibot-review-pill {
  border-radius: var(--r-md);
}

.status-badge {
  border-radius: var(--r-pill);
}

.panel-card,
.settings-card,
.admin-banner,
.data-table-wrap,
.account-list,
.empty-state,
.stat-grid,
.modal-card,
.login-card,
.toast,
.log-area,
.preview-frame-wrap,
.tpl-preview-frame-wrap,
.portal-grid,
.folder-picker,
.lure-content-empty,
.tpl-preview-body,
.attachment-logo-preview {
  border-radius: var(--r-lg);
}

.tpl-accent {
  border-radius: var(--r-sm);
}

.nav-link,
.tab-btn,
.stat-card,
.stat-card.stat-link,
.portal-btn {
  border-radius: 0;
}

.portal-icon {
  border-radius: var(--r-sm);
}

::-webkit-scrollbar-thumb {
  border-radius: var(--r-pill);
}

/* ── Logo ─────────────────────────────────────────────────── */

.logo-mark {
  display: block;
  flex-shrink: 0;
  background-color: var(--text);
  -webkit-mask-image: url('../assets/obsidian-logo.svg');
  mask-image: url('../assets/obsidian-logo.svg');
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.logo-png {
  width: 50px;
  height: 50px;
}

[data-theme="light"] .logo-png {
  filter: invert(1);
}

/* ── App shell ────────────────────────────────────────────── */

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

.app-header {
  height: var(--header-h, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--page-x);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.header-logo {
  width: 24px;
  height: 24px;
}

.header-brand-stack {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
  min-width: 0;
}

.header-brand {
  display: block;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--text);
}

.header-sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  line-height: 1;
  margin-top: 3px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.role-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.role-badge.admin {
  color: var(--text);
  border-color: var(--text);
}

.session-info {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 240px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
}

.session-user { color: var(--text); }

.acting-tenant-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px var(--page-x, 20px);
  background: rgba(168, 85, 247, 0.1);
  border-bottom: 1px solid rgba(168, 85, 247, 0.35);
  color: var(--text);
}
.acting-tenant-bar[hidden] { display: none !important; }
.acting-tenant-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}
.acting-tenant-kicker {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c084fc;
}
.acting-tenant-name {
  font-size: 13px;
  font-weight: 700;
}
.acting-tenant-hint {
  font-size: 11px;
  color: var(--muted);
}
body.acting-as-tenant .app-header {
  border-bottom-color: rgba(168, 85, 247, 0.35);
}
.session-sep  { color: var(--dim); }
.session-host {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── App nav ──────────────────────────────────────────────── */

.app-nav {
  display: flex;
  align-items: stretch;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 calc(var(--page-x) - 14px);
  overflow: hidden;
  flex-wrap: wrap;
  position: sticky;
  top: var(--header-h, 48px);
  min-height: var(--nav-h, 40px);
  z-index: 90;
  scrollbar-width: none;
}

.app-nav::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.app-nav > div {
  display: contents;
}

.nav-link {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -1px;
  border-radius: 0;
  transition: color var(--t), border-color var(--t);
}

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

.nav-link.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ── App content / footer ─────────────────────────────────── */

.app-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 20px var(--page-x);
  overflow: auto;
}

.app-content > .view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

.app-content > .view.active {
  animation: view-in 0.15s ease;
}

.app-content > .view[hidden] {
  display: none !important;
}

/* Webmail: full-bleed Outlook shell — lock viewport scroll, flex-fill below nav */
.app-shell:has(#view-webmail.active) {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.app-shell:has(#view-webmail.active) .app-footer {
  display: none;
}

.app-content:has(#view-webmail.active) {
  padding: 0;
  overflow: hidden;
  background: #faf9f8;
  flex: 1;
  min-height: 0;
}

.app-content > #view-webmail.view {
  flex: 1;
  width: 100%;
  max-width: none;
  min-height: 0;
  height: auto;
  padding: 0;
  overflow: hidden;
  background: #faf9f8;
}

/* ── Webmail-only tab mode (?wm_token= new-tab) ──────────────────────────
   Hide the Obsidian header and nav entirely; webmail fills the full viewport */
body.wm-only .app-header,
body.wm-only .app-nav,
body.wm-only .app-footer { display: none !important; }

body.wm-only .app-shell {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.wm-only .app-content {
  flex: 1;
  padding: 0;
  overflow: hidden;
  min-height: 0;
  background: #faf9f8;
}

.app-footer {
  padding: 8px var(--page-x);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  background: var(--bg);
}

/* ── Toolbar / section header / labels ────────────────────── */

.page-stack,
.overview-layout,
.lures-layout {
  display: flex;
  flex-direction: column;
  gap: var(--page-gap);
  width: 100%;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

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

.page-header:has(.page-header-desc) {
  align-items: flex-start;
}

.page-header-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.page-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1.2;
}

.page-header-desc {
  margin: 0;
  max-width: 72ch;
}

.page-stack > .toolbar,
.page-stack > .tokens-toolbar {
  border-bottom: 1px solid var(--border);
  align-items: flex-end;
  padding-bottom: 0;
  margin-bottom: 0;
}

.page-stack > .toolbar .tab-bar,
.page-stack > .tokens-toolbar .tab-bar {
  border-bottom: none;
}

.page-stack > .panel-card,
.page-stack > .admin-banner,
.page-stack > .stat-grid,
.page-stack > .tab-bar,
.settings-view .panel-card {
  margin-bottom: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-header-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.section-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--section-label);
}

.section-stats,
.count-pill,
.tpl-count {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 3px 8px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}

.section-stats:empty,
.count-pill:empty,
.tpl-count:empty {
  display: none;
}

.view-desc {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
  line-height: 1.55;
  max-width: 72ch;
}

.field-hint {
  display: block;
  font-size: 10px;
  color: var(--dim);
  margin-top: 4px;
  letter-spacing: 0.02em;
}

/* ── Panel / settings card ────────────────────────────────── */

.panel-card,
.settings-card {
  border: 1px solid var(--border);
  padding: var(--panel-pad-y) var(--panel-pad-x);
  margin-bottom: var(--page-gap);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t), background var(--t), box-shadow var(--t);
}

.panel-card:hover,
.settings-card:hover {
  border-color: var(--border);
}

.panel-card-title,
.settings-card-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--section-label);
  margin-bottom: 12px;
}

.section-header .panel-card-title,
.section-header .settings-card-title {
  margin-bottom: 0;
}

/* ── Admin banner / workspace hero ────────────────────────── */

.admin-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: var(--panel-pad-y) var(--panel-pad-x);
  margin-bottom: var(--page-gap);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.admin-banner-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}

.admin-banner-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: 0.02em;
}

.workspace-hero {
  margin-bottom: 0;
}

.workspace-hero .admin-banner-title {
  font-size: 15px;
  letter-spacing: 0.05em;
}

.workspace-hero .admin-banner-sub {
  font-size: 12px;
  margin-top: 6px;
}

.workspace-meta {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  word-break: break-all;
}

.workspace-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.workspace-hero-main {
  min-width: 0;
}

@media (max-width: 900px) {
  .workspace-hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .workspace-hero-actions { width: 100%; }
}

/* ── Overview page ────────────────────────────────────────── */

.overview-panels {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: var(--page-gap);
  align-items: stretch;
  flex: 1;
  min-height: 360px;
}

@media (max-width: 900px) {
  .overview-panels { grid-template-columns: 1fr; }
}

.overview-panels .overview-panel,
.overview-panels > .panel-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 360px;
  overflow: hidden;
  padding-bottom: 0;
}

.overview-panels .overview-panel .section-header {
  margin-bottom: 12px;
  align-items: center;
}

.overview-panels .overview-panel .panel-card-title {
  margin-bottom: 0;
  font-size: 11px;
}

.overview-panels .overview-panel .data-table-wrap,
.overview-panels .overview-panel .overview-table-wrap,
.overview-panels > .panel-card .data-table-wrap,
.overview-panels > .panel-card .account-list {
  flex: 1;
  min-height: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
  margin-left: calc(-1 * var(--panel-pad-x));
  margin-right: calc(-1 * var(--panel-pad-x));
  width: calc(100% + (var(--panel-pad-x) * 2));
}

.overview-table {
  table-layout: fixed;
  width: 100%;
  font-size: 12px;
}

.overview-table th,
.overview-table td {
  padding: 8px 10px;
  vertical-align: middle;
}

.overview-table th { font-size: 10px; }

.overview-table .mono,
.overview-table .overview-id,
.overview-table .overview-code,
.overview-table .overview-email {
  font-size: 11px;
}

.overview-table .col-ov-id     { width: 48px; }
.overview-table .col-ov-status { width: 100px; }
.overview-table .col-ov-bot    { width: 64px; }
.overview-table .col-ov-code   { width: 108px; }
.overview-table .col-ov-source { width: 120px; }
.overview-table .col-ov-account{ width: 42%; }

.overview-id {
  font-family: var(--font-mono);
  font-size: 12px !important;
  font-weight: 600;
  color: var(--muted);
  text-align: right;
}

.overview-account {
  font-size: 12px;
  font-weight: 600;
}

.overview-row {
  cursor: pointer;
  transition: background var(--t);
}

.overview-row:hover,
.overview-row:focus-visible {
  background: var(--row-hover);
  outline: none;
}

.overview-source {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.overview-table .status-badge {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-table-wrap {
  overflow: auto;
}

/* ── Stats grid / stat cards ──────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-bottom: 0;
  overflow: hidden;
}

@media (max-width: 640px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.stat-card {
  padding: 16px 18px;
  border: none;
  text-align: left;
  background: var(--surface);
}

.stat-card.stat-link {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background var(--t);
  width: 100%;
}

.stat-card.stat-link:hover {
  background: var(--surface2);
}

.stat-card.stat-link:focus-visible {
  outline: 1px solid var(--text);
  outline-offset: -1px;
}

.stat-card.accent .stat-value {
  color: var(--text);
}

.stat-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--section-label);
  margin-bottom: 6px;
}

.stat-value {
  display: block;
  font-family: var(--font-sans);
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
}

.stat-value.sm { font-size: 18px; }

.user-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.user-stat {
  font-size: 11px;
  color: var(--muted);
}

.user-stat strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

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

.btn {
  appearance: none;
  -webkit-appearance: none;
  padding: 7px 13px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.35;
  transition: background var(--t), border-color var(--t), color var(--t), opacity var(--t), box-shadow var(--t);
}

.btn:hover:not(:disabled) {
  background: var(--btn-hover-bg);
  border-color: var(--border2);
}

.btn:focus-visible {
  outline: none;
  border-color: var(--text);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.btn.primary:hover:not(:disabled) {
  background: var(--muted);
  border-color: var(--muted);
}

.btn.danger {
  color: var(--red);
  border-color: var(--red-border);
  background: var(--btn-bg);
}

.btn.danger:hover:not(:disabled) {
  background: var(--red-bg);
  border-color: var(--red);
}

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

.btn.ghost:hover:not(:disabled) {
  background: var(--card-hover);
  border-color: var(--border2);
}

.btn.sm {
  padding: 4px 9px;
  font-size: 11px;
}

.btn.xs {
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
}

.admin-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.admin-row-actions .btn {
  flex: 0 0 auto;
  min-width: 0;
  width: auto;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}

.admin-row-actions-cell {
  padding: 8px 12px 8px 4px;
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

#admin-tokens-table .admin-row-actions {
  flex-direction: column;
  align-items: stretch;
  min-width: 64px;
}

#admin-tokens-table .admin-row-actions .btn {
  width: 100%;
  text-align: center;
}

#admin-tokens-table-wrap,
#view-admin-tokens .data-table-wrap {
  overflow-x: auto;
}

.admin-actions-th {
  text-align: right;
}

/* ── Icon buttons ─────────────────────────────────────────── */

.icon-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--toggle-icon);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: background var(--t), color var(--t), border-color var(--t), opacity var(--t);
}

.icon-btn:hover {
  background: var(--btn-hover-bg);
  color: var(--text);
  opacity: 1;
}

.icon-btn:focus-visible {
  outline: none;
  border-color: var(--text);
}

.icon-btn.danger {
  color: var(--close-color);
  border-color: var(--red-border);
}

.icon-btn.danger:hover {
  background: var(--red-bg);
  color: var(--red);
}

.icon-btn svg {
  width: 14px;
  height: 14px;
}

/* ── Status badges ────────────────────────────────────────── */

.status-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: transparent;
  line-height: 1.25;
  white-space: nowrap;
}

.status-badge.ok       { color: var(--green);  background: var(--green-bg);  border-color: var(--green-border); }
.status-badge.warn     { color: var(--amber);  background: var(--amber-bg);  border-color: var(--amber-border); }
.status-badge.beta     { color: var(--purple); background: var(--purple-bg); border-color: var(--purple-border); }
.status-badge.buggy,
.status-badge.fail     { color: var(--red);    background: var(--red-bg);    border-color: var(--red-border); }
.status-badge.ga       { color: var(--amber);  background: var(--amber-bg);  border-color: var(--amber-border); }
.status-badge.pending  { color: var(--blue);   background: var(--blue-bg);   border-color: var(--blue-border); }

.status-badge.live::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  margin-right: 5px;
  vertical-align: middle;
}

/* ── Tab bar ──────────────────────────────────────────────── */

.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--page-gap);
  overflow-x: auto;
}

.tab-bar.inline {
  margin-bottom: 0;
  border-bottom: none;
  flex: 1;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color var(--t), border-color var(--t);
}

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

.tab-btn.active {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--text);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: flex;
  flex-direction: column;
  gap: var(--page-gap);
  animation: view-in 0.15s ease;
}

.settings-view .tab-bar {
  margin-bottom: 0;
  gap: 2px;
}

.settings-view .tab-btn {
  padding: 10px 16px;
}

/* ── Portal grid (dashboard tiles) ────────────────────────── */

.portal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface);
}

@media (max-width: 640px) {
  .portal-grid { grid-template-columns: 1fr; }
}

.portal-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: none;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
}

.portal-grid .portal-btn:nth-child(2n) { border-right: none; }
.portal-grid .portal-btn:nth-last-child(-n+2) { border-bottom: none; }

@media (max-width: 640px) {
  .portal-grid .portal-btn { border-right: none; }
  .portal-grid .portal-btn:last-child { border-bottom: none; }
}

.portal-btn:hover:not(:disabled) {
  background: var(--card-hover);
}

.portal-btn:disabled,
.portal-btn.loading {
  opacity: 0.5;
  cursor: not-allowed;
}

.portal-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  font-size: 13px;
  background: var(--surface2);
}

.portal-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.portal-sub {
  font-size: 11px;
  color: var(--muted);
}

.portal-meta {
  margin-top: 6px;
}

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

.form-field {
  margin-bottom: 12px;
}

.form-lbl {
  display: block;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--section-label);
  margin-bottom: 5px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  transition: border-color var(--t), background var(--t), box-shadow var(--t);
}

.form-select,
select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%2371717a' d='M1.2 1.2L6 6l4.8-4.8' stroke='%2371717a' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 12px 8px;
  padding-right: 30px;
}

.form-input.mono,
.form-textarea.mono,
.form-select.mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 14%, transparent);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--dim);
}

.form-input.sm,
.form-select.sm,
select.form-input.sm {
  padding: 4px 8px;
  font-size: 12px;
}

.form-select.sm,
select.form-input.sm {
  padding-right: 26px;
  background-position: right 8px center;
}

.form-textarea {
  resize: vertical;
  min-height: 72px;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.form-row > .form-field {
  min-width: 0;
}

.lure-file-kill-row {
  grid-template-columns: minmax(0, 1fr) 128px;
}

.lure-ttl-field {
  width: 128px;
  max-width: 128px;
  flex: none;
}

.lure-doc-field,
.lure-doc-picker {
  min-width: 0;
  max-width: 100%;
}

.lure-doc-picker {
  position: relative;
}

.lure-doc-kind {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  overflow: hidden;
}

.lure-doc-kind-btn {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 32px;
  padding: 0 6px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dim);
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--t), background var(--t), box-shadow var(--t);
}

.lure-doc-kind-btn:nth-child(4n) {
  border-right: none;
}

.lure-doc-kind-btn:nth-child(n+9) {
  border-bottom: none;
}

.lure-doc-kind-btn:hover {
  color: var(--text);
  background: var(--surface);
}

.lure-doc-kind-btn.is-on {
  color: var(--blue);
  background: var(--blue-bg);
  box-shadow: inset 0 0 0 1px var(--blue-border);
  font-weight: 700;
}

.lure-doc-kind-btn.is-on:hover {
  color: var(--blue);
  background: var(--blue-bg);
}

.lure-doc-kind + .field-hint {
  display: block;
  margin-top: 8px;
}

.lure-doc-combo {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  border-radius: var(--r-md);
  overflow: hidden;
}

.lure-doc-combo:focus-within {
  border-color: var(--text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 14%, transparent);
}

.lure-doc-input,
#lure-document.lure-doc-input {
  flex: 1;
  min-width: 0;
  margin: 0;
  height: 38px;
  border: none !important;
  box-shadow: none !important;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 12px;
  border-radius: 0;
}

.lure-doc-trigger {
  appearance: none;
  flex: none;
  width: 38px;
  min-height: 38px;
  padding: 0;
  border: none;
  border-left: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.lure-doc-trigger:hover,
.lure-doc-trigger[aria-expanded="true"] {
  color: var(--text);
  background: var(--card-hover);
}

.lure-doc-trigger:focus {
  outline: none;
  color: var(--text);
}

.lure-doc-trigger-name,
.lure-doc-trigger-caret {
  display: none;
}

.lure-doc-menu {
  position: fixed;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  width: min(520px, calc(100vw - 16px));
  max-height: min(480px, 68vh);
  overflow: hidden;
  border: 1px solid var(--border2);
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  border-radius: var(--r-md);
}

.lure-doc-menu[hidden] {
  display: none !important;
}

.lure-doc-menu-head {
  flex-shrink: 0;
  padding: 10px 10px 9px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.lure-doc-search {
  width: 100%;
  height: 34px;
  padding: 0 10px 0 30px;
  border: 1px solid var(--input-border);
  background: var(--input-bg) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='M20 20l-3-3'/></svg>") no-repeat 9px 50% / 12px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12px;
  border-radius: var(--r-md);
}

.lure-doc-search:focus {
  outline: none;
  border-color: var(--text);
}

.lure-doc-search::placeholder {
  color: var(--dim);
}

.lure-doc-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.lure-doc-cat {
  appearance: none;
  flex: none;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  border-radius: 999px;
  white-space: nowrap;
}

.lure-doc-cat:hover {
  color: var(--text);
  border-color: var(--border2);
}

.lure-doc-cat.active {
  color: var(--blue);
  background: var(--blue-bg);
  border-color: var(--blue-border);
}

.lure-doc-menu-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 0 10px;
}

.lure-doc-group-label {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 14px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--section-label);
  background: var(--surface);
}

.lure-doc-custom-panel {
  padding: 12px 14px 6px;
}

.lure-doc-custom-copy {
  margin-bottom: 10px;
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.lure-doc-opt {
  appearance: none;
  display: block;
  width: 100%;
  position: relative;
  padding: 8px 14px 8px 32px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  white-space: normal;
  overflow: visible;
  word-break: break-word;
}

.lure-doc-opt:hover,
.lure-doc-opt.kb {
  color: var(--text);
  background: var(--card-hover);
}

.lure-doc-opt.active {
  color: var(--text);
  background: var(--blue-bg);
}

.lure-doc-opt.active::before {
  content: "✓";
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
}

.lure-doc-co {
  color: var(--text);
  font-style: normal;
  font-weight: 600;
}

.lure-doc-trigger-name .lure-doc-co {
  color: var(--blue);
}

.lure-doc-opt.active .lure-doc-co {
  color: var(--blue);
}

.lure-doc-ext {
  color: var(--dim);
}

.lure-doc-empty {
  padding: 18px 12px;
  text-align: center;
  color: var(--dim);
  font-size: 12px;
}

@media (max-width: 640px) {
  .form-row,
  .lure-file-kill-row { grid-template-columns: 1fr; }
  .lure-ttl-field { width: auto; max-width: none; }
}

.form-row-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.form-row-inline .form-input { flex: 1; }

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.input-with-action {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.input-with-action .form-input {
  flex: 1;
  min-width: 0;
}

.input-with-action .btn {
  flex-shrink: 0;
}

.checkbox-inline,
.form-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0;
}

.checkbox-inline input,
.form-inline-check input {
  accent-color: var(--text);
}

/* ── Data tables ──────────────────────────────────────────── */

.data-table-wrap {
  border: 1px solid var(--border);
  overflow: hidden;
  overflow-x: auto;
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th,
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table th {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--section-label);
  background: var(--surface2);
  cursor: pointer;
  user-select: none;
  transition: color var(--t);
}

.data-table th:hover { color: var(--text); }

.data-table tbody tr {
  transition: background var(--t);
}

.data-table tbody tr:hover {
  background: var(--row-hover);
}

.data-table tbody tr.selected {
  background: var(--surface2);
}

.data-table .mono {
  font-family: var(--font-mono);
  font-size: 11px;
}

.data-table.compact th,
.data-table.compact td {
  padding: 6px 10px;
  font-size: 11px;
}

.data-table .table-empty td {
  padding: 28px 10px;
  text-align: center;
  color: var(--muted);
  cursor: default;
}

.data-table .table-empty:hover { background: transparent; }

/* ── Account list / cards ─────────────────────────────────── */

.account-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--card-border);
  overflow: hidden;
  background: var(--surface);
}

.account-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  align-items: center;
  padding: 7px 14px;
  border-bottom: 1px solid var(--card-border);
  transition: background var(--t);
}

.account-card.token-card {
  grid-template-columns: 40px minmax(0, 1fr) var(--tok-btns-w);
  gap: 0 8px;
  align-items: center;
  padding: 8px 12px 8px 10px;
  border-left: 3px solid var(--card-border);
  min-width: 1240px;
}

/* Packed columns — leftover space goes to Tags, not a hole after Email. */
:root {
  --tok-type-w:    118px;
  --tok-status-w:  80px;
  --tok-ga-w:      44px;
  --tok-geo-w:    108px;
  --tok-date-w:    92px;
  --tok-expires-w: 78px;
  --tok-btns-w:   456px;
}

#view-tokens .page-stack {
  overflow-x: auto;
}

.tok-header-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) var(--tok-btns-w);
  gap: 0 8px;
  min-width: 1240px;
  align-items: center;
  padding: 6px 12px 6px 10px;
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-bottom: 1px solid var(--border2);
  position: sticky;
  top: 0;
  z-index: 20;
  border-left: 3px solid var(--border2);
}
.tok-header-cols,
.tok-info-row {
  display: grid;
  grid-template-columns:
    minmax(160px, 1.2fr)
    var(--tok-type-w)
    var(--tok-status-w)
    var(--tok-ga-w)
    var(--tok-geo-w)
    var(--tok-date-w)
    var(--tok-expires-w)
    minmax(56px, 0.8fr);
  column-gap: 8px;
  align-items: center;
  min-width: 0;
  width: 100%;
}
.tok-th {
  font-size: 9px;
  font-weight: 700;
  color: var(--section-label);
  text-transform: uppercase;
  letter-spacing: .08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}
.tok-th-index {
  text-align: right;
  padding-right: 2px;
}
.tok-th-actions {
  text-align: right;
}

.tok-info-row {
  overflow: hidden;
}

.tok-info-row > div {
  min-width: 0;
}

.tok-col-ident {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}
.tok-name-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}
.tok-name-text {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.tok-id-chips {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.tok-id-chips .status-badge {
  flex-shrink: 0;
  padding: 2px 6px;
}

.tok-col-ga {
  text-align: left;
}
.tok-ga-cell {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
}
.tok-ga-cell.yes { color: var(--amber); font-weight: 800; }
.tok-ga-cell.probing { color: var(--dim); font-weight: 600; }
.tok-ga-cell.no { color: var(--dim); font-weight: 600; }

.tok-col-geo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
}
.tok-geo-cc {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.tok-flag {
  width: 16px;
  height: 12px;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
  border-radius: 1px;
  background: #111;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16);
}
.tok-geo-ip {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.tok-col-expires {
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tok-exp-past { color: #ef4444; font-weight: 600; }
.tok-exp-ok { color: var(--dim); }
.tok-exp-none { color: var(--dim); }

.tok-col-ident .tok-col-email,
.tok-col-email {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  user-select: all;
}

.tok-col-type {
  text-align: left;
}
.tok-type-pill {
  display: inline-block;
  max-width: 100%;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border: 1px solid;
  letter-spacing: .03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.tok-type-pill.type-oauth    { color: var(--blue);   border-color: var(--blue-border);   background: var(--blue-bg);   }
.tok-type-pill.type-prt      { color: var(--green);  border-color: var(--green-border);  background: var(--green-bg);  }
.tok-type-pill.type-winhello { color: var(--purple); border-color: var(--purple-border); background: var(--purple-bg); }
.tok-type-pill.type-enrolling{ color: var(--amber);  border-color: var(--amber-border);  background: var(--amber-bg);  }
.tok-type-pill.type-failed   { color: var(--red);    border-color: var(--red-border);    background: var(--red-bg);    }

.tok-col-status {
  text-align: left;
}
.tok-status-dot {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
}
.tok-status-dot.active,
.tok-status-dot.tok-status-resurrect { color: var(--green); }
.tok-status-dot.inactive{ color: var(--red);   }
.tok-status-dot.tok-status-stored { color: var(--amber); }

.tok-col-date {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  font-size: 10px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
}
.tok-captured-time {
  font-size: 9px;
  color: var(--dim);
  opacity: .85;
}
.tok-expiry-note {
  color: #ef4444;
  font-weight: 600;
  font-size: 9px;
}

.tok-col-tags {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  overflow: hidden;
  max-height: 34px;
}
.tok-col-tags .tok-tag-badge {
  margin-left: 0;
  flex-shrink: 0;
}

.tok-col-btns {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
}
.tok-col-btns .btn.sm {
  flex-shrink: 0;
  padding: 4px 7px;
}

/* ── Pagination bar ──────────────────────────────────────── */
.tok-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border: 1px solid var(--card-border);
  border-top: none;
  background: var(--surface);
  gap: 12px;
  flex-wrap: wrap;
}
.tok-pag-info {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  font-family: var(--font-mono);
}
.tok-pag-pages {
  display: flex;
  align-items: center;
  gap: 2px;
}
.tok-pag-btn {
  min-width: 28px;
  height: 24px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t);
  user-select: none;
  font-family: var(--font-mono);
}
.tok-pag-btn:hover:not(:disabled):not(.tok-pag-dot) {
  background: var(--btn-hover-bg);
  color: var(--text);
  border-color: var(--border2);
}
.tok-pag-btn.tok-pag-active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.tok-pag-btn:disabled {
  opacity: .3;
  cursor: not-allowed;
}
.tok-pag-dot {
  border: none;
  background: none;
  color: var(--dim);
  cursor: default;
  letter-spacing: .1em;
}
.tok-pag-sizes {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--muted);
}
.tok-pag-sizes span { margin-right: 4px; }
.tok-psz {
  padding: 2px 8px;
  height: 24px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--t), border-color var(--t);
  font-family: var(--font-mono);
  letter-spacing: .03em;
}
.tok-psz:hover { color: var(--text); border-color: var(--border2); }
.tok-psz.tok-psz-active { color: var(--blue); border-color: var(--blue); font-weight: 700; }

/* Token type accent strips */
.account-card.token-card.tok-oauth   { border-left-color: var(--blue);   }
.account-card.token-card.tok-prt     { border-left-color: var(--green);  }
.account-card.token-card.tok-winhello{ border-left-color: var(--purple); }
.account-card.token-card.tok-resurrected {
  box-shadow: inset 4px 0 0 rgba(34, 197, 94, 0.55);
}
.tok-type-pill.type-resurrected {
  color: var(--green);
  border-color: var(--green-border);
  background: var(--green-bg);
}
.status-badge.tok-resurrect-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
  letter-spacing: 0.04em;
}
.account-card.token-card.tok-enrolling{ border-left-color: var(--amber); }
.account-card.token-card.tok-failed  { border-left-color: var(--red);    }
.account-card.token-card.tok-inactive { border-left-color: #3f3f46;      }
/* Global Admin — gold accent strip, highest priority */
.account-card.token-card.tok-ga {
  border-left-color: #f59e0b;
  background: linear-gradient(90deg, rgba(245,158,11,.06) 0%, var(--surface) 48px);
}

.account-card:last-child { border-bottom: none; }

.account-card:hover {
  background: var(--card-hover);
}

.account-list.compact .account-card {
  padding: 8px 12px;
}

.token-index {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-align: right;
  padding-right: 2px;
  user-select: none;
}

.account-check {
  width: 14px;
  height: 14px;
  accent-color: var(--text);
}

.account-main { min-width: 0; }

.account-name {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  line-height: 1.4;
}

.account-upn {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
}

.account-notes {
  font-size: 10px;
  color: var(--dim);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
}

/* ── Token tag picker ────────────────────────────────── */
#tok-tag-picker {
  position: fixed;
  z-index: 9500;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 220px;
  box-shadow: 0 8px 28px rgba(0,0,0,.5);
}
#tok-tag-picker[hidden] { display: none; }
.tok-tag-pill {
  background: transparent;
  border: 1px solid;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  padding: 4px 6px;
  cursor: pointer;
  transition: opacity .12s, transform .1s;
  text-align: center;
  opacity: .45;
}
.tok-tag-pill:hover { opacity: .75; transform: scale(1.04); }
.tok-tag-pill.active { opacity: 1; box-shadow: 0 0 0 2px currentColor; }
.tok-tag { font-size: 9px !important; padding: 2px 6px !important; font-weight: 700 !important; letter-spacing: .05em !important; }

/* ── Token inline notes ─────────────────────────────── */
.token-notes-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;           /* takes remaining space between token-info and buttons */
  min-width: 80px;
  max-width: 280px;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 3px 6px;
  transition: border-color .12s, background .12s;
  cursor: text;
  overflow: hidden;
}
.token-notes-row:hover {
  border-color: var(--border);
  background: var(--surface2);
}
.token-notes-row.editing {
  border-color: var(--blue);
  background: var(--input-bg);
  overflow: visible;
}
.token-notes-icon {
  font-size: 10px;
  flex-shrink: 0;
  color: var(--border2);
  line-height: 1;
  transition: color .12s;
}
.token-notes-row:hover .token-notes-icon,
.token-notes-row.editing .token-notes-icon { color: var(--blue); }
.token-notes {
  font-size: 11px;
  color: var(--muted);
  flex: 1;
  outline: none;
  border: none;
  background: transparent;
  min-width: 40px;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: text;
  line-height: 1.5;
  display: block;
}
.token-notes-row.editing .token-notes {
  color: var(--text);
  white-space: normal;
  overflow: visible;
}
/* Placeholder via CSS — sits inside the contenteditable, never blocks clicks */
.token-notes:empty::before {
  content: attr(data-placeholder);
  color: var(--border2);
  font-style: italic;
  pointer-events: none;
}
.token-notes.saving { opacity: .5; }
.token-notes-row.saved-flash { border-color: var(--green, #22c55e) !important; transition: none; }

.account-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 0;
}
.token-btns {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.token-btns .btn {
  flex-shrink: 0;
  padding: 5px 12px;
  font-size: 11px;
}
.token-btns .btn.danger {
  padding: 5px 9px;
}

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--dim);
  font-size: 13px;
  letter-spacing: 0.01em;
  border: 1px solid var(--card-border);
  background: var(--surface);
}

.empty-state-inset {
  border: none;
  background: transparent;
  padding: 28px 12px;
}

/* ── Tokens page ──────────────────────────────────────────── */

.tokens-toolbar {
  margin-bottom: 0;
  gap: 8px;
  flex-wrap: wrap;
}

.tokens-toolbar .tokens-search {
  flex: 1;
  min-width: 180px;
  max-width: 280px;
}

.tokens-toolbar .tokens-sort {
  width: auto;
  min-width: 190px;
}

/* ── Modal ────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: overlay-in 0.15s ease;
}

.modal-overlay[hidden] { display: none; }

.modal-card {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 22px;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.15s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-title {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.modal-body {
  margin-bottom: 14px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Lure builder split modal ─────────────────────────────── */

/* Landscape template preview — must beat .modal-card { max-width: 480px } */
.modal-card.modal-template-preview {
  width: min(1240px, 94vw);
  max-width: min(1240px, 94vw);
  min-height: min(680px, 90vh);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 18px 20px 16px;
}

.modal-card.modal-template-preview .modal-header {
  flex-shrink: 0;
  margin-bottom: 8px;
}

.modal-card.modal-template-preview .modal-footer {
  flex-shrink: 0;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

#modal-template-preview.modal-overlay {
  padding: 12px;
  align-items: center;
}

.tpl-preview-header-text {
  min-width: 0;
}

.tpl-preview-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: 0.02em;
}

.tpl-preview-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.tpl-preview-toolbar {
  flex-shrink: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tpl-preview-toolbar .preview-toolbar-cluster {
  margin-left: 0;
  flex: 1;
  min-width: 0;
}

.tpl-preview-frame-wrap {
  flex: 1;
  min-height: min(520px, calc(90vh - 210px));
  max-height: none;
}

.modal-card.modal-template-preview .preview-device-stage.is-desktop iframe,
.modal-card.modal-template-preview .preview-device-stage.is-desktop .tpl-preview-pdf {
  /* OneNote / SharePoint teasers need full card + CTA visible (match training-preview) */
  min-height: min(640px, calc(90vh - 200px));
  height: min(640px, calc(90vh - 200px));
}

.tpl-preview-category {
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 0.06em;
  margin-left: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.modal-lure-builder {
  max-width: min(1240px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px 18px 14px;
}

.modal-lure-builder .modal-header {
  flex-shrink: 0;
  margin-bottom: 10px;
}

.lure-builder-header {
  align-items: flex-start;
}

.lure-builder-ident {
  min-width: 0;
}

.modal-lure-builder .modal-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.15;
}

.lure-builder-header .page-kicker {
  margin-bottom: 4px;
}

.modal-lure-builder .modal-footer {
  flex-shrink: 0;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.lure-builder-layout {
  display: grid;
  grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
  gap: 14px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.lure-builder-form {
  overflow-y: auto;
  padding-right: 6px;
  max-height: calc(92vh - 118px);
}

.lure-builder-form .form-field {
  margin-bottom: 0;
  min-width: 0;
}

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

.lure-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.lure-block:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.lure-block-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--section-label);
}

.lure-note {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--dim);
}

.lure-builder-tabpanel > .lure-note {
  margin-top: 10px;
}

.lure-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  background: var(--bg);
  overflow: hidden;
}

.lure-seg-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.lure-seg-btn {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  min-width: 0;
  border: none;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--dim);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--t), background var(--t), box-shadow var(--t);
}

.lure-seg-3 .lure-seg-btn {
  letter-spacing: 0.04em;
  padding: 0 6px;
}

.lure-seg-btn:last-child {
  border-right: none;
}

.lure-seg-btn:hover {
  color: var(--text);
  background: var(--surface);
}

.lure-seg-btn.active {
  color: var(--blue);
  background: var(--blue-bg);
  box-shadow: inset 0 0 0 1px var(--blue-border);
  font-weight: 700;
}

.lure-seg-btn.active::before {
  content: "✓";
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.lure-seg-btn.active:hover {
  color: var(--blue);
  background: var(--blue-bg);
}

.lure-toggle {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.lure-toggle-copy {
  min-width: 0;
}

.lure-toggle-copy .form-lbl {
  margin-bottom: 3px;
}

.lure-switch {
  position: relative;
  width: 34px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.lure-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 1;
}

.lure-switch-track {
  position: absolute;
  inset: 0;
  border: 1px solid var(--border2);
  background: var(--bg);
  pointer-events: none;
}

.lure-switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: var(--muted);
}

.lure-switch input:checked + .lure-switch-track {
  border-color: var(--green-border);
  background: var(--green-bg);
}

.lure-switch input:checked + .lure-switch-track::after {
  left: 18px;
  background: var(--green);
}

.lure-switch input:focus-visible + .lure-switch-track {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}

.lure-builder-preview {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  border-radius: var(--r-lg);
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.preview-toolbar-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.lure-builder-preview .preview-toolbar-cluster {
  margin-left: auto;
}

.preview-device-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg);
}

.preview-device-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: none;
  border-radius: calc(var(--r-sm) - 2px);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--t), color var(--t);
}

.preview-device-tab svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.85;
}

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

.preview-device-tab.active {
  background: var(--surface2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}

.preview-device-tab.active svg { opacity: 1; }

@media (max-width: 520px) {
  .preview-device-tab span { display: none; }
  .preview-device-tab { padding: 5px 7px; }
}

.preview-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--section-label);
}

.preview-step-tabs {
  display: flex;
  gap: 4px;
}

.preview-tab {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t);
}

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

.preview-tab.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.preview-frame-wrap {
  flex: 1;
  min-height: 420px;
  background:
    radial-gradient(circle at 50% 0%, rgba(127, 127, 127, 0.07), transparent 52%),
    var(--surface2);
  position: relative;
  overflow: auto;
  padding: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.lure-builder-preview .preview-frame-wrap {
  border-radius: 0;
}

.preview-device-stage {
  width: 100%;
  min-height: 396px;
  transition: width 0.22s ease, max-width 0.22s ease, box-shadow 0.22s ease;
}

.preview-device-stage.is-desktop {
  max-width: 100%;
  height: 100%;
  min-height: inherit;
}

.preview-device-stage.is-mobile {
  width: 390px;
  max-width: 100%;
  flex-shrink: 0;
  border-radius: 28px;
  border: 3px solid #1c1c1e;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  overflow: hidden;
  background: #fff;
  min-height: 720px;
}

[data-theme="light"] .preview-device-stage.is-mobile {
  border-color: #3a3a3c;
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.18),
    0 0 0 1px rgba(0, 0, 0, 0.06) inset;
}

.preview-device-stage.is-mobile::before {
  content: "";
  display: block;
  height: 26px;
  background: linear-gradient(180deg, #1c1c1e 0%, #0f0f10 100%);
}

.preview-device-stage.is-mobile::after {
  content: "";
  position: absolute;
  top: 9px;
  left: 50%;
  transform: translateX(-50%);
  width: 64px;
  height: 5px;
  border-radius: 99px;
  background: #2c2c2e;
  pointer-events: none;
}

.preview-device-stage.is-mobile {
  position: relative;
}

.preview-frame-wrap iframe,
.preview-device-stage iframe {
  width: 100%;
  height: 100%;
  min-height: 420px;
  border: none;
  display: block;
  background: #fff;
  transition: opacity var(--t);
}

.lure-builder-preview .preview-device-stage.is-desktop iframe {
  /* OneNote / SharePoint auth steps need room for passcode panel + CTA */
  min-height: min(640px, calc(90vh - 200px));
  height: min(640px, calc(90vh - 200px));
}

.preview-device-stage.is-mobile iframe,
.preview-device-stage.is-mobile .tpl-preview-pdf {
  min-height: 694px;
  height: 694px;
}

.preview-frame-wrap iframe.is-loading,
.preview-device-stage iframe.is-loading { opacity: 0.55; }

.tpl-preview-pdf {
  width: 100%;
  min-height: 420px;
  border: none;
  display: block;
  background: #fff;
}

.preview-device-stage.is-mobile .tpl-preview-pdf {
  min-height: 694px;
  height: 694px;
}

.preview-hint {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  padding: 6px 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

/* Setup / Content tabs inside builder form column */
.lure-builder-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
}

.lure-builder-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--t), border-color var(--t);
}

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

.lure-builder-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

.lure-builder-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  padding: 0 5px;
  height: 16px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.lure-builder-tab.active .lure-builder-tab-count {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.lure-builder-tabpanel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lure-builder-tabpanel[data-builder-panel="setup"] {
  gap: 0;
}

/* Content editor */
.lure-content-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.lure-content-toolbar-text { flex: 1; min-width: 0; }

.lure-content-toolbar-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--section-label);
  margin-bottom: 4px;
}

.lure-content-toolbar-sub {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.lure-content-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lure-content-section-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--section-label);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  margin-top: 6px;
}

.lure-content-section-title:first-child { margin-top: 0; }

.lure-content-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lure-content-field-lbl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text);
}

.lure-content-field-lbl-key {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--dim);
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
}

.lure-content-field-hint {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.45;
}

.lure-content-field-default {
  font-size: 10px;
  color: var(--dim);
  font-family: var(--font-mono);
  line-height: 1.4;
  padding-left: 8px;
  border-left: 2px solid var(--border);
}

.lure-content-field textarea.form-input {
  resize: vertical;
  min-height: 60px;
  font-family: var(--font-sans);
  line-height: 1.4;
}

.lure-content-field .form-input.is-edited {
  border-color: var(--text);
}

.lure-content-field-reset {
  align-self: flex-start;
  padding: 0;
  border: none;
  background: none;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
  transition: color var(--t);
}

.lure-content-field-reset:hover { color: var(--text); }

.lure-content-empty {
  padding: 16px;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  background: var(--bg);
}

@media (max-width: 860px) {
  .lure-builder-layout { grid-template-columns: 1fr; }
  .lure-builder-preview { min-height: 360px; }
  .preview-frame-wrap,
  .preview-frame-wrap iframe { min-height: 360px; }
}

/* ── Boot / login gate ────────────────────────────────────── */

.boot-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2100;
}

.boot-overlay[hidden] { display: none; }

.boot-card { text-align: center; }

.boot-text {
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.login-overlay[hidden] { display: none; }

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 36px 32px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.15s ease;
}

.login-logo {
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
}

.login-brand {
  text-align: center;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.login-desc {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 20px;
  letter-spacing: 0.02em;
}

.login-error {
  font-size: 11px;
  color: var(--red);
  min-height: 16px;
  margin-top: 8px;
}

/* ── Log / output ─────────────────────────────────────────── */

.log-area {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--log-bg);
  border: 1px solid var(--border);
  padding: 12px;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
  color: var(--muted);
}

/* ── Toast ────────────────────────────────────────────────── */

.toast-root {
  position: fixed;
  top: calc(var(--header-h, 48px) + 10px);
  right: 18px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.toast {
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: var(--surface2);
  font-size: 13px;
  font-weight: 500;
  min-width: 240px;
  max-width: 360px;
  pointer-events: auto;
  animation: toast-in 0.2s ease;
  color: var(--text);
  box-shadow: var(--shadow-md);
}

.toast.exiting {
  animation: toast-out 0.15s ease forwards;
}

.toast.success { border-color: var(--green-border); background: var(--green-bg); color: var(--green); }
.toast.error   { border-color: var(--red-border);   background: var(--red-bg);   color: var(--red); }
.toast.info    { border-color: var(--blue-border);  background: var(--blue-bg);  color: var(--blue); }

/* ── Session detail panel ─────────────────────────────────── */

.detail-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 16px;
  font-size: 12px;
  margin-bottom: 14px;
}

.detail-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--section-label);
}

.detail-value {
  color: var(--text);
  word-break: break-word;
}

.detail-value.mono {
  font-family: var(--font-mono);
  word-break: break-all;
}

.user-code-display {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.28em;
  padding: 16px;
  border: 1px solid var(--border);
  text-align: center;
  margin: 12px 0;
  color: var(--text);
}

/* ── Lures / redirectors / antibot layouts ────────────────── */

.lures-hero-desc {
  margin: 8px 0 0;
  max-width: 72ch;
  font-size: 12px;
  color: var(--muted);
}

.lures-panel-card {
  margin-bottom: 0;
  min-width: 0;
  padding: var(--panel-pad-y) var(--panel-pad-x);
  overflow: hidden;
}

/* ── Templates catalog ────────────────────────────────────── */

.templates-view .templates-section {
  padding: var(--panel-pad-y) var(--panel-pad-x);
}

.templates-section .section-header {
  margin-bottom: 8px;
}

.templates-section-desc { display: none; }

/* ── Template gallery ───────────────────────────────────────────── */
/* ══ Template Catalog — Row Layout ══════════════════════════════ */
/* ══════════════════════════════════════════════════════════════
   Template Catalog — Polished Row Layout
   ══════════════════════════════════════════════════════════════ */
.template-grid {
  display: flex;
  flex-direction: column;
}

/* ── Row ── */
.template-card {
  --tpl-accent: #4b5563;
  position: relative;
  display: grid;
  grid-template-columns: 3px 260px 1fr 148px;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  transition: background .1s;
  min-height: 68px;
}
.template-card:last-child { border-bottom: none; }
.template-card:hover { background: var(--card-hover); }

/* Col 1 — Brand accent stripe */
.template-card::before {
  content: '';
  display: block;
  background: var(--tpl-accent);
  opacity: .8;
}

/* Col 2 — Identity */
.template-card-head {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 14px 18px;
  border-right: 1px solid var(--border);
}
.tpl-accent { display: none; }

.template-card-title-block { display: flex; flex-direction: column; gap: 2px; }

.template-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -.02em;
}
.template-card-brand {
  font-size: 10px;
  color: var(--dim);
  letter-spacing: .01em;
  font-family: "IBM Plex Mono", monospace;
  margin-top: 1px;
}

/* Badge — accent-coloured pill */
.template-card-head .status-badge {
  margin-top: 6px;
  align-self: flex-start;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  border: none;
  background: rgba(255,255,255,.06);
  color: var(--muted);
}
.template-card-head .status-badge.ok  { background: rgba(34,197,94,.12);  color: #4ade80; }
.template-card-head .status-badge.pending { background: rgba(251,191,36,.12); color: #fbbf24; }
.template-card-head .status-badge.warn    { background: rgba(168,85,247,.12); color: #c084fc; }
.template-card-head .status-badge.info    { background: rgba(59,130,246,.12); color: #60a5fa; }

/* Col 3 — Description + flow */
.template-card-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
}
.template-card-tagline {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
  max-width: 620px;
}
.template-card-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
}
.template-card-flow-lbl { display: none; }
.template-card-desc { display: none; }

.template-card-flow-step {
  font-size: 10px;
  font-weight: 600;
  color: var(--dim);
  white-space: nowrap;
  letter-spacing: .01em;
}
.template-card:hover .template-card-flow-step { color: var(--muted); }

.template-card-flow-sep {
  display: inline-flex;
  align-items: center;
  margin: 0 6px;
  color: var(--border2);
  font-size: 11px;
}
.template-card-flow-sep::before { content: '›'; }
.template-card-flow-sep::after  { content: none; }

/* Col 4 — Action buttons */
.template-card-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 7px;
  padding: 14px 16px;
  border-left: 1px solid var(--border);
}

/* Override any conflicting .btn rules for this context */
.template-card-actions .btn {
  width: 100%;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  padding: 7px 0;
  letter-spacing: .01em;
}
.template-card-actions .btn.primary {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 4px;
}
.template-card-actions .btn.primary:hover { background: var(--blue-dark, #1d4ed8); }
.template-card-actions .btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border2);
  border-radius: 4px;
}
.template-card-actions .btn.ghost:hover { color: var(--text); border-color: var(--muted); }


/* ══ Template Switcher Tab Bar ══════════════════════════════════ */
.tpl-switcher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  padding: 0 14px 0 0;
  flex-shrink: 0;
}
.tpl-switcher-tabs { display: flex; align-items: stretch; }

.tpl-switcher-tab {
  position: relative;
  background: none;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 12px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: color .12s, background .12s;
}
.tpl-switcher-tab:hover { color: var(--text); background: rgba(255,255,255,.03); }
.tpl-switcher-tab.active { color: var(--text); background: var(--surface); font-weight: 700; }
.tpl-switcher-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 2px;
  background: var(--blue);
}
.tpl-switcher-tab .tpl-count {
  font-size: 9px; padding: 2px 7px; border-radius: 10px;
  background: var(--bg); color: var(--dim); border: 1px solid var(--border);
  font-weight: 700; letter-spacing: .05em; font-family: "IBM Plex Mono", monospace;
}
.tpl-switcher-tab.active .tpl-count { background: var(--blue); color: #fff; border-color: transparent; }
.tpl-panel { }


/* ── Antibot Gate Cards ──────────────────────────────────────── */
/* ── Antibot: Captcha style selector ───────────────────────────── */
.antibot-captcha-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.antibot-captcha-row[hidden] { display: none !important; }

.captcha-style-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid var(--border2);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: var(--bg);
  flex: 1;
  min-width: 140px;
  max-width: 200px;
}
.captcha-style-card:hover {
  border-color: var(--blue);
  background: var(--surface);
}
.captcha-style-card input[type="radio"] {
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--blue);
}
.captcha-style-card input[type="radio"]:checked ~ .captcha-style-body .captcha-style-name {
  color: var(--blue);
}
.captcha-style-card:has(input:checked) {
  border-color: var(--blue);
  background: rgba(37,99,235,.06);
}
.captcha-style-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.captcha-style-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.captcha-style-desc {
  font-size: 10px;
  color: var(--dim);
  line-height: 1.4;
}

.ab-gate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}

.ab-gate-card {
  background: var(--surface);
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: background var(--t);
  position: relative;
}
.ab-gate-card:hover { background: var(--surface2); }
.ab-gate-inactive { opacity: .55; }

/* Header */
.ab-gate-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.ab-gate-head-left { display: flex; align-items: flex-start; gap: 10px; }
.ab-gate-num {
  font-size: 10px;
  font-weight: 700;
  color: var(--dim);
  min-width: 18px;
  padding-top: 2px;
  letter-spacing: .04em;
}
.ab-gate-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
  word-break: break-word;
}
.ab-gate-slug {
  font-size: 10px;
  color: var(--dim);
  letter-spacing: .02em;
  margin-top: 2px;
}
.ab-gate-head-right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

/* Filters */
.ab-gate-filters { display: flex; flex-wrap: wrap; gap: 4px; }
.ab-filter-tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 2px 6px;
  border: 1px solid;
  text-transform: uppercase;
}
.ab-filter-bots   { color: #ef4444; border-color: rgba(239,68,68,.3);  background: rgba(239,68,68,.07); }
.ab-filter-scan   { color: #f97316; border-color: rgba(249,115,22,.3); background: rgba(249,115,22,.07); }
.ab-filter-fp     { color: #8b5cf6; border-color: rgba(139,92,246,.3); background: rgba(139,92,246,.07); }
.ab-filter-hl     { color: #06b6d4; border-color: rgba(6,182,212,.3);  background: rgba(6,182,212,.07); }
.ab-filter-cap    { color: #f59e0b; border-color: rgba(245,158,11,.3); background: rgba(245,158,11,.07); }
.ab-filter-emb    { color: #64748b; border-color: rgba(100,116,139,.3);background: rgba(100,116,139,.07); }
.ab-filter-touch  { color: #22c55e; border-color: rgba(34,197,94,.3);  background: rgba(34,197,94,.07); }

/* Analytics */
.ab-gate-analytics { display: flex; flex-direction: column; gap: 6px; }
.ab-stat-row {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.ab-stat { text-align: center; min-width: 36px; }
.ab-stat-val { font-size: 16px; font-weight: 700; color: var(--fg); line-height: 1; font-variant-numeric: tabular-nums; }
.ab-stat-lbl { font-size: 9px; color: var(--dim); letter-spacing: .04em; text-transform: uppercase; margin-top: 2px; }
.ab-stat-green .ab-stat-val { color: #22c55e; }
.ab-stat-red   .ab-stat-val { color: #ef4444; }
.ab-stat-yellow.ab-stat-val, .ab-stat-yellow .ab-stat-val { color: #f59e0b; }
.ab-stat-orange.ab-stat-val, .ab-stat-orange .ab-stat-val { color: #f97316; }

/* Segmented bar */
.ab-bar-wrap {
  display: flex;
  height: 4px;
  background: var(--border2);
  overflow: hidden;
  gap: 1px;
}
.ab-bar-seg  { height: 100%; transition: width .4s ease; min-width: 2px; }
.ab-bar-green  { background: #22c55e; }
.ab-bar-red    { background: #ef4444; }
.ab-bar-yellow { background: #f59e0b; }
.ab-bar-orange { background: #f97316; }

.ab-gate-nodata { font-size: 11px; }

/* OS routing */
.ab-gate-routing { display: flex; flex-wrap: wrap; gap: 4px; }
.ab-os-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 7px;
  max-width: 160px;
}
.ab-os-url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--dim);
  max-width: 120px;
  display: inline-block;
}
.ab-os-other { opacity: .7; }

/* Actions */
.ab-gate-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
}
.ab-gate-actions .btn { font-size: 11px; padding: 4px 10px; height: auto; }

/* ══════════════════════════════════════════════════════════════
   Redirector Campaign Cards — full-insight layout
   ══════════════════════════════════════════════════════════════ */

.redir-card-grid {
  display: flex;
  flex-direction: column;
}

/* Card wrapper */
.redir-card {
  position: relative;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  transition: background .12s;
  padding-left: 4px;               /* space for accent stripe */
}
.redir-card:last-child { border-bottom: none; }
.redir-card:hover { background: var(--card-hover); }
.redir-card.redir-card-inactive { opacity: .58; }

/* Left accent stripe */
.redir-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--redir-accent, var(--border2));
}
.redir-card[data-status="live"]     { --redir-accent: #22c55e; }
.redir-card[data-status="pending"]  { --redir-accent: #f59e0b; }
.redir-card[data-status="inactive"] { --redir-accent: #52525b; }

/* ── Header: identity + actions ─────────────────────────────── */
.redir-card-header {
  display: flex;
  align-items: center;
  padding: 10px 14px 6px 18px;
  gap: 8px;
  min-width: 0;
}
/* Left: all identity info */
.redir-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.redir-card-num {
  font-size: 10px;
  color: var(--dim);
  font-family: "IBM Plex Mono", monospace;
  flex-shrink: 0;
}
.redir-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.015em;
  flex-shrink: 0;
}
.redir-card-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}
.redir-card-status-dot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--redir-accent, var(--dim));
  flex-shrink: 0;
}
.redir-card-status-dot::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--redir-accent, var(--dim));
  flex-shrink: 0;
}
/* Right: actions pinned to the right */
.redir-card-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.redir-card-actions .btn { font-size: 11px; padding: 4px 10px; height: auto; }

/* ── URL row ─────────────────────────────────────────────────── */
.redir-card-url-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 7px 18px;
  min-width: 0;
}
.redir-card-slug {
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--dim);
  flex-shrink: 0;
}
.redir-card-url-sep {
  font-size: 11px;
  color: var(--border2);
  flex-shrink: 0;
}
.redir-card-gate-link {
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--blue);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.redir-card-gate-link:hover { text-decoration: underline; }
.redir-card-gate-missing {
  font-size: 11px;
  color: var(--amber);
}

/* ── Analytics body ──────────────────────────────────────────── */
.redir-card-body {
  padding: 0 14px 10px 18px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* Funnel bar */
.redir-funnel-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--border2);
  display: flex;
  overflow: hidden;
}
.redir-funnel-bar-pass   { background: #22c55e; min-width: 2px; border-radius: 3px 0 0 3px; }
.redir-funnel-bar-deny   { background: #ef4444; min-width: 2px; }
.redir-funnel-bar-invalid{ background: #f59e0b; min-width: 2px; border-radius: 0 3px 3px 0; }

.redir-funnel-label {
  font-size: 10px;
  color: var(--dim);
  margin-top: 2px;
}

/* Stat pills */
.redir-stat-pills {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.redir-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  white-space: nowrap;
}
.redir-stat-pill.pill-pass   { background: rgba(34,197,94,.08);  border-color: rgba(34,197,94,.25);  color: #4ade80; }
.redir-stat-pill.pill-deny   { background: rgba(239,68,68,.08);  border-color: rgba(239,68,68,.25);  color: #f87171; }
.redir-stat-pill.pill-invalid{ background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.25); color: #fbbf24; }
.redir-stat-pill.pill-views  { background: rgba(59,130,246,.07); border-color: rgba(59,130,246,.2);  color: #93c5fd; }
.redir-stat-pill.pill-leads  { background: rgba(168,85,247,.07); border-color: rgba(168,85,247,.2);  color: #c4b5fd; }

.redir-no-activity {
  font-size: 11px;
  color: var(--dim);
  font-style: italic;
}

/* ── Routing footer ──────────────────────────────────────────── */
.redir-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 9px 18px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.redir-routing-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--dim);
  flex-shrink: 0;
}
.redir-routing-destinations {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.redir-dest-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  max-width: 280px;
}
.redir-dest-chip .dest-label {
  font-weight: 700;
  font-size: 9px;
  color: var(--dim);
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.redir-dest-chip .dest-url {
  font-family: "IBM Plex Mono", monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.redir-dest-chip.mx-ms     { border-color: rgba(59,130,246,.3);  color: #93c5fd; }
.redir-dest-chip.mx-ms     .dest-label { color: #60a5fa; }
.redir-dest-chip.mx-google { border-color: rgba(234,179,8,.25);  color: #fde047; }
.redir-dest-chip.mx-google .dest-label { color: #ca8a04; }

/* ══════════════════════════════════════════════════════════════
   Row action menu — overflow dropdown (shared by lures, redirectors)
   ══════════════════════════════════════════════════════════════ */
.row-action-menu {
  position: relative;
  display: inline-flex;
}
.row-action-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 200;
  min-width: 168px;
  background: var(--surface);
  border: 1px solid var(--border2);
  padding: 4px 0;
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
.row-action-menu-item {
  display: block;
  width: 100%;
  padding: 7px 14px;
  font-size: 12px;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.4;
}
.row-action-menu-item:hover { background: var(--card-hover); }
.row-action-menu-item.danger { color: var(--red, #ef4444); }

/* ══════════════════════════════════════════════════════════════
   Redirector Stats Analytics Modal — stats strip + full-width log
   ══════════════════════════════════════════════════════════════ */

.modal-card.rsa-modal {
  width: min(1040px, 96vw);
  max-width: min(1040px, 96vw);
  max-height: 88vh;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rsa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 11px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
}
.rsa-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 2px;
}
.rsa-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.01em;
}

.rsa-stat-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.rsa-stat {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
  padding: 10px 14px;
  border-right: 1px solid var(--border);
  min-width: 0;
  white-space: nowrap;
}
.rsa-stat:last-child { border-right: none; }

@media (max-width: 720px) {
  .rsa-stat-strip { grid-template-columns: repeat(3, 1fr); }
  .rsa-stat:nth-child(3) { border-right: none; }
}
.rsa-stat-num {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
  line-height: 1;
  color: var(--text);
}
.rsa-stat-lbl {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--dim);
}
.rsa-stat-purple .rsa-stat-num { color: #c4b5fd; }
.rsa-stat-blue   .rsa-stat-num { color: #93c5fd; }
.rsa-stat-green  .rsa-stat-num { color: #4ade80; }
.rsa-stat-red    .rsa-stat-num { color: #f87171; }
.rsa-stat-amber  .rsa-stat-num { color: #fbbf24; }
.rsa-stat-accent .rsa-stat-num { color: var(--text); }

.rsa-funnel-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 16px 9px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.rsa-funnel-bar {
  height: 4px;
  background: var(--border2);
  display: flex;
  overflow: hidden;
  gap: 1px;
}
.rsa-funnel-pass    { background: #22c55e; min-width: 0; width: 0; transition: width .4s; }
.rsa-funnel-deny    { background: #ef4444; min-width: 0; width: 0; transition: width .4s; }
.rsa-funnel-invalid { background: #f59e0b; min-width: 0; width: 0; transition: width .4s; }
.rsa-funnel-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.rsa-funnel-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 11px;
  color: var(--muted);
}
.rsa-legend-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex-shrink: 0;
}

.rsa-mx-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}
.rsa-mx-inline[hidden] { display: none; }
.rsa-mx-kicker {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dim);
}
.rsa-mx-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}
.rsa-mx-chip b {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.rsa-mx-ms b     { color: #93c5fd; }
.rsa-mx-google b { color: #fde047; }
.rsa-mx-other b  { color: var(--muted); }

.rsa-log {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.rsa-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 10px;
}
.rsa-log-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
}
.rsa-log-filters {
  display: flex;
  gap: 4px;
}
.rsa-filter-btn {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
  letter-spacing: .03em;
  font-family: inherit;
}
.rsa-filter-btn:hover  { background: var(--card-hover); color: var(--text); }
.rsa-filter-btn.active { background: var(--border2); color: var(--text); }
.rsa-filter-btn.green  { border-color: rgba(34,197,94,.3); }
.rsa-filter-btn.green.active  { background: rgba(34,197,94,.12); color: #4ade80; border-color: #22c55e; }
.rsa-filter-btn.red    { border-color: rgba(239,68,68,.3); }
.rsa-filter-btn.red.active    { background: rgba(239,68,68,.12); color: #f87171; border-color: #ef4444; }

.rsa-log-body {
  flex: 1;
  overflow-y: auto;
  min-height: 220px;
}
.rsa-log-placeholder {
  padding: 20px 16px;
  font-size: 11px;
  color: var(--dim);
  font-style: italic;
}

.rsa-log-thead,
.rsa-log-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1.5fr) minmax(0, 1.2fr) 56px;
  gap: 0 12px;
  align-items: center;
  padding: 6px 16px;
  min-width: 0;
}
.rsa-log-thead {
  padding-top: 5px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  position: sticky;
  top: 0;
  z-index: 1;
}
.rsa-log-thead span {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--dim);
}
.rsa-log-thead span:last-child,
.rsa-log-ts {
  text-align: right;
}
.rsa-log-row {
  border-bottom: 1px solid var(--border);
}
.rsa-log-row:hover { background: var(--row-hover, var(--card-hover)); }

/* Outcome pill */
.rsa-log-outcome {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 3px 8px;
  white-space: nowrap;
  border: 1px solid;
}
.rsa-log-outcome.pass  { color:#4ade80; background:rgba(34,197,94,.1);  border-color:rgba(34,197,94,.3);  }
.rsa-log-outcome.deny  { color:#f87171; background:rgba(239,68,68,.1);  border-color:rgba(239,68,68,.3);  }
.rsa-log-outcome.inval { color:#fbbf24; background:rgba(245,158,11,.1); border-color:rgba(245,158,11,.3); }

/* Email (truncated) */
.rsa-log-email {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Destination URL + IP */
.rsa-log-dest {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Timestamp (HH:MM) */
.rsa-log-ts {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--dim);
  white-space: nowrap;
  text-align: right;
}

.rsa-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.rsa-footer-actions {
  display: flex;
  gap: 8px;
}

/* How to use */
#view-guide .page-header,
#view-guide .page-header:has(.page-header-desc) {
  align-items: flex-start;
}

#view-guide .page-header-main {
  flex: 1 1 100%;
  max-width: none;
}

#view-guide .page-header-desc {
  max-width: 62ch;
}

.guide-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  min-width: 0;
}

.guide-flow {
  counter-reset: guide-flow;
  list-style: none;
  margin: 0;
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 0;
  border: 1px solid var(--border);
  background: var(--surface);
}

.guide-flow li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
  padding: 0 4px 0 0;
}

.guide-flow li::before {
  content: counter(guide-flow);
  counter-increment: guide-flow;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border2);
  background: var(--bg);
  font-size: 10px;
  letter-spacing: 0;
  color: var(--muted);
}

.guide-flow li:not(:last-child)::after {
  content: '';
  width: 18px;
  height: 1px;
  background: var(--border2);
  margin: 0 8px 0 4px;
}

.guide-toc.tab-bar {
  margin-bottom: 0;
}

.guide-toc-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.guide-section,
.guide-also {
  scroll-margin-top: 72px;
}

.guide-section {
  margin-bottom: 0;
}

.guide-section-head {
  margin-bottom: 14px;
}

.guide-section-head .page-kicker {
  margin-bottom: 6px;
}

.guide-section-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1.2;
  margin: 0 0 6px;
}

.guide-section-head .view-desc {
  margin: 0;
}

.guide-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  background: var(--bg);
}

.guide-step {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.guide-step:last-child {
  border-bottom: none;
}

.guide-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-top: 1px;
  border: 1px solid var(--border2);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.guide-step-body {
  min-width: 0;
}

.guide-step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.guide-step-head strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.guide-step-body p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

.guide-step-body p + p {
  margin-top: 6px;
}

button.guide-jump.btn {
  text-decoration: none;
}

button.guide-jump:not(.btn) {
  appearance: none;
  display: inline;
  padding: 0;
  border: none;
  background: none;
  color: var(--blue);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

button.guide-jump:not(.btn):hover {
  color: var(--text);
}

.guide-callout {
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-left-width: 2px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}

.guide-callout strong {
  color: var(--amber);
  font-weight: 700;
}

.guide-section code,
.guide-mini code,
#view-guide .page-header-desc code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
}

.guide-also-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.guide-mini {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-mini .panel-card-title {
  margin-bottom: 0;
}

.guide-mini p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  flex: 1;
}

.guide-mini .btn {
  align-self: flex-start;
}

@media (max-width: 900px) {
  .guide-also-grid {
    grid-template-columns: 1fr;
  }
  .guide-flow li {
    white-space: normal;
  }
}
