/* Andromeda component layer (2026-11). Colours, radii, spacing and type come
   from tokens.css (loaded first). Linear-style shell and density, Vercel-style
   headers and tabs, Stripe-style tables. Desktop only (min 1200px). */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs);
  line-height: var(--lh);
  min-height: 100vh;
  min-width: 1200px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-h); }

code, pre, .font-mono, .mono { font-family: var(--mono); }
code, .mono { font-size: 0.92em; }

:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--r-sm); }

/* ── Shell ───────────────────────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 14px;
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.sidebar-logo .logo-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--accent);
  flex-shrink: 0;
}

.sidebar-nav { padding: 4px 12px; flex: 1; }
.sidebar-footer { padding: 10px 12px 14px; border-top: 1px solid var(--border); }

.sidebar-nav a,
.sidebar-footer a,
.sidebar-footer .nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin: 1px 0;
  border-radius: var(--r);
  color: var(--text-2);
  font-size: var(--fs);
  font-weight: 500;
  line-height: 1.3;
  transition: color 0.1s, background 0.1s;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: var(--font);
}
.sidebar-nav a svg, .sidebar-footer a svg, .sidebar-footer .nav-btn svg {
  width: 16px; height: 16px; flex-shrink: 0; color: var(--text-muted);
}
.sidebar-nav a:hover, .sidebar-footer a:hover, .sidebar-footer .nav-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}
.sidebar-nav a.active, .sidebar-footer a.active {
  color: var(--text);
  background: var(--surface-3);
}
.sidebar-nav a.active svg, .sidebar-footer a.active svg { color: var(--text); }

.sidebar .nav-section {
  padding: 14px 10px 6px;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 2px; margin-top: 4px;
  border-top: 1px solid var(--border);
}
.sidebar-user .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-2);
  font-size: var(--fs-xs); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-user .name { flex: 1; font-size: var(--fs); font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .logout {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-family: var(--font); font-size: var(--fs-sm); padding: 4px 6px; border-radius: var(--r-sm);
}
.sidebar-user .logout:hover { color: var(--text); background: var(--surface-2); }
.sidebar-footer select {
  width: 100%; margin: 2px 0 6px; padding: 6px 28px 6px 10px; font-size: var(--fs-sm);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 var(--s-7);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs);
  color: var(--text-muted);
  min-width: 0;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .breadcrumb-sep { color: var(--border-strong); }
.breadcrumb .current { color: var(--text); font-weight: 500; }
.breadcrumb span, .breadcrumb a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }

.flash-area { padding: var(--s-4) var(--s-7) 0; }

/* ── Page header / content ───────────────────────────────────────────────── */
.page-header {
  padding: var(--s-6) var(--s-7) 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
}
.page-header-left { flex: 1; min-width: 0; }
.page-title {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.page-subtitle { color: var(--text-muted); font-size: var(--fs); margin-top: 6px; }
.page-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--text-muted); font-size: var(--fs); margin-top: 8px; }
.page-meta .dot { color: var(--border-strong); }
.page-meta strong { color: var(--text); font-weight: 500; }
.page-meta code { font-size: var(--fs-sm); color: var(--text-2); background: var(--surface-2); padding: 1px 6px; border-radius: var(--r-sm); }
.page-content { padding: var(--s-6) var(--s-7) var(--s-8); }
.page-header + .page-content { padding-top: var(--s-5); }
.page-actions { display: flex; align-items: center; gap: var(--s-2); flex-shrink: 0; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin: var(--s-6) 0 var(--s-3); }
.section-head:first-child { margin-top: 0; }
.section-title { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.01em; }
.section-title small { font-size: var(--fs); font-weight: 400; color: var(--text-muted); margin-left: 8px; }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  padding: 0 var(--s-7);
}
.page-header .tabs, .offer-header .tabs { padding: 0; margin-top: var(--s-5); }
.tabs a.tab, .tab-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 4px;
  margin-right: 20px;
  margin-bottom: -1px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--fs);
  font-weight: 500;
  font-family: var(--font);
  text-decoration: none;
  transition: color 0.1s, border-color 0.1s;
}
.tabs a.tab:hover, .tab-btn:hover { color: var(--text); }
.tabs a.tab.active, .tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-count { color: var(--text-muted); font-weight: 400; font-size: var(--fs-sm); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.offer-header { padding: var(--s-6) var(--s-7) 0; border-bottom: 1px solid var(--border); background: var(--bg); }
.offer-header .page-header { padding: 0; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: var(--s-4); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4); }
.card-head > div { min-width: 0; }
.card-title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.card-head .card-title { margin-bottom: 2px; }
.card-sub { color: var(--text-muted); font-size: var(--fs); margin-bottom: var(--s-4); }
.card-head .card-sub { margin-bottom: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .table-wrap { border: none; border-radius: 0; }
.card-footer { display: flex; align-items: center; gap: var(--s-2); margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--border); }

/* ── Grid / utils ────────────────────────────────────────────────────────── */
.grid { display: grid; gap: var(--s-4); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid > *, .two-col > * { min-width: 0; } /* a 1080px iframe inside a column must not widen it */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--s-6); align-items: start; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r);
  font-size: var(--fs);
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, color 0.1s, box-shadow 0.1s;
  line-height: 1.2;
  white-space: nowrap;
  font-family: var(--font);
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--text-inverse); border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-h); border-color: var(--accent-h); color: var(--text-inverse); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover:not(:disabled) { background: var(--danger); border-color: var(--danger); color: var(--text-inverse); }
.btn-danger.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: var(--fs-sm); }
.btn-xs { padding: 3px 8px; font-size: var(--fs-xs); }
.btn-icon { width: 30px; height: 30px; padding: 0; }
.btn-block { width: 100%; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--s-4); }
label {
  display: block;
  font-size: var(--fs);
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="date"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs);
  padding: 8px 12px;
  transition: border-color 0.1s, box-shadow 0.1s;
  outline: none;
  line-height: 1.4;
}
input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text-muted); cursor: not-allowed; }
input[type="file"] { font-size: var(--fs-sm); color: var(--text-2); }
textarea { resize: vertical; min-height: 80px; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}
.form-hint { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 5px; line-height: 1.45; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.form-actions {
  display: flex; align-items: center; gap: var(--s-2);
  margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--border);
}
.input-mono { font-family: var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.input-group { display: grid; grid-template-columns: 220px 1fr; gap: var(--s-3); }
.input-row { display: flex; gap: var(--s-2); align-items: center; }
.input-row > * { min-width: 0; flex: 1 1 auto; }
.input-row > .btn, .input-row > form { flex: 0 0 auto; }
.input-row > .fixed { flex: 0 0 160px; width: 160px; }

/* Checkbox label — overrides the default label style */
.checkbox-label {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: var(--fs); font-weight: 400; color: var(--text); margin-bottom: 0;
}
.checkbox-label input[type="checkbox"] { width: auto; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

/* ⓘ explainer for AI-interpreted inputs (bubble built in main.js) */
.info-tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px;
  border: 1px solid var(--border-strong); border-radius: 50%;
  color: var(--text-muted);
  font-size: 10px; font-style: italic; font-weight: 600; font-family: Georgia, serif; line-height: 1;
  cursor: help; vertical-align: middle; margin-left: 5px; flex-shrink: 0; user-select: none;
  text-transform: none; letter-spacing: 0;
}
.info-tip:hover, .info-tip:focus { color: var(--accent); border-color: var(--accent); outline: none; }
#info-tip-bubble {
  position: fixed; display: none; max-width: 300px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-md); padding: 8px 10px;
  font-size: var(--fs-sm); line-height: 1.45; color: var(--text);
  white-space: pre-line; z-index: 4000; pointer-events: none;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; font-size: var(--fs); }
th {
  text-align: left;
  padding: 10px 14px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 1;
  white-space: nowrap;
}
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions, th.actions { text-align: right; white-space: nowrap; }
td a.row-link { color: var(--text); font-weight: 500; }
td a.row-link:hover { color: var(--accent); }
.table-empty { padding: var(--s-7); text-align: center; color: var(--text-muted); }

/* ── Badges / chips ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
  line-height: 1.5;
}
.badge-accent, .badge-active   { background: var(--accent-soft); color: var(--accent-text); }
.badge-success, .badge-winner  { background: var(--success-soft); color: var(--success); }
.badge-warning                 { background: var(--warning-soft); color: var(--warning); }
.badge-danger, .badge-dead     { background: var(--danger-soft); color: var(--danger); }
.badge-untested                { background: var(--surface-3); color: var(--text-muted); }
.badge-muted, .badge-outline   { background: transparent; color: var(--text-muted); border: 1px dashed var(--border-strong); }
.slug-chip {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: var(--r-sm);
  background: var(--surface-3); color: var(--text-2);
  font-family: var(--mono); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.1em;
}
.dot-status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs); }
.dot-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.dot-status.ok { color: var(--success); }
.dot-status.warn { color: var(--warning); }
.dot-status.bad { color: var(--danger); }
.dot-status.off { color: var(--text-muted); }

.chip, .dim-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid transparent;
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.4;
  white-space: nowrap;
}
a.chip:hover, a.dim-tag:hover { color: var(--text); border-color: var(--border-strong); }
.chip.active { background: var(--surface-3); color: var(--text); font-weight: 500; }
.dim-tag strong { color: var(--text); font-weight: 500; }

/* ── Alerts / toasts ─────────────────────────────────────────────────────── */
.alert, .toast {
  padding: 10px 14px;
  border-radius: var(--r);
  font-size: var(--fs);
  margin-bottom: var(--s-4);
  border: 1px solid transparent;
  line-height: 1.45;
}
.alert-error,   .toast-error   { background: var(--danger-soft);  border-color: color-mix(in srgb, var(--danger) 30%, transparent);  color: var(--danger); }
.alert-warning, .toast-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); color: var(--warning); }
.alert-success, .toast-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); color: var(--success); }
.alert-info,    .toast-info    { background: var(--accent-soft);  border-color: color-mix(in srgb, var(--accent) 30%, transparent);  color: var(--accent-text); }

/* ── Empty state / skeleton / divider ───────────────────────────────────── */
.empty-state { text-align: center; padding: var(--s-8) var(--s-6); color: var(--text-muted); }
.empty-state-title { font-size: var(--fs-md); font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state p { margin-bottom: var(--s-4); font-size: var(--fs); }
.skeleton {
  display: block; border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  min-height: 1em;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.divider { border: none; border-top: 1px solid var(--border); margin: var(--s-5) 0; }

/* ── Key/value summary rows ──────────────────────────────────────────────── */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--s-4) var(--s-5); }
.kv dt { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: 2px; }
.kv dd { font-size: var(--fs); color: var(--text); font-weight: 500; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(10, 10, 14, 0.55);
  z-index: 100; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: var(--s-6);
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
}
.modal-title { font-size: var(--fs-md); font-weight: 600; margin-bottom: var(--s-4); letter-spacing: -0.01em; }
.modal-actions {
  display: flex; gap: var(--s-2); justify-content: flex-end;
  margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--border);
}

/* ── Dropdown ────────────────────────────────────────────────────────────── */
.dropdown { position: relative; }
.dropdown-panel, .ins-dd-panel {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 50;
  min-width: 240px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-md);
  padding: 8px 10px;
}
.dropdown-panel.open, .ins-dd-panel.open { display: block; }

/* ── Code editor / previews ──────────────────────────────────────────────── */
.code-editor {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r);
  font-family: var(--mono); font-size: var(--fs-sm); color: var(--text);
  padding: 12px; width: 100%; min-height: 200px; resize: vertical; outline: none;
}
.code-editor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }

/* Ad preview iframe — the editor CHROME. The iframe document is the ad's own
   HTML and never inherits anything from this file. */
.preview-wrap {
  width: 540px; height: 540px;
  border: 1px solid var(--border); border-radius: var(--r);
  overflow: hidden; background: #fff; flex-shrink: 0;
}
.preview-wrap iframe { width: 1080px; height: 1080px; border: none; transform: scale(0.5); transform-origin: top left; }

/* ── Concept cards (flag-hidden views keep working) ──────────────────────── */
.concept-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-4); transition: border-color 0.15s; }
.concept-card:hover { border-color: var(--accent); }
.concept-card.status-dead { opacity: 0.5; }
.concept-card.status-dead:hover { opacity: 0.8; border-color: var(--danger); }
.concept-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.concept-angle { font-size: var(--fs); font-weight: 600; line-height: 1.3; }
.concept-dims { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.concept-plan-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor; border-radius: 50%;
  animation: spin 0.6s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── List rows (sources, campaigns, files) ───────────────────────────────── */
.source-item, .list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.source-item:last-child, .list-row:last-child { border-bottom: none; }
.source-type-badge {
  padding: 2px 8px; border-radius: var(--r-sm);
  font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase;
  background: var(--surface-3); color: var(--text-muted); flex-shrink: 0;
}
.source-label { flex: 1; font-size: var(--fs); }
.source-id { font-size: var(--fs-xs); color: var(--text-muted); font-family: var(--mono); }
.source-synced { font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; }
.file-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface);
}
.file-row + .file-row { margin-top: 8px; }
.file-row .file-name { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .file-name svg { width: 14px; height: 14px; color: var(--text-muted); vertical-align: -2px; margin-right: 6px; }

/* ── Progress ────────────────────────────────────────────────────────────── */
.progress-bar-track { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; margin: var(--s-4) 0; }
.progress-bar-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.3s ease; }
.concept-progress-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: var(--fs); }
.concept-progress-row:last-child { border-bottom: none; }
.progress-status-icon { width: 24px; flex-shrink: 0; text-align: center; }

/* ── GDrive folder picker tree ───────────────────────────────────────────── */
.ftree-row { display: flex; align-items: center; gap: 6px; padding: 7px 12px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background 0.1s; }
.ftree-row:hover { background: var(--surface-2); }
.ftree-toggle { width: 16px; text-align: center; flex-shrink: 0; font-size: 0.65rem; color: var(--text-muted); cursor: pointer; user-select: none; }
.ftree-name { font-size: var(--fs); flex: 1; }
.ftree-children { padding-left: 24px; }
.ftree-loading { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 32px; color: var(--text-muted); font-size: var(--fs); }
.ftree-row-label .ftree-name { color: var(--text-muted); font-weight: 600; }

/* ── Insights dashboard ──────────────────────────────────────────────────── */
.insights-filters { margin-bottom: var(--s-4); }
.ins-filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ins-filter-row select { width: auto; }
.ins-check {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; user-select: none;
  text-transform: none; letter-spacing: normal; font-weight: 400; margin-bottom: 0;
}
.ins-seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.ins-seg button {
  background: var(--surface); border: none; color: var(--text-2);
  font-family: var(--font); font-size: var(--fs-sm); padding: 6px 12px; cursor: pointer;
  border-right: 1px solid var(--border); transition: color 0.1s, background 0.1s;
}
.ins-seg button:last-child { border-right: none; }
.ins-seg button:hover { background: var(--surface-2); }
.ins-seg button.active { background: var(--accent); color: var(--text-inverse); }
.ins-dd { position: relative; }
.ins-dd-panel { min-width: 340px; max-width: 460px; max-height: 420px; overflow-y: auto; }
.ins-tree-row { display: flex; align-items: center; gap: 4px; padding: 3px 0; }
.ins-tree-row label, label.ins-tree-row {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--fs-sm); color: var(--text); cursor: pointer; min-width: 0;
  text-transform: none; letter-spacing: normal; font-weight: 400; margin-bottom: 0;
}
.ins-tree-row input[type="checkbox"] { flex-shrink: 0; }
.ins-tree-caret { width: 16px; text-align: center; flex-shrink: 0; font-size: 0.65rem; color: var(--text-muted); cursor: pointer; user-select: none; }
.ins-tree-children { padding-left: 22px; }
.ins-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: baseline; }
/* A frequency over a range or an ad set / campaign row is an approximation (tooltip) */
.ins-approx { text-decoration: underline dotted var(--text-muted); text-underline-offset: 3px; cursor: help; }
.ins-day-row td { background: var(--surface-2); border-bottom-color: transparent; padding-top: 5px; padding-bottom: 5px; }

/* ── Ad layout editor: text styling toolbar (chrome only) ────────────────── */
.editor-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 8px 10px; margin-bottom: 10px;
}
.editor-toolbar .tt-group { display: inline-flex; align-items: center; gap: 4px; }
.editor-toolbar button {
  width: 30px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  color: var(--text); font-family: var(--font); font-size: var(--fs-sm); cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.editor-toolbar button:hover:not(:disabled) { border-color: var(--accent); }
.editor-toolbar button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--text-inverse); }
.editor-toolbar button:disabled { opacity: 0.4; cursor: not-allowed; }
.editor-toolbar select, .editor-toolbar input[type="number"] { width: auto; padding: 4px 8px; font-size: var(--fs-sm); }
.editor-toolbar input[type="color"] {
  width: 30px; height: 28px; padding: 2px; border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); background: var(--surface); cursor: pointer;
}
.editor-toolbar .tt-hl { background: #fff59d; color: #111; padding: 0 3px; border-radius: 2px; }

/* ── Hover-to-expand thumbnail preview (js-thumb-preview in main.js) ─────── */
#thumb-preview {
  position: fixed; z-index: 3000; pointer-events: none; display: none;
  padding: 4px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-md);
}
#thumb-preview.visible { display: block; }
#thumb-preview img { display: block; width: auto; height: auto; max-width: 400px; max-height: 400px; border-radius: var(--r-sm); }

/* ── Ad library cards ────────────────────────────────────────────────────── */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s-4); }
.lib-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; position: relative; box-shadow: var(--shadow-sm); }
.lib-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.lib-card .lib-thumb { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: var(--surface-2); }
.lib-card .lib-thumb-empty { aspect-ratio: 4 / 5; display: flex; flex-direction: column; gap: 6px; align-items: center; justify-content: center; color: var(--text-muted); background: var(--surface-2); font-size: var(--fs-sm); padding: 12px; text-align: center; }
.lib-card .lib-thumb-empty.is-pending { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 10px, var(--surface-3) 10px, var(--surface-3) 20px); }
.lib-card .lib-thumb-empty.is-failed { color: var(--danger); background: var(--danger-soft); }
.lib-card .lib-thumb-error { font-size: var(--fs-xs); color: var(--text-muted); word-break: break-word; }
.lib-card .lib-retry { padding: 8px 12px 0; }
input[type="search"].lib-search { width: 260px; }
.lib-card .lib-check { position: absolute; top: 10px; left: 10px; width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; z-index: 2; }
.lib-card .lib-flag { position: absolute; top: 10px; right: 10px; z-index: 2; }
.lib-card .lib-meta { padding: 10px 12px 12px; border-top: 1px solid var(--border); }
.lib-card .lib-name { font-family: var(--mono); font-size: var(--fs-xs); color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-card .lib-sub { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 4px; }
.lib-card .lib-actions { display: flex; align-items: center; gap: 2px; margin-top: 8px; flex-wrap: wrap; }
.bulk-bar {
  position: sticky; bottom: var(--s-4); z-index: 30;
  display: inline-flex; align-items: center; gap: var(--s-3);
  padding: 10px 14px; margin-top: var(--s-5);
  background: var(--text); color: var(--bg);
  border-radius: var(--r-lg); box-shadow: var(--shadow-md);
}
.bulk-bar .btn-ghost { color: var(--bg); opacity: 0.85; }
.bulk-bar .btn-ghost:hover:not(:disabled) { opacity: 1; background: rgba(255,255,255,0.12); color: var(--bg); }
.bulk-bar .btn-secondary { background: transparent; color: var(--bg); border-color: rgba(255,255,255,0.3); box-shadow: none; }
.bulk-bar .btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,0.12); color: var(--bg); }
.bulk-bar .btn-danger { background: transparent; color: #ff8a8a; border-color: rgba(255,255,255,0.3); }

/* ── Campaign builder: collapsible attachment rows with inline edit ──────── */
.att-row { border-bottom: 1px solid var(--border); }
.att-head { display: flex; gap: 10px; align-items: center; padding: 8px 0; }
.att-head .att-toggle { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: var(--fs); padding: 2px 6px; transition: transform .15s; }
.att-row.open .att-toggle { transform: rotate(90deg); }
.att-head .att-name { font-family: var(--mono); font-size: var(--fs-xs); font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-head .att-sub { font-size: var(--fs-xs); color: var(--text-muted); }
.att-body { display: none; grid-template-columns: 1fr 1fr; gap: 10px 16px; padding: 4px 0 12px 74px; }
.att-row.open .att-body { display: grid; }
.att-field.wide { grid-column: 1 / -1; }
.att-field .att-label { font-size: var(--fs-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.att-field .att-value { font-size: var(--fs-sm); color: var(--text); white-space: pre-wrap; word-break: break-word; border: 1px solid transparent; border-radius: var(--r-sm); padding: 4px 6px; margin: 0 -6px; min-height: 26px; }
.att-field.editable .att-value { cursor: text; }
.att-field.editable .att-value:hover { border-color: var(--border); background: var(--surface-2); }
.att-field .att-value.is-empty { color: var(--text-muted); font-style: italic; }
.att-field .att-state { font-size: var(--fs-xs); color: var(--success); min-height: 1em; }
.att-field .att-state.is-error { color: var(--danger); }
.sheet-preview table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); }
.sheet-preview td, .sheet-preview th { border-top: 1px solid var(--border); padding: 4px 6px; text-align: left; vertical-align: top; white-space: pre-wrap; word-break: break-word; }

/* ── Auth pages (standalone documents, same tokens) ──────────────────────── */
body.auth-body { display: flex; align-items: center; justify-content: center; padding: var(--s-6); min-width: 0; }
.auth-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); padding: 40px; width: 100%; max-width: 420px;
}
.auth-logo { display: flex; align-items: center; gap: 10px; font-size: var(--fs-lg); font-weight: 700; color: var(--text); margin-bottom: 6px; letter-spacing: -0.01em; }
.auth-logo .logo-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); }
.auth-subtitle { font-size: var(--fs); color: var(--text-muted); margin-bottom: var(--s-7); }
.auth-subtitle strong { color: var(--text); }
.auth-card .form-group { margin-bottom: 18px; }
.auth-card .btn-block { margin-top: 8px; padding: 10px; font-size: var(--fs-md); }
.auth-footer { text-align: center; font-size: var(--fs); color: var(--text-muted); margin-top: var(--s-6); line-height: 1.8; }
.auth-footer a:hover { text-decoration: underline; }
.auth-card input[name="code"] { font-family: var(--mono); font-size: 1.5rem; letter-spacing: 0.4em; text-align: center; }
