/* Germanize CMS — owner hub, styled to match the app brand.
   Real brand tokens from AppTheme.swift: per-app accent — Germanize BLUE
   (#25A7DE, light text) / Englify LIME (#C4E538, dark text) — over a warm
   off-white background (#FCFCFC) + warm near-black text (#373530) +
   rounded "Notion/Polarsteps" cards + Craftwork Grotesk for headings.
   The active app is set via <body data-app="…"> and repaints every
   --app-tinted surface (incl. the paywall live preview). */

/* ── Craftwork Grotesk (self-hosted, same weights the app bundles) ── */
@font-face {
  font-family: "Craftwork Grotesk";
  src: url("fonts/CraftworkGrotesk-Regular.otf") format("opentype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Craftwork Grotesk";
  src: url("fonts/CraftworkGrotesk-Medium.otf") format("opentype");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Craftwork Grotesk";
  src: url("fonts/CraftworkGrotesk-SemiBold.otf") format("opentype");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Craftwork Grotesk";
  src: url("fonts/CraftworkGrotesk-Bold.otf") format("opentype");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Craftwork Grotesk";
  src: url("fonts/CraftworkGrotesk-Heavy.otf") format("opentype");
  font-weight: 800; font-style: normal; font-display: swap;
}

:root {
  /* Warm neutral ramp (from background / cardBackground / subtleBackground
     / cardBorder / textPrimary..tertiary colorsets) */
  --bg: #fcfcfc;
  --panel: #ffffff;
  --panel-2: #f7f6f3;
  --panel-3: #eeede9;
  --border: #e3e2df;
  --border-strong: #d4d3cf;
  --text: #373530;
  --text-2: #787772;
  --muted: #9b9a97;

  /* Brand accent — Germanize is the deployment's base app: brand BLUE.
     The per-app value is overridden in body[data-app] below (Englify = lime). */
  --accent: #25a7de;
  --accent-strong: #1b6e97;
  --accent-fg: #fcfcfc;       /* accentForeground — light text on blue */
  --accent-soft: rgba(37, 167, 222, 0.16);

  /* Per-app accent: switched by body[data-app]. Defaults to Germanize blue. */
  --app: #25a7de;
  --app-strong: #1b6e97;
  --app-fg: #fcfcfc;
  --app-soft: rgba(37, 167, 222, 0.16);

  /* Semantic colors from the app palette */
  --success: #2e9e4f;         /* swipeRight forest green */
  --success-soft: rgba(46, 158, 79, 0.12);
  --warn: #ffc947;            /* xpGold */
  --warn-strong: #b98900;
  --warn-soft: rgba(255, 201, 71, 0.18);
  --danger: #f44336;          /* errorRed — the single brand red */
  --danger-soft: rgba(244, 67, 54, 0.10);
  --danger-strong: #d62a1c;   /* darker danger for solid-button hover/inline text */
  /* Info — a single calm, on-brand blue-grey for neutral "scheduled / upcoming"
     states. Replaces the assorted saturated blues that used to leak in. */
  --info: #3a6ea5;
  --info-soft: rgba(58, 110, 165, 0.11);
  --info-border: rgba(58, 110, 165, 0.30);

  /* Near-black ink used for device bezels in the live phone preview. */
  --ink: #161512;

  /* Radii from AppRadius (8/12/20/24) */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-card: 24px;

  /* ── Spacing scale (4 · 8 · 12 · 16 · 24 · 32) ──
     One rhythm for the whole dashboard: card padding, field gaps, the gutter
     between sections, button padding. --space stays the legacy 16px alias. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space: 16px;

  /* Page layout — shared max-width + side gutter so every tab lines up. */
  --page-max: 1180px;
  --page-gutter: 36px;

  /* Gap between the floating sidebar card and the window edges + content. */
  --sidebar-gap: 14px;

  /* ── Control sizing — one height/radius for buttons + inputs everywhere. */
  --control-h: 38px;
  --control-radius: 8px;

  /* Neutral-black shadows from AppShadow */
  --shadow-sm: 0 1px 6px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 3px 12px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);

  --font-head: "Craftwork Grotesk", "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
}

/* ─────────────────────────── Dark theme ───────────────────────────
   Mirrors the iOS app's DARK appearance exactly (from background /
   subtleBackground / cardBackground / textPrimary..secondary / hairline /
   AccentColor colorsets). Brand rule: NO pure #000 / #fff — the page is a
   near-black brand tone (#1a1a1a), surfaces are slightly lifted, text is a
   near-white brand tone (#eeeeec), and the accent follows the active app
   (Germanize blue / Englify lime), brightened for the dark surface. Set
   via data-theme="dark" on <html> by the
   no-flash head script + the toggle. Every surface inherits because the
   whole sheet is driven by these custom properties. */
:root[data-theme="dark"] {
  --bg: #1a1a1a;              /* background (dark)        R0.102 */
  --panel: #242424;          /* cardBackground (dark)    R0.141 — lifted surface */
  --panel-2: #292929;        /* subtleBackground (dark)  R0.161 */
  --panel-3: #333333;        /* one more step up for hover / active fills */
  --border: #383838;         /* hairline (dark)          R0.220 */
  --border-strong: #4a4a4a;  /* a touch stronger for inputs / focus rings */
  --text: #eeeeec;           /* textPrimary (dark)       R0.933 — near-white brand tone */
  --text-2: #999997;         /* textSecondary (dark)     R0.600 */
  --muted: #7c7c7a;          /* dimmer still, stays above the surfaces */

  /* Accent uses Germanize's DARK blue (slightly brighter so it keeps
     contrast on the near-black surface). Foreground is the brand off-white
     the blue accent uses — never pure white. */
  --accent: #3db3e8;
  --accent-strong: #2a9bd4;
  --accent-fg: #fcfcfc;
  --accent-soft: rgba(61, 179, 232, 0.16);

  /* Per-app accent defaults to Germanize dark blue (Englify overridden below). */
  --app: #3db3e8;
  --app-strong: #2a9bd4;
  --app-fg: #fcfcfc;
  --app-soft: rgba(61, 179, 232, 0.16);

  /* Semantic colours nudged brighter so they read on the dark surface
     while staying on-brand. */
  --success: #3fb866;
  --success-soft: rgba(63, 184, 102, 0.16);
  --warn: #ffc947;
  --warn-strong: #ffd97a;
  --warn-soft: rgba(255, 201, 71, 0.16);
  --danger: #ff5b50;
  --danger-soft: rgba(255, 91, 80, 0.14);
  --danger-strong: #ff7a72;
  --info: #6aa0d8;
  --info-soft: rgba(106, 160, 216, 0.14);
  --info-border: rgba(106, 160, 216, 0.34);

  /* Device bezel ink in the live phone preview — keep it dark-on-dark. */
  --ink: #050505;

  /* Deeper, softer shadows so floating surfaces still lift on dark. */
  --shadow-sm: 0 1px 6px rgba(0, 0, 0, 0.30);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 10px 34px rgba(0, 0, 0, 0.55);
}

/* Englify's dark accent — its brand lime, brightened for the dark surface. */
:root[data-theme="dark"] body[data-app="englify"] {
  --app: #d0f251;
  --app-strong: #c4e63f;
  --app-fg: #1a2e00;
  --app-soft: rgba(208, 242, 81, 0.15);
}

/* Smooth (not jarring) cross-fade when the theme flips. Scoped to the
   structural surfaces so we don't animate every hover transition. */
html, body, .sidebar, .content, .modal-card, .toast, input, textarea, select,
.app-context-pill, .theme-toggle, .nav-item, .kpi, .insight-card, .chart-card {
  transition: background-color 0.22s ease, border-color 0.22s ease, color 0.22s ease;
}
@media (prefers-reduced-motion: reduce) {
  html, body, .sidebar, .content, .modal-card, .toast, input, textarea, select,
  .app-context-pill, .theme-toggle, .nav-item, .kpi, .insight-card, .chart-card {
    transition: none;
  }
}

/* Per-app accent theming. Germanize is BLUE (the :root default above);
   Englify is its brand LIME (#c4e538) with dark-text foreground for WCAG
   contrast (white on lime is only ~1.5:1). Switching app in the CMS
   repaints every --app-tinted surface (incl. the paywall live preview). */
body[data-app="englify"] {
  --app: #c4e538;
  --app-strong: #b3d12d;
  --app-fg: #1a2e00;
  --app-soft: rgba(196, 229, 56, 0.16);
}

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

[hidden] { display: none !important; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* Native-mobile polish: no iOS text auto-zoom on rotate, no grey tap flash
     (`tap-highlight-color` is inherited, so it covers every control), and no
     body rubber-band / pull-to-refresh — the app reads native, not "webby". */
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
  min-height: 100vh;
}

h1, h2, h3, h4, .brand-word { font-family: var(--font-head); }

a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }

/* Themed scrollbars so the sidebar / tables / code blocks don't show a
   bright OS scrollbar in dark mode. Token-driven, so they follow the theme.
   (Firefox uses the standard properties; WebKit/Blink the ::-webkit hooks.) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
  border: 3px solid var(--bg);
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; }

/* ───────────── Form controls ───────────── */

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  padding: 8px 14px;
  background: var(--panel);
  color: var(--text);
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.08s;
  border-color: var(--border);
  font-weight: 500;
  font-size: 13px;
}
button:hover { background: var(--panel-2); }
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
/* One consistent keyboard-focus ring for every button — brand-tinted. */
button:focus-visible {
  outline: none;
  border-color: var(--app-strong);
  box-shadow: 0 0 0 3px var(--app-soft);
}
button.danger:focus-visible,
button.danger-solid:focus-visible {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

button.primary {
  /* Primary buttons carry the per-app accent (brand lime for BOTH
     Germanize and Englify) so the brand reads consistently everywhere. */
  background: var(--app);
  color: var(--app-fg);
  border-color: var(--app-strong);
  font-weight: 600;
  font-family: var(--font-head);
}
button.primary:hover { background: var(--app-strong); }

button.ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
button.ghost:hover { background: var(--panel-2); color: var(--text); }

button.danger {
  background: transparent;
  color: var(--danger);
  border-color: transparent;
}
button.danger:hover { background: var(--danger-soft); }

/* Solid destructive button — used in styled confirm modals so "delete"
   reads clearly without looking like the brand primary. */
button.danger-solid {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  font-weight: 600;
  font-family: var(--font-head);
}
button.danger-solid:hover { filter: brightness(0.94); }

button.ai-button {
  background: var(--app-soft);
  color: var(--app-fg);
  border-color: var(--app);
  font-weight: 600;
}
button.ai-button:hover { background: var(--app); }

input, textarea, select {
  font: inherit;
  width: 100%;
  padding: 9px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  color: var(--text);
  outline: none;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus, select:focus {
  border-color: var(--app-strong);
  box-shadow: 0 0 0 3px var(--app-soft);
}
textarea { resize: vertical; line-height: 1.55; }

label {
  display: block;
  margin-bottom: 14px;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
label > input, label > textarea, label > select {
  margin-top: 6px;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  color: var(--text);
  font-size: 14px;
}
label input[type=checkbox] { width: auto; margin-right: 8px; }

.muted { color: var(--muted); font-size: 12.5px; }
.small-hint { font-size: 11px; color: var(--muted); display: block; margin-top: 6px; line-height: 1.45; }
.error { color: var(--danger); font-size: 13px; margin-top: 8px; }

/* ───────────── Login ───────────── */
.view {
  padding: 0;
  max-width: var(--page-max);
  margin: 0 auto;
}
#login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 20px;
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.login-card h1 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}
.login-card p { margin-bottom: 24px; color: var(--text-2); font-size: 13px; }
/* Login illustration (286.Passports) — rendered as-is in light mode. */
.login-illu {
  display: block;
  width: 100%;
  max-width: 180px;
  height: auto;
  margin: 0 auto 18px;
}
/* The artwork is pure monochrome ink (#231f20) on transparent, so on the
   dark login card (--panel #242424) it all but vanishes. It carries no
   colour, so a straight invert flips the near-black ink to a soft off-white
   line-drawing (~#dce0df) that reads cleanly on the dark surface. */
:root[data-theme="dark"] .login-illu { filter: invert(1); }
.login-card .login-brand { font-size: 22px; font-weight: 800; letter-spacing: -0.3px; margin-bottom: 2px; }
.login-card .login-tool {
  margin-bottom: 24px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.login-card input { margin-bottom: 12px; }
.login-card button { width: 100%; padding: 11px; }

/* ───────────── App shell — sidebar hub ───────────── */
#app-view { padding: 0; max-width: none; }
#editor-view { padding: 24px 32px 64px; }

.hub {
  display: grid;
  /* Floating sidebar: a fixed gutter on the left of the grid lets the
     sidebar card sit OFF the window edge (it adds its own margin), and the
     column itself carries the card width. */
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
  align-items: stretch;
}

/* ── Sidebar (floating card) ──
   Detached from the window edge on all sides, rounded, with a soft shadow,
   so it reads as a floating panel rather than a glued rail (matching the
   reference). It stays sticky and scrolls internally when tall. */
.sidebar {
  position: sticky;
  top: var(--sidebar-gap, 14px);
  align-self: start;
  /* Full viewport height minus the top+bottom gap so the card floats with
     equal breathing room top and bottom. */
  height: calc(100vh - (var(--sidebar-gap, 14px) * 2));
  margin: var(--sidebar-gap, 14px) 0 var(--sidebar-gap, 14px) var(--sidebar-gap, 14px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 14px 16px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  /* The sidebar itself never scrolls as a whole — that used to let the brand
     scroll away and clip the memoji + Sign-out on short windows. Instead the
     NAV is the lone scroll region (below), so the brand/app-switch stay pinned
     at the top and the memoji + footer stay pinned at the bottom, always. */
  overflow: hidden;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 4px;
}
/* Top-left brand mark — the REAL icon of the selected app (germanize.png /
   englify.png), swapped on app switch. Replaces the old solid lime
   brand-square placeholder. Rounded like an iOS app icon. */
.brand-app-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  flex-shrink: 0;
  object-fit: cover;
  display: block;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}
.brand-word {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text);
}
.sidebar-app-label {
  margin: 10px 6px 2px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
}
.sidebar .app-picker {
  width: 100%;
  padding: 9px 30px 9px 12px;
  font-size: 13.5px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
  margin-bottom: 6px;
}
.sidebar .app-picker:focus {
  border-color: var(--app-strong);
  box-shadow: 0 0 0 3px var(--app-soft);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 6px;
  /* The only scroll region in the sidebar: grows to fill the gap between the
     pinned brand/app-switch (above) and the pinned memoji + footer (below),
     and scrolls internally when the nav is taller than the window. min-height:0
     is required for a flex child to be allowed to shrink + scroll. */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  /* Quiet, thin scrollbar so it only whispers when it's actually needed. */
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  padding-right: 2px;
  margin-right: -2px;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
  padding: 4px 8px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  justify-content: flex-start;
  padding: 9px 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  text-decoration: none;
}
/* Nav icon slot now holds an inline iconoir line SVG. The SVG draws with
   currentColor, so it inherits the row's text colour (muted → text on
   hover/active) and adapts to light/dark for free. */
.nav-item .nav-ico {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color 0.12s ease;
}
.nav-item .nav-ico svg { width: 19px; height: 19px; display: block; }
.nav-item:hover { background: var(--panel-3); color: var(--text); }
.nav-item:hover .nav-ico { color: var(--text-2); }
.nav-item.active {
  background: var(--app-soft);
  color: var(--text);
  font-weight: 600;
  border-color: transparent;
}
/* Active row: tint the icon in the app accent for a premium pop. */
.nav-item.active .nav-ico { color: var(--app-strong); }
.nav-link { color: var(--text-2); }

/* Owner Memoji — a small mascot that peeks up just above the footer. It is a
   FIXED-size block (not the flex spacer it used to be), so the scrolling nav
   absorbs any height change and the memoji + Sign-out are always fully visible,
   pinned to the bottom of the sidebar, on every window height. */
.sidebar-memoji {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 6px 0 0;
  /* Bleeds 1px into the footer divider so he reads as peeking OVER the edge. */
  margin-bottom: -1px;
}
.sidebar-memoji-img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.12));
}
.sidebar-footer {
  /* margin-top:auto removed — the .sidebar-memoji flex spacer now pushes the
     footer to the bottom while centering the Memoji in the gap. */
  margin-top: 0;
  padding-top: 10px;
  /* Faint divider above the footer, echoing the reference's section rules. */
  border-top: 1px solid var(--border);
}

/* Sign out — compact + de-emphasised. Smaller padding + font, quieter
   colour and a borderless/transparent resting state so it reads as a
   secondary affordance rather than a button competing with the nav. The
   1.5px iconoir log-out glyph sits left of a small label. */
.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  justify-content: flex-start;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}
.logout-btn .logout-icon { flex-shrink: 0; transition: transform 0.14s ease; }
.logout-btn:hover {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: transparent;
}
.logout-btn:hover .logout-icon { transform: translateX(2px); }
.logout-btn:focus-visible {
  outline: none;
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

/* ── Content area ── */
.content {
  min-width: 0;
  /* Slightly tighter left gutter so content keeps a matching gap from the
     floating sidebar card without drifting too far right. */
  padding: 0 var(--page-gutter) 72px max(var(--sidebar-gap), 24px);
}
/* Thin per-app accent hairline at the very top of the content area — an
   always-visible "which app" cue. Kept as a contained rounded bar (rather
   than a full-bleed top border) so it sits neatly next to the floating
   sidebar instead of butting against it. */
.content > .page-header {
  position: relative;
}
.content > .page-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--app);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 0 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.page-header h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text);
  margin-bottom: 4px;
}
.page-help { color: var(--text-2); font-size: 13.5px; max-width: 60ch; }

/* App-context pill — "🇩🇪 Germanize", tinted in the app accent. Lives in
   the page header AND the editor header so the owner always knows which
   app they're editing. */
.app-context-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  font-family: var(--font-head);
  color: var(--text);
  background: var(--app-soft);
  border: 1px solid var(--app);
  white-space: nowrap;
}
/* The real app icon (germanize.png / englify.png) shown in the context
   pill — a small rounded square so it reads as an app mark, sitting just
   left of the circular language flag. */
.app-context-pill .app-context-ico {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  flex-shrink: 0;
  object-fit: cover;
  display: inline-block;
  vertical-align: middle;
}

/* Right-side header cluster: app-context pill + theme toggle, kept as a
   tidy compact group at the top-right of every tab. */
.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Theme toggle — a small circular icon-only button holding the iconoir
   moon/sun (1.5px). De-emphasised secondary styling; the inactive icon is
   hidden via the data-theme state below so only one glyph shows at a time. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  flex-shrink: 0;
  color: var(--text-2);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.theme-toggle:hover {
  color: var(--text);
  background: var(--panel-2);
  border-color: var(--border-strong);
}
.theme-toggle:focus-visible {
  outline: none;
  border-color: var(--app-strong);
  box-shadow: 0 0 0 3px var(--app-soft);
}
.theme-toggle .theme-ico { width: 19px; height: 19px; display: block; }
/* Show the moon in light mode (tap → go dark), the sun in dark mode
   (tap → go light). The other glyph is hidden so only one shows. */
.theme-toggle .theme-ico-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-ico-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-ico-sun { display: block; }

.tab { padding-top: 4px; }

/* ─────────────────────────────────────────────────────────────────────
   Mobile shell — off-canvas drawer + sticky top bar.

   Two breakpoints replace the old scattered ones for the shell:
     • ≤900px  → "drawer mode": the floating sidebar becomes a fixed
                 off-canvas panel toggled by the hamburger in .mobile-topbar.
     • ≤640px  → "phone mode": touch-target bumps, card-list tables,
                 single-column grids, bottom-sheet modals (further down).

   The .mobile-topbar + #nav-scrim live in the markup at all sizes but are
   display:none above the breakpoint, so the desktop grid is untouched.
   ───────────────────────────────────────────────────────────────────── */

/* The mobile top bar + drawer scrim are desktop-hidden by default. */
.mobile-topbar { display: none; }
#nav-scrim { display: none; }

@media (max-width: 900px) {
  /* Kill horizontal rubber-band/slide on phones. The off-canvas drawer is a
     position:fixed panel parked at translateX(-105%) (off-screen LEFT); with
     nothing clipping the viewport's X axis, iOS lets you scroll/bounce left
     into that empty parked area ("desliza para os lados sem conteúdo").
     `overflow-x: clip` clips the X axis only — it does NOT create a scroll
     container, so position:fixed/sticky and vertical scrolling are unaffected. */
  html, body { overflow-x: clip; max-width: 100%; }

  /* Single content column; the sidebar leaves the grid flow and becomes a
     fixed off-canvas drawer. */
  .hub { grid-template-columns: 1fr; min-width: 0; max-width: 100%; overflow-x: clip; }
  .content { min-width: 0; max-width: 100%; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;            /* pin to the left edge, full height */
    z-index: 200;
    width: min(86vw, 320px);
    height: 100vh;
    height: 100dvh;
    margin: 0;
    border-radius: 0 20px 20px 0;
    /* Off-canvas by default; slid in when body.nav-open. */
    transform: translateX(-105%);
    transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
    /* Respect the iOS home-indicator / notch when the drawer is open. */
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    will-change: transform;
    /* Scrolling a tall drawer must not bleed into the page behind it. */
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  /* Lock the page behind the open drawer — native modal behaviour, no
     scrolling content bleeding under the menu. */
  body.nav-open { overflow: hidden; }

  /* Undo the desktop "memoji spacer pushes footer down" — in a tall drawer
     the nav should sit naturally at the top. The memoji stays but doesn't
     need to eat all the slack. */
  .sidebar-memoji { flex: 0 0 auto; }

  /* Backdrop behind the open drawer. */
  #nav-scrim {
    position: fixed;
    inset: 0;
    z-index: 190;
    background: rgba(20, 18, 14, 0.46);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }
  body.nav-open #nav-scrim { display: block; opacity: 1; pointer-events: auto; }

  /* Single-column nav inside the drawer (undo the old 2-col fallback). */
  .sidebar-nav { display: flex; flex-direction: column; }

  /* Sticky top bar replaces the scrolled-away page-header cluster. */
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 150;
    margin: 0 calc(-1 * var(--page-gutter)) 4px calc(-1 * max(var(--sidebar-gap), 24px));
    padding: 10px max(var(--page-gutter), 16px) 10px max(var(--sidebar-gap), 16px);
    padding-top: max(10px, env(safe-area-inset-top));
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid var(--border);
  }
  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    flex-shrink: 0;
    color: var(--text);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
  }
  .mobile-nav-toggle:hover { background: var(--panel-2); }
  .mobile-topbar-title {
    flex: 1 1 auto;
    min-width: 0;
    font-family: var(--font-head);
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mobile-topbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }
  /* The full page-header still renders below the bar; hide its duplicate
     action cluster on phones (the top bar carries it now). */
  .page-header .header-actions { display: none; }

  .content { padding: 0 18px 64px; }
}

/* ─────────────────────────────────────────────────────────────────────
   Phone breakpoint (≤640px) — foundations.

   Bumps every interactive control to a ≥44px touch target, lets wide
   tables scroll horizontally instead of clipping, forces dense grids to a
   single column, makes the top bar sticky, and adds iOS safe-area padding.
   (Card-list table conversions and bottom-sheet modals live in their own
   blocks below.)
   ───────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* ── Touch targets ── Apple/Material min is 44px. */
  button,
  .filter,
  .nav-item,
  input[type="search"],
  select,
  .toolbar input,
  .toolbar select {
    min-height: 44px;
  }
  /* iOS auto-zooms the page when a text field with font-size <16px gains
     focus (Articles search, date inputs, editor fields, etc.). Force 16px on
     every text-entry control at phone width so focusing a field never zooms. */
  input, textarea, select {
    font-size: 16px;
  }
  /* Icon-only round controls → 44×44. */
  .theme-toggle { width: 44px; height: 44px; }
  /* Small icon buttons (24–28px) → ~44px tap area. */
  .row-delete,
  .articles-date-clear,
  .cust-fact-copy,
  .ads-act-btn,
  .ads-act-btn.ads-act-more,
  .help-tip {
    min-width: 44px;
    min-height: 44px;
  }
  /* help-tip is a tiny round badge — keep it visually small but give it a
     larger transparent hit slop via padding so taps land reliably. */
  .help-tip {
    width: 22px;
    height: 22px;
    font-size: 12px;
  }

  /* ── Wide tables: scroll instead of clip ──
     The shared .analytics-table-wrap is overflow:hidden on desktop; on a
     phone let it scroll horizontally as a fallback for any table not
     converted to a card list. */
  .analytics-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Single-column dense grids ── drop the min-width floors. */
  .chart-grid,
  .insight-grid,
  .analytics-summary,
  .funnel-summary,
  .schedule-row {
    grid-template-columns: 1fr;
  }
  /* Cards-of-the-Day row: the 180px date column squeezed the middle on a
     phone; stacked single-column it reads cleanly and never overflows. */
  .schedule-row { gap: 6px; }
  /* Editor edition picker: let the "+ New" button drop below the select on a
     phone instead of being squeezed beside it. */
  .edition-input-row { flex-wrap: wrap; }
  .edition-input-row select { flex: 1 1 100%; }
  .edition-input-row .ghost { flex: 1 1 100%; }

  /* ── Sticky top bar shadow on scroll feel ── (the bar itself is already
     sticky from the ≤900px block; nothing more needed, but ensure the
     full page-header doesn't add a redundant top accent gap). */
  .page-header { padding-top: 14px; }

  /* ── Safe-area bottom padding so content/toasts clear the home bar. ── */
  .content { padding-bottom: max(64px, env(safe-area-inset-bottom)); }
  #toast-host { bottom: max(20px, env(safe-area-inset-bottom)) !important; }
}

/* Articles toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter {
  width: auto;
  padding: 7px 28px 7px 12px;
  font-size: 13px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
}

/* A link that lives in a toolbar alongside buttons — styled to read as a
   secondary (ghost) button so the toolbar row stays visually consistent
   instead of mixing a raw underlined link with real buttons. */
.toolbar-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  background: var(--panel);
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.toolbar-link:hover {
  background: var(--panel-2);
  color: var(--text);
  border-color: var(--border-strong);
}

#articles-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 12.5px;
}

/* Article list rows ─ table-like, soft */
#articles-list {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.article-row {
  display: grid;
  /* FIXED column template so every row's STATUS / VIEWS / VOTES / %LIKES /
     DATE land at the SAME horizontal position regardless of content — a
     real grid, no reflow. A row missing data (no views, no votes) keeps
     its column SLOT (placeholder text in place) without shifting
     neighbours. Columns:
       thumb · level · title · status · views · votes · %likes · date · ↗ · ✕
     The title is the only flexible (1fr) column; everything else is a
     fixed px width so the numeric columns align vertically down the list.
     The shared .articles-header grid below MUST mirror this template. */
  grid-template-columns: 60px 48px 1fr 132px 84px 92px 110px 96px 28px 28px;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.12s ease;
  border-bottom: 1px solid var(--border);
}
.article-row:last-child { border-bottom: none; }
.article-row:hover { background: var(--panel-2); }

.article-row .thumb {
  width: 60px;
  height: 44px;
  flex-shrink: 0;
  background-color: var(--panel-3);
  background-size: cover;
  background-position: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.article-row .thumb.thumb-empty {
  background: linear-gradient(135deg, var(--panel-3), var(--panel-2));
}

.article-row .title { min-width: 0; }
.article-row h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.article-row p {
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Level pill — small, compact CEFR badge matching the iOS app's
   level-badge style. One base rule used EVERYWHERE (article list, vocab
   list, analytics table, fix-cards results) so the tag never balloons
   into a big coloured block. Small rounded pill · level-appropriate
   tint · small bold text. */
.level-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 26px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0.2px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  vertical-align: middle;
}
.level-A1 { background: #dcfce7; color: #166534; }
.level-A2 { background: #d9f99d; color: #365314; }
.level-B1 { background: #fef3c7; color: #854d0e; }
.level-B2 { background: #fed7aa; color: #9a3412; }
.level-C1 { background: #fecaca; color: #991b1b; }
.level-C2 { background: #e9d5ff; color: #6b21a8; }

.article-row .status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;            /* center the badge within its fixed status column */
  gap: 6px;
  padding: 3px 10px 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
/* Match the Ads status pill: a small leading dot in the status colour. */
.article-row .status-pill::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.status-pill.draft     { color: var(--text-2); background: var(--panel-2);  border-color: var(--border); }
.status-pill.scheduled { color: var(--info);   background: var(--info-soft); border-color: var(--info-border); }
.status-pill.published { color: #4d7c0f; background: rgba(132, 204, 22, 0.16); border-color: rgba(132, 204, 22, 0.40); }

.article-row .meta {
  color: var(--muted);
  font-size: 12px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Per-article stats now render as THREE separate grid cells (Views ·
   Votes · %Likes) so they align vertically across rows. The wrapper uses
   `display: contents` so its children become direct grid items of
   .article-row and sit in the fixed view/vote/like columns. */
.article-stats-cells { display: contents; }

/* Shared base for the three stat cells. Each ALWAYS occupies its slot
   (placeholder when empty) so neighbours never shift. */
.article-row .article-col {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.article-row .article-col-views {
  text-align: right;
  color: var(--text-2);
  font-weight: 600;
}
.article-row .article-col-views.muted { color: var(--muted); font-weight: 500; }
.article-row .article-col-votes { display: inline-flex; align-items: center; }
.article-row .article-col-votes.muted { font-style: italic; color: var(--muted); }

.article-vote {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.article-vote-bar {
  display: inline-flex;
  width: 100%;
  max-width: 84px;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--panel-3);
  flex-shrink: 0;
}
.article-vote-fill { height: 100%; display: block; }
.article-vote-fill.up   { background: var(--accent); }
.article-vote-fill.down { background: #fca5a5; }

/* %Likes cell: thumbs-up % (positive/green) + thumbs-down % (muted). */
.article-row .article-col-likes {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text-2);
  font-weight: 600;
}
.article-row .article-col-likes.muted {
  color: var(--muted);
  font-weight: 500;
  text-align: right;
}
.article-vote-num {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.article-vote-num.up   { color: var(--success); }
.article-vote-num.down { color: var(--muted); }
.article-thumb-ico { flex-shrink: 0; }
.article-thumb-ico.up   { color: var(--success); }
.article-thumb-ico.down { color: var(--muted); }

/* Toolbar hint under the Articles toolbar — explains views/votes go live
   once the app reports them. Quiet, single line. */
.articles-stats-hint {
  margin: -2px 16px 10px;
  font-size: 11.5px;
}

.pin-mark {
  display: inline-block;
  margin-right: 2px;
  font-size: 11px;
  filter: grayscale(0.2);
}

.empty-state {
  padding: 56px 24px;
  text-align: center;
  color: var(--text-2);
  background: var(--panel);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-card);
  font-size: 14px;
  line-height: 1.55;
}
.empty-state .empty-emoji {
  display: block;
  font-size: 38px;
  margin-bottom: 14px;
  opacity: 0.9;
}
.empty-state .empty-title {
  display: block;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  margin-bottom: 6px;
}
.empty-state .empty-sub { display: block; max-width: 42ch; margin: 0 auto 16px; }
.empty-state button.primary { margin-top: 4px; }

/* Analytics tab — KPI cards + per-article table */
.analytics-summary {
  display: grid;
  /* auto-fit so the KPI row reflows to 2-up / 1-up on narrower viewports
     instead of squashing three fixed columns. */
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  box-shadow: var(--shadow-md);
}
.kpi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 6px;
}
.kpi-value {
  font-family: var(--font-head);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.6px;
  font-variant-numeric: tabular-nums;
}
.kpi-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
}

.analytics-table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.analytics-table thead th {
  text-align: left;
  padding: 10px 14px;
  background: var(--panel-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.analytics-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.analytics-table tbody tr:last-child td { border-bottom: none; }
.analytics-table tbody tr:hover { background: var(--panel-2); }
.analytics-table .numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.analytics-table .ratio-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.analytics-table .ratio-bar-track {
  width: 60px;
  height: 5px;
  background: var(--panel-3);
  border-radius: 999px;
  overflow: hidden;
}
.analytics-table .ratio-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}
.analytics-table .ratio-poor   .ratio-bar-fill { background: #fca5a5; }
.analytics-table .ratio-medium .ratio-bar-fill { background: #fcd34d; }
.analytics-table .ratio-good   .ratio-bar-fill { background: var(--accent); }

@media (max-width: 800px) {
  .analytics-summary { grid-template-columns: 1fr; }
}

/* Funnel widgets (onboarding + paywall) */
.funnel-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.funnel-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  box-shadow: var(--shadow-md);
}
.funnel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.funnel-period {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}
.funnel-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.funnel-row {
  display: grid;
  grid-template-columns: 120px 1fr 70px;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}
.funnel-row-label {
  color: var(--text);
  font-weight: 500;
}
.funnel-row-track {
  height: 18px;
  background: var(--panel-3);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.funnel-row-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
}
.funnel-row-fill.pct-low { background: #fca5a5; }
.funnel-row-fill.pct-mid { background: #fcd34d; }
.funnel-row-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 12px;
}
.funnel-row-num strong {
  color: var(--text);
  font-weight: 600;
}
.funnel-hint {
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--muted);
  font-style: italic;
}
.funnel-ctx {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
}
.funnel-ctx strong { color: var(--text); font-weight: 600; }
.funnel-empty {
  color: var(--muted);
  font-size: 12.5px;
  font-style: italic;
  padding: 8px 0;
}

@media (max-width: 800px) {
  .funnel-summary { grid-template-columns: 1fr; }
  .funnel-row { grid-template-columns: 90px 1fr 60px; }
}

/* ───────────── Analytics: date-range bar ───────────── */
.range-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.range-presets {
  display: inline-flex;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.range-preset {
  border: none;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.range-preset:hover { color: var(--text); }
.range-preset.active {
  background: var(--accent);
  color: var(--accent-fg);
  box-shadow: var(--shadow-sm);
}

/* ── App segmented control ───────────────────────────────────────────
   A pill-shaped Germanize | Englify (| All) selector. Reuses the
   range-preset pill look so it feels native, but the active segment
   paints in the chosen app's BRAND colour so the separation reads at a
   glance. Used above the Articles list (2-up) and on Overview (3-up). */
.app-seg {
  display: inline-flex;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  flex: 0 0 auto;
}
.app-seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.app-seg-btn:hover { background: transparent; color: var(--text); }
.app-seg-flag {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}
/* Active segment — neutral accent fallback; brand overrides below. */
.app-seg-btn.active {
  background: var(--accent);
  color: var(--accent-fg);
  box-shadow: var(--shadow-sm);
}
/* Brand-correct active states. Germanize = blue, Englify = lime
   (lime needs dark foreground for contrast). Apply on BOTH the Articles
   2-up control and the Overview tri-toggle. */
.app-seg-btn.active[data-app="germanize"],
.app-seg-btn.active[data-scope="germanize"] {
  background: #25a7de;
  color: #fcfcfc;
}
.app-seg-btn.active[data-app="englify"],
.app-seg-btn.active[data-scope="englify"] {
  background: #c4e538;
  color: #1a2e00;
}
.app-seg-btn.active[data-scope="all"] {
  background: var(--text);
  color: var(--bg);
}

/* Articles app-scope bar — segmented control on the left, sync on the
   right, sitting just above the filter toolbar. */
.articles-appbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.articles-appbar-spacer { flex: 1 1 auto; }
.sync-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 14px;
}
.sync-all-btn svg { flex: 0 0 auto; }
.range-custom { display: inline-flex; align-items: center; gap: 8px; }
.range-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.range-input {
  font: inherit;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
}
.compare-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.compare-toggle input { width: 16px; height: 16px; accent-color: var(--accent-strong); cursor: pointer; }

.kpi-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin: 4px 0 12px;
}

/* ── Overview / Dashboard ──
   Reuses .analytics-summary / .kpi / .chart-grid / .insight-grid / .bar-row
   wholesale; only the toolbar + the content/quick-action lists are new. */
.dash-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.dash-stat-list { display: flex; flex-direction: column; gap: 2px; }
.dash-stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.dash-stat-row:last-child { border-bottom: none; }
.dash-stat-label { color: var(--text-2); font-size: 13px; }
.dash-stat-num { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.dash-stat-total .dash-stat-label { font-weight: 700; color: var(--text); }
/* Per-app breakdown rows shown under the total in Overview "All" mode. */
.dash-stat-split { padding: 5px 0 5px 4px; }
.dash-stat-split .dash-stat-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
}
.dash-stat-split .app-seg-flag { width: 14px; height: 14px; }
.dash-stat-split .dash-stat-num { font-weight: 600; color: var(--text-2); }
.dash-action-list { display: flex; flex-direction: column; gap: 8px; }
.dash-action {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}
.dash-action:hover { border-color: var(--app-strong); background: var(--app-soft); transform: translateX(2px); }
.dash-action:focus-visible { outline: none; border-color: var(--app-strong); box-shadow: 0 0 0 3px var(--app-soft); }

/* ── Ads tab: Google AdMob config panel ── */
.admob-panel {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  margin-bottom: 22px;
}
.admob-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.admob-head-text h3 { margin: 0 0 4px; }
.admob-head-text p { margin: 0; max-width: 60ch; }
.admob-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; flex-shrink: 0; }
.admob-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.admob-switch-track { width: 40px; height: 23px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background 0.15s ease; flex-shrink: 0; }
.admob-switch-thumb { position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: transform 0.15s ease; }
.admob-switch input:checked + .admob-switch-track { background: var(--success); }
.admob-switch input:checked + .admob-switch-track .admob-switch-thumb { transform: translateX(17px); }
.admob-switch input:focus-visible + .admob-switch-track { box-shadow: 0 0 0 3px var(--app-soft); }
.admob-switch-label { font-weight: 700; font-size: 13px; }

.admob-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.admob-field { display: flex; flex-direction: column; gap: 6px; }
.admob-field-wide { grid-column: 1 / -1; }
.admob-field-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); }
.admob-panel input[type="text"], .admob-panel input[type="number"] {
  width: 100%;
  padding: 9px 11px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.admob-panel input[type="text"]:focus, .admob-panel input[type="number"]:focus {
  outline: none; border-color: var(--app-strong); box-shadow: 0 0 0 3px var(--app-soft);
}

.admob-units { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.admob-unit { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.admob-unit-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; cursor: pointer; }
.admob-unit-head input, .admob-place-row input { width: 16px; height: 16px; accent-color: var(--accent-strong); cursor: pointer; }
.admob-inter-freq { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.admob-inter-freq input[type="number"] { width: 58px; }

.admob-placements { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.admob-place-row { display: flex; flex-wrap: wrap; gap: 16px; }
.admob-place-row label { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }

.admob-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.admob-hint { flex: 1 1 100%; font-size: 12px; }
.admob-hint code { font-size: 11.5px; }

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

/* KPI period deltas */
.kpi-delta {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
  min-height: 15px;
}
.kpi-delta.good { color: var(--success); }
.kpi-delta.bad  { color: var(--danger); }
.kpi-delta.flat { color: var(--muted); }

/* ───────────── Analytics: time-series charts ───────────── */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
  margin: 8px 0 24px;
}
.chart-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px 20px 12px;
  box-shadow: var(--shadow-md);
}
.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.chart-title { font-size: 13px; font-weight: 700; color: var(--text); }
.chart-legend { font-size: 11px; color: var(--muted); display: inline-flex; gap: 12px; }
.chart-legend .leg-cur { color: var(--text-2); }
.chart-legend .leg-cmp { color: var(--muted); }
.chart-host { width: 100%; }
.chart-svg { width: 100%; height: 220px; display: block; }
.chart-grid-line { stroke: var(--border); stroke-width: 1; }
.chart-ytick { fill: var(--muted); font-size: 10px; text-anchor: end; font-family: var(--font-body); }
.chart-xtick { fill: var(--muted); font-size: 10px; font-family: var(--font-body); }
.chart-line { stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart-cmp-line { stroke: var(--muted); stroke-width: 1.6; stroke-dasharray: 4 4; stroke-linecap: round; stroke-linejoin: round; opacity: 0.8; }
.chart-empty {
  color: var(--muted);
  font-size: 12.5px;
  font-style: italic;
  padding: 70px 8px;
  text-align: center;
}

/* ───────────── Analytics: insight cards (mix / geo / platform …) ───────────── */
.insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.insight-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  box-shadow: var(--shadow-md);
}
.insight-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.insight-note {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}
.insight-body { display: flex; flex-direction: column; gap: 9px; }
.insight-empty {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  line-height: 1.5;
  padding: 6px 0;
}
.ab-sub {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin: 4px 0 2px;
}
.big-stat {
  font-family: var(--font-head);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.6px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* Shared horizontal-bar rows (plan mix, geo, platform, version, A/B) */
.bar-row {
  display: grid;
  grid-template-columns: 96px 1fr 78px;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}
.bar-label { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-label.geo-label { display: inline-flex; align-items: center; gap: 7px; }
.geo-flag { width: 16px; height: 16px; border-radius: 999px; flex: 0 0 auto; }
.geo-flag-blank { background: var(--panel-3); display: inline-block; }
.bar-track {
  height: 16px;
  background: var(--panel-3);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill { height: 100%; border-radius: 999px; transition: width 0.3s ease; }
.bar-fill.bar-a { background: var(--accent-strong); }
.bar-fill.bar-b { background: var(--success); }
.bar-fill.bar-c { background: var(--warn); }
.bar-fill.bar-d { background: var(--muted); }
.bar-fill.bar-e { background: var(--border-strong); }
.bar-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 11.5px;
}
.bar-num strong { color: var(--text); font-weight: 600; }

/* Editor edition picker: a select + a compact "+ New" button on one row. */
.edition-input-row { display: flex; gap: 8px; align-items: center; }
.edition-input-row select { flex: 1 1 auto; min-width: 0; }
.edition-input-row .ghost { flex: 0 0 auto; white-space: nowrap; padding: 8px 12px; }
/* Edition chip shown in the article row (only once >1 edition exists). */
.ed-tag {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--app-strong);
  background: var(--app-soft);
  border-radius: 999px;
}

/* "New" auto-tag — articles published within the last 30 days. Per-app accent
   fill (blue / lime) with the on-accent foreground so it stays legible in both
   brand themes and stands apart from the neutral edition chip. Expires on its
   own once the 30-day window passes. */
.new-tag {
  display: inline-block;
  margin-top: 4px;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--app-fg, #fcfcfc);
  background: var(--app, #25a7de);
  border-radius: 999px;
}

@media (max-width: 800px) {
  .range-bar { gap: 10px; }
  .bar-row { grid-template-columns: 80px 1fr 70px; }
}

/* Push tab */
#push-tab { max-width: 580px; }
#push-tab h2 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
#push-tab > p { margin-bottom: 22px; }
#push-tab label { margin-top: 12px; }
#push-send { margin-top: 18px; padding: 10px 22px; }
#push-result { margin-top: 14px; min-height: 18px; font-size: 13px; }

/* ───────────── Editor ───────────── */
.editor-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
  margin-bottom: 28px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.grow { flex: 1; }

.editor-header h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
}
.editor-header .status-indicator {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  margin-left: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.editor-header .status-indicator.draft     { background: var(--panel-3); color: var(--text-2); }
.editor-header .status-indicator.scheduled { background: var(--warn-soft); color: var(--warn-strong); }
.editor-header .status-indicator.published { background: var(--success-soft); color: var(--success); }

/* Schedule readout — "Hidden until … · goes live in 2 days" under the
   datetime picker, so the author sees the consequence of the chosen time. */
.schedule-readout {
  margin-top: 8px;
  font-size: 11.5px;
  line-height: 1.45;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
}
.schedule-readout.is-future { background: var(--warn-soft); color: var(--warn-strong); }
.schedule-readout.is-past   { background: var(--danger-soft); color: var(--danger); }

/* Dirty marker — orange dot inline with the status pill so the
   author always knows when something is unsaved. The pulse keeps it
   noticeable without being loud (no banner). */
.dirty-indicator {
  color: var(--warn);
  font-size: 18px;
  line-height: 1;
  margin-left: 4px;
  animation: dirty-pulse 1.6s ease-in-out infinite;
}
@keyframes dirty-pulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

.editor-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  padding-bottom: 80px;
}
.editor-main { min-width: 0; }
.editor-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.editor-body h3 {
  margin-top: 32px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 8px;
}
.form-grid label.span-2 { grid-column: 1 / -1; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  margin-bottom: 10px;
}
.section-head h3 { margin: 0; }

/* Sidebar panels (publish + schedule + meta) */
.side-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.side-panel h4 {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 12px;
}

/* Status segmented control */
.status-seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 12px;
}
.status-seg button {
  background: transparent;
  border: none;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border-radius: 4px;
  text-align: center;
}
.status-seg button.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.status-seg button:hover:not(.active) { color: var(--text); }

#schedule-inline { margin-top: 12px; }
#schedule-inline label { margin-bottom: 0; }

.publish-action {
  width: 100%;
  margin-top: 14px;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
}

/* Image input — text URL + upload button on the same row */
.image-input-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.image-input-row input { flex: 1; }
.image-input-row button { white-space: nowrap; }

/* Banner tab */
/* Banner: slot selector (3 independent slots) */
.banner-slot-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.banner-slot-tab {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 9px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  line-height: 1.2;
}
.banner-slot-tab:hover { border-color: var(--app); }
.banner-slot-tab.is-active {
  background: var(--app);
  color: var(--app-fg);
  border-color: var(--app);
}
.banner-slot-sub {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.7;
}
.banner-slot-tab.is-active .banner-slot-sub { opacity: 0.85; }

/* Banner: per-slot note (square-format flag) */
.banner-slot-note {
  margin: 0 0 14px;
  padding: 9px 12px;
  border-radius: var(--radius);
  background: var(--warn-soft, var(--panel-2));
  color: var(--warn-strong, var(--text));
  font-size: 13px;
  font-weight: 600;
}

.banner-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  margin-top: 12px;
}
.banner-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}
.banner-preview {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 3 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.banner-preview.empty { background: var(--panel-2); }
/* The image aspect-FITS (scaledToFit, NO crop) exactly like the app, so a
   non-matching ratio shows letterbox bars — matching reality. The bars use
   the panel-2 tone so they read as "padding", not part of the artwork. */
.banner-preview-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--panel-2);
  display: block;
}
/* Square slot (grammar_magazine) — 1:1 preview, capped width so it
   doesn't tower over the wide slots' 3:1 preview. */
.banner-preview.is-square {
  aspect-ratio: 1 / 1;
  max-width: 340px;
  margin-inline: auto;
}
.banner-preview-message {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  background: rgba(255,255,255,0.95);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  text-align: center;
}
/* Recommended-dimensions line above the preview + soft aspect mismatch warning
   below it. The warning is amber (soft, non-blocking) since the app letterboxes
   rather than rejecting. */
.banner-dim-guidance { margin: 0 0 8px; }
.banner-aspect-warn {
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
  /* Readable amber text on a soft amber wash. Deliberately NOT var(--warn)
     (that token is a bright fill, illegible as body text on a light panel). */
  color: #9a6700;
  background: var(--warn-soft, rgba(255, 201, 71, 0.18));
  border: 1px solid rgba(255, 201, 71, 0.45);
  border-radius: 8px;
  padding: 8px 10px;
}

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

/* Banner: audience segmented control */
.segmented {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel-2);
}
.seg-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-right: 1px solid var(--border);
}
.seg-btn:last-child { border-right: none; }
.seg-btn.is-active { background: var(--app); color: var(--app-fg); }

/* Section divider — separates the instant-push block from the merged-in
   scheduled-notifications block inside the Notifications tab. */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0 22px;
}
.scheduled-section { margin-top: 4px; }

/* Banner: preview summary */
.banner-summary {
  margin: 14px 0 0;
  display: grid;
  gap: 6px;
  font-size: 13px;
}
.banner-summary > div {
  display: flex;
  gap: 8px;
}
.banner-summary dt {
  margin: 0;
  min-width: 72px;
  color: var(--muted);
  font-weight: 600;
}
.banner-summary dd { margin: 0; color: var(--text); }
.schedule-readout.is-live { background: var(--ok-soft, var(--panel-2)); color: var(--ok, var(--text)); }

/* Banner: custom daypart hour range */
.daypart-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.daypart-custom input[type="number"] {
  width: 84px;
}
.daypart-custom-sep {
  color: var(--muted);
  font-weight: 600;
}

/* Image preview pill */
.image-preview {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  background: var(--panel-2);
  border-radius: var(--radius-sm);
}
.image-preview img {
  width: 72px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--panel-3);
}

/* Image suggestions — three curated thumbnails per article. The row
   sits between the image input and the live preview, so authors see
   a visual menu rather than a list of URLs. */
.image-suggestions {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.image-suggestions-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.image-suggestion {
  /* Override button defaults so each thumbnail is purely an image
     surface. We keep a 3:2 ratio so the proportions match the iOS
     hero crop and the author can pre-judge the framing. */
  padding: 0;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--panel-2);
  background-size: cover;
  background-position: center;
  aspect-ratio: 3 / 2;
  cursor: pointer;
  position: relative;
  transition: border-color 0.12s ease, transform 0.08s, box-shadow 0.12s ease;
}
.image-suggestion:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.image-suggestion.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.image-suggestion.active::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

/* Big hero preview for the article image. 16:9 mirrors the iOS
   crop so the author can pre-judge the framing before saving. The
   loader text fades out as soon as the photo loads — no jump cut. */
.image-hero-preview {
  margin-top: 10px;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.image-hero-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s ease;
}
.image-hero-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}
/* Drag-and-drop on the article hero preview box (mirrors .banner-dropzone).
   Idle empty state shows a dashed border + the loader's drop prompt; a file
   dragged over the box highlights it with the app accent and reveals the
   "Solte para enviar" overlay. */
.image-hero-preview.is-empty {
  border-style: dashed;
  cursor: pointer;
}
.image-hero-preview.dragover {
  border-color: var(--app, var(--accent, #c4e538));
  background: var(--app-soft, var(--accent-soft, rgba(196, 229, 56, 0.16)));
}
.image-hero-droplay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--app-strong, var(--text, #373530));
  background: var(--app-soft, var(--accent-soft, rgba(196, 229, 56, 0.16)));
  border-radius: inherit;
  pointer-events: none;
}
.image-hero-preview.dragover .image-hero-droplay { display: flex; }

/* Word-count badge — colour-codes how the body length compares to
   the recommended band for the chosen CEFR level. */
.body-stats {
  font-variant-numeric: tabular-nums;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
}
.body-stats-ok   { background: var(--accent-soft); color: var(--accent-fg); }
.body-stats-warn { background: var(--warn-soft); color: #92400e; }
.body-stats-low  { background: #fee2e2; color: #991b1b; }
.body-stats-high { background: #fee2e2; color: #991b1b; }

/* List-row delete: slim ✕ icon, no red. Hover reveals destructive
   intent. Keeps the row compact and stops the eye from being drawn
   to a "Löschen" button bigger than the title. */
.row-delete {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 14px;
  color: var(--muted);
  border-color: transparent;
}
.row-delete:hover {
  color: var(--danger);
  background: rgba(225, 29, 72, 0.08);
}

/* Body word-count line */
.body-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* Repeated cards (vocab + exercise) */
.repeat-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
}
.repeat-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.repeat-card-head h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-2);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
}

/* ───── Grammar-highlight: automatic color swatch + inline preview ─────
   The color is DERIVED from (grammarType, level), never typed by the
   author — it mirrors MagazineGrammarType.axis(level:).tint in the app.
   The little dot in the card header + the swatch row both repaint the
   moment a type or level is picked. */
.gh-swatch-dot {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.18);
  flex: 0 0 auto;
}
.gh-color-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 4px 0 10px;
  padding: 9px 11px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.gh-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.18);
}
.gh-color-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 92px;
}
.gh-color-axis {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.gh-color-hex {
  font-size: 12px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.gh-preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 160px;
  min-width: 140px;
}
.gh-preview-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
/* The inline mirror of the app's colored squiggle: the quote underlined
   in the type's color, cue word bolded. textDecorationColor is set
   inline per-row in JS to the exact axis color. */
.gh-preview-quote {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration-line: underline;
  text-decoration-style: wavy;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.gh-preview-quote b { font-weight: 800; }

/* Wrong-answer explanation rows */
.wae-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 8px;
  margin-bottom: 6px;
  align-items: center;
}
.wae-row .opt {
  font-size: 12px;
  color: var(--muted);
  padding-left: 4px;
}

/* ───────────── Comprehension: click-to-mark correct answer ───────────── */
.answer-options-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 6px 0 6px;
}
.answer-options-head > span:first-child {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.answer-options-head .small-hint { margin-top: 0; }
.answer-options { display: flex; flex-direction: column; gap: 6px; }
.answer-option-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: background 0.12s ease, border-color 0.12s ease;
}
.answer-option-row.is-correct {
  background: var(--success-soft);
  border-color: var(--success);
}
.answer-radio {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: var(--panel);
  padding: 0;
  cursor: pointer;
  position: relative;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.answer-radio:hover { border-color: var(--success); }
.answer-radio.checked {
  border-color: var(--success);
  background: var(--success);
}
.answer-radio.checked::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}
.answer-option-input { flex: 1 1 auto; }
.answer-opt-remove {
  flex: 0 0 auto;
  padding: 2px 8px;
  color: var(--muted);
}
.answer-opt-remove:hover { color: var(--danger); }
.answer-add-opt {
  align-self: flex-start;
  margin-top: 2px;
  font-size: 12px;
  padding: 4px 10px;
}
.answer-missing-warn { color: var(--danger); }
.ex-quote-warn { color: var(--danger); }
.ex-quote-from-sel, .gh-quote-from-sel {
  font-size: 11.5px;
  padding: 4px 10px;
  margin-top: 6px;
}
.gh-quote-ok { color: var(--success); }
.gh-quote-warn, .gh-level-warn, .gh-cue-warn { color: var(--danger); }

/* ───────────── Modals ───────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
}
.modal-card h3 {
  margin-bottom: 6px;
  font-size: 18px;
  font-weight: 700;
}
.modal-card > p.muted { margin-bottom: 18px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* ─── Cards-of-day schedule ─── */
.cards-schedule {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 16px;
}
.schedule-row {
  display: grid;
  grid-template-columns: 180px 1fr 80px;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.schedule-row.is-today {
  background: var(--app-soft);
  border-color: var(--app);
  box-shadow: 0 0 0 2px var(--app-soft);
}
.schedule-date { color: var(--text-2); font-variant-numeric: tabular-nums; font-size: 13px; }
.schedule-word { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.schedule-word strong { font-size: 15px; }
.schedule-pt { color: var(--text-2); font-style: italic; font-size: 13px; }
/* CEFR level badge — shares the ONE warm level palette used by .level-pill
   everywhere else (article list, vocab, analytics) instead of a separate
   rainbow. Soft tint + dark level-appropriate text. */
.schedule-level { font-size: 10.5px; padding: 2px 8px; border-radius: 999px; font-weight: 700; letter-spacing: .2px; }
.schedule-level.lvl-A1 { background: #dcfce7; color: #166534; }
.schedule-level.lvl-A2 { background: #d9f99d; color: #365314; }
.schedule-level.lvl-B1 { background: #fef3c7; color: #854d0e; }
.schedule-level.lvl-B2 { background: #fed7aa; color: #9a3412; }
.schedule-level.lvl-C1 { background: #fecaca; color: #991b1b; }
.schedule-level.lvl-C2 { background: #e9d5ff; color: #6b21a8; }
.schedule-idx { font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .editor-body { grid-template-columns: 1fr; }
  .editor-side { order: -1; }
}
/* Audio section in the article editor (between Vokabeln and Aufgaben) */
.audio-status {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  white-space: nowrap;
}
.audio-status.is-present {
  background: var(--success-soft);
  color: var(--success);
}
.audio-status.is-missing {
  background: var(--panel-3);
  color: var(--muted);
}
.audio-status.is-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.audio-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.audio-block audio {
  width: 100%;
  outline: none;
}
.audio-dropzone {
  display: block;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.audio-dropzone:hover { border-color: var(--accent); }

/* Upload triggers that are <label for> instead of <button> (native single
   picker open). Match the .ghost button look so they read as buttons —
   overriding the base uppercase form-label styling. */
label.ghost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  font-weight: 500;
  font-size: 13px;
  text-transform: none;
  letter-spacing: normal;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}
label.ghost:hover { background: var(--panel-2); color: var(--text); }
label.ghost.danger { color: var(--danger); }
label.ghost.danger:hover { background: var(--danger-soft); }
label.ghost[hidden] { display: none; }
label.ghost.is-disabled { opacity: 0.5; cursor: not-allowed; }

/* Standalone field caption used where the control sits OUTSIDE the <label>
   (the file input is now a sibling, so the caption can't wrap it). Mirrors
   the base uppercase form-label caption so it lines up with its siblings. */
.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.audio-dropzone.is-dragover {
  border-color: var(--accent);
  background: rgba(132, 204, 22, 0.08);
}
.audio-dropzone-label {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--text-2);
}
.audio-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.audio-actions .small-hint {
  margin: 0;
  flex: 1;
}

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid label.span-2 { grid-column: 1; }

  /* Articles list → a real 2-line card (no data loss). Switch the row from
     a wide fixed grid to a wrapping flex layout, then use `order` + a forced
     line break so it reads as:

       [thumb]  [A1] Title …                       [↗] [✕]
                Published · 1.2k views · 5 Jun 2026

     Level, status, the stat cells, the date AND both actions all stay
     visible — nothing is display:none'd. */
  .article-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 10px;
    row-gap: 4px;
    padding: 12px 14px;
  }
  .article-row .thumb { order: 0; align-self: flex-start; }
  .article-row .level-pill { order: 1; align-self: flex-start; }
  /* Line 1 belongs to the title: thumb + level are small, so giving the title
     flex:1 1 auto lets it claim the rest of the row and wrap naturally to a
     couple of lines instead of being crushed to one-word-per-line by the
     trailing action buttons (which now sit on the LAST line, right-aligned). */
  .article-row .title { order: 2; flex: 1 1 auto; min-width: 0; }
  /* Line 2: status · stats · date — all inline, wrapping as needed. */
  .article-row .status-pill { order: 3; align-self: center; }
  .article-row .article-stats-cells {
    order: 4;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11.5px;
  }
  .article-row .meta { order: 5; font-size: 11.5px; color: var(--muted); }
  /* Actions trail to the far right of the last line so they never steal width
     from the title. margin-left:auto on the first one pushes the pair right. */
  .article-row > [data-action="open-tab"] { order: 6; align-self: center; margin-left: auto; }
  .article-row .row-delete { order: 7; align-self: center; }

  #editor-view { padding: 20px 16px 64px; }
  .content { padding: 0 14px 56px; }
  .page-header { flex-direction: column; gap: 10px; }
  .page-header #page-title { max-width: 100%; overflow-wrap: anywhere; }

  /* ── THE iPhone fix ──
     The Articles column-header row is a 10-column grid sized for the desktop
     (≈800px wide). On a phone it cannot shrink, so its labels collapsed on top
     of each other ("TITSTATUS") and the columns stopped aligning with the rows.
     The rows already reflow into self-labelling 2-line cards above, so the
     header carries no information here — hide it, exactly like the analytics
     tables do for their card lists. */
  .articles-header { display: none; }
  /* Belt-and-braces: even if a future row escapes the flex reflow, never let
     the list force the page wider than the phone. */
  #articles-list { overflow-x: hidden; }

  /* Dictionary rows had NO phone treatment at all — the same 7-column grid was
     crushed into the screen. Reflow them into the same wrapping 2-line card as
     the article rows: word + level on line 1, the meta (article/POS/topics/
     flags) wrapping onto the next lines, delete pinned to the right. */
  .vocab-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 8px;
    row-gap: 4px;
    padding: 12px 14px;
  }
  .vocab-row .vocab-level-pill { order: 0; }
  .vocab-row .vocab-word { order: 1; flex: 1 1 auto; white-space: normal; }
  .vocab-row .vocab-delete { order: 2; align-self: flex-start; margin-left: auto; }
  .vocab-row .vocab-article { order: 3; }
  .vocab-row .vocab-pos { order: 4; }
  .vocab-row .vocab-topics { order: 5; flex: 1 1 100%; white-space: normal; }
  .vocab-row .vocab-flags { order: 6; flex: 1 1 100%; }
}

/* ─────────────────────────────────────────────────────────────────────
   Mobile card-list — shared styles for the phone render branches that
   replace the wide <table>s (Customers, Revenue, Analytics, Ads). Each row
   builder emits, into its existing <tbody>, a single full-width cell that
   holds a .cm-card-list of .cm-card panels (valid table markup), so the
   desktop table path stays byte-identical above 640px.
   ───────────────────────────────────────────────────────────────────── */
/* When a table renders its phone card list, its column headers are
   meaningless (each card is self-labelling) — hide the thead. Scoped to a
   tbody that actually contains a card cell so desktop is untouched. */
@media (max-width: 640px) {
  .analytics-table:has(.cm-card-cell) thead,
  .ads-table-modern:has(.cm-card-cell) thead { display: none; }
}
.cm-card-cell { padding: 12px !important; background: var(--panel); }
.cm-card-cell:hover { background: var(--panel) !important; }   /* kill tr:hover tint */
.cm-card-list { display: flex; flex-direction: column; gap: 10px; }
.cm-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.cm-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.cm-card-head .cust-row-id,
.cm-card-head .event-tag { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cm-card-sub { font-size: 11.5px; margin-bottom: 10px; }
.cm-amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.cm-card-rows { display: flex; flex-direction: column; gap: 6px; }
.cm-kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}
.cm-kv .cm-k {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}
.cm-kv .cm-v { color: var(--text); text-align: right; min-width: 0; overflow-wrap: anywhere; }
.cm-kv .cm-v code { font-size: 12px; }
/* Card is tappable (customers open a detail view). */
.cm-card[role="button"] { cursor: pointer; }
.cm-card[role="button"]:hover { border-color: var(--border-strong); background: var(--panel-3); }
.cm-card[role="button"]:focus-visible {
  outline: none;
  border-color: var(--app-strong);
  box-shadow: 0 0 0 3px var(--app-soft);
}

/* Analytics card title block. */
.an-card .an-card-title { min-width: 0; }
.an-card .an-card-name { font-weight: 600; }

/* Ads card. Reuses the existing thumb / status / slot / segmentation /
   action-button styles; only the card frame + line layout are new. */
.ads-card .ads-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.ads-card .ads-card-thumb { flex-shrink: 0; }
.ads-card .ads-card-thumb .ads-thumb { width: 52px; height: 52px; }
.ads-card .ads-card-name-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}
.ads-card .ads-name-primary {
  font-weight: 600;
  font-size: 14px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.ads-card .ads-card-name-wrap .ads-slot-badge { align-self: flex-start; }
.ads-card .ads-card-head .ads-status { flex-shrink: 0; }
.ads-card .ads-card-targeting { margin-bottom: 10px; }
.ads-card .ads-card-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12.5px;
  color: var(--text-2);
  padding: 8px 0;
  margin-bottom: 8px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.ads-card .ads-card-metrics strong { color: var(--text); font-variant-numeric: tabular-nums; }
.ads-card .ads-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
/* On the card, action buttons show their labels (room is no longer tight). */
.ads-card .ads-card-actions .ads-act-btn .ads-act-label { display: inline; }
.ads-card .ads-card-actions .ads-act-btn {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: var(--panel);
}

/* ── Tap-to-toggle help popover (replaces hover-only title= on touch) ── */
.help-popover {
  position: absolute;
  z-index: 400;
  max-width: 280px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  /* Subtle entrance. */
  animation: helpPopIn 0.12s ease;
}
@keyframes helpPopIn {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: none; }
}

/* ─────────────────────────────────────────────────────────────────────
   Step 4 — phone modals as bottom sheets + ads overflow menu as a sheet.
   ───────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Modals dock to the bottom edge as near-full-width sheets with rounded
     top corners — the familiar iOS sheet feel. Reduced padding gives the
     dense forms more room. Applies to the standard modal, the vocab editor
     and the campaign editor (all share .modal-backdrop). */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  /* Higher-specificity selectors (.modal-backdrop > …) so these win over the
     base .modal-card / .campaign-card rules that appear LATER in the file
     (equal specificity → source order would otherwise beat a plain media
     rule). */
  .modal-backdrop > .modal-card,
  .modal-backdrop > .vocab-modal-card,
  .modal-backdrop > .campaign-card {
    width: 100%;
    max-width: none;
    border-radius: 18px 18px 0 0;
    max-height: 92vh;
    max-height: 92dvh;
    overflow-y: auto;
    animation: sheetUp 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  }
  /* The standard + vocab cards carry their own padding; the campaign card is
     padding:0 by design (it has an internal scroll body), so leave it. */
  .modal-backdrop > .modal-card,
  .modal-backdrop > .vocab-modal-card {
    padding: 18px;
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }
  @keyframes sheetUp {
    from { transform: translateY(100%); }
    to   { transform: none; }
  }
  /* The confirm modal stays a centered dialog (it's small) — undo the sheet
     docking just for it so a yes/no question doesn't slide from the bottom.
     Selector matches the sheet rule's specificity (0,2,0) and comes later in
     source, so it wins. */
  .confirm-backdrop { align-items: center; padding: 20px; }
  .confirm-backdrop > .confirm-card {
    width: 100%;
    max-width: 420px;
    border-radius: var(--radius-card);
    animation: none;
  }

  /* Ads overflow ("⋯") menu → bottom sheet, so it never overflows the
     viewport edge on a narrow screen. */
  .ads-menu {
    position: fixed;
    inset: auto 0 0 0;
    top: auto;
    right: 0;
    z-index: 300;
    min-width: 0;
    width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 10px 14px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    box-shadow: 0 -8px 28px rgba(0,0,0,0.28);
    animation: sheetUp 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .ads-menu-item { min-height: 48px; font-size: 14px; }
}

/* ───────────── Vocabulary tab ───────────── */
.vocab-search {
  min-width: 220px;
  flex: 1;
}
#vocab-count { margin-left: auto; }

.vocab-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-2);
}
.vocab-stats strong {
  color: var(--text);
  font-weight: 600;
  margin-right: 4px;
}

#vocab-list {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  min-height: 80px;
}

.vocab-row {
  display: grid;
  /* Column order matches the appended children: article · level · word ·
     POS · meaning/topics · flags · delete. Each .vocab-row is its OWN grid.
     Every CEFR code is exactly two glyphs ("A1".."C2"), so the level pill is
     a constant width across rows — its column is therefore a content-sized
     track (max-content) that HUGS the compact badge instead of a slim-but-
     still-too-wide 44px lane with dead space to the badge's right. The
     article track stays fixed (der/die/das vary) so the words still line up.
     min-width:0 on the word / meaning fr-columns lets them ellipsize rather
     than stretch the grid. */
  grid-template-columns: 40px max-content minmax(0, 1.4fr) 84px minmax(0, 2fr) 96px 28px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s ease;
  font-size: 13px;
}
.vocab-row:last-child { border-bottom: none; }
.vocab-row:hover { background: var(--panel-2); }

.vocab-row .vocab-article {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  font-variant-numeric: tabular-nums;
}
/* Level badge in the dictionary list: rendered with the SAME .schedule-level
   class as the Cards-of-the-Day tab, so it is pixel-identical to that tag —
   same 10.5px font, 2px 8px padding, solid level tint and white text. The
   only dictionary-specific rule is left-aligning the chip in its max-content
   grid column; we add NO size overrides so the two badges stay in lockstep. */
.vocab-row .vocab-level-pill {
  justify-self: start;
}
.vocab-row .vocab-word {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vocab-row .vocab-pos {
  font-size: 11px;
  color: var(--text-2);
  text-transform: lowercase;
}
.vocab-row .vocab-topics {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vocab-row .vocab-flags {
  display: flex;
  gap: 4px;
  font-size: 11px;
}
.vocab-row .vocab-flag {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.vocab-row .vocab-flag.archaic { background: var(--warn-soft); color: var(--warn-strong); }
.vocab-row .vocab-flag.regional { background: var(--info-soft); color: var(--info); }

.vocab-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
  padding: 8px 14px;
}
.vocab-pagination button:disabled { opacity: 0.4; }
.vocab-page-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}
.vocab-page-jump input {
  width: 70px;
  padding: 5px 8px;
  font-size: 13px;
}

/* ───────────── Vocabulary editor modal ───────────── */
.vocab-modal {
  align-items: flex-start;
  padding: 40px 20px;
  overflow-y: auto;
}
.vocab-modal-card {
  max-width: 760px;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.vocab-modal-head {
  display: flex;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 2;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.vocab-modal-head h3 {
  flex: 1;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.vocab-form {
  padding: 20px 24px 4px;
}
.vocab-form > label {
  margin-bottom: 14px;
  display: block;
}
.vocab-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.vocab-form-row > label {
  margin-bottom: 0;
}
.vocab-form-row.vocab-checkbox-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}
.vocab-button-cell {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.vocab-button-cell button {
  margin-top: 4px;
  width: 100%;
}

.vocab-mono {
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, monospace;
  font-size: 13.5px;
  line-height: 1.5;
}
.vocab-example-preview {
  display: inline;
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, monospace;
  font-size: 12px;
}
.vocab-example-preview mark {
  background: var(--accent);
  color: var(--accent-fg);
  padding: 0 2px;
  border-radius: 3px;
  font-weight: 600;
}

.vocab-details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  margin-bottom: 14px;
  padding: 0;
}
.vocab-details > summary {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-2);
  list-style: none;
}
.vocab-details > summary::-webkit-details-marker { display: none; }
.vocab-details > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  font-size: 10px;
  transition: transform 0.15s ease;
}
.vocab-details[open] > summary::before {
  transform: rotate(90deg);
}
.vocab-details > *:not(summary) {
  padding-left: 14px;
  padding-right: 14px;
}
.vocab-details > .vocab-form-row {
  padding-top: 0;
  padding-bottom: 0;
}
.vocab-details > .vocab-form-row:last-of-type { padding-bottom: 14px; }

.vocab-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.vocab-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  font-family: inherit;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.vocab-chip:hover {
  background: var(--panel-2);
}
.vocab-chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}
.vocab-chip.custom-active {
  background: var(--info-soft);
  border-color: var(--info-border);
  color: var(--info);
  font-weight: 600;
}
.vocab-chips-add {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.vocab-chips-add input { flex: 1; }
.vocab-chips-add button { white-space: nowrap; }

.vocab-inline-check {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  margin-bottom: 0 !important;
  font-size: 13px;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.vocab-inline-check input[type=checkbox] {
  width: auto !important;
  margin: 0 !important;
}

.vocab-field-error {
  display: block;
  margin-top: 4px;
  color: var(--danger);
  font-size: 12px;
}

.vocab-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  position: sticky;
  bottom: 0;
}
.vocab-modal-actions .grow { flex: 1; }
#ve-status {
  margin: 0 24px 16px;
}

@media (max-width: 700px) {
  .vocab-form-row { grid-template-columns: 1fr; }
  .vocab-row {
    grid-template-columns: 60px 1fr auto;
    grid-template-areas:
      "article word delete"
      "pos topics topics"
      "flags flags flags";
    row-gap: 4px;
    padding: 10px 14px;
  }
  .vocab-row .vocab-article { grid-area: article; }
  .vocab-row .vocab-word    { grid-area: word; }
  .vocab-row .vocab-pos     { grid-area: pos; }
  .vocab-row .vocab-level-pill { display: none; }
  .vocab-row .vocab-topics  { grid-area: topics; }
  .vocab-row .vocab-flags   { grid-area: flags; }
  .vocab-row .vocab-delete  { grid-area: delete; }
  .vocab-pagination { flex-wrap: wrap; }
}

/* ───────────── Fix Cards (card overrides) ───────────── */

.fixcards-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.fixcards-result {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.fixcards-result-main { flex: 1; min-width: 0; }
.fixcards-result-main strong { font-size: 15px; }
.fixcards-result-main .small-hint { display: block; margin-top: 3px; }
.fixcards-result .level-pill { margin-left: 8px; vertical-align: middle; }

.override-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent-fg);
  vertical-align: middle;
}

.fixcards-overrides {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.fixcards-override-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.fixcards-override-main { flex: 1; min-width: 0; }
.fixcards-override-main strong { font-size: 14px; }
.fixcards-override-actions { display: flex; gap: 6px; flex-shrink: 0; }

.override-pill {
  display: inline-block;
  padding: 1px 7px;
  margin-right: 4px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--panel-2);
  color: var(--text-2);
}

/* ── Override editor modal ── */
.override-base {
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.override-base-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.override-base-head strong { font-size: 16px; }
.override-base-key { margin-top: 4px; }
.override-base-key code {
  background: var(--panel-3);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.override-preview {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: var(--panel);
}
.override-preview-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.override-preview-body strong { font-size: 15px; }
.override-preview-meaning { margin-top: 6px; }
.override-preview-example { margin-top: 4px; font-style: italic; }
.override-preview-regional { margin-top: 4px; font-size: 12px; }

/* ─── Umsatz / Revenue dashboard + Paywall config editor ─────────── */

/* Ledger event + environment tags reuse the analytics table styling. */
.event-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.env-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
}
.env-prod { background: var(--success-soft); color: var(--success); border: 1px solid var(--success); }
.env-sandbox { background: var(--warn-soft); color: var(--warn-strong); border: 1px solid var(--warn); }

/* ───────────── Paywall visual builder ───────────── */
.paywall-builder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  align-items: start;
  margin-top: 12px;
}
@media (max-width: 980px) {
  .paywall-builder { grid-template-columns: 1fr; }
  .pw-preview-sticky { position: static !important; }
}

/* The inline "● Unsaved changes" chip in the paywall toolbar reuses the
   dirty-indicator colour but at body size (the editor's bare dot is 18px). */
#paywall-dirty.dirty-indicator {
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Editor column — grouped sections */
.pw-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  background: var(--panel);
}
.pw-section-head { margin-bottom: 12px; }
.pw-section-head h3 {
  font-size: 15px;
  margin: 0 0 2px;
}
.pw-section > label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 12px;
}
.pw-section > label input,
.pw-section > label select,
.pw-product label input,
.pw-product label select {
  display: block;
  width: 100%;
  margin-top: 4px;
  font-weight: 400;
}
.pw-section > label.checkbox-row { font-weight: 600; color: var(--text); }
.pw-raw summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.pw-raw[open] summary { margin-bottom: 10px; }

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
}
.checkbox-row input { width: auto !important; margin: 0 !important; }

/* Product cards */
.pw-product {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  background: var(--panel-2);
}
.pw-product label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 0;
}
.pw-product-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}
.pw-product-row:first-child { grid-template-columns: 2fr 1fr auto; }
.pw-product-row.pw-product-flags { grid-template-columns: 1fr; margin-bottom: 0; }
.pw-product-row.pw-product-flags .checkbox-row { font-weight: 500; color: var(--text-2); }
@media (max-width: 620px) {
  .pw-product-row,
  .pw-product-row:first-child { grid-template-columns: 1fr; }
}
.pw-del { align-self: center; }

/* Comparison-table editor — feature label + a Free and Premium TEXT cell
   (each takes "yes" / "no" / "infinity" tokens or a short figure like
   "3 / Niveau") + delete. */
.pw-compare-rows { margin-bottom: 10px; }
.pw-compare-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.pw-compare-label { width: 100%; }
.pw-compare-cell { width: 100%; font-size: 12.5px; }
.pw-compare-check {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
}
.pw-compare-check input { width: auto !important; margin: 0 !important; }
@media (max-width: 620px) {
  .pw-compare-row { grid-template-columns: 1fr; }
}

.config-preview {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-2);
  overflow-x: auto;
  white-space: pre;
  margin: 0;
}

/* ── Live in-app preview (phone mockup) ── */
.paywall-preview-col { min-width: 0; }
.pw-preview-sticky { position: sticky; top: 16px; }
.pw-preview-label {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}
.phone-frame {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  background: var(--ink);
  border-radius: 36px;
  padding: 12px;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.phone-notch {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 22px;
  background: var(--ink);
  border-radius: 0 0 14px 14px;
  z-index: 2;
}
.phone-screen {
  background: var(--panel);
  border-radius: 26px;
  padding: 30px 16px 18px;
  min-height: 480px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* In-app paywall mock pieces */
.pw-mini-hero { font-size: 34px; text-align: center; }
.pw-mini-headline {
  font-family: var(--font-head);
  font-size: 21px;
  font-weight: 800;
  text-align: center;
  line-height: 1.2;
  color: var(--text);
}
.pw-mini-sub {
  font-size: 12.5px;
  text-align: center;
  color: var(--text-2);
  line-height: 1.4;
  margin-top: -2px;
}
.pw-mini-compare {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  font-size: 11.5px;
}
.pw-mini-compare-head,
.pw-mini-compare-row {
  display: grid;
  grid-template-columns: 1fr 42px 56px;
  align-items: center;
  padding: 6px 10px;
}
.pw-mini-compare-head {
  background: var(--panel-2);
  font-weight: 700;
  color: var(--text-2);
  text-align: center;
}
.pw-mini-compare-head span:first-child { text-align: left; }
.pw-mini-compare-row { border-top: 1px solid var(--border); text-align: center; }
.pw-mini-compare-row .pw-mini-feat { text-align: left; color: var(--text); }
.pw-mini-prem { color: var(--app); font-weight: 700; }
.pw-mini-products { display: flex; flex-direction: column; gap: 8px; }
.pw-mini-product {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 11px 12px;
  background: var(--panel);
}
.pw-mini-highlight {
  border-color: var(--app);
  box-shadow: 0 0 0 2px var(--app-soft);
}
.pw-mini-badge {
  position: absolute;
  top: -9px;
  left: 12px;
  background: var(--app);
  color: var(--app-fg);
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 8px;
  border-radius: 999px;
}
.pw-mini-name { font-size: 13.5px; font-weight: 700; color: var(--text); }
.pw-mini-trial { font-size: 10.5px; color: var(--app); font-weight: 600; }
.pw-mini-price { font-size: 12.5px; color: var(--text-2); }
.pw-mini-period { font-size: 11px; color: var(--muted); }
.pw-mini-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
}
.pw-mini-radio.on { border-color: var(--app); background: var(--app); box-shadow: inset 0 0 0 3px var(--panel); }
.pw-mini-empty { font-size: 12px; color: var(--muted); text-align: center; padding: 12px; }
.pw-mini-cta {
  background: var(--app);
  color: var(--app-fg);
  border: none;
  border-radius: 14px;
  padding: 13px;
  font-size: 14px;
  font-weight: 800;
  font-family: var(--font-head);
  text-align: center;
  width: 100%;
  margin-top: 2px;
}
.pw-mini-promo {
  font-size: 11.5px;
  text-align: center;
  color: var(--text-2);
  line-height: 1.4;
}
.pw-mini-legal { font-size: 9.5px; text-align: center; color: var(--muted); line-height: 1.35; }

/* ───────────── Paywall v2: publish state + compliance + offers ───────────── */

/* Live / Unsaved state chip in the paywall toolbar. */
.pw-live-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.pw-live-ok {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(46, 158, 79, 0.28);
}
.pw-live-dirty {
  color: var(--warn-strong);
  background: var(--warn-soft);
  border-color: rgba(255, 201, 71, 0.45);
}

/* The big Publish button gets a touch more presence than a normal primary. */
#paywall-publish { font-weight: 700; padding: 9px 18px; }

/* Quick-edit section reads as the "do this first" card. */
.pw-quick { background: var(--app-soft); border-color: var(--app); }
.pw-quick .pw-section-head h3 { color: var(--app-fg); }

/* Compliance / info note — calm, informative, not alarming. */
.pw-compliance-note {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-2);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
}
.pw-compliance-ico { flex-shrink: 0; font-size: 13px; line-height: 1.4; }
.pw-asc-note { background: var(--app-soft); border-color: var(--app); }

/* Per-product "price bound to StoreKit product" line. */
.pw-product-bind {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-2);
  background: var(--panel);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  margin-bottom: 12px;
}
.pw-product-bind code {
  font-size: 10.5px;
  background: var(--panel-3);
  padding: 1px 5px;
  border-radius: 4px;
  word-break: break-all;
}

/* Offer codes editor */
.pw-offer-list { margin-bottom: 10px; }
.pw-offer-empty {
  font-size: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.pw-offer-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--panel-2);
}
.pw-offer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1.4fr auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}
.pw-offer-row label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 0;
}
.pw-offer-row label input,
.pw-offer-row label select { display: block; width: 100%; margin-top: 4px; font-weight: 400; }
.pw-offer-active { align-self: center; white-space: nowrap; }
.pw-offer-del { align-self: center; }
@media (max-width: 620px) {
  .pw-offer-grid { grid-template-columns: 1fr; }
}

/* ───────────── Paywall v2: faithful in-app preview (pwm-*) ───────────── */
/* These mirror the iOS PaywallView (iPhone layout) inside the phone mock. */
.pwm-scroll { display: flex; flex-direction: column; gap: 12px; }

/* Hero — illustration inside a blurred lime halo + heavy headline + body
   subtitle. iOS: AppSpacing.md (16pt) gap between illu group and copy, and
   AppSpacing.xs (4pt) between headline and subline. The phone mock is ~288pt
   wide vs. the real 390pt iPhone, so sizes are scaled ~0.74x: hero headline
   BrandFont.heavy(36) → ~27px, body(16) → ~12px, illu 157pt → ~116px. */
.pwm-hero { display: flex; flex-direction: column; align-items: center; gap: 11px; padding-top: 2px; }
/* iOS wraps the illustration in a ZStack with a blurred accent.opacity(0.15)
   circle (150pt) behind it. The halo is absolutely centred under the art. */
.pwm-hero-illu-wrap {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 132px; height: 118px;
}
.pwm-hero-halo {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 112px; height: 112px;
  border-radius: 50%;
  background: var(--app);
  opacity: 0.15;
  filter: blur(14px);
}
/* Real app illustration, template-tinted to the text colour via mask —
   reproduces iOS Illustration(tint: textPrimary). The SVG's opacity layers
   carry through the mask alpha, so the line-art shading matches the app. */
.pwm-hero-illu {
  position: relative;
  z-index: 1;
  width: 116px; height: 116px;
  background-color: var(--text);
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.pwm-hero-headline {
  font-family: var(--font-head);
  font-size: 27px;
  font-weight: 800;
  text-align: center;
  line-height: 1.08;
  letter-spacing: -0.3px;
  color: var(--text);
}
.pwm-hero-sub {
  font-size: 12px;
  text-align: center;
  color: var(--text-2);
  line-height: 1.4;
  padding: 0 6px;
}

/* Comparison card — mirrors freeVsPremiumCard: AppRadius.md (12px) corners,
   1px cardBorder, AppColors.cardBackground. The header is a full-width title
   line + a sub-header row whose Free/Premium labels live in the same two
   fixed-width value columns as the rows below. Dividers at iOS opacity 0.3. */
.pwm-compare {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel);
}
.pwm-compare-title {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  padding: 11px 12px 6px;
}
.pwm-compare-head,
.pwm-compare-row {
  display: grid;
  /* Two fixed value columns (matching iOS's .frame(width: 100)) so the
     descriptive figures ("3 / Niveau", "+23 / Lektion") fit without
     clipping and the Free/Premium columns line up across every row. */
  grid-template-columns: minmax(0, 1fr) 78px 84px;
  align-items: center;
  padding: 10px 12px;
  font-size: 11px;
}
.pwm-compare-head {
  border-top: none;
  padding-top: 0;
  padding-bottom: 8px;
  text-align: center;
}
.pwm-compare-head span { font-weight: 600; }
.pwm-compare-head span:nth-child(2) {
  /* "Free" column — iOS textTertiary, 11pt semibold */
  color: var(--muted);
}
.pwm-compare-head .pwm-prem-col {
  /* "Premium" column — iOS accent (lime), 11pt bold */
  color: var(--app);
  font-weight: 800;
}
.pwm-compare-head .pwm-feat,
.pwm-compare-row .pwm-feat { text-align: left; }
.pwm-compare-row {
  border-top: 1px solid rgba(227, 226, 223, 0.55);
  text-align: center;
}
.pwm-compare-row .pwm-feat { color: var(--text); font-size: 12.5px; }
/* Value cells — drawn as iOS icon circles: a lime checkmark.circle (yes) and
   a faint xmark.circle (no, tertiary @ ~55%). */
.pwm-cell {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; margin: 0 auto;
  border-radius: 50%;
  font-size: 11px; font-weight: 700; line-height: 1;
}
.pwm-yes { color: var(--app-fg); background: var(--app); }
.pwm-no { color: var(--muted); border: 1.2px solid var(--border-strong); opacity: 0.6; font-weight: 600; font-size: 9px; }
/* Descriptive value cells ("3 / Niveau", "+107") — mirror iOS comparisonCell's
   text branch: centered, up to 2 lines, muted on Free / bold dark on Premium. */
.pwm-val {
  display: inline-flex; align-items: center; justify-content: center;
  width: auto; height: auto; margin: 0; border-radius: 0; background: none;
  text-align: center; line-height: 1.2; font-size: 11px; font-weight: 500;
  color: var(--muted);
  hyphens: auto; overflow-wrap: anywhere;
}
.pwm-val-prem { color: var(--text); font-weight: 700; }
/* Infinity cell — bare ∞ glyph (no circle), lime in the Premium column and
   muted in Free, matching iOS comparisonCell's "infinity" branch. */
.pwm-val-inf { font-size: 15px; font-weight: 800; line-height: 1; }
.pwm-val-inf.pwm-val-prem { color: var(--app-strong); }

/* Plan rows — mirror planSelection: AppRadius.md (12px) corners, AppSpacing.md
   (16pt) gap between rows, AppSpacing.md inner padding. Selected = 2px accent
   border + accent.opacity(0.06) wash + filled checkmark radio; unselected =
   1px cardBorder + hollow circle. Radio is top-aligned (HStack .top). */
.pwm-plans { display: flex; flex-direction: column; gap: 11px; }
.pwm-plan {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px;
  background: var(--panel);
}
.pwm-plan-sel {
  border-color: var(--app);
  border-width: 2px;
  padding: 12px;
  background: var(--app-soft);
}
.pwm-plan-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pwm-plan-top { display: flex; align-items: center; gap: 6px; }
.pwm-plan-name { font-size: 15px; font-weight: 600; color: var(--text); }
.pwm-plan-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.2px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--app);
  color: var(--app-fg);
}
/* Savings / discount badges read red (matches the iOS discountRed). */
.pwm-badge-save { background: var(--danger); color: #fff; }
/* Gift / no-subscription tagline — iOS 11pt semibold textPrimary with a
   leading gift (or infinity) symbol. */
.pwm-plan-gift {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; color: var(--text);
}
.pwm-gift-ico { font-size: 11px; line-height: 1; color: var(--text); }
.pwm-plan-price { display: flex; align-items: baseline; gap: 4px; margin-top: 1px; }
.pwm-plan-amount {
  /* iOS uses BrandFont.regular(24) — a thin, tracked, tabular price. */
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.3px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.pwm-plan-period { font-size: 11px; color: var(--text-2); }
.pwm-plan-radio {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
  margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
  color: transparent;
}
.pwm-plan-radio.on { border-color: var(--app); background: var(--app); color: var(--app-fg); }
.pwm-empty { font-size: 12px; color: var(--muted); text-align: center; padding: 14px; }

/* Primary CTA — mirrors primaryCTA: accent capsule, accentForeground text,
   17pt semibold main label (scaled to ~15px for the mock), 11pt @0.85 subline.
   The iPhone CTA has no shadow (only the Mac layout adds one), so none here.
   iOS groups CTA + coffee with AppSpacing.sm (8pt). */
.pwm-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  background: var(--app);
  color: var(--app-fg);
  border: none;
  border-radius: 999px;
  padding: 13px;
  width: 100%;
  margin-top: 2px;
  cursor: default;
}
.pwm-cta-main { font-family: var(--font-head); font-size: 15px; font-weight: 600; }
.pwm-cta-sub { font-size: 10px; font-weight: 500; opacity: 0.85; }

/* Coffee line — iOS pairs a coffee glyph with a textSecondary caption. */
.pwm-coffee, .pwm-promo {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 11px;
  text-align: center;
  color: var(--text-2);
  line-height: 1.4;
}
.pwm-coffee-ico { font-size: 17px; line-height: 1; }
.pwm-offer {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 11px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  padding: 8px;
}
.pwm-offer-ico { font-size: 13px; }
/* Trust chips — iOS three chips (lock.shield / counterclockwise / applelogo)
   in textSecondary, 11pt medium, evenly spaced. */
.pwm-trust {
  display: flex; justify-content: center; gap: 14px;
  font-size: 10.5px; color: var(--text-2);
  margin-top: 2px;
}
.pwm-trust-chip { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-weight: 500; }
/* Restore — iOS textTertiary caption, NOT underlined. */
.pwm-restore { font-size: 11px; text-align: center; color: var(--muted); }
.pwm-legal { font-size: 9px; text-align: center; color: var(--muted); line-height: 1.45; }
.pwm-legal-links { font-size: 9.5px; text-align: center; color: var(--text-2); }

/* The faithful preview is taller than the old mock — let the phone screen
   grow and scroll inside the frame so the whole layout is visible. */
#pw-live-preview { min-height: 520px; max-height: 660px; overflow-y: auto; }

/* ───────────── Customer Center ───────────── */
.cust-row { cursor: pointer; }
.cust-row-id { font-size: 12.5px; }
.cust-row-sub { font-size: 10.5px; margin-top: 2px; }

/* Status pills — reuse the brand palette. */
.cust-status-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--text-2);
  white-space: nowrap;
}
.cust-pill-ok     { background: var(--success-soft); color: var(--success); }
.cust-pill-warn   { background: var(--warn-soft); color: var(--warn-strong); }
.cust-pill-app    { background: var(--app-soft); color: var(--app-fg); }
.cust-pill-danger { background: var(--danger-soft); color: var(--danger); }
.cust-pill-muted  { background: var(--panel-3); color: var(--muted); }

/* Detail header */
.cust-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 4px;
}
.cust-detail-id {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  word-break: break-all;
}
.cust-detail-sub { font-size: 11.5px; margin-top: 2px; word-break: break-all; }
.cust-detail-head .cust-status-pill { font-size: 12px; padding: 4px 11px; flex-shrink: 0; }

/* Two-column detail body */
.cust-detail-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  margin-top: 8px;
}
@media (max-width: 900px) {
  .cust-detail-cols { grid-template-columns: 1fr; }
}

/* Entitlement / comp cards */
.cust-cards { display: flex; flex-direction: column; gap: 10px; }
.cust-empty {
  font-size: 12.5px;
  padding: 12px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.cust-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 15px;
  background: var(--panel);
}
.cust-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}
.cust-card-title { font-size: 14px; font-weight: 700; color: var(--text); }
.cust-card-meta { font-size: 11.5px; line-height: 1.5; }
.cust-card-reason {
  font-size: 12px;
  color: var(--text);
  margin-top: 6px;
  font-style: italic;
}
.cust-card-id { font-size: 11px; margin-top: 6px; word-break: break-all; }
.cust-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cust-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--app-soft);
  color: var(--app-fg);
}
.cust-tag-off { background: var(--panel-3); color: var(--muted); }
.cust-tag-app { background: var(--app-soft); }

/* Timeline */
.cust-timeline {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.cust-tl-item {
  display: flex;
  gap: 11px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}
.cust-tl-item:last-child { border-bottom: none; }
.cust-tl-ico {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--panel-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.cust-tl-body { flex: 1; min-width: 0; }
.cust-tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cust-tl-label { font-size: 13px; font-weight: 600; color: var(--text); }
.cust-tl-amount { font-size: 12px; font-weight: 700; color: var(--success); margin-left: auto; }
.cust-tl-sub { font-size: 11.5px; margin-top: 2px; }
.cust-tl-time { font-size: 10.5px; margin-top: 2px; }
/* Subtle left tint per kind. */
.cust-tl-refund .cust-tl-ico, .cust-tl-cancel .cust-tl-ico { background: var(--danger-soft); }
.cust-tl-comp-grant .cust-tl-ico { background: var(--app-soft); }
.cust-tl-purchase .cust-tl-ico, .cust-tl-renew .cust-tl-ico { background: var(--success-soft); }

/* Honest note shown when a search can't be backed by stored data (e.g. email). */
.cust-honest-note {
  margin: 8px 0 0;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn-strong, var(--warn));
  border-radius: 8px;
  background: var(--warn-soft);
  color: var(--warn-strong, var(--text));
  font-size: 12px;
  line-height: 1.5;
}

/* ───────────── Account details (facts grid) ───────────── */
.cust-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 4px;
}
.cust-fact {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
  padding: 9px 11px;
}
.cust-fact-label {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.cust-fact-body {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}
.cust-fact-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
  flex: 1;
  min-width: 0;
}
.cust-fact-value.cust-fact-empty { color: var(--muted); font-weight: 500; font-style: italic; }
.cust-fact-value.cust-fact-danger { color: var(--danger); }
.cust-fact-copy {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--panel-3);
  color: var(--muted);
  border-radius: 6px;
  width: 24px;
  height: 24px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.cust-fact-copy:hover { color: var(--text); border-color: var(--border-strong); }
.cust-fact-note {
  font-size: 10.5px;
  line-height: 1.45;
  margin-top: 4px;
}

/* Grant modal target line */
.grant-target { margin: -6px 0 14px; word-break: break-all; }

/* ───────────── Banner photo upload (dropzone) ───────────── */
.banner-dropzone {
  position: relative;
  margin-top: 4px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.banner-dropzone:hover,
.banner-dropzone:focus-visible { border-color: var(--app); background: var(--app-soft); outline: none; }
.banner-dropzone.dragover { border-color: var(--app); background: var(--app-soft); }
.banner-dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}
.banner-dropzone-icon { font-size: 24px; color: var(--text-2); }
.banner-dropzone-text { font-size: 13px; color: var(--text); font-weight: 500; }
.banner-dropzone-link { color: var(--app-strong, var(--text)); text-decoration: underline; }
.banner-dropzone .small-hint { margin-top: 2px; }
.banner-thumb {
  max-width: 100%;
  max-height: 160px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  display: block;
}
.banner-dropzone.has-image .banner-dropzone-inner {
  position: absolute;
  inset: auto 0 6px 0;
  background: rgba(0,0,0,0.55);
  color: #fff;
  padding: 4px;
  border-radius: 0 0 var(--radius) var(--radius);
}
.banner-dropzone.has-image .banner-dropzone-icon,
.banner-dropzone.has-image .small-hint { display: none; }
.banner-dropzone.has-image .banner-dropzone-text { color: #fff; font-size: 11px; }

/* Variant hero image: Replace/Remove actions under the dropzone. */
.expv-hero-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ───────────── Owner-friendly UX kit ───────────── */

/* Toasts — non-blocking, bottom-right, on-brand. */
#toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  max-width: 380px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--text-2);
}
.toast-ok { border-color: var(--success); }
.toast-ok .toast-icon { background: var(--success); }
.toast-error { border-color: var(--danger); }
.toast-error .toast-icon { background: var(--danger); }
.toast-app { border-color: var(--app); }
.toast-app .toast-icon { background: var(--app); color: var(--app-fg); }
.toast-info .toast-icon { background: var(--text-2); }

/* Styled confirm modal */
.confirm-card { max-width: 440px; }
.confirm-title { margin-bottom: 10px; font-size: 18px; font-weight: 800; }
.confirm-body { color: var(--text-2); font-size: 14px; line-height: 1.55; }
.confirm-body strong { color: var(--text); font-weight: 700; }

/* Loading skeleton */
.loading-skeleton {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px;
}
.skel-row {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.skel-block {
  height: 16px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--panel-3) 25%, var(--panel-2) 37%, var(--panel-3) 63%);
  background-size: 400% 100%;
  animation: skel-shimmer 1.25s ease-in-out infinite;
}
.skel-row:nth-child(2n) .skel-block { width: 78%; }
.skel-row:nth-child(3n) .skel-block { width: 64%; }
@keyframes skel-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* Tooltip helper — a small (?) badge that explains jargon on hover. */
.help-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: 5px;
  border-radius: 50%;
  background: var(--panel-3);
  color: var(--text-2);
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  vertical-align: middle;
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: normal;
}
.help-tip:hover { background: var(--app-soft); color: var(--text); }

/* ───────────────── Scheduled notifications + A/B experiments ─────────────────
   New "Scheduled" and "A/B Tests" tabs. Cards reuse the existing panel /
   border / radius tokens so they sit naturally next to the other tabs. */

/* Shared editor wrapper for both new tabs. */
.sched-editor, .exp-editor {
  margin: 14px 0 20px;
}

/* ── Scheduled list ── */
.sched-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.sched-empty, .exp-empty { padding: 22px; text-align: center; }
.sched-card {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.sched-card-main { flex: 1; min-width: 0; }
.sched-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.sched-card-title { font-size: 15px; }
.sched-card-body { font-size: 13px; margin-bottom: 6px; white-space: pre-wrap; }
.sched-card-meta { font-size: 12px; }
.sched-card-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.sched-row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.sched-active { margin-bottom: 6px; }

.sched-pill, .exp-pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
}
.sched-pill-up   { background: var(--success-soft); color: var(--success); }
.sched-pill-past { background: var(--app-soft); color: var(--muted); }
.sched-pill-off  { background: var(--danger-soft); color: var(--danger); }

/* ════════════════ A/B Tests (visual experiments) ════════════════ */
/* Square, clean cards like the polished Ads table: 1px neutral border, lime
   accent only on bars/badges/CTAs, generous whitespace. */

/* ── Split-bar segment palette (lime + neutral greys, up to 5 variants) ── */
.exp-seg-c0 { --seg: var(--app);            --seg-fg: var(--app-fg); }
.exp-seg-c1 { --seg: #8fb83f;               --seg-fg: #14240a; }
.exp-seg-c2 { --seg: var(--border-strong);  --seg-fg: var(--text); }
.exp-seg-c3 { --seg: #c9c8c3;               --seg-fg: var(--text); }
.exp-seg-c4 { --seg: #e3e2df;               --seg-fg: var(--text-2); }

/* ── Tests list ── */
.exp-list { display: flex; flex-direction: column; gap: 12px; margin: 12px 0 18px; }
.exp-card {
  padding: 16px 18px; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.exp-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.exp-card-title { font-size: 15px; font-weight: 700; }
.exp-card-count { font-size: 12px; margin-left: auto; }
.exp-pill {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
}
.exp-pill-run   { background: var(--success-soft); color: var(--success); }
.exp-pill-stop  { background: var(--panel-2); color: var(--muted); }
.exp-pill-draft { background: var(--warn-soft); color: var(--warn-strong); }

/* The split bar (shared by list cards + the editor). */
.exp-split { display: flex; gap: 4px; height: 34px; margin-bottom: 14px; }
.exp-split-seg {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--seg, var(--app-soft)); border-radius: var(--radius-sm);
  min-width: 0; overflow: hidden; line-height: 1; padding: 0 6px;
}
.exp-split-key {
  font-size: 11px; font-weight: 800; color: var(--seg-fg, var(--app-fg));
}
.exp-split-pct {
  font-size: 11px; font-weight: 600; color: var(--seg-fg, var(--text));
  font-variant-numeric: tabular-nums; opacity: 0.82;
}

.exp-card-actions { display: flex; gap: 8px; align-items: center; }

/* ── Mini variant previews (real paywall mock, small) ── */
.exp-minis { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 14px; }
.exp-mini {
  width: 150px; display: flex; flex-direction: column; gap: 8px;
  padding: 10px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.exp-mini-head { display: flex; align-items: center; gap: 6px; }
.exp-mini-badge, .exp-variant-badge, .exp-split-slider-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 6px; flex-shrink: 0;
  font-size: 11px; font-weight: 800;
  background: var(--seg, var(--app)); color: var(--seg-fg, var(--app-fg));
}
.exp-mini-name {
  font-size: 12px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.exp-mini-pct {
  margin-left: auto; font-size: 11px; font-weight: 700; color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.exp-mini-metric {
  display: flex; align-items: baseline; gap: 5px; font-size: 12px;
}
.exp-mini-metric strong { font-size: 14px; color: var(--app-fg); }
.exp-winner { width: 100%; font-size: 12px; padding: 6px 8px; }

/* ── A tiny, non-interactive paywall mock used inside variant cards ── */
.phone-screen-mini {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 10px 8px; height: 240px; overflow: hidden;
  display: flex; flex-direction: column; gap: 6px;
  /* Shrink the full pwm-* mock to a thumbnail; pointer-events off so the
     mini is a pure preview, not interactive. */
  pointer-events: none; position: relative;
}
.phone-screen-mini .pwm-scroll {
  transform: scale(0.62); transform-origin: top center; width: 161%;
  margin-left: -30.5%; gap: 8px;
}

/* ── Editor card ── */
.exp-editor { margin: 14px 0 20px; }
.exp-editor-card {
  padding: 18px 20px; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.exp-editor-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.exp-editor-head h3 { margin: 0; font-size: 16px; }
.exp-editor-head .small-hint { margin-left: auto; }
.exp-name-field { display: block; margin-bottom: 18px; }

/* ── Traffic split block (bar + sliders) ── */
.exp-split-block {
  padding: 14px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 18px;
}
.exp-split-block-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.exp-split-block-title { font-size: 13px; font-weight: 700; color: var(--text); }
.exp-split-even { font-size: 12px; padding: 5px 11px; }
.exp-split-bar-edit { margin-bottom: 12px; }
.exp-split-sliders { display: flex; flex-direction: column; gap: 8px; }
.exp-split-slider-row { display: flex; align-items: center; gap: 10px; }
.exp-split-slider-name {
  font-size: 12.5px; color: var(--text); min-width: 90px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.exp-split-slider { flex: 1; accent-color: var(--app-strong); cursor: pointer; }
.exp-split-slider-pct {
  font-size: 12.5px; font-weight: 700; color: var(--app-fg);
  font-variant-numeric: tabular-nums; min-width: 38px; text-align: right;
}

/* ── Variant cards (draggable) ── */
.exp-variants-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.exp-variants-title { font-size: 13px; font-weight: 700; color: var(--text); }
.exp-variants { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 16px; }
.exp-variant {
  width: 190px; display: flex; flex-direction: column; gap: 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; background: var(--panel-2);
  transition: box-shadow .12s ease, border-color .12s ease, opacity .12s ease;
}
.exp-variant.dragging { opacity: 0.45; }
.exp-variant.drag-over { border-color: var(--app-strong); box-shadow: 0 0 0 2px var(--app-soft); }
.exp-variant-head { display: flex; align-items: center; gap: 7px; }
.exp-variant-drag { cursor: grab; color: var(--muted); font-size: 15px; line-height: 1; user-select: none; }
.exp-variant-name {
  flex: 1; min-width: 0; font-size: 13px; font-weight: 600;
  padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--panel);
}
.exp-variant-foot { display: flex; flex-direction: column; gap: 8px; }
.exp-variant-summary {
  font-size: 11.5px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.exp-variant-edit { font-size: 12px; padding: 6px 10px; }
.exp-editor-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }

/* ── Variant paywall modal (reuses .modal-backdrop) ── */
.exp-variant-modal-box {
  width: min(920px, 96vw); max-height: 90vh;
  display: flex; flex-direction: column;
  background: var(--panel); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.exp-variant-modal-body {
  display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start;
}
.exp-variant-fields { min-width: 0; }
.exp-variant-preview-col { position: sticky; top: 0; }
.phone-frame-sm { max-width: 270px; }
.phone-frame-sm .phone-screen { min-height: 420px; max-height: 460px; overflow-y: auto; padding: 26px 12px 14px; }
@media (max-width: 760px) {
  .exp-variant-modal-body { grid-template-columns: 1fr; }
  .exp-variant-preview-col { display: none; }
}
.modal-head, .modal-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; flex-shrink: 0;
}
.modal-head { border-bottom: 1px solid var(--border); justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { border-top: 1px solid var(--border); justify-content: flex-end; }

/* ───────────── Circular flags ───────────── */
/* Shared base for every circular flag <img> (app switcher + regional
   picker). Sizes nudged per context via the modifier classes. */
.flag-ico {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  object-fit: cover;
}
.flag-pill { width: 16px; height: 16px; }

/* Accessibly hide the native <select> that backs the custom switcher. */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── App switcher (circular flag dropdown) ── */
.app-switch { position: relative; margin-bottom: 6px; }
.app-switch-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.app-switch-btn:hover { border-color: var(--app-strong); }
.app-switch-btn[aria-expanded="true"] {
  border-color: var(--app-strong);
  box-shadow: 0 0 0 3px var(--app-soft);
}
.app-switch-flag { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; object-fit: cover; }
.app-switch-name { flex: 1; text-align: left; }
.app-switch-caret { color: var(--muted); font-size: 11px; }
.app-switch-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 60;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.16);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.app-switch-opt {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}
.app-switch-opt:hover { background: var(--panel-2); }
.app-switch-opt[aria-selected="true"] { background: var(--app-soft); }
.app-switch-opt .flag-ico { width: 18px; height: 18px; }
/* Each app's REAL icon shown beside its name in the switcher option rows,
   sitting just left of the circular language flag — so the owner can pick
   by app brand, not only by flag. */
.app-switch-opt-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  flex-shrink: 0;
  object-fit: cover;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}

/* ── Regional-variant flag picker (word + override editors) ── */
.flag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 4px;
}
.flag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px 6px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text-2);
  background: var(--panel-2);
  border: 1.5px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.flag-chip:hover { border-color: var(--app-strong); }
.flag-chip.selected {
  color: var(--text);
  background: var(--app-soft);
  border-color: var(--app-strong);
}
.flag-chip-ico { width: 22px; height: 22px; }

.flag-rows { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.flag-row {
  display: flex;
  align-items: center;
  gap: 9px;
}
.flag-row-ico { width: 22px; height: 22px; }
.flag-row-label {
  flex-shrink: 0;
  min-width: 92px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}
.flag-row-input { flex: 1; }
.flag-row-remove { flex-shrink: 0; padding: 4px 9px; }
.flag-row-opt { display: inline-flex; align-items: center; gap: 6px; }
.vocab-field-label { display: block; font-weight: 600; }

/* ───────────── Articles list — sortable column header ───────────── */
/* Sits above #articles-list and mirrors the .article-row grid exactly so
   the labels line up over their columns. The numeric/% columns (Views /
   Votes / % Likes / Date) are clickable to sort the list. */
.articles-header {
  display: grid;
  /* MUST mirror the .article-row template exactly (same 10 fixed columns)
     so each header label sits above its column. */
  grid-template-columns: 60px 48px 1fr 132px 84px 92px 110px 96px 28px 28px;
  align-items: center;
  gap: 14px;
  padding: 8px 16px;
  margin-bottom: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.articles-header .ah-cell { white-space: nowrap; min-width: 0; }
.articles-header .ah-numeric { text-align: right; }
/* Clickable sortable column heads — cursor + hover lift so they read as
   interactive, plus an active-column tint. */
.articles-header .ah-sortable {
  cursor: pointer;
  user-select: none;
  border-radius: 5px;
  padding: 3px 5px;
  margin: -3px -5px;
  transition: background 0.12s ease, color 0.12s ease;
}
.articles-header .ah-sortable:hover { background: var(--panel-3); color: var(--text); }
.articles-header .ah-sortable:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--app-soft);
  color: var(--text);
}
.articles-header .ah-sortable.is-active { color: var(--text); }
.articles-header .ah-arrow { font-size: 10px; }

/* When a column header drives the sort, the dropdown is shown as
   superseded so the two controls never look like they disagree. */
.filter.is-superseded { opacity: 0.55; }

/* ───────────── Analytics table — sortable column headers ───────────── */
.analytics-table thead th.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: background 0.12s ease, color 0.12s ease;
}
.analytics-table thead th.sortable-th:hover {
  background: var(--panel-3);
  color: var(--text);
}
.analytics-table thead th.sortable-th:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--app-soft);
  color: var(--text);
}
.analytics-table thead th.sortable-th.is-active { color: var(--text); }
.analytics-table thead th .th-arrow { font-size: 10px; }

/* ───────────── Ads tab ───────────── */
/* Honest metrics note shown only while every banner still reads 0. */
.ads-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.45;
}
.ads-note em { font-style: italic; color: var(--muted); }
.ads-empty { margin-top: 14px; }

/* ── Modern SaaS table layout ──────────────────────────────────────────
   Comfortable rows, vertically-centered content, hairline dividers, and a
   subtle hover. Scoped to .ads-table-modern so the shared .analytics-table
   base elsewhere is untouched. */
.ads-table-modern { font-size: 13px; }
.ads-table-modern thead th {
  padding: 12px 16px;
  white-space: nowrap;
}
.ads-table-modern tbody td {
  padding: 11px 16px;
  height: 62px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.ads-table-modern tbody tr { transition: background 0.12s ease; }
.ads-table-modern tbody tr:hover { background: var(--panel-2); }
/* Archived rows read muted so the live ones stand out; paused sits between. */
.ads-table-modern tbody tr.is-archived td { opacity: 0.55; }
.ads-table-modern tbody tr.is-paused td { opacity: 0.82; }

/* Column sizing hints so the layout reads predictably on a wide window and
   the Segmentação column absorbs the slack. */
.ads-table-modern .ads-thumb-col { width: 72px; padding-right: 8px; }
.ads-table-modern .ads-name-th   { width: 22%; }
.ads-table-modern .ads-slot-th   { width: 110px; }
.ads-table-modern .ads-status-th { width: 116px; }
.ads-table-modern .ads-seg-th    { width: auto; }
.ads-table-modern th.numeric     { width: 92px; }
.ads-table-modern .ads-actions-col { width: 1%; }

/* ── Thumbnail ── Fixed 56x40 box so square + wide banners render alike.
   Muted dashed placeholder when there's no image / the load fails. */
.ads-thumb {
  display: block;
  width: 56px;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
}
.ads-thumb-empty {
  border: 1px dashed var(--border-strong);
  background: repeating-linear-gradient(
    135deg, var(--panel-2), var(--panel-2) 6px, var(--panel-3) 6px, var(--panel-3) 12px
  );
}

/* ── Name ── Bold primary, ellipsis-truncated; quiet secondary slot line. */
.ads-name-wrap { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ads-name-primary {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}
.ads-name-primary.ads-name-fallback { font-weight: 500; color: var(--muted); }
.ads-name-secondary {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}

/* ── Slot pill ── A single neutral pill with a tiny leading dot. */
.ads-slot-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-2);
  white-space: nowrap;
}
.ads-slot-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border-strong);
  flex: none;
}

/* ── Status pill ── Single line, never wraps, with a leading status dot.
   Color-keyed to the lifecycle. */
.ads-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  border: 1px solid var(--border);
  color: var(--text-2);
  background: var(--panel-2);
}
.ads-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.ads-status-active,
.ads-status-live      { color: #4d7c0f; background: rgba(132, 204, 22, 0.16); border-color: rgba(132, 204, 22, 0.40); }
.ads-status-paused    { color: #b45309; background: rgba(217, 119, 6, 0.13);  border-color: rgba(217, 119, 6, 0.34); }
.ads-status-scheduled { color: var(--info); background: var(--info-soft);  border-color: var(--info-border); }
.ads-status-expired   { color: var(--text-2); background: var(--panel-2); border-color: var(--border); }
.ads-status-expired   .ads-status-dot { background: var(--muted); }
.ads-status-archived  { color: var(--muted); background: var(--panel-2); border-style: dashed; }
.ads-status-archived  .ads-status-dot { background: var(--muted); }

/* ── Segmentação ── ONE uniform chip style. Defaults (no restriction) stay
   muted; an ACTIVE restriction (.is-active) reads in normal text tone with a
   slightly stronger border so the eye lands on what's actually constrained. */
.ads-targeting {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: 440px;
}
.ads-seg-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  white-space: nowrap;
}
.ads-seg-chip .ads-chip-ico { flex: none; opacity: 0.7; }
.ads-seg-chip.is-active {
  color: var(--text);
  font-weight: 600;
  border-color: var(--border-strong);
  background: var(--panel);
}
.ads-seg-chip.is-active .ads-chip-ico { opacity: 0.95; }

/* ── Metrics ── Right-aligned, tabular figures; muted zeros. */
.ads-table-modern td.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.ads-table-modern td.numeric.is-zero { color: var(--muted); }

/* ── Ações ── A tidy, right-aligned icon-button group. Labels show on wide
   windows; collapse to icon-only when narrow. */
.ads-actions-col { text-align: right; white-space: nowrap; }
.ads-actions-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
}
.ads-act-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
}
.ads-act-btn svg { flex: none; }
.ads-act-btn:hover { background: var(--panel-3); color: var(--text); }
.ads-act-btn.is-primary {
  border-color: var(--border-strong);
  color: var(--text);
}
.ads-act-btn.is-primary:hover { background: var(--panel-3); border-color: var(--text-2); }
.ads-act-btn.is-danger { color: var(--danger); }
.ads-act-btn.is-danger:hover { background: var(--danger-soft); color: var(--danger); }
.ads-act-btn.ads-act-more { padding: 6px; color: var(--text-2); }
.ads-act-btn.ads-act-more:hover { background: var(--panel-3); color: var(--text); }
.ads-act-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--app-soft);
}

/* ── Overflow menu ── Holds the less-common Arquivar / Pôr no ar actions. */
.ads-actions-overflow { position: relative; display: inline-flex; }
.ads-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  min-width: 170px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}
.ads-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
}
.ads-menu-item svg { flex: none; color: var(--text-2); }
.ads-menu-item:hover { background: var(--panel-2); }
.ads-menu-item.is-danger { color: var(--danger); }
.ads-menu-item.is-danger svg { color: var(--danger); }
.ads-menu-item.is-danger:hover { background: var(--danger-soft); }

/* Hide action labels (icon-only) when the window can't comfortably fit them,
   so the group never wraps. The overflow menu keeps full text labels. */
@media (max-width: 1180px) {
  .ads-act-btn .ads-act-label { display: none; }
  .ads-act-btn { padding: 6px; }
}

/* Header action cluster — the "+ Criar banner" + Reload buttons on the Ads
   tab header, kept on one row. */
.section-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Banner-tab hint pointing owners to the Ads tab for multi-banner management. */
.banner-ads-hint {
  margin-top: -4px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  font-size: 12.5px;
  line-height: 1.45;
}

/* ─── Campaign editor modal (Ads tab) ─── A persistent .modal-backdrop toggled
   via the hidden attribute, so it must explicitly hide when [hidden]. */
.modal-backdrop[hidden] { display: none; }
.campaign-card {
  max-width: 560px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.campaign-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--border);
}
.campaign-modal-head h3 { margin: 0; }
.campaign-modal-head .icon-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  border-radius: 8px;
}
.campaign-modal-head .icon-btn:hover { background: var(--panel-2); color: var(--text); }
.campaign-modal-body {
  padding: 16px 24px 8px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.campaign-modal-body label { display: block; margin-bottom: 14px; }
.campaign-modal-actions {
  padding: 14px 24px 18px;
  border-top: 1px solid var(--border);
  margin-top: 0;
}
/* Two-up start/end date row inside the modal. */
.camp-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.camp-row-2 label { margin-bottom: 14px; }
@media (max-width: 520px) {
  .camp-row-2 { grid-template-columns: 1fr; gap: 0; }
}

/* ───────────── Articles publish-date day filter ───────────── */
/* From/to date pickers in the Articles toolbar, grouped under one label
   ("Publicado em / Posted"). Matches the .filter chip styling. */
.articles-date-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.articles-date-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  white-space: nowrap;
}
.articles-date-input {
  padding: 7px 10px;
  width: auto;
  font-size: 12.5px;
}
.articles-date-sep { color: var(--muted); font-weight: 600; }
.articles-date-clear {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 13px;
  color: var(--muted);
  border-color: transparent;
}
.articles-date-clear:hover { color: var(--text); background: var(--panel-3); }

/* ───────────── Save-button confirmation states ───────────── */
/* After a banner SAVE persists, the button flashes a green "Activated ✓"
   success state for a few seconds before reverting; a failed save flashes
   a red error state. Reuses the brand success/danger tokens. */
button.btn-success,
button.primary.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
button.btn-success:hover,
button.primary.btn-success:hover {
  background: var(--success);
  filter: brightness(0.96);
}
button.btn-error,
button.primary.btn-error {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
button.btn-error:hover,
button.primary.btn-error:hover {
  background: var(--danger);
  filter: brightness(0.96);
}

/* ───────────────────────── App Store Reviews ───────────────────────── */
.reviews-list { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.review-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--panel);
}
.review-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 7px;
}
.review-title { font-size: 14px; font-weight: 700; color: var(--text); }
.review-meta { font-size: 11.5px; }
.review-stars { color: #f5a623; font-size: 14px; letter-spacing: 1px; white-space: nowrap; }
.review-stars-empty { color: var(--border-strong); }
.review-body {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
/* Existing developer response */
.review-response {
  margin-top: 11px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.review-response-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-strong);
  margin-bottom: 4px;
}
.review-response-body {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.review-response-actions { display: flex; gap: 8px; margin-top: 9px; }
.review-response-actions button { font-size: 12px; padding: 5px 11px; }
/* Reply composer */
.review-reply { margin-top: 11px; }
.review-reply-text {
  width: 100%;
  resize: vertical;
  font: inherit;
  font-size: 13px;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
  box-sizing: border-box;
}
.review-reply-text:focus {
  outline: none;
  border-color: var(--accent);
}
.review-reply-actions { display: flex; gap: 8px; margin-top: 8px; }

/* Reviews: sentiment analytics + filters + suggestions ─────────────── */
/* The KPI row reuses the Analytics .analytics-summary grid + plain .kpi cards
   verbatim — sentiment is conveyed soberly via the .kpi-delta good/bad/flat
   text colour (same pattern as the Analytics deltas), never a coloured box. */
.reviews-toolbar { margin-bottom: 14px; }
.reviews-intro { line-height: 1.5; margin-bottom: 14px; }

/* Sentiment tag on each review card — sober: muted uppercase label, no fill,
   just a subtle semantic text tint to keep it scannable. */
.review-sentiment {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  color: var(--muted);
}
.review-sentiment-positive { color: var(--success); }
.review-sentiment-neutral  { color: var(--muted); }
.review-sentiment-negative { color: var(--danger); }

/* Suggested-reply chips above the reply textarea. */
.review-suggs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 9px; }
.review-sugg {
  appearance: none;
  text-align: left;
  max-width: 100%;
  font: inherit;
  font-size: 12px;
  line-height: 1.35;
  padding: 6px 11px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.review-sugg:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  border-style: solid;
  color: var(--text);
}

.reviews-empty {
  padding: 28px 20px;
  line-height: 1.55;
  color: var(--muted);
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}

/* ═════════════════════════════════════════════════════════════════════
   LIQUID GLASS — mobile design elevation (built ON TOP of the existing
   off-canvas shell). Everything here is scoped to the phone / drawer
   breakpoints so the desktop grid (>900px) is byte-for-byte untouched.

   The treatment matches the iOS 26 "liquid glass" feel the apps use:
     • backdrop-filter: blur(...) saturate(...)  → the frost
     • a translucent, brand-TINTED fill (uses --app via color-mix)
     • a bright hairline border (top edge a touch brighter = the "lip")
     • a soft, deep shadow so the surface visibly floats

   Tokens below carry the look; a @supports fallback near the bottom swaps
   in a SOLID translucent fill for browsers without backdrop-filter so the
   chrome never goes see-through-and-unreadable.
   ═════════════════════════════════════════════════════════════════════ */

:root {
  /* Glass blur/saturate — one knob each so the whole system stays in sync. */
  --glass-blur: 18px;
  --glass-sat: 170%;

  /* Translucent brand-tinted fills. Light theme: the warm page bg whitened
     and made see-through, with a whisper of the active accent so the glass
     reads as "ours", not a generic grey panel. */
  --glass-fill: color-mix(in srgb, var(--panel) 72%, transparent);
  --glass-fill-strong: color-mix(in srgb, var(--panel) 84%, transparent);
  --glass-tint: color-mix(in srgb, var(--app) 9%, var(--glass-fill));
  /* Bright top "lip" + softer base hairline → the lit-edge look. */
  --glass-border: color-mix(in srgb, #ffffff 50%, var(--border));
  --glass-lip: color-mix(in srgb, #ffffff 70%, transparent);
  --glass-shadow: 0 8px 30px rgba(20, 18, 14, 0.16), 0 2px 8px rgba(20, 18, 14, 0.08);
  /* Scrim behind the drawer — warm ink, lightly frosted. */
  --glass-scrim: rgba(20, 18, 14, 0.40);

  /* Active-press wash for touch rows/buttons (subtle accent flash). */
  --glass-press: color-mix(in srgb, var(--app) 14%, transparent);

  /* Phone spacing scale — one rhythm for the small screen so gutters,
     row padding and section gaps line up. */
  --m-gutter: 16px;
  --m-gap: 10px;
}
:root[data-theme="dark"] {
  /* Dark glass: a touch MORE opaque (dark frost needs body to stay legible),
     bright lip dimmed, scrim deeper. */
  --glass-fill: color-mix(in srgb, var(--panel) 78%, transparent);
  --glass-fill-strong: color-mix(in srgb, var(--panel) 88%, transparent);
  --glass-tint: color-mix(in srgb, var(--app) 12%, var(--glass-fill));
  --glass-border: color-mix(in srgb, #ffffff 16%, var(--border));
  --glass-lip: color-mix(in srgb, #ffffff 14%, transparent);
  --glass-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), 0 3px 12px rgba(0, 0, 0, 0.40);
  --glass-scrim: rgba(0, 0, 0, 0.58);
  --glass-press: color-mix(in srgb, var(--app) 22%, transparent);
}

/* ─────────────────────────────────────────────────────────────────────
   Drawer-mode glass (≤900px) — top bar, off-canvas drawer + scrim.
   ───────────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  /* ── Sticky top bar → liquid glass slab ── */
  .mobile-topbar {
    background: var(--glass-tint);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
    border-bottom: 1px solid var(--glass-border);
    /* The bright top lip — a 1px inset highlight reads as light catching
       the glass edge. Paired with a faint downward shadow so the bar lifts
       off the content scrolling under it. */
    box-shadow: inset 0 1px 0 var(--glass-lip), 0 4px 18px rgba(20, 18, 14, 0.07);
  }
  :root[data-theme="dark"] .mobile-topbar {
    box-shadow: inset 0 1px 0 var(--glass-lip), 0 6px 22px rgba(0, 0, 0, 0.45);
  }

  /* The hamburger reads as a small glass chip too, with a crisp press state. */
  .mobile-nav-toggle {
    background: color-mix(in srgb, var(--panel) 60%, transparent);
    -webkit-backdrop-filter: blur(8px) saturate(150%);
    backdrop-filter: blur(8px) saturate(150%);
    border-color: var(--glass-border);
    transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
  }
  .mobile-nav-toggle:hover { background: color-mix(in srgb, var(--panel) 80%, transparent); }
  .mobile-nav-toggle:active {
    transform: scale(0.94);
    background: var(--glass-press);
    box-shadow: inset 0 0 0 1px var(--app-soft);
  }
  /* Hamburger morph: when the drawer is open, give it the accent so it
     reads as "active / tap to close". (body.nav-open is already toggled.) */
  body.nav-open .mobile-nav-toggle {
    color: var(--app);
    border-color: color-mix(in srgb, var(--app) 45%, var(--glass-border));
    background: var(--app-soft);
  }

  /* ── Off-canvas drawer → frosted glass panel ── */
  .sidebar {
    background: var(--glass-tint);
    -webkit-backdrop-filter: blur(calc(var(--glass-blur) + 6px)) saturate(var(--glass-sat));
    backdrop-filter: blur(calc(var(--glass-blur) + 6px)) saturate(var(--glass-sat));
    /* Right edge hairline + the bright inner lip + a deep lift shadow. */
    border-right: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow), inset -1px 0 0 var(--glass-lip);
  }
  /* Slightly snappier, more "physical" drawer easing. */
  .sidebar { transition: transform 0.30s cubic-bezier(0.32, 0.72, 0, 1); }

  /* ── Scrim → warmer frost + gentle fade ── */
  #nav-scrim {
    background: var(--glass-scrim);
    -webkit-backdrop-filter: blur(3px) saturate(108%);
    backdrop-filter: blur(3px) saturate(108%);
    transition: opacity 0.30s ease;
  }

  /* Nav rows inside the glass drawer: clearer hierarchy + a touch ripple.
     Selected row gets the accent wash + a left accent bar (native sidebar
     feel) instead of relying on a flat tint alone. */
  .sidebar .nav-item {
    position: relative;
    border-radius: var(--radius-sm);
    transition: background 0.14s ease, color 0.14s ease, transform 0.1s ease;
  }
  .sidebar .nav-item:active { transform: scale(0.985); background: var(--glass-press); }
  .sidebar .nav-item.active::before {
    content: "";
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 56%;
    border-radius: 0 3px 3px 0;
    background: var(--app);
  }
}

/* ─────────────────────────────────────────────────────────────────────
   Phone glass (≤640px) — bottom-sheet modals, ads sheet, help popover,
   card surfaces, toasts + design polish (spacing, rows, states).
   ───────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* ── Bottom-sheet modals → liquid glass sheet ──
     Targets the same trio the existing sheet rule docks (standard modal,
     vocab editor, campaign editor). Keeps the existing sheetUp animation;
     adds the frost, the grab-handle, the bright lip and a deeper lift. */
  .modal-backdrop {
    background: var(--glass-scrim);
    -webkit-backdrop-filter: blur(6px) saturate(115%);
    backdrop-filter: blur(6px) saturate(115%);
  }
  .modal-backdrop > .modal-card,
  .modal-backdrop > .vocab-modal-card,
  .modal-backdrop > .campaign-card {
    background: var(--glass-tint);
    -webkit-backdrop-filter: blur(calc(var(--glass-blur) + 4px)) saturate(var(--glass-sat));
    backdrop-filter: blur(calc(var(--glass-blur) + 4px)) saturate(var(--glass-sat));
    border: 1px solid var(--glass-border);
    border-bottom: none;
    box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-lip);
    /* Extra top padding makes room for the grab handle drawn below. */
    position: relative;
  }
  .modal-backdrop > .modal-card,
  .modal-backdrop > .vocab-modal-card {
    padding-top: 26px;
  }
  /* iOS-style grab handle centered on the sheet lip. */
  .modal-backdrop > .modal-card::before,
  .modal-backdrop > .vocab-modal-card::before,
  .modal-backdrop > .campaign-card::before {
    content: "";
    position: absolute;
    top: 8px; left: 50%;
    transform: translateX(-50%);
    width: 40px; height: 5px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--text) 22%, transparent);
    pointer-events: none;
    z-index: 1;
  }

  /* ── Ads overflow sheet → matching glass ── */
  .ads-menu {
    background: var(--glass-tint);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
    border: 1px solid var(--glass-border);
    border-bottom: none;
    box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-lip);
  }
  .ads-menu-item {
    border-radius: var(--radius-sm);
    transition: background 0.14s ease, transform 0.1s ease;
  }
  .ads-menu-item:active { background: var(--glass-press); transform: scale(0.985); }

  /* ── Help popover → small glass tile ── */
  .help-popover {
    background: var(--glass-fill-strong);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
    backdrop-filter: blur(14px) saturate(150%);
    border-color: var(--glass-border);
    box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-lip);
  }

  /* ── Toasts → glass pills floating above the home bar ── */
  .toast {
    background: var(--glass-fill-strong);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    backdrop-filter: blur(16px) saturate(160%);
    border-color: var(--glass-border);
    box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-lip);
  }

  /* ── Phone card surfaces (the .cm-card lists that replace wide tables) ──
     Lift them to a subtle glass tile with a clearer head, a press state and
     a touch-ripple via :active. */
  .cm-card {
    background: var(--glass-fill);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    backdrop-filter: blur(10px) saturate(140%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: inset 0 1px 0 var(--glass-lip), var(--shadow-sm);
    transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  }
  .cm-card[role="button"]:active {
    transform: scale(0.99);
    border-color: color-mix(in srgb, var(--app) 38%, var(--glass-border));
    box-shadow: inset 0 0 0 1px var(--app-soft), var(--shadow-md);
  }
  /* Tighten the key/value rhythm + sharper label hierarchy. */
  .cm-card-head { margin-bottom: 6px; }
  .cm-kv { padding: 3px 0; }
  .cm-kv + .cm-kv { border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }

  /* The article list rows (flex cards on phone, see ≤600px block) get the
     same press affordance so every tappable row feels native. */
  .article-row { transition: background 0.14s ease, transform 0.1s ease; }
  .article-row:active { background: var(--glass-press); }
  .vocab-row:active { background: var(--glass-press); }

  /* Status pills read a touch bolder on small screens (clearer at a glance). */
  .status-pill,
  .cust-status-pill,
  .schedule-level { font-weight: 700; letter-spacing: 0.2px; }

  /* ── Spacing consistency on the phone ── one gutter + gap rhythm. */
  .toolbar { gap: var(--m-gap); margin-bottom: var(--m-gutter); }
  .content { padding-left: var(--m-gutter); padding-right: var(--m-gutter); }
  .cm-card-list { gap: var(--m-gap); }

  /* ── Polished empty state ── give it a frosted card, more breathing room,
     and a gentle float-in so a blank screen feels intentional, not broken. */
  .empty-state {
    padding: 48px 22px;
    background: var(--glass-fill);
    -webkit-backdrop-filter: blur(8px) saturate(130%);
    backdrop-filter: blur(8px) saturate(130%);
    border: 1px dashed var(--glass-border);
    box-shadow: inset 0 1px 0 var(--glass-lip);
    animation: glassFadeIn 0.3s ease both;
  }
  .empty-state .empty-emoji {
    font-size: 34px;
    animation: glassFloat 3.4s ease-in-out infinite;
  }

  /* ── Polished loading skeleton ── glassy rows + a calmer shimmer. */
  .skel-row {
    background: var(--glass-fill);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border-color: var(--glass-border);
    border-radius: var(--radius-lg);
  }

  @keyframes glassFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
  }
  @keyframes glassFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4px); }
  }
}

/* ─────────────────────────────────────────────────────────────────────
   FALLBACK — browsers WITHOUT backdrop-filter (older Firefox, etc.).
   Swap every glass surface to a SOLID, near-opaque translucent fill so the
   chrome never goes see-through-and-unreadable. Light + dark both covered
   because the fills resolve from the theme's --panel.
   ───────────────────────────────────────────────────────────────────── */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  @media (max-width: 900px) {
    .mobile-topbar { background: color-mix(in srgb, var(--panel) 97%, var(--app)); }
    .mobile-nav-toggle { background: var(--panel); }
    .sidebar { background: color-mix(in srgb, var(--panel) 97%, var(--app)); }
    #nav-scrim { background: var(--glass-scrim); }
  }
  @media (max-width: 640px) {
    .modal-backdrop { background: var(--glass-scrim); }
    .modal-backdrop > .modal-card,
    .modal-backdrop > .vocab-modal-card,
    .modal-backdrop > .campaign-card,
    .ads-menu,
    .help-popover,
    .toast { background: color-mix(in srgb, var(--panel) 98%, var(--app)); }
    .cm-card,
    .empty-state,
    .skel-row { background: var(--panel-2); }
  }
}

/* Reduced-motion: drop the empty-state float + fade for users who ask. */
@media (prefers-reduced-motion: reduce) {
  .empty-state,
  .empty-state .empty-emoji { animation: none; }
}
