/* ==============================================================
   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,
.template-card,
.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: 52px;
  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); }
.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-x: auto;
  flex-wrap: nowrap;
  position: sticky;
  top: 52px;
  z-index: 90;
}

.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(--text);
}

/* ── 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;
}

.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;
}

/* ── 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;
}

/* ── 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: 1fr 1fr;
  gap: 12px;
}

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

.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: 10px 16px;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 1px solid var(--card-border);
  transition: background var(--t);
}

.account-card.token-card {
  grid-template-columns: 36px 1fr auto;
}

.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: 600;
}

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

.account-notes {
  font-size: 11px;
  color: var(--dim);
  margin-top: 2px;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.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 ─────────────────────────────── */

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

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

.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, 420px) 1fr;
  gap: 14px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

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

.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;
}

.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: var(--surface2);
  position: relative;
  overflow: hidden;
}

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

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

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

.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;
}

/* 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: 68px;
  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-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1px;
  align-items: stretch;
  border: 1px solid var(--border);
  overflow: hidden;
}

.template-card {
  --tpl-accent: var(--border2);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border: none;
  border-right: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  transition: background var(--t), border-color var(--t);
}

/* Left accent stripe — 2px, no radius */
.template-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--tpl-accent);
  z-index: 1;
}

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

/* ── Card header ── */
.template-card-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 12px 10px 14px;
}

.tpl-accent {
  display: none; /* replaced by ::before stripe */
}

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

.template-card-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1.3;
  overflow-wrap: anywhere;
  font-family: "IBM Plex Sans", sans-serif;
}

.template-card-brand {
  font-size: 9px;
  font-weight: 600;
  color: var(--section-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
  font-family: "IBM Plex Mono", monospace;
}

/* Description removed */
.template-card-desc { display: none; }

/* ── Flow steps (tag pills) ── */
.template-card-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 8px 12px 10px 14px;
  border-top: 1px solid var(--border);
  background: transparent;
  flex: 1;
}

.template-card-flow-lbl { display: none; }

.template-card-flow-val {
  font-size: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.template-card-flow-step {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 6px;
  line-height: 1.4;
  font-family: "IBM Plex Sans", sans-serif;
  transition: color var(--t), border-color var(--t);
}

.template-card:hover .template-card-flow-step {
  color: var(--text);
  border-color: var(--border2);
}

.template-card-flow-sep {
  width: 10px;
  height: 1px;
  background: var(--dim);
  flex-shrink: 0;
  position: relative;
}
/* Arrow on the separator line */
.template-card-flow-sep::after {
  content: '→';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 8px;
  color: var(--dim);
  background: transparent;
  line-height: 1;
}

/* ── Action buttons ── */
.template-card-actions {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.template-card-actions .btn {
  flex: 1;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 6px;
  border: none;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--t), color var(--t);
}

.template-card-actions .btn:last-child {
  border-right: none;
}

.template-card-actions .btn:hover {
  background: var(--surface2);
  color: var(--text);
}

.template-card-actions .btn.primary {
  flex: 1.2;
  color: var(--blue);
  background: var(--blue-bg);
}

.template-card-actions .btn.primary:hover {
  background: var(--blue);
  color: #fff;
}

/* Template preview modal — reuses .preview-frame-wrap/iframe */
.modal-template-preview {
  max-width: min(1080px, 96vw);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px;
}

.modal-template-preview .modal-header {
  flex-shrink: 0;
  margin-bottom: 12px;
  align-items: flex-start;
}

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

.tpl-preview-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tpl-preview-sub {
  font-size: 10px;
  color: var(--dim);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tpl-preview-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}

.tpl-preview-toolbar {
  gap: 12px;
}

.tpl-preview-category {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--dim);
}

.tpl-preview-frame-wrap {
  min-height: 60vh;
}

.tpl-preview-frame-wrap iframe,
.tpl-preview-frame-wrap .tpl-preview-pdf {
  min-height: 60vh;
}

.tpl-preview-frame-wrap .tpl-preview-pdf {
  display: block;
  width: 100%;
  height: 60vh;
  border: 0;
  background: var(--surface-2, #1a1a1a);
}

.tpl-preview-frame-wrap .tpl-preview-pdf[hidden] {
  display: none;
}

.tpl-preview-frame-wrap iframe.is-loading,
.tpl-preview-frame-wrap .tpl-preview-pdf.is-loading {
  opacity: 0.55;
}

@media (max-width: 720px) {
  .template-grid { grid-template-columns: 1fr; }
  .tpl-preview-frame-wrap,
  .tpl-preview-frame-wrap iframe,
  .tpl-preview-frame-wrap .tpl-preview-pdf { min-height: 50vh; }
}


.lures-panel-card .section-header {
  margin-bottom: 12px;
  gap: 12px;
}

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

.lures-panel-card .section-stats {
  white-space: nowrap;
}

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

.lures-panel-card .empty-state {
  border: none;
  background: transparent;
  padding: 40px 8px;
}

.lures-toolbar {
  margin-bottom: 12px;
  gap: 8px;
}

.lures-toolbar .lures-search {
  flex: 1;
  min-width: 200px;
  max-width: 420px;
}

.lures-table-wrap {
  margin: 0 calc(-1 * var(--panel-pad-x)) calc(-1 * var(--panel-pad-y));
  width: calc(100% + (var(--panel-pad-x) * 2));
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
}

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

.lures-table .col-lure-num       { width: 48px; }
.lures-table .col-lure-route     { width: 96px; }
.lures-table .col-lure-campaign  { width: 12%; }
.lures-table .col-lure-template  { width: 10%; }
.lures-table .col-lure-url       { width: 24%; }
.lures-table .col-lure-doc       { width: 12%; }
.lures-table .col-lure-tag       { width: 14%; }
.lures-table .col-lure-actions   { width: 300px; }

.lures-table th,
.lures-table td {
  overflow: hidden;
  vertical-align: middle;
  padding: 10px 12px;
}

.lures-table th.lure-num-head,
.lures-table td.lure-num {
  text-align: right;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding-right: 12px;
}

.lures-table th:last-child,
.lures-table td.lure-actions-cell {
  text-align: right;
}

.lure-name-cell { min-width: 0; }

.lure-campaign-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lure-slug {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--dim);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.lure-url-cell,
.lure-doc-cell,
.lure-tag-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.lure-url-cell a { color: var(--blue); }

.lure-route-cell {
  text-align: center;
  font-size: 11px;
}

.lure-actions-cell {
  padding-top: 8px;
  padding-bottom: 8px;
}

.lure-actions-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.lure-actions-wrap .btn.lure-action {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
}

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

@media (max-width: 1100px) {
  .lures-panel-card .section-stats { display: none; }
}

@media (max-width: 900px) {
  .lure-actions-wrap { justify-content: flex-start; }
}

/* ── Redirectors table ────────────────────────────────────── */

.redirectors-table {
  min-width: 1180px;
}

.redirectors-table .col-redir-num       { width: 48px; }
.redirectors-table .col-redir-campaign  { width: 16%; }
.redirectors-table .col-redir-theme     { width: 88px; }
.redirectors-table .col-redir-status    { width: 88px; }
.redirectors-table .col-redir-gate      { width: 16%; }
.redirectors-table .col-redir-routing   { width: 14%; }
.redirectors-table .col-redir-analytics { width: 140px; }
.redirectors-table .col-redir-actions   { width: 300px; }

.redirectors-table td.redirector-analytics-cell,
.redirectors-table td.lure-actions-cell {
  overflow: visible;
  white-space: normal;
  vertical-align: middle;
}

.redirector-routing-cell {
  min-width: 0;
  white-space: normal;
}

.redirector-route-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  line-height: 1.35;
}

.redirector-route-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.redirector-route-item .route-label {
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

.redirector-route-item .route-url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-family: var(--font-mono);
}

.redirector-analytics-cell {
  font-size: 11px;
  line-height: 1.35;
  min-width: 0;
}

.redirector-analytics-stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.redirector-analytics-stack .analytics-primary {
  white-space: normal;
  word-break: break-word;
}

.redirector-analytics-cell .analytics-pass {
  color: var(--green);
  font-weight: 600;
}

.redirector-analytics-cell .analytics-deny {
  color: var(--red);
}

.redirector-analytics-stack .analytics-meta {
  display: block;
  font-size: 10px;
  color: var(--dim);
  line-height: 1.3;
}

.redirector-actions-row {
  position: relative;
  flex-wrap: nowrap;
}

.redirector-actions-row .btn.lure-action {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* ── Row action menu (kebab dropdown) ─────────────────────── */

.row-action-menu {
  position: relative;
  flex: 0 0 auto;
}

.row-action-menu-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 30;
  min-width: 168px;
  padding: 4px;
  border: 1px solid var(--border);
  background: var(--surface2);
  animation: modal-in 0.15s ease;
}

.row-action-menu-item {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background var(--t), color var(--t);
}

.row-action-menu-item:hover {
  background: var(--btn-hover-bg);
}

.row-action-menu-item.danger {
  color: var(--red);
}

/* ── Redirector stats modal ───────────────────────────────── */

.redirector-stats-modal {
  max-width: 720px;
}

.redirector-stats-grid {
  margin: 12px 0 14px;
}

.redirector-stats-grid .stat-value {
  font-size: 20px;
}

.redirector-mx-stats {
  margin-bottom: 12px;
  padding: 0;
}

.redirector-mx-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 12px 16px 16px;
}

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

.redirector-stats-footnote {
  margin: 0;
  font-size: 11px;
  color: var(--dim);
}

@media (max-width: 900px) {
  .redirector-actions-row {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .redirector-mx-stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Antibot: OS/captcha ──────────────────────────────────── */

.antibot-os-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0 14px;
}

.antibot-os-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  align-items: center;
}

.antibot-captcha-styles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.antibot-captcha-styles[disabled],
.antibot-captcha-styles.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.captcha-style-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
}

.captcha-style-card:hover {
  border-color: var(--border2);
}

.captcha-style-card:has(input:checked) {
  border-color: var(--text);
  background: var(--card-hover);
}

.captcha-style-card input {
  margin-top: 3px;
  accent-color: var(--text);
}

.captcha-style-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.captcha-style-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.captcha-style-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

/* ── Antibot wizard modal ─────────────────────────────────── */

.modal-card.modal-antibot {
  max-width: min(640px, 96vw);
  width: 100%;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.modal-card.modal-antibot .modal-header {
  padding: 18px 20px 12px;
  margin-bottom: 0;
}

.modal-card.modal-antibot .modal-body {
  margin-bottom: 0;
}

.antibot-step-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.antibot-tabs {
  padding: 0 20px;
  margin: 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.antibot-tabs .tab-btn {
  flex: 1;
  text-align: center;
  min-width: 0;
}

.antibot-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px 20px;
}

.antibot-step-panel { display: none; }

.antibot-step-panel.active {
  display: block;
  animation: view-in 0.15s ease;
}

.antibot-body .panel-card {
  margin-bottom: 12px;
  padding: 12px 14px;
}

.antibot-body .panel-card:last-child { margin-bottom: 0; }

.antibot-advanced summary {
  cursor: pointer;
  list-style: none;
}

.antibot-advanced summary::-webkit-details-marker {
  display: none;
}

.antibot-captcha-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.antibot-captcha-row .captcha-style-card {
  margin: 0;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
  padding: 10px 8px;
}

.antibot-captcha-row .captcha-style-body {
  align-items: center;
}

.antibot-routing-lead {
  margin: 0 0 12px;
}

.antibot-os-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  padding: 10px 12px;
}

.antibot-os-list .antibot-os-row {
  grid-template-columns: 108px 1fr;
}

.antibot-os-row + .antibot-os-row {
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.antibot-os-label { margin: 0; }

.antibot-os-url:disabled { opacity: 0.45; }

.antibot-review-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
}

.antibot-review-section {
  padding: 12px 14px;
}

.antibot-review-section + .antibot-review-section {
  border-top: 1px solid var(--border);
}

.antibot-review-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

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

.antibot-review-edit {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color var(--t);
}

.antibot-review-edit:hover { color: var(--text); }

.antibot-review-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  padding: 3px 0;
}

.antibot-review-key { color: var(--muted); }

.antibot-review-val {
  text-align: right;
  word-break: break-all;
  color: var(--text);
}

.antibot-review-pill {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border: 1px solid var(--border);
}

.antibot-review-pill.is-on {
  color: var(--green);
  border-color: var(--green-border);
  background: var(--green-bg);
}

.antibot-review-pill.is-off {
  color: var(--dim);
}

.antibot-deploy-hint { margin: 12px 0 0; }

.antibot-footer {
  justify-content: space-between;
  padding: 14px 20px 18px;
  margin: 0;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.antibot-footer-actions {
  display: flex;
  gap: 8px;
}

@media (max-width: 560px) {
  .antibot-captcha-row {
    grid-template-columns: 1fr;
  }
  .antibot-os-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* ── Antibot analytics view ───────────────────────────────── */

.antibot-analytics-card {
  margin-top: 0;
}

.antibot-analytics-toolbar {
  align-items: flex-start;
  gap: 16px;
}

.antibot-analytics-toolbar-left {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.antibot-analytics-heading { min-width: 0; }

.antibot-analytics-heading .panel-card-title {
  margin-bottom: 0;
}

.antibot-analytics-body {
  padding-top: 4px;
}

.antibot-stats-campaign-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.antibot-stats-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.antibot-stats-slug {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  padding: 2px 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.antibot-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}

.antibot-kpi {
  padding: 14px 16px;
  border: none;
  background: var(--surface);
}

.antibot-kpi-primary {
  background: var(--surface);
  border-top: 2px solid var(--text);
}

.antibot-kpi-success {
  background: var(--surface);
  border-top: 2px solid var(--green);
}

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

.antibot-kpi-value {
  display: block;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.antibot-metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-top: 10px;
}

.antibot-metric {
  padding: 10px 12px;
  border: none;
  background: var(--surface);
}

.antibot-metric-value {
  display: block;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.antibot-metric-value.is-warn { color: var(--yellow); }

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

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

.antibot-events-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.antibot-events-section .antibot-events-wrap {
  border: 1px solid var(--border);
  overflow: auto;
  max-height: 420px;
  background: var(--surface);
}

.antibot-events-filter {
  min-width: 130px;
}

.antibot-events-table { margin: 0; }

.antibot-events-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--section-label);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.antibot-events-table td {
  font-size: 11px;
  padding: 9px 12px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

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

.antibot-events-table td:nth-child(2),
.antibot-events-table td:nth-child(3) {
  white-space: normal;
  max-width: 160px;
  line-height: 1.35;
  color: var(--muted);
}

.antibot-events-table .table-empty td {
  padding: 32px 16px;
  text-align: center;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.5;
}

.antibot-stats-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.antibot-stats-notice-icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  border: 1px solid var(--border2);
}

.antibot-stats-notice p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

@media (max-width: 760px) {
  .antibot-analytics-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .antibot-analytics-toolbar-left {
    flex-direction: column;
    gap: 10px;
  }
  .antibot-kpi-row { grid-template-columns: 1fr; }
  .antibot-metric-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .antibot-section-head {
    flex-direction: column;
    align-items: stretch;
  }
  .antibot-events-filter { width: 100%; }
}

/* ── Deploy modal ─────────────────────────────────────────── */

.deploy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.deploy-card {
  margin: 0;
}

.deploy-card .view-desc {
  min-height: 2.8em;
  margin-bottom: 10px;
}

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

/* ── Deploy result bar ────────────────────────────────────── */
.deploy-result-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2, #1a1a1a);
  border: 1px solid var(--border, #333);
  border-radius: 8px;
  padding: 10px 12px;
}

.deploy-result-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.deploy-result-url {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--accent, #7c6af7);
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  cursor: text;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deploy-result-copy {
  flex-shrink: 0;
  font-size: 11px;
  padding: 4px 10px;
}

.deploy-result-copy.copied {
  color: #22c55e;
  border-color: #22c55e;
}

.deploy-result-open {
  flex-shrink: 0;
  font-size: 11px;
  padding: 4px 10px;
  text-decoration: none;
}

.deploy-result-meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted, #71717a);
  padding-left: 2px;
}

/* ── Alerts ───────────────────────────────────────────────── */

.alert {
  padding: 10px 12px;
  border: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.45;
  margin-bottom: 14px;
}

.alert.warn {
  border-color: var(--amber-border);
  background: var(--amber-bg);
  color: var(--text);
}

/* ── Capability grid ──────────────────────────────────────── */

.capability-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.capability-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  font-size: 11px;
}

.capability-item.ok {
  border-color: var(--green-border);
  color: var(--green);
}

.capability-item.no {
  opacity: 0.55;
}

/* ── Token-manage panels ──────────────────────────────────── */

.manage-panel { margin-top: 8px; }

.exo-notes {
  margin: 0;
  padding-left: 18px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

/* ── Folder picker (token extract modal) ──────────────────── */

.folder-picker {
  border: 1px solid var(--border);
  padding: 8px;
  background: var(--surface);
  overflow: auto;
}

/* ── Proxy sub-panels ─────────────────────────────────────── */

.proxy-panel { margin-top: 4px; }

/* ── App-wide utility ─────────────────────────────────────── */

progress,
.progress-bar {
  height: 4px;
  border-radius: var(--r-pill);
}

/* ── Attachment logo upload ───────────────────────────────── */

.attachment-logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.attachment-logo-input {
  flex: 1;
  min-width: 0;
}

.attachment-logo-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.attachment-logo-preview img {
  display: block;
  max-width: 120px;
  max-height: 48px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.attachment-logo-meta {
  font-size: 11px;
  color: var(--muted);
}

.field-hint-inline {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}

.attachment-form {
  padding-top: 4px;
}

.attachment-deliverability-body {
  padding: 0 0 4px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}

.attachment-deliverability-body p {
  margin: 0 0 10px;
}

.attachment-deliverability-steps {
  margin: 0 0 10px 18px;
  padding: 0;
}

.attachment-deliverability-steps li {
  margin-bottom: 6px;
}

.attachment-deliverability-tip {
  color: var(--muted);
  font-size: 12px;
}
