/* ============================================================================
   Discovery Platform
   The operational sibling of discoverymarketing.io: warm paper, strong ink,
   sage actions, and one signal-red accent. Tenant brands remain content, not
   shell chrome.
   ============================================================================ */

@font-face {
  font-family: 'Anton';
  src: url('/assets/fonts/anton.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Source Sans 3';
  src: url('/assets/fonts/source-sans-3-400.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Source Sans 3';
  src: url('/assets/fonts/source-sans-3-600.woff2') format('woff2');
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: 'Source Sans 3';
  src: url('/assets/fonts/source-sans-3-700.woff2') format('woff2');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

/* ── Design tokens ── */
:root {
  --brand: #547451;
  --brand-hover: #111311;
  --brand-accent: #a84b43;
  --brand-soft: color-mix(in srgb, var(--brand) 9%, white);
  --brand-soft-border: color-mix(in srgb, var(--brand) 22%, white);

  --bg: #fafaf8;
  --surface: #ffffff;
  --surface-2: #f3f4f1;
  --border: #e3e5df;
  --border-strong: #cfd3cc;

  --text: #111311;
  --text-muted: #565b57;
  --text-dim: #6b716c;

  --success: #166534;
  --success-bg: #e9f9ef;
  --warning: #92400e;
  --warning-bg: #fdf3e3;
  --danger: #b91c1c;
  --danger-bg: #fdeaea;
  --info-bg: #eaf2fd;

  --radius-sm: 7px;
  --radius: 12px;
  --radius-lg: 16px;

  --shadow-sm: 0 2px 3px rgba(17, 19, 17, 0.06);
  --shadow: 0 5px 14px rgba(17, 19, 17, 0.08);
  --shadow-lg: 0 18px 48px rgba(17, 19, 17, 0.16);

  --font: 'Source Sans 3', 'Arial', sans-serif;
  --font-display: 'Anton', 'Impact', sans-serif;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --z-sidebar: 30;
  --z-sticky: 40;
  --z-popover: 60;
  --z-overlay: 80;
  --z-toast: 200;

  --sidebar-w: 236px;
  --topbar-h: 62px;
  --bottomnav-h: 62px;
}

html[data-platform-brand='atp'] {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --border: #e4e9f1;
  --border-strong: #d3dae5;
  --text: #16233a;
  --text-muted: #5a6779;
  --text-dim: #667085;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

img { max-width: 100%; }

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

h1, h2, h3, h4, p { margin: 0; }

a { color: var(--brand); }

button { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Splash / loading overlay ── */
.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-sm {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-width: 2px;
  vertical-align: -3px;
  margin-right: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.splash-text { color: var(--text-muted); font-size: 14px; font-weight: 500; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--text-dim); background: var(--surface-2); }

.btn-ghost { background: transparent; color: var(--brand); }
.btn-ghost:hover:not(:disabled) { background: var(--brand-soft); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-lg { min-height: 52px; padding: 14px 26px; font-size: 16px; border-radius: var(--radius); }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 13.5px; }
.btn-block { width: 100%; }

.btn svg { flex: none; }

/* ── Forms ── */
.field { display: block; margin-bottom: 16px; }

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.field-hint {
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.45;
}

.input,
select.input,
textarea.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}

.input::placeholder { color: var(--text-dim); }

textarea.input { min-height: 110px; resize: vertical; line-height: 1.6; }

select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235a6779' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  cursor: pointer;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* ── Auth ── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: var(--bg);
}

html[data-platform-brand='discovery'] .auth-wrap {
  background:
    linear-gradient(90deg, transparent 0 65%, color-mix(in srgb, var(--brand) 8%, transparent) 65% 100%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 40px 36px;
}

html[data-platform-brand='discovery'] .auth-card { box-shadow: 0 18px 48px rgba(17, 19, 17, 0.12); }

.auth-brand { text-align: center; margin-bottom: 26px; }

.auth-brand .logo-mark { width: 46px; height: 46px; font-size: 20px; margin: 0 auto 12px; }
.auth-brand--platform .logo-mark { width: 64px; height: 64px; margin-bottom: 16px; }

.auth-wordmark {
  font-family: var(--font-display);
  font-size: 25px;
  line-height: 1;
  letter-spacing: -0.015em;
  text-transform: uppercase;
}

.auth-brand h1 {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.auth-brand--platform h1 {
  margin-top: 12px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
}

.auth-brand p { margin-top: 6px; color: var(--text-muted); font-size: 14px; }

.auth-note {
  margin-top: 18px;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-muted);
}

.auth-note button {
  background: none;
  border: none;
  padding: 4px;
  color: var(--brand);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.auth-error {
  margin-bottom: 16px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13.5px;
  line-height: 1.5;
}

.auth-success {
  margin-bottom: 16px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--success-bg);
  color: var(--success);
  font-size: 13.5px;
  line-height: 1.5;
}

/* ── App shell ── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--bg) 95%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16.5px;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}

html[data-platform-brand='discovery'] .logo {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 18px;
  letter-spacing: -0.015em;
  text-transform: uppercase;
}

.logo-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

.logo-mark--platform {
  background: transparent;
  border-radius: 0;
  overflow: visible;
}

.platform-mark-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-spacer { flex: 1; }

.biz-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.biz-switcher select.input {
  min-height: 40px;
  max-width: 240px;
  font-size: 14px;
  font-weight: 600;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: none;
  padding: 4px;
  border-radius: 999px;
  cursor: pointer;
}

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 14px;
  font-weight: 700;
  flex: none;
}

.user-menu {
  position: absolute;
  top: calc(var(--topbar-h) - 6px);
  right: 16px;
  z-index: 60;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  animation: pop-in 0.14s ease;
}

.user-menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-menu-head strong { display: block; font-size: 14.5px; }
.user-menu-head span { font-size: 12.5px; color: var(--text-muted); word-break: break-all; }

.user-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  border: none;
  background: none;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.user-menu button:hover { background: var(--surface-2); }

@keyframes pop-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
  z-index: 30;
  width: var(--sidebar-w);
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  padding: 18px 12px 24px;
  overflow-y: auto;
}

.nav-label {
  padding: 16px 12px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  margin-bottom: 2px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-muted);
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav-item svg { flex: none; }

.nav-item:hover { background: var(--surface-2); color: var(--text); }

.nav-item.is-active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.nav-item.is-active svg { color: var(--brand); }

/* Main content */
.main {
  padding: calc(var(--topbar-h) + 26px) 28px 60px;
  margin-left: var(--sidebar-w);
  max-width: calc(1120px + var(--sidebar-w));
}

.view { animation: view-in 0.18s ease; }

@keyframes view-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.page-head { margin-bottom: 22px; }

.page-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }

html[data-platform-brand='discovery'] .page-title {
  font-family: var(--font-display);
  font-size: 31px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.015em;
  text-transform: uppercase;
}

.page-sub { margin-top: 6px; color: var(--text-muted); font-size: 14.5px; max-width: 620px; }

.page-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.toolbar-row .input { width: auto; flex: 1 1 220px; max-width: 340px; }

/* Bottom nav (mobile) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: none;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.bottom-nav::-webkit-scrollbar { display: none; }

.bottom-nav-inner { display: flex; min-width: 100%; }

.bottom-nav-item {
  flex: 1 0 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 54px;
  padding: 6px 4px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.bottom-nav-item.is-active { color: var(--brand); background: var(--brand-soft); }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  margin-bottom: 18px;
}

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

.card-title { font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em; }

.card-sub { margin-top: 3px; font-size: 13.5px; color: var(--text-muted); }

/* ── Badges & chips ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-neutral { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.badge-info { background: var(--info-bg); color: var(--brand); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

.rollout-provider-grid { border: 0; padding: 0; margin: 20px 0; }
.rollout-provider-grid, .rollout-version-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.rollout-choice { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.rollout-version-grid { margin: 18px 0; }
.rollout-version-grid > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; background: var(--surface-subtle); border-radius: 8px; font-size: 13px; }
.offboarding-gate { margin-top: 22px; padding: 18px; border: 1px solid var(--danger); border-radius: 10px; background: var(--danger-bg); }
.offboarding-gate h3 { margin: 0 0 12px; }
.mfa-enrollment { max-width: 430px; }
.mfa-enrollment img { width: min(240px, 100%); height: auto; display: block; margin: 16px 0; background: #fff; padding: 8px; border-radius: 8px; }
.mfa-secret { overflow-wrap: anywhere; padding: 10px; border: 1px solid var(--border); border-radius: 8px; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 15px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.chip.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* ── Brand HQ ── */
.brand-hq {
  --brand-shell-gap: var(--space-5);
  contain: inline-size;
  color: var(--text);
}

.brand-access-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  margin: calc(-1 * var(--space-7)) 0 var(--space-4);
}

.brand-guide-shell {
  display: grid;
  grid-template-columns: 152px minmax(0, 1fr) 232px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.brand-guide-index {
  min-width: 0;
  max-width: 100%;
  padding: var(--space-5) var(--space-3);
  background: var(--surface-2);
  border-right: 1px solid var(--border);
}

.brand-section-nav {
  position: sticky;
  top: calc(var(--topbar-h) + var(--space-5));
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.brand-section-link {
  width: 100%;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font: 600 0.875rem/1.25 var(--font);
  text-align: left;
  cursor: pointer;
}

.brand-section-link:hover,
.brand-section-link.is-active {
  background: var(--surface);
  color: var(--text);
}

.brand-section-link.is-active { color: var(--brand); }

.brand-guide-main { min-width: 0; }
.brand-guide-main,
.brand-library-section,
.brand-table-wrap { max-width: 100%; }
.brand-table-wrap { min-width: 0; }

.brand-foundations-grid {
  display: grid;
  grid-template-columns: minmax(180px, .8fr) minmax(190px, 1fr) minmax(220px, 1.1fr);
  border-bottom: 1px solid var(--border);
}

.brand-foundation-section {
  min-width: 0;
  padding: var(--space-5);
  scroll-margin-top: calc(var(--topbar-h) + var(--space-4));
}

.brand-foundations-grid .brand-foundation-section + .brand-foundation-section {
  border-left: 1px solid var(--border);
}

.brand-voice-section { border-bottom: 1px solid var(--border); }

.brand-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.brand-section-heading h2,
.brand-library-head h2,
.brand-rail-section h2 {
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-section-heading p,
.brand-library-head p {
  max-width: 68ch;
  margin-top: var(--space-1);
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.brand-logo-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 168px;
  margin-bottom: var(--space-4);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

.brand-logo-image {
  display: block;
  max-width: 80%;
  max-height: 120px;
  object-fit: contain;
}

.brand-logo-fallback {
  font: 700 2.25rem/1 var(--font);
  letter-spacing: -0.03em;
}

.brand-color-list,
.brand-font-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.brand-color-row,
.brand-font-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.brand-swatch {
  width: 48px;
  height: 48px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.brand-color-row strong,
.brand-font-row strong {
  display: block;
  font-size: 0.875rem;
}

.brand-color-row .mono {
  display: inline-block;
  margin-top: var(--space-1);
}

.brand-color-row p,
.brand-font-row p,
.brand-empty-inline {
  margin-top: var(--space-1);
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.brand-color-edit {
  display: grid;
  grid-template-columns: 48px minmax(110px, .8fr) minmax(124px, .7fr) minmax(150px, 1.2fr);
  align-items: end;
  gap: var(--space-3);
}

.brand-color-edit .field { margin: 0; }

.brand-color-picker {
  width: 48px;
  height: 44px;
  padding: 2px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.brand-font-sample {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  flex: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1.75rem;
}

.brand-font-fields {
  min-width: 0;
  margin: 0 0 var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.brand-font-fields:last-child { margin-bottom: 0; }
.brand-font-fields legend { padding: 0 var(--space-2); font-size: 0.875rem; font-weight: 700; }

.brand-voice-preview {
  max-width: 28ch;
  margin: 0;
  color: var(--text);
  font-size: 1.75rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.brand-trait-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.brand-save-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--info-bg);
  border-bottom: 1px solid var(--border);
}

.brand-save-bar p { color: var(--text-muted); font-size: 0.875rem; }

.brand-library-section {
  padding: var(--space-5);
  scroll-margin-top: calc(var(--topbar-h) + var(--space-4));
}

.brand-library-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.brand-library-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.brand-search { flex: 1 1 220px; }
.brand-filter-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.brand-assets-table { min-width: 780px; }
.brand-assets-table td:first-child { min-width: 190px; }
.brand-assets-table td:first-child span { display: block; margin-top: var(--space-1); color: var(--text-muted); font-size: 0.75rem; }

.brand-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-1);
  white-space: nowrap;
}

.brand-row-actions .btn { width: 44px; padding: 0; }
.brand-library-empty { border: 1px solid var(--border); border-radius: var(--radius); }

.brand-guide-rail {
  min-width: 0;
  background: var(--surface-2);
  border-left: 1px solid var(--border);
}

.brand-rail-section { padding: var(--space-5) var(--space-4); }
.brand-rail-section + .brand-rail-section { border-top: 1px solid var(--border); }

.brand-rail-heading {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
}

.brand-rail-heading span { color: var(--text-muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }

.brand-progress {
  height: 6px;
  margin: var(--space-3) 0 var(--space-4);
  overflow: hidden;
  background: var(--border);
  border-radius: 999px;
}

.brand-progress span { display: block; height: 100%; background: var(--success); border-radius: inherit; }

.brand-check-list,
.brand-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.brand-check-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.brand-check-list li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.brand-check-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: none;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
}

.brand-check-list .is-complete { color: var(--text); }
.brand-check-list .is-complete .brand-check-icon { background: var(--success-bg); border-color: var(--success); color: var(--success); }

.brand-activity-list { margin-top: var(--space-4); }

.brand-activity-list li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: var(--space-2);
  padding-bottom: var(--space-4);
}

.brand-activity-dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  background: var(--brand);
  border-radius: 50%;
}

.brand-activity-list strong,
.brand-activity-list p,
.brand-activity-list time {
  display: block;
  font-size: 0.75rem;
  line-height: 1.45;
}

.brand-activity-list p { color: var(--text-muted); }
.brand-activity-list time { margin-top: var(--space-1); color: var(--text-dim); }

.brand-hq .btn-sm,
.brand-hq .chip { min-height: 44px; }

.brand-asset-modal { max-width: 680px; }

@media (max-width: 1200px) {
  .brand-guide-shell { grid-template-columns: 140px minmax(0, 1fr); }
  .brand-guide-rail {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-top: 1px solid var(--border);
    border-left: 0;
  }
  .brand-rail-section + .brand-rail-section { border-top: 0; border-left: 1px solid var(--border); }
}

@media (max-width: 1040px) {
  .brand-foundations-grid { grid-template-columns: 1fr 1fr; }
  .brand-foundations-grid .brand-foundation-section:nth-child(3) {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border);
    border-left: 0;
  }
}

@media (max-width: 900px) {
  .brand-access-row { margin-top: 0; }
  .brand-guide-shell { grid-template-columns: minmax(0, 1fr); }
  .brand-guide-index {
    padding: var(--space-2);
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .brand-section-nav {
    position: static;
    flex-direction: row;
    min-width: max-content;
  }
  .brand-section-link { width: auto; }
}

@media (max-width: 680px) {
  .brand-foundations-grid,
  .brand-guide-rail { grid-template-columns: 1fr; }
  .brand-foundations-grid .brand-foundation-section + .brand-foundation-section {
    grid-column: auto;
    border-top: 1px solid var(--border);
    border-left: 0;
  }
  .brand-rail-section + .brand-rail-section { border-top: 1px solid var(--border); border-left: 0; }
  .brand-library-toolbar,
  .brand-library-head,
  .brand-save-bar { align-items: stretch; flex-direction: column; }
  .brand-guide-index { overflow: visible; }
  .brand-section-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
    width: 100%;
  }
  .brand-section-link { width: 100%; min-width: 0; }
  .brand-search { flex-basis: auto; }
  .brand-color-edit { grid-template-columns: 48px minmax(0, 1fr); }
  .brand-color-edit .field:last-child { grid-column: 1 / -1; }
  .brand-voice-preview { font-size: 1.5rem; }
  .brand-table-wrap { overflow: visible; border: 0; }
  .brand-assets-table,
  .brand-assets-table tbody { display: block; min-width: 0; width: 100%; }
  .brand-assets-table thead { display: none; }
  .brand-assets-table tr {
    display: block;
    margin-bottom: var(--space-3);
    padding: var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  .brand-assets-table td,
  .brand-assets-table td:first-child {
    display: grid;
    grid-template-columns: minmax(84px, .45fr) minmax(0, 1fr);
    gap: var(--space-3);
    min-width: 0;
    padding: var(--space-2) 0;
    border: 0;
  }
  .brand-assets-table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
  }
  .brand-assets-table td:first-child strong,
  .brand-assets-table td:first-child span { grid-column: 2; }
  .brand-assets-table .brand-row-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
  }
  .brand-assets-table .brand-row-actions::before { display: none; }
}

/* ── Email automations ── */
.email-readiness { display:flex; align-items:center; justify-content:space-between; gap:18px; margin-bottom:22px; padding:18px 20px; border:1px solid var(--warning); border-radius:var(--radius); background:var(--warning-bg); }
.email-readiness.is-ready { border-color:var(--success); background:var(--success-bg); }
.email-readiness p { margin-top:4px; color:var(--text-muted); font-size:13.5px; }
.email-page-heading { display:flex; align-items:end; justify-content:space-between; gap:16px; margin:28px 0 14px; }
.email-rule-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin:18px 0; }
.email-rule-grid fieldset,.email-broadcast-audience { border:1px solid var(--border); border-radius:10px; padding:14px; }
.email-rule-grid legend,.email-broadcast-audience legend { padding:0 6px; font-size:13px; font-weight:700; }
.email-stage-grid { display:flex; flex-wrap:wrap; gap:8px; }
.email-stage-choice { display:flex; align-items:center; gap:6px; padding:7px 10px; border:1px solid var(--border); border-radius:999px; font-size:13px; background:var(--surface); }
.email-step-list { display:grid; gap:14px; margin:18px 0; }
.email-step { display:grid; grid-template-columns:34px 1fr; gap:12px; padding:16px; border:1px solid var(--border); border-radius:12px; background:var(--surface-subtle); }
.email-step-number { display:grid; place-items:center; width:30px; height:30px; border-radius:50%; background:var(--text); color:var(--surface); font-weight:700; }
.email-step-fields { display:grid; gap:12px; min-width:0; }
.email-step textarea,#broadcast-body { min-height:130px; }
.email-broadcast-audience { margin:16px 0; }
@media (max-width:720px) { .email-rule-grid { grid-template-columns:1fr; } .email-readiness { align-items:flex-start; flex-direction:column; } }
.operator-view-switch { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }

/* ── Toasts ── */
.toast-root {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius);
  background: var(--text);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s ease;
}

.toast-success { background: #15803d; }
.toast-error { background: #b91c1c; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: none; }
}

.toast.is-leaving { opacity: 0; transition: opacity 0.3s; }

/* ── Skeletons & empty states ── */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--border);
  border-radius: var(--radius-sm);
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer { to { transform: translateX(100%); } }

.skeleton-line { height: 14px; margin-bottom: 12px; }
.skeleton-tile { height: 96px; border-radius: var(--radius-lg); }
.skeleton-card { height: 150px; border-radius: var(--radius-lg); margin-bottom: 18px; }

.empty {
  text-align: center;
  padding: 44px 24px;
  color: var(--text-muted);
}

.empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
}

.empty h3 { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty p { font-size: 14px; max-width: 380px; margin: 0 auto; }
.empty .btn { margin-top: 18px; }

/* ── Home ── */
.greeting { margin-bottom: 24px; }
.greeting h1 { font-size: 27px; font-weight: 800; letter-spacing: -0.02em; }

html[data-platform-brand='discovery'] .greeting h1 {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.015em;
  text-transform: uppercase;
}
.greeting p { margin-top: 6px; color: var(--text-muted); font-size: 15px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
}

.stat-value {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.stat-label { margin-top: 4px; font-size: 13px; font-weight: 500; color: var(--text-muted); }

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.action-tile {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.action-tile:hover { border-color: var(--brand-soft-border); box-shadow: var(--shadow); }
.action-tile:active { transform: scale(0.99); }

.action-tile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--brand);
}

.action-tile strong { display: block; font-size: 15.5px; font-weight: 700; }
.action-tile span { display: block; margin-top: 2px; font-size: 13px; color: var(--text-muted); }

.lead-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-radius: 6px;
}

.lead-row:last-child { border-bottom: none; }
.lead-row:hover { background: var(--surface-2); }

.lead-row-main { min-width: 0; }
.lead-row-main strong { display: block; font-size: 14.5px; }
.lead-row-main span {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lead-row-side { flex: none; display: flex; align-items: center; gap: 10px; }
.lead-row time { font-size: 12px; color: var(--text-dim); white-space: nowrap; }

/* ── CRM board ── */
.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(256px, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 16px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  align-items: start;
}

.board-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  scroll-snap-align: start;
  min-height: 180px;
}

.board-col.drag-over { border-color: var(--brand); background: var(--brand-soft); }

.col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 12px;
}

.col-title { font-size: 13px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-muted); }

.col-title .col-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: 1px;
}

.col-count {
  min-width: 24px;
  text-align: center;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.col-empty {
  padding: 20px 10px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}

.lead-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 13px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.lead-card:hover { border-color: var(--brand-soft-border); box-shadow: var(--shadow); }
.lead-card.is-dragging { opacity: 0.5; }

.lead-card h4 { font-size: 14.5px; font-weight: 700; margin-bottom: 3px; }

.lead-card .lead-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-card time { display: block; margin-top: 6px; font-size: 11.5px; color: var(--text-dim); }

.lead-card select.stage-select {
  margin-top: 10px;
  width: 100%;
  min-height: 38px;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 30px 6px 10px;
  background-position: right 9px center;
}

/* ── Drawer ── */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(22, 35, 58, 0.42);
  animation: fade-in 0.18s ease;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 71;
  width: min(440px, 100vw);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  padding: 24px 24px 40px;
  animation: drawer-in 0.22s ease;
}

@keyframes drawer-in {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.drawer-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.drawer h2 { font-size: 20px; font-weight: 700; padding-right: 44px; }

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

.drawer-section h3 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.contact-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  font-size: 14.5px;
  color: var(--text);
  text-decoration: none;
  word-break: break-all;
}

.contact-line svg { color: var(--brand); flex: none; }
.contact-line[href]:hover { color: var(--brand); }

.timeline { list-style: none; margin: 0; padding: 0; }

.timeline-item {
  position: relative;
  padding: 0 0 16px 22px;
  border-left: 2px solid var(--border);
  margin-left: 6px;
}

.timeline-item:last-child { padding-bottom: 2px; }

.timeline-item::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--surface);
}

.timeline-item p { font-size: 13.5px; }
.timeline-item time { font-size: 12px; color: var(--text-dim); }

/* ── Analytics ── */
.bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 180px;
  padding-top: 8px;
}

.bar-col {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
  gap: 6px;
}

.bar-fill {
  width: 100%;
  max-width: 34px;
  min-height: 3px;
  border-radius: 5px 5px 2px 2px;
  background: var(--brand);
  opacity: 0.85;
  transition: opacity 0.15s;
}

.bar-col:hover .bar-fill { opacity: 1; }

.bar-label {
  font-size: 10.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.list-row:last-child { border-bottom: none; }

.list-row-label {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.list-row-value { font-weight: 700; font-variant-numeric: tabular-nums; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

.split-bar {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  margin: 14px 0 12px;
  background: var(--surface-2);
}

.split-seg { height: 100%; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); }

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
}

/* ── Website editor ── */
.page-group { margin-bottom: 28px; }

.page-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
  text-transform: capitalize;
}

.block-row { padding: 16px 0; border-bottom: 1px solid var(--border); }
.block-row:last-child { border-bottom: none; padding-bottom: 4px; }
.block-row:first-child { padding-top: 4px; }

.block-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.block-label { font-size: 14px; font-weight: 600; }

.block-help { font-size: 12.5px; color: var(--text-dim); margin-top: -4px; margin-bottom: 8px; }

.locked-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.locked-value {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  font-size: 14.5px;
  color: var(--text-muted);
  overflow-wrap: break-word;
}

.save-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  transition: color 0.2s;
}

.save-pill.is-saved { color: var(--success); }
.save-pill.is-saving { color: var(--text-muted); }
.save-pill.is-error { color: var(--danger); }

/* Rich text editor */
.rt-toolbar {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--surface-2);
}

.rt-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}

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

.rt-editor {
  min-height: 96px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--surface);
  font-size: 15px;
  line-height: 1.65;
  overflow-wrap: break-word;
}

.rt-editor:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}

.rt-editor:empty::before { content: attr(data-placeholder); color: var(--text-dim); }

.rt-editor img { border-radius: var(--radius-sm); }
.rt-editor blockquote {
  margin: 12px 0;
  padding: 4px 16px;
  border-left: 1px solid var(--brand);
  color: var(--text-muted);
}

.rt-editor-lg { min-height: 320px; }

/* Image block */
.img-block { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }

.img-preview {
  width: 148px;
  height: 100px;
  flex: none;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  object-fit: cover;
  background: var(--surface-2);
}

.img-preview-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}

.img-block-fields { flex: 1 1 200px; min-width: 0; }

/* Publish bar */
.publish-bar {
  position: fixed;
  left: var(--sidebar-w);
  right: 0;
  bottom: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 28px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 24px rgba(22, 35, 58, 0.08);
  animation: publish-in 0.25s ease;
}

@keyframes publish-in {
  from { transform: translateY(100%); }
  to { transform: none; }
}

.publish-bar-msg { display: flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 600; }

.publish-bar-msg .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warning);
  flex: none;
}

.publish-bar-actions { display: flex; gap: 10px; }

.main.has-publish-bar { padding-bottom: 140px; }

/* ── Blog ── */
.post-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-radius: 6px;
}

.post-row:hover { background: var(--surface-2); }
.post-row:last-child { border-bottom: none; }

.post-cover {
  width: 78px;
  height: 54px;
  flex: none;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.post-row-main { flex: 1; min-width: 0; }
.post-row-main strong { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-row-main span { display: block; margin-top: 2px; font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.composer-title {
  width: 100%;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  padding: 6px 0;
}

.composer-title:focus { outline: none; }
.composer-title::placeholder { color: var(--text-dim); }

.cover-uploader {
  position: relative;
  width: 100%;
  max-width: 520px;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
}

.cover-uploader img { display: block; width: 100%; max-height: 240px; object-fit: cover; }

.composer-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* ── Requests ── */
.request-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.request-item:last-child { border-bottom: none; }

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

.request-item-head strong { font-size: 14.5px; }

.request-desc { font-size: 14px; color: var(--text-muted); white-space: pre-wrap; overflow-wrap: break-word; }

.request-meta { margin-top: 8px; font-size: 12.5px; color: var(--text-dim); display: flex; gap: 14px; flex-wrap: wrap; }

.request-admin-note {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--info-bg);
  font-size: 13.5px;
}

.op-request-controls {
  display: grid;
  grid-template-columns: 160px 140px 1fr auto;
  gap: 10px;
  align-items: start;
  margin-top: 12px;
}

.screenshot-thumb {
  max-width: 200px;
  max-height: 120px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-top: 8px;
}

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}

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

.data-table th {
  text-align: left;
  padding: 11px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(22, 35, 58, 0.45);
  animation: fade-in 0.16s ease;
}

.modal {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 26px;
  animation: pop-in 0.18s ease;
}

.modal h2 { font-size: 19px; font-weight: 700; margin-bottom: 16px; padding-right: 30px; }

.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.integration-center-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.integration-center-card { min-width: 0; }
.integration-identities { margin: -2px 0 16px; }
.integration-identity-group { padding: 13px 0; border-top: 1px solid var(--border); }
.integration-identity-group:last-child { border-bottom: 1px solid var(--border); }
.integration-identity-group h3 { margin: 0 0 8px; font-size: 13.5px; font-weight: 700; }
.integration-identity-group dl { margin: 0; }
.integration-identity-group dl > div { display: grid; grid-template-columns: minmax(110px, 0.8fr) minmax(0, 1.2fr); gap: 14px; align-items: baseline; padding: 4px 0; }
.integration-identity-group dt { color: var(--text-muted); font-size: 12.5px; }
.integration-identity-group dd { min-width: 0; margin: 0; text-align: right; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.integration-identity-group dd.mono { justify-self: end; }
.integration-asset-list strong { max-width: 62%; text-align: right; overflow-wrap: anywhere; }
.integration-launch { margin-top: 18px; }
.integration-email { margin-top: 18px; }
.integration-domain { margin-top: 18px; }
.integration-alerts { margin-bottom: 18px; border-color: color-mix(in srgb, var(--danger, #b42318) 25%, var(--border)); }
.alert-list { display: grid; gap: 12px; }
.integration-alert { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; padding: 14px; border: 1px solid var(--border); background: var(--surface-subtle, #fafafa); }
.integration-alert h3 { margin: 8px 0 4px; font-size: 15px; }
.integration-alert p { margin: 0; }
.integration-launch .settings-list li { gap: 18px; align-items: flex-start; }
.google-marketing-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 18px 0 4px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.google-marketing-account { min-width: 0; padding: 16px 18px; border-left: 1px solid var(--border); }
.google-marketing-account:first-child { padding-left: 0; border-left: 0; }
.google-marketing-account:last-child { padding-right: 0; }
.google-marketing-account-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.google-marketing-account-head h3 { margin: 2px 0 0; font-size: 14.5px; }
.google-marketing-account dl { margin: 0; }
.google-marketing-account dl > div { display: grid; grid-template-columns: minmax(92px, 0.8fr) minmax(0, 1.2fr); gap: 10px; align-items: baseline; padding: 4px 0; }
.google-marketing-account dt { color: var(--text-muted); font-size: 12.5px; }
.google-marketing-account dd { min-width: 0; margin: 0; text-align: right; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.google-marketing-account dd.mono { justify-self: end; }
.google-marketing-evidence { margin: 10px 0 0; color: var(--text-muted); font-size: 12.5px; line-height: 1.45; text-wrap: pretty; }
.google-provision-title { margin-top: 18px; }
.google-provision-summary { margin: 14px 0; padding: 14px; border: 1px solid var(--border); background: var(--surface-subtle, #fafafa); }
.google-provision-summary p { margin: 8px 0 12px; }
.google-provision-actions { justify-content: flex-start; margin-top: 12px; }
.google-provision-panel { margin-top: 16px; padding: 16px; border: 1px solid var(--border); background: var(--surface-subtle, #fafafa); }
.google-provision-panel h4 { margin: 0 0 8px; font-size: 15px; }
.google-provision-panel .settings-list { margin: 12px 0 16px; }
.google-provision-panel .settings-list li { align-items: flex-start; }
.google-provision-panel .settings-list strong { max-width: 62%; text-align: right; font-size: 12px; }
.google-provision-panel .check-row { margin: 14px 0; }
.google-provision-divider { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

@media (max-width: 720px) {
  .integration-center-grid { grid-template-columns: 1fr; }
  .integration-alert { flex-direction: column; }
  .google-marketing-overview { grid-template-columns: 1fr; }
  .google-marketing-account {
    padding: 14px 0;
    border-top: 1px solid var(--border);
    border-left: 0;
  }
  .google-marketing-account:first-child { border-top: 0; }
  .google-marketing-account dl > div { grid-template-columns: 1fr; gap: 2px; }
  .google-marketing-account dd { text-align: left; }
  .google-marketing-account dd.mono { justify-self: start; }
  .integration-identity-group dl > div { grid-template-columns: 1fr; gap: 2px; }
  .integration-identity-group dd { text-align: left; }
  .integration-identity-group dd.mono { justify-self: start; }
}

/* ── Settings / admin ── */
.settings-list { list-style: none; margin: 0; padding: 0; }

.settings-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.settings-list li:last-child { border-bottom: none; }

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  word-break: break-all;
}

.biz-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.team-permission-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.permission-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
}

.permission-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.permission-toggle input:disabled { cursor: not-allowed; }
.permission-toggle:has(input:disabled) { color: var(--text-muted); cursor: default; }

.permission-toggle-block {
  align-items: flex-start;
  max-width: 520px;
  margin: 0 0 var(--space-4);
  padding: var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.permission-toggle-block strong,
.permission-toggle-block small { display: block; }
.permission-toggle-block small { margin-top: var(--space-1); color: var(--text-muted); line-height: 1.45; }
.permission-toggle-compact { justify-content: center; min-width: 44px; }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .two-col { grid-template-columns: 1fr; }
  .op-request-controls { grid-template-columns: 1fr 1fr; }
  .op-request-controls textarea { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .sidebar { display: none; }
  .bottom-nav { display: block; }

  .main {
    margin-left: 0;
    padding: calc(var(--topbar-h) + 18px) 16px calc(var(--bottomnav-h) + 40px);
  }

  .publish-bar {
    left: 0;
    bottom: var(--bottomnav-h);
    padding: 12px 16px;
  }

  .main.has-publish-bar { padding-bottom: calc(var(--bottomnav-h) + 150px); }

  .topbar { padding: 0 14px; gap: 10px; }
  .biz-switcher select.input { max-width: 150px; }
  .logo-name { max-width: 130px; }

  .quick-actions { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }

  .drawer {
    top: auto;
    left: 0;
    width: 100vw;
    max-height: 88vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    animation: sheet-in 0.24s ease;
  }

  @keyframes sheet-in {
    from { transform: translateY(60px); opacity: 0; }
    to { transform: none; opacity: 1; }
  }

  .board { grid-auto-columns: 82vw; }

  .page-title { font-size: 21px; }
  .greeting h1 { font-size: 23px; }

  .bars { height: 140px; gap: 3px; }
  .bar-label { font-size: 9px; }
}

@media (max-width: 480px) {
  .topbar { gap: 6px; }
  .logo-name { display: none; }
  .operator-view-switch { gap: 4px; flex-wrap: nowrap; }
  .biz-switcher select.input { width: 104px; max-width: 104px; font-size: 12px; padding-inline: 9px 25px; }
  #client-preview-toggle { min-height: 40px; padding-inline: 8px; font-size: 12px; white-space: nowrap; }
  .user-chip { padding: 2px; }
  .avatar { width: 34px; height: 34px; }
  .card { padding: 16px; }
  .toolbar-row .input { max-width: none; }
  .composer-title { font-size: 21px; }
  .img-preview { width: 110px; height: 76px; }
}

/* ── Print / reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
