/* Mediakart "Studio" theme.
   A near-black canvas, glass panels lit from their top edge, one electric blue,
   and the logo gradient kept for three places only: the hero's accent word,
   the play mark in the empty preview and the download buttons' edge. Sentence
   case throughout; the logo is the only all-caps text. The planner is a work
   tool used all day, so legibility wins over spectacle, and every animation
   stops under prefers-reduced-motion. admin.html shares this sheet; its rules
   are near the end. */

:root {
  color-scheme: dark;

  --bg: #05070B;
  --panel: #0A0E15;
  --raise: #0F141D;
  --glass: rgba(15, 20, 29, .72);
  --glass-2: rgba(255, 255, 255, .025);   /* tiles and sub panels inside a card */
  --well: rgba(2, 4, 8, .42);             /* inputs sit a shade below the card */
  --line: rgba(148, 163, 184, .14);
  --line-2: rgba(148, 163, 184, .24);
  --field-edge: rgba(148, 163, 184, .18);
  --edge-hi: rgba(255, 255, 255, .10);    /* a panel's top-lit border, top... */
  --edge-lo: rgba(255, 255, 255, .04);    /* ...fading towards the bottom */
  --ctl-edge: #5F6A80;       /* checkbox outline: 3.55:1 on --panel, 3.39:1 on --raise */
  --ink: #E8EDF5;
  --ink-2: #A9B3C4;          /* 9.14:1 on --panel, 8.73:1 on --raise */
  --ink-3: #8089A0;          /* 5.53:1 on --panel, 5.28:1 on --raise */
  --blue: #2F8CFF;
  --blue-2: #7CB8FF;
  --blue-glow: rgba(47, 140, 255, .35);
  --band: rgba(47, 140, 255, .12);
  /* White on --blue is only 3.32:1, so the filled button sits on a deeper
     shade of the same blue that keeps its label at 4.5:1 or better. */
  --blue-fill: #1F6FE5;      /* white 4.70:1 */
  --blue-fill-hi: #2070EE;   /* white 4.55:1, the hover state */
  --magenta: #F0327F;
  --orange: #FF9A2E;
  --cyan: #1AA6E8;
  /* The logo's colours in its own order, routed through warm red and violet
     between orange and cyan. Orange and cyan are complementary, so blending
     them directly passes through grey (the accent word went khaki at "-rea");
     every neighbouring pair here is close on the wheel. #7A5CFF is 4.6:1 on --bg. */
  --grad: linear-gradient(90deg, #F0327F 0%, #FF9A2E 32%, #F24B6A 52%, #7A5CFF 76%, #1AA6E8 100%);
  --ok: #3DDC97;
  --warn: #F5B544;
  --danger: #FF5C7A;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  --serif: "Instrument Serif", Georgia, serif;
  /* The type scale. Every text size on the planner is one of these seven. */
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-16: 16px;
  --fs-20: 20px;
  --fs-24: 24px;
  --fs-28: 28px;
  --header-h: 64px;
  --gutter: 32px;
  --card-shadow: 0 24px 60px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .05);
  /* The plan table's pinned cost column needs an opaque fill that matches the
     table over the card. */
  --table-solid: #0B0F16;
  --table-solid-head: #10141B;

  /* Names the older markup, admin.html and inline styles still use, mapped onto
     this palette so nothing falls back to a light-theme colour. */
  --card: var(--panel);
  --blue-dark: var(--blue-2);
  --blue-deep: var(--ink);
  --blue-input: var(--blue-2);
  --muted: var(--ink-3);
  --line-soft: var(--line);
  --g-pink: var(--magenta);
  --g-orange: var(--orange);
  --g-cyan: var(--cyan);
  --warn-bg: rgba(245, 181, 68, .10);
  --warn-ink: var(--warn);
  --warn-line: var(--warn);
  --shadow: 0 1px 0 rgba(255, 255, 255, .02) inset;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
/* A field reached with Tab is scrolled clear of the sticky header and of the
   generate bar pinned at the bottom. */
html {
  scrollbar-color: rgba(148, 163, 184, .28) var(--bg);
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 8px);
  scroll-padding-bottom: 96px;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--fs-14)/1.5 var(--font);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* The dot grid, very faint and fading out down the page, so long plans read on
   plain black. Fixed and painted under everything, so it never sits on text. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: radial-gradient(rgba(148, 163, 184, .07) 1px, transparent 1.3px) 0 0 / 22px 22px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, .5) 45%, transparent 85%);
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, .5) 45%, transparent 85%);
}

/* The aurora behind the hero: three soft pools of the logo's colours, drifting
   over most of a minute. It runs on past the hero and fades out across the top
   of the workspace, so the glass cards have colour behind their upper edge to
   pick up. Radial gradients rather than blurred boxes: one composited layer,
   no filter. */
.aurora {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 760px;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 40%, transparent 88%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 40%, transparent 88%);
}
.aurora i {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}
.aurora i:nth-child(1) {
  left: -14%; top: -260px; width: 62%; height: 700px;
  background: radial-gradient(closest-side, rgba(240, 50, 127, .15), rgba(240, 50, 127, .06) 55%, transparent);
  animation: aurora-a 52s ease-in-out infinite alternate;
}
.aurora i:nth-child(2) {
  left: 24%; top: -300px; width: 52%; height: 640px;
  background: radial-gradient(closest-side, rgba(255, 154, 46, .10), rgba(255, 154, 46, .04) 55%, transparent);
  animation: aurora-b 44s ease-in-out infinite alternate;
}
.aurora i:nth-child(3) {
  right: -16%; top: -240px; width: 64%; height: 720px;
  background: radial-gradient(closest-side, rgba(26, 166, 232, .15), rgba(26, 166, 232, .06) 55%, transparent);
  animation: aurora-c 58s ease-in-out infinite alternate;
}
@keyframes aurora-a { to { transform: translate3d(8%, 40px, 0) scale(1.08); } }
@keyframes aurora-b { to { transform: translate3d(-10%, 30px, 0) scale(.94); } }
@keyframes aurora-c { to { transform: translate3d(-7%, 50px, 0) scale(1.05); } }

::selection { background: rgba(47, 140, 255, .38); color: #fff; }
a { color: var(--blue-2); text-decoration-color: rgba(124, 184, 255, .4); text-underline-offset: 3px; }
a:hover { color: #A8D0FF; }
code, kbd { font-family: var(--mono); font-size: .92em; color: var(--ink); background: var(--raise);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
strong, b { font-weight: 600; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-3); }
/* Visually hidden, and pinned so it can never stretch a scroll container. */
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.ico { display: block; flex: none; }

/* ---------------------------------------------------------------- header */
header.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: var(--header-h);
  padding: 8px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(5, 7, 11, .62);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.brandmark { display: inline-flex; align-items: center; flex: none; border-radius: 6px; }
.brandmark img { display: block; height: 28px; width: auto; }

/* ---------------------------------------------------------------- layout */
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px; }
.wrap.wide { max-width: 1720px; padding: 0 var(--gutter); }
.grid2 { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 24px; align-items: start; }
.wrap.wide .grid2 { grid-template-columns: 440px minmax(0, 1fr); gap: 24px; }
/* The preview column runs the full height of the form, so the empty state and
   any errors (the stage) stay in view, sticky, while the planner works down
   the brief. */
.previewcol { align-self: stretch; min-width: 0; }
.stage { position: sticky; top: calc(var(--header-h) + 20px); }

/* ---------------------------------------------------------------- hero */
.hero { position: relative; max-width: 1100px; padding: 48px 0 36px; }
.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  margin: 0 0 24px;
  padding: 0 14px 0 12px;
  border-radius: 999px;
  background: rgba(15, 20, 29, .55);
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 8px 24px rgba(0, 0, 0, .25);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font: 500 var(--fs-13)/1 var(--font);
  color: var(--ink-2);
}
.hero-pill .gdot {
  width: 6px; height: 6px; border-radius: 50%; flex: none;
  background: var(--grad);
  box-shadow: 0 0 10px rgba(240, 50, 127, .45);
}
.hero h1 {
  margin: 0;
  font: 500 clamp(36px, 4.4vw, 60px)/1.04 var(--font);
  letter-spacing: -.035em;
  color: var(--ink);
  text-wrap: balance;
}
.hero h1 em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.1em;
  letter-spacing: -.01em;
  padding: 0 .08em 0 .02em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* ---------------------------------------------------------------- cards */
/* Glass: a translucent fill with a faint sheen across its top, a 1px border
   drawn as a gradient that is lit at the top and fades down the sides, and a
   soft shadow underneath. The border is a masked pseudo-element, so it follows
   the radius and never takes layout. */
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, 0) 140px), var(--glass);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--card-shadow);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(180deg, var(--edge-hi), var(--edge-lo) 38%, rgba(255, 255, 255, .03));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}
.card h2 { margin: 0 0 12px; font: 600 var(--fs-16)/1.3 var(--font); letter-spacing: -.01em; color: var(--ink); }
.subcard {
  margin: 4px 0 0;
  padding: 12px 16px;
  background: var(--glass-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.subcard-h { margin-bottom: 8px; font: 600 var(--fs-13)/1.3 var(--font); color: var(--ink); }
.spacer { height: 12px; }

.cardhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.cardhead h2 { margin: 0; font: 600 var(--fs-16)/1.3 var(--font); letter-spacing: -.01em; }
.cardhint { font-size: var(--fs-12); color: var(--ink-3); text-align: right; }
.cardhint .req { color: var(--magenta); }

/* ---------------------------------------------------------------- form */
/* Each section of the brief lights up while the planner works in it: a soft
   blue glass panel behind it, a 2px accent sliding down its left edge and a
   glowing number. Hover shows the panel at a lower strength. The section is a
   stacking context so the panel sits behind its fields; the one in focus is
   lifted above its neighbours so the geo menu can hang over the next one. */
.step { position: relative; z-index: 0; padding: 24px 0 28px; border-top: 1px solid var(--line); transition: border-color .2s ease; }
.step:first-of-type { border-top: 0; padding-top: 16px; }
/* .active is set from the pointer as well as focus (planner.html
   markActiveStep), because Safari and Firefox on a Mac do not focus a clicked
   button, so :focus-within alone would leave the light on the last section. */
.step:is(:focus-within, .active) { z-index: 2; }
.step::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 8px -14px 10px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(47, 140, 255, .06), rgba(47, 140, 255, .02) 55%, rgba(47, 140, 255, .012));
  box-shadow: inset 0 0 0 1px rgba(124, 184, 255, .10), inset 0 1px 0 rgba(255, 255, 255, .05);
  opacity: 0;
  transition: opacity .22s ease;
  pointer-events: none;
}
.step:first-of-type::before { top: 2px; }
.step::after {
  content: "";
  position: absolute;
  left: -14px;
  top: 22px;
  bottom: 24px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--blue-2), var(--blue));
  box-shadow: 0 0 12px rgba(47, 140, 255, .55);
  opacity: 0;
  transform: scaleY(.15);
  transform-origin: 50% 0;
  transition: opacity .2s ease, transform .32s cubic-bezier(.2, .8, .2, 1);
  pointer-events: none;
}
.step:first-of-type::after { top: 16px; }
@media (hover: hover) {
  .step:hover::before { opacity: .45; }
}
.step:is(:focus-within, .active)::before { opacity: 1; }
.step:is(:focus-within, .active)::after { opacity: 1; transform: none; }
/* A lit section's panel stands in for the dividers above and below it, so no
   hairline runs a few pixels outside the panel's edges. */
.step:is(:focus-within, .active), .step:is(:focus-within, .active) + .step { border-top-color: transparent; }
@media (hover: hover) {
  .step:hover, .step:hover + .step { border-top-color: transparent; }
}
.stephead {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 4px;
  font: 600 var(--fs-14)/1.3 var(--font);
  letter-spacing: -.005em;
  color: var(--ink);
}
.stephead .idx {
  display: inline-grid;
  place-content: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 6px;
  background: var(--raise);
  border: 1px solid var(--line-2);
  color: var(--blue-2);
  font: 600 var(--fs-12)/1 var(--font);
  font-variant-numeric: tabular-nums;
  position: relative;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease, border-radius .2s ease;
}
@media (hover: hover) {
  .step:hover .stephead .idx { border-color: rgba(124, 184, 255, .45); }
}
.step:is(:focus-within, .active) .stephead .idx {
  border-color: rgba(47, 140, 255, .75);
  background: rgba(47, 140, 255, .18);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(47, 140, 255, .12), 0 0 16px rgba(47, 140, 255, .45);
}
/* A section whose required fields are all in: its number becomes a check in a
   filled blue circle, scaling in once. */
.step.done .stephead .idx {
  border-radius: 50%;
  border-color: var(--blue);
  background: var(--blue);
  color: transparent;
  box-shadow: 0 0 12px rgba(47, 140, 255, .35);
}
.step.done:is(:focus-within, .active) .stephead .idx { box-shadow: 0 0 0 3px rgba(47, 140, 255, .14), 0 0 16px rgba(47, 140, 255, .5); }
.step.done .stephead .idx::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #fff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4.2 8.3 2.5 2.5 5-5.6' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4.2 8.3 2.5 2.5 5-5.6' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
  animation: tick-in .28s cubic-bezier(.2, .9, .3, 1.35) both;
}
@keyframes tick-in { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: none; } }

label { display: block; margin: 16px 0 8px; font: 500 var(--fs-13)/1.35 var(--font); color: var(--ink-2); }
label .req { color: var(--magenta); font-weight: 600; }
label .hint { display: inline; margin: 0 0 0 4px; font-weight: 400; }
.hint { margin-top: 8px; font-size: var(--fs-12); line-height: 1.5; color: var(--ink-3); }
/* A quoted campaign name or brand with no spaces in it wraps inside the card
   and the hint, as the plan name does, instead of widening the page. */
.hint, #categoryHint, .checkcard li, details.plannotes li, .errbox li { overflow-wrap: anywhere; }
#budgetWords { color: var(--blue-2); font-weight: 500; font-variant-numeric: tabular-nums; }
#categoryHint:not(:empty) { color: var(--blue-2); }

input[type=text], input[type=number], input[type=date], input[type=search],
input[type=email], input[type=password], input[type=url], select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  background: var(--well);
  color: var(--ink);
  border: 1px solid var(--field-edge);
  border-radius: 10px;
  font: 400 var(--fs-14)/1.35 var(--font);
  font-variant-numeric: tabular-nums;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25);
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}
/* A text box grows with what is typed (up to a limit) instead of showing the
   browser's hatched resize grip. */
textarea {
  min-height: 68px;
  max-height: 180px;
  line-height: 1.5;
  resize: none;
  field-sizing: content;
  overflow-y: auto;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
/* A field answers the pointer: on hover its edge takes a blue-tinted hairline
   and the well lifts a shade; in focus the edge turns blue with a soft ring and
   a faint highlight along its inner top. Scoped to the text-like fields, so a
   checkbox or a range slider keeps its own states. */
:is(input[type=text], input[type=number], input[type=date], input[type=search],
input[type=email], input[type=password], input[type=url], select, textarea):hover:not(:disabled):not(:focus):not([readonly]) {
  border-color: rgba(124, 184, 255, .34);
  background-color: rgba(16, 23, 35, .62);
}
:is(input[type=text], input[type=number], input[type=date], input[type=search],
input[type=email], input[type=password], input[type=url], select, textarea):focus {
  border-color: var(--blue);
  background-color: rgba(12, 18, 28, .72);
  box-shadow: 0 0 0 3px rgba(47, 140, 255, .18), inset 0 1px 0 rgba(255, 255, 255, .06);
}
input:disabled, select:disabled, textarea:disabled { opacity: .5; cursor: not-allowed; }
input[readonly] { color: var(--ink-2); background: rgba(255, 255, 255, .02); }
select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 36px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%23A9B3C4' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
select option { background: var(--raise); color: var(--ink); }
/* The category select reads as empty until a category is chosen. */
#category:has(option[value=""]:checked) { color: var(--ink-3); }
#category option { color: var(--ink); }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=date]::-webkit-calendar-picker-indicator { opacity: .4; cursor: pointer; filter: invert(.8); }
input[type=date]::-webkit-calendar-picker-indicator:hover { opacity: .9; }
/* An empty optional date shows its dd-mm-yyyy mask dimmed, never as a value. */
input[type=date].empty::-webkit-datetime-edit { color: var(--ink-3); }
input[type=range] { accent-color: var(--blue); }
input[type=file] { color: var(--ink-2); font: inherit; font-size: var(--fs-13); }
input[type=file]::file-selector-button {
  margin-right: 12px; padding: 8px 12px; border-radius: 8px; cursor: pointer;
  background: var(--raise); color: var(--ink); border: 1px solid var(--line-2); font: inherit;
}

/* A field the last Generate found missing or wrong: outlined, its message under it. */
input.invalid, select.invalid, textarea.invalid,
input.invalid:focus, select.invalid:focus, textarea.invalid:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 92, 122, .15);
}
.chips.invalid { width: fit-content; max-width: 100%; }
.chips.invalid, .rategrid.invalid {
  border-radius: 12px;
  outline: 1px solid var(--danger);
  outline-offset: 5px;
  box-shadow: 0 0 0 8px rgba(255, 92, 122, .08);
}
.ferr {
  margin-top: 8px;
  font: 500 var(--fs-12)/1.4 var(--font);
  color: var(--danger);
}
.chips.invalid + .ferr, .rategrid.invalid + .ferr { margin-top: 12px; }

/* Checkboxes: an outlined box that fills blue with a white tick. Its edge is
   the one control boundary that must be seen to know the control is there, so
   it is a solid grey at 3.55:1 on --panel and 3.39:1 on --raise (WCAG asks 3:1
   for non-text), not a hairline, which measured about 1.6:1. */
input[type=checkbox] {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  display: inline-grid;
  place-content: center;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1px solid var(--ctl-edge);
  border-radius: 4.5px;
  background: var(--raise);
  cursor: pointer;
  vertical-align: -3px;
  transition: background-color .12s, border-color .12s;
}
input[type=checkbox]::before {
  content: "";
  width: 9px;
  height: 9px;
  background: #fff;
  transform: scale(0);
  transition: transform .12s;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
input[type=checkbox]:hover { border-color: var(--blue); }
input[type=checkbox]:checked { background: var(--blue); border-color: var(--blue); }
input[type=checkbox]:checked::before { transform: scale(1); }
input[type=checkbox]:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.row { display: flex; gap: 12px; }
.row > div { flex: 1; min-width: 0; }
/* A date box needs room for dd-mm-yyyy and its picker; the weeks box does not. */
.row > div:has(> input[type=date]) { flex: 1.25; }
.row > div:has(> #weeks) { flex: .7; }
/* If a label wraps to two lines, its box still lines up with the others. */
.row:has(> div > input[type=date]) { align-items: flex-end; }
input[type=date] { padding-left: 12px; padding-right: 8px; font-size: var(--fs-14); }

/* Chips: objectives, ages, NCCS, inventories, formats, presets, regions. A
   plain rounded rectangle: the selected state (blue tint, blue edge, white
   text) carries the meaning, and the 10px radius matches the inputs and holds
   its shape when a long format name wraps. */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 16px;
  border: 1px solid var(--field-edge);
  border-radius: 10px;
  background: rgba(255, 255, 255, .015);
  color: var(--ink-2);
  font: 500 var(--fs-13)/1.25 var(--font);
  cursor: pointer;
  user-select: none;
  transition: border-color .16s ease, background-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease,
    padding .18s ease;
}
/* A chip answers the pointer: its edge tints blue, its text brightens and it
   lifts a pixel on a soft shadow; pressed, it gives a little. */
@media (hover: hover) {
  .chip:hover {
    border-color: rgba(124, 184, 255, .45);
    color: var(--ink);
    background: rgba(47, 140, 255, .06);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .28);
  }
}
.chip:active { transform: scale(.97); }
.chip.on, .metrochip:has(input:checked) {
  background: rgba(47, 140, 255, .14);
  border-color: rgba(47, 140, 255, .85);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(47, 140, 255, .12), 0 4px 18px rgba(47, 140, 255, .12);
}
@media (hover: hover) {
  .chip.on:hover, .metrochip:has(input:checked):hover {
    background: rgba(47, 140, 255, .2);
    border-color: var(--blue);
    box-shadow: 0 0 0 1px rgba(47, 140, 255, .16), 0 8px 22px rgba(47, 140, 255, .2);
  }
}
/* A selected chip leads with a small check that opens in beside its name. The
   check is always there at zero width, with a margin that cancels the chip's
   gap. Selecting never changes a chip's width, so its neighbours never move
   under the pointer: the check (12px, then 4px to the name) is paid for by the
   side padding, 16px a side unselected and 8px selected, so only the name
   glides right as the check fades in. */
.chip::before {
  content: "";
  flex: none;
  width: 0;
  height: 12px;
  margin-right: -8px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3.5 8.4 3 3 6-6.8' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3.5 8.4 3 3 6-6.8' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
  opacity: 0;
  transition: width .18s ease, margin .18s ease, opacity .18s ease;
}
.chip.on:not(.disclose), .metrochip:has(input:checked) { padding-left: 8px; padding-right: 8px; }
.chip.on::before, .metrochip:has(input:checked)::before { width: 12px; margin-right: -4px; opacity: 1; }
.chip.disclose::before { content: none; }
/* The format chips are redrawn on every pick, so the one just picked plays
   its selection in from here instead of appearing already on. */
.chip.on.pop { animation: chip-on .22s ease both; }
.chip.on.pop::before { animation: chip-check .22s ease both; }
@keyframes chip-on { from { background-color: rgba(255, 255, 255, .015); border-color: var(--field-edge); box-shadow: none; padding-left: 16px; padding-right: 16px; } }
@keyframes chip-check { from { width: 0; margin-right: -8px; opacity: 0; } }
.metrochip { position: relative; margin: 0; }
.metrochip input[type=checkbox] { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.metrochip:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Geo presets: Pan India, the metros in numeric order, the tiers, then the
   regions folded behind one chip that opens them in place. */
.presets { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.presets .chips { margin-top: 0; }
button.chip { font-family: var(--font); }
.chip.disclose { gap: 6px; padding-left: 12px; padding-right: 8px; }
.chip.disclose .ico { color: var(--ink-3); transition: transform .2s; }
.chip.disclose[aria-expanded="true"] .ico { transform: rotate(180deg); }
.chip.disclose[aria-expanded="true"] { color: var(--ink); border-color: var(--line-2); }
.chip.disclose.on { background: var(--band); border-color: rgba(47, 140, 255, .5); color: #fff; }
.chip.disclose .dcount:empty { display: none; }
.chip.disclose .dcount {
  display: inline-grid; place-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px;
  background: var(--blue-fill);
  color: #fff;
  font: 600 var(--fs-12)/1 var(--font);
  font-variant-numeric: tabular-nums;
}
.regionset { display: contents; }
.regionset[hidden] { display: none; }

/* Selected-geo chips under the geo search */
.geochips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.geochips:empty { display: none; }
.geochip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 2px 4px 2px 12px;
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: var(--fs-13);
  font-weight: 500;
}
.geochip .gt { color: var(--ink-3); font-weight: 400; font-size: var(--fs-12); }
.geochip .why { color: var(--ink-3); font-weight: 400; font-size: var(--fs-12); }
.geochip .x {
  display: inline-grid; place-content: center;
  width: 24px; height: 24px; padding: 0;
  border: 0; border-radius: 6px;
  background: transparent; color: var(--ink-3);
  font-size: var(--fs-16); line-height: 1; cursor: pointer;
  transition: color .12s, background-color .12s;
}
.geochip .x:hover { color: var(--danger); background: rgba(255, 92, 122, .12); }
.geochip.warn { border-color: rgba(245, 181, 68, .45); background: rgba(245, 181, 68, .08); }
.geochip.grp { border-color: rgba(47, 140, 255, .35); background: var(--band); }

/* Geo typeahead */
.geowrap { position: relative; margin-top: 12px; }
.geowrap .geoicon { position: absolute; left: 12px; top: 13.5px; color: var(--ink-3); pointer-events: none; }
.geowrap #geoSearch { padding-left: 36px; }
.geomenu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 30;
  margin-top: 8px;
  max-height: 300px;
  overflow: auto;
  padding: 4px;
  /* Opaque: at 97% the selected-geo chips under the menu read through it. */
  background: #111722;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
  scrollbar-width: thin;
}
.geomenu .opt {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: var(--fs-14);
  color: var(--ink);
  cursor: pointer;
}
/* One highlight behind the rows glides to the row in hand (the page moves it,
   from the pointer or the arrow keys). Without it, as a fallback, the row
   itself lights. */
.geomenu .geohl {
  position: absolute;
  left: 4px;
  right: 4px;
  top: 0;
  height: 0;
  border-radius: 8px;
  background: rgba(47, 140, 255, .16);
  box-shadow: inset 0 0 0 1px rgba(124, 184, 255, .22), inset 2px 0 0 var(--blue);
  opacity: 0;
  pointer-events: none;
  transition: top .16s cubic-bezier(.2, .8, .2, 1), height .16s cubic-bezier(.2, .8, .2, 1), opacity .12s ease;
}
.geomenu .geohl.show { opacity: 1; }
.geomenu:not(:has(.geohl)) .opt:hover, .geomenu:not(:has(.geohl)) .opt.on { background: var(--band); }
.geomenu .opt.on .gt { color: var(--ink-2); }
.geomenu .opt .gt { color: var(--ink-3); font-size: var(--fs-12); }
.geomenu .opt .gtype {
  margin-left: 6px; padding: 1px 6px;
  border: 1px solid var(--line); border-radius: 5px; font-size: var(--fs-12);
}
.geomenu .opt .est { padding: 1px 6px; margin-left: 4px; border: 1px solid var(--line-2); border-radius: 5px; font-size: var(--fs-12); }
.geomenu .none { padding: 12px; color: var(--ink-3); font-size: var(--fs-13); }

/* Folding boxes: paste geos, platform mix, plan notes. A chevron that turns on
   open instead of the browser's triangle. */
details > summary { list-style: none; cursor: pointer; user-select: none; }
details > summary::-webkit-details-marker { display: none; }
details.pastebox {
  margin: 12px 0 4px;
  padding: 0 16px;
  background: var(--glass-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color .15s;
}
details.pastebox:hover { border-color: var(--line-2); }
details.pastebox > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  font: 500 var(--fs-13)/1.3 var(--font);
  color: var(--ink-2);
}
details.pastebox > summary::after {
  content: "";
  width: 14px; height: 14px; margin-left: auto; flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4.5 6.25 3.5 3.5 3.5-3.5' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4.5 6.25 3.5 3.5 3.5-3.5' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  color: var(--ink-3);
  transition: transform .2s;
}
details.pastebox[open] > summary::after { transform: rotate(180deg); }
details.pastebox > summary:hover { color: var(--ink); }
details.pastebox > summary .hint { display: inline; margin: 0 0 0 4px; font-size: var(--fs-12); font-weight: 400; }
details.pastebox[open] { padding-bottom: 16px; }
details.pastebox[open] > summary { margin-bottom: 4px; }
details.pastebox textarea { width: 100%; font-size: var(--fs-13); }
#geoPaste { min-height: 120px; max-height: 240px; }
.pasteactions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
label.inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  margin: 0;
  font-size: var(--fs-13);
  font-weight: 400;
  color: var(--ink-2);
}
/* The number boxes size to their content (the device split narrows them
   below); the checkbox keeps its 16px square, which the first rule used to
   squeeze to 11px. */
label.inline input { width: auto; }
label.inline input[type=checkbox] { width: 16px; }
label.inline input[type=number] { min-height: 34px; padding: 4px 8px; font-size: var(--fs-13); }
/* One option under a field (Include brand keywords under Context, Include
   Desktop above the Rich Media formats): a row of its own, set off from the
   box above it, and under the format label set off from the chips below. It
   reads like the workbook options, not like a hint. */
.fieldopt { display: flex; margin: 10px 0 0; }
.fieldopt label.inline { display: flex; font-weight: 500; color: var(--ink); }
#formatPickers .fieldopt { margin: 0 0 10px; }

#geoPreview { margin-top: 12px; font-size: var(--fs-13); color: var(--ink-2); }
#geoPreview:empty { display: none; }
#geoPreview .pv-sum { font: 600 var(--fs-13)/1.4 var(--font); color: var(--ink); margin-bottom: 8px; }
.pv-note { color: var(--ink-3); margin: 4px 0; font-size: var(--fs-13); line-height: 1.55; }
.pv-note b { color: var(--ink-2); }
.pv-head { margin: 16px 0 8px; font: 600 var(--fs-13)/1.3 var(--font); color: var(--ink-2); }
.pv-unmatched {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 4px 0; padding: 8px 12px;
  border: 1px dashed rgba(255, 92, 122, .45);
  border-radius: 8px;
  background: rgba(255, 92, 122, .06);
  color: var(--ink-2);
}
.pv-unmatched b { color: var(--ink); }
.pv-unmatched button {
  padding: 2px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-2); background: transparent; color: var(--ink);
  font: 500 var(--fs-12)/1.6 var(--font);
  transition: background-color .14s ease, border-color .14s ease;
}
.pv-unmatched button:hover { background: var(--band); border-color: var(--blue); }

/* Per-format split % and CPM rate inputs under the format pickers */
.rategrid {
  display: flex; flex-direction: column; gap: 6px;
  margin: 12px 0 4px; padding: 12px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--glass-2);
}
.ratehead, .raterow { display: grid; grid-template-columns: minmax(0, 1fr) 72px 104px; align-items: center; gap: 8px; }
.ratehead { padding: 0 0 2px; font-size: var(--fs-12); color: var(--ink-3); }
.ratehead span:not(:first-child) { text-align: right; padding-right: 2px; }
.raterow .ratename { min-width: 0; font-size: var(--fs-13); color: var(--ink-2); }
/* A row's unit beside its name, shown when the grid's lines are bought on
   different units (planner.html renderFormatPickers). */
.raterow .runit { margin-left: 6px; font-size: var(--fs-12); color: var(--ink-3); }
.raterow input.fRate, .raterow input.fSplit {
  width: 100%;
  min-height: 34px;
  padding: 4px 10px;
  font-size: var(--fs-13);
  text-align: right;
  border-radius: 8px;
}
/* A video unit's length, under its split and rate row: the label sits in the
   format column, the slider and its seconds span the two number columns. */
.lenrow {
  display: grid; grid-template-columns: minmax(0, 1fr) 184px; align-items: center; gap: 8px;
  margin-top: -2px; padding-bottom: 4px;
}
.lenrow .lenlabel { padding-left: 12px; font-size: var(--fs-12); color: var(--ink-3); }
.lenrow .pair { display: flex; align-items: center; gap: 10px; min-height: 30px; }
/* The slider's box is 24px tall, a thumb-sized target around its track. */
.lenrow input.lenIn { flex: 1; min-width: 0; height: 24px; min-height: 24px; margin: 0; padding: 0; border: 0; background: none; box-shadow: none; cursor: pointer; }
.lenrow input.lenIn:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; border-radius: 4px; }
.lenrow output { min-width: 34px; text-align: right; color: var(--ink); font: 500 var(--fs-13)/1 var(--font); font-variant-numeric: tabular-nums; }
/* What the typed splits add up to, under the grid (planner.html updateSplitNotes). */
.rategrid .splitnote { margin: 2px 0 0; }

/* "Use" beside a suggested category the planner has not taken: a small pill,
   so it reads as an action inside the hint. */
#categoryHint .usebtn {
  display: inline-block; vertical-align: baseline; margin-left: 4px; padding: 2px 9px; min-height: 24px; box-sizing: border-box;
  /* The pill's edge is a control boundary: .62 reads at 3:1 on the card, .45 did not. */
  border: 1px solid rgba(124, 184, 255, .62); border-radius: 999px; background: rgba(47, 140, 255, .1);
  font: 500 var(--fs-12)/1.5 var(--font); color: var(--ink); cursor: pointer;
  transition: background-color .14s ease, border-color .14s ease;
}
#categoryHint .usebtn:hover { background: rgba(47, 140, 255, .2); border-color: var(--blue); }
#categoryHint .usebtn:active { transform: scale(.97); }

/* Device split */
.splitrow input[type=number] { width: 84px; }

/* Platform mix rows */
.mixgrid { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow: auto; margin: 4px 0 8px; scrollbar-width: thin; }
label.mixrow {
  display: flex; align-items: center; gap: 8px;
  margin: 0; padding: 4px 8px; border-radius: 8px;
  font-size: var(--fs-13); font-weight: 400; color: var(--ink-2);
  transition: background-color .14s ease, color .14s ease;
}
label.mixrow:hover { background: rgba(47, 140, 255, .06); color: var(--ink); }
label.mixrow.on { background: var(--band); color: var(--ink); }
.mixname { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mixrow .tag { flex: none; font-size: var(--fs-12); padding: 1px 8px; }
input.mixpct { width: 64px; min-height: 30px; padding: 2px 8px; font-size: var(--fs-13); text-align: right; }

/* Optional parts of the plan */
.planopts { display: flex; flex-direction: column; gap: 12px; margin: 4px 0 2px; }
.planopts label.inline { display: flex; font-weight: 500; color: var(--ink); }

/* ---------------------------------------------------------------- buttons */
button { font-family: inherit; }
button.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  background: var(--blue-fill);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, 0) 60%);
  color: #fff;
  font: 600 var(--fs-16)/1.2 var(--font);
  letter-spacing: -.01em;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 1px 0 rgba(0, 0, 0, .5), 0 8px 24px rgba(31, 111, 229, .18);
  transition: background-color .18s, box-shadow .25s, opacity .18s, transform .18s;
}
button.primary:hover:not(:disabled) {
  background-color: var(--blue-fill-hi);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .24), 0 1px 0 rgba(0, 0, 0, .5), 0 12px 40px rgba(47, 140, 255, .38);
  transform: translateY(-1px);
}
button.primary:active:not(:disabled) { transform: translateY(0) scale(.985); transition-duration: .06s; }
button.primary .arr { transition: transform .2s; }
button.primary:hover:not(:disabled) .arr { transform: translateX(3px); }
button.primary.small { width: auto; min-height: 34px; padding: 0 14px; font-size: var(--fs-13); border-radius: 10px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 1px 0 rgba(0, 0, 0, .5); }

/* The generate bar: pinned to the bottom of the screen while the brief is in
   view, resting at the end of the card once the card's end is reached. Glass
   over the brief, a hairline on top, the progress on the left. It sits under
   the card's lit border (z-index 4), so the card's edges run through it. */
.card.brief { padding-bottom: 0; }
.genbar {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px -24px 0;
  padding: 14px 24px 16px;
  /* Nearly opaque: Chrome's blur thins out toward the bar's lower edge, and at
     80% the chips under it showed through as ghost text. */
  background: rgba(10, 14, 21, .94);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  transition: box-shadow .2s ease, border-color .2s ease, opacity .15s ease;
}
.genbar.stuck {
  border-radius: 0;
  border-top-color: rgba(255, 255, 255, .08);
  box-shadow: 0 -16px 32px rgba(0, 0, 0, .35);
}
/* While the geo search lists its matches, a pinned bar steps aside so it never
   covers the lower rows. */
.card.brief:has(#geoMenu:not([style*="none"])) .genbar.stuck { opacity: 0; pointer-events: none; }
.genbar-end { display: block; height: 1px; margin-top: -1px; pointer-events: none; }
/* One line always. On a laptop's 400px brief, beside the button with its
   shortcut, the status has 117px: room for "Ready to generate" (111px) but
   not for "3 of 5 sections ready" (128px), so the count drops "sections" when
   the status is narrower than that (a container query on the status itself).
   Anything longer ends in an ellipsis rather than wrapping. */
.genstatus {
  flex: 1;
  min-width: 0;
  container-type: inline-size;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font: 500 var(--fs-13)/1.35 var(--font);
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  transition: color .2s ease;
}
@container (max-width: 130px) { .genstatus .gs-long { display: none; } }
.genstatus.ready { color: var(--ok); }
.genstatus.changed { color: var(--blue-2); }
.genbar #genBtn { width: auto; flex: none; min-height: 46px; margin: 0; padding: 0 18px; }
/* The shortcut, quiet inside the button. On the blue fill the theme's grey
   would fall to 1.6:1, so it is white on a darker inset (4.5:1 or better). */
.kbdhint {
  display: inline-flex;
  align-items: center;
  height: 20px;
  margin-left: -2px;      /* 8px after the arrow, not the button's 10px */
  padding: 0 5px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 5px;
  background: rgba(3, 10, 24, .3);
  color: rgba(255, 255, 255, .92);
  font: 500 var(--fs-12)/1 var(--font);
  letter-spacing: .02em;
  gap: 4px;
}
/* The return arrow is drawn: the type has no glyph for it, and the fallback
   font set it small and raised. */
.kbdhint svg { flex: none; display: block; }
#genBtn.busy .kbdhint { display: none; }
@media (hover: none), (max-width: 640px) { .kbdhint { display: none; } }
/* While the plan is built the button says so with a small spinner and a
   working cursor. Only the fill is dimmed: the blue at 60% over the card, as
   opacity .6 would look, with the label kept at full white (8.8:1). */
#genBtn .spin { display: none; }
#genBtn.busy .spin {
  display: block;
  width: 16px; height: 16px; flex: none;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .28);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
}
#genBtn:disabled {
  opacity: 1;
  cursor: progress;
  background-color: #174892;
  background-color: color-mix(in srgb, var(--blue-fill) 60%, var(--panel));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}
#genBtn:disabled .arr { display: none; }
@keyframes spin { to { transform: rotate(1turn); } }

button.ghost, a.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: rgba(255, 255, 255, .025);
  color: var(--ink);
  font: 500 var(--fs-13)/1.2 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, transform .12s ease;
}
button.ghost .ico, a.ghost .ico { color: var(--ink-2); }
button.ghost:hover:not(:disabled), a.ghost:hover { background: rgba(255, 255, 255, .06); border-color: rgba(124, 184, 255, .5); color: #fff; }
button.ghost:active:not(:disabled), a.ghost:active { transform: scale(.97); background: rgba(255, 255, 255, .04); }
button:disabled { opacity: .5; cursor: not-allowed; }
[hidden] { display: none !important; }

button.textbtn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0; margin: 0; border: 0; background: none;
  font: inherit; font-weight: 500; color: var(--blue-2);
  cursor: pointer;
}
button.textbtn:hover { color: #A8D0FF; text-decoration: underline; text-underline-offset: 3px; }
button.textbtn:active:not(:disabled) { opacity: .75; }
/* Pointer targets at least 24px tall (WCAG 2.5.8): the plan's text buttons,
   its View links and the Plan notes summary, which measured 20 to 21px. */
.kwacts .textbtn, a.viewlink, details.plannotes > summary { min-height: 24px; }
button.textbtn:disabled { color: var(--ink-3); }

/* The downloads: a dark fill inside a 1px border drawn by the logo gradient,
   with a slow conic sheen on hover. The full button closes the plan card; a
   compact one sits by the plan's title. */
button.primary.gradient, button.dl-compact {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid transparent;
  background: linear-gradient(#0F1520, #0F1520) padding-box, var(--grad) border-box;
  color: #fff;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .4), 0 0 0 1px rgba(0, 0, 0, .2);
}
button.primary.gradient { min-height: 58px; margin-top: 28px; border-radius: 14px; }
button.primary.gradient::before {
  content: "";
  position: absolute;
  inset: -150% -10%;
  z-index: -1;
  background: conic-gradient(from 0deg, transparent 0 62%, rgba(240, 50, 127, .16) 72%, rgba(255, 154, 46, .14) 80%, rgba(122, 92, 255, .16) 86%, rgba(26, 166, 232, .18) 90%, transparent 96%);
  opacity: 0;
  transition: opacity .4s;
  animation: sheen 5s linear infinite paused;
}
button.primary.gradient:hover:not(:disabled), button.dl-compact:hover:not(:disabled) {
  background: linear-gradient(#131B28, #131B28) padding-box, var(--grad) border-box;
  box-shadow: 0 12px 44px rgba(240, 50, 127, .14), 0 12px 44px rgba(26, 166, 232, .14);
}
button.primary.gradient:hover:not(:disabled)::before { opacity: 1; animation-play-state: running; }
button.primary.gradient .lbl { font: 600 var(--fs-16)/1.2 var(--font); }
button.primary.gradient .fn {
  max-width: 48%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 400 var(--fs-13)/1.2 var(--font);
  color: var(--ink-3);
}
button.primary.gradient.done .ico, button.dl-compact.done .ico { color: var(--ok); }
button.dl-compact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  height: 40px;
  padding: 0 16px 0 14px;
  border-radius: 11px;
  font: 600 var(--fs-13)/1 var(--font);
  cursor: pointer;
  transition: background-color .18s, box-shadow .25s;
}
button.dl-compact:disabled { opacity: .7; cursor: progress; }
@keyframes sheen { to { transform: rotate(1turn); } }
/* While the workbook is made, a spinner stands where the download icon was. */
button.dl .spin { display: none; }
button.dl.busy .ico { display: none; }
button.dl.busy .spin {
  display: block;
  width: 16px; height: 16px; flex: none;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .22);
  border-top-color: var(--blue-2);
  animation: spin .8s linear infinite;
}
button.primary.gradient.busy:disabled { opacity: 1; cursor: progress; }
button.dl.done .lbl { color: var(--ok); }

/* ---------------------------------------------------------------- preview: empty state */
.card.empty {
  overflow: hidden;
  /* Tall enough for the mark, short enough that the overlay copy is in the
     first screen under the hero on a 900px laptop. */
  min-height: 520px;
  height: clamp(520px, calc(100vh - 360px), 760px);
  padding: 0;
  text-align: left;
  background: rgba(10, 14, 21, .78);
}
/* Under an error the box beside it is shorter, so the overlay copy still ends
   inside the first screen. */
.previewcol:has(#errors .errbox) .card.empty { height: clamp(440px, calc(100vh - 450px), 760px); min-height: 440px; }
/* Shown only until the signal field takes the canvas, or if it never loads. */
.card.empty:not(.has-field) {
  background-image: radial-gradient(rgba(148, 163, 184, .16) 1px, transparent 1.4px);
  background-size: 10px 10px;
  background-position: center;
}
#signalField { position: absolute; inset: 0; display: block; width: 100%; height: 100%; transition: opacity .3s; }
/* A soft scrim in the bottom-left corner only, under the overlay copy, so the
   text holds its contrast over the dots while the mark (kept right of centre
   by the field) stays untouched. */
.card.empty::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34%;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(60% 100% at 50% 100%, rgba(10, 14, 21, .92) 0%, rgba(10, 14, 21, .55) 50%, rgba(10, 14, 21, 0) 85%);
}
.empty-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 28px 32px 36px;
  text-align: center;
  pointer-events: none;
}
.card.empty .empty-overlay h2 { margin: 0 0 8px; font: 500 var(--fs-24)/1.2 var(--font); letter-spacing: -.02em; color: var(--ink); }
.empty-overlay p { margin: 0; font-size: var(--fs-14); line-height: 1.55; color: var(--ink-2); }

/* ---------------------------------------------------------------- preview: generating */
/* The build happens in the same box: the field dims and keeps sweeping, and a
   glass panel takes the overlay's place with the steps really running. */
.card.empty.building #signalField { opacity: .5; }
.card.empty.building .empty-overlay { display: none; }
.gen-panel {
  position: absolute;
  left: 0;
  right: 0;
  margin: 0 auto;
  bottom: 24px;
  z-index: 3;
  width: min(440px, calc(100% - 48px));
  overflow: hidden;
  padding: 18px 20px 8px;
  background: rgba(10, 14, 21, .72);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .05);
  animation: panel-in .25s ease-out both;
}
@keyframes panel-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.card.empty, .card.plancard, .errbox { scroll-margin-top: calc(var(--header-h) + 16px); }
/* An indeterminate bar along the panel's top edge: the logo gradient sweeping across. */
.gen-bar { position: absolute; top: 0; left: 0; right: 0; height: 2px; overflow: hidden; background: rgba(255, 255, 255, .05); z-index: 5; }
.gen-bar::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 42%;
  background: var(--grad);
  border-radius: 2px;
  animation: sweep 1.5s cubic-bezier(.45, .05, .35, 1) infinite;
}
.gen-panel.done .gen-bar::after { width: 100%; animation: none; transform: none; transition: width .3s; }
@keyframes sweep { from { transform: translateX(-105%); } to { transform: translateX(245%); } }
.gen-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 0 4px; }
.gen-panel h2 { margin: 0; font: 600 var(--fs-16)/1.3 var(--font); letter-spacing: -.01em; color: var(--ink); }
.gen-time { font: 500 var(--fs-13)/1 var(--font); font-variant-numeric: tabular-nums; color: var(--ink-3); }
.gen-steps { list-style: none; margin: 0; padding: 0; }
.gstep {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  font-size: var(--fs-14);
  color: var(--ink-3);
  transition: color .2s;
}
.gstep:first-child { border-top: 0; }
.gstep[data-state="active"], .gstep[data-state="done"], .gstep[data-state="warn"] { color: var(--ink); }
.gstep .gtext { font-weight: 500; }
.gstep .gdetail { font-size: var(--fs-13); color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: right; }
.gicon { position: relative; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-2); }
.gstep[data-state="active"] .gicon {
  border: 2px solid rgba(47, 140, 255, .2);
  border-top-color: var(--blue);
  animation: spin .75s linear infinite;
}
.gstep[data-state="done"] .gicon { border: 0; background: var(--blue); box-shadow: 0 0 12px rgba(47, 140, 255, .35); }
.gstep[data-state="done"] .gicon::after,
.gstep[data-state="warn"] .gicon::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #fff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m6 10.3 2.7 2.7 5.3-6' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 20px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m6 10.3 2.7 2.7 5.3-6' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 20px no-repeat;
}
.gstep[data-state="warn"] .gicon { border: 2px solid var(--warn); }
.gstep[data-state="warn"] .gicon::after {
  background: var(--warn);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 4.6v4.2M8 11.3v.1' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 4.6v4.2M8 11.3v.1' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  -webkit-mask-size: 16px;
  mask-size: 16px;
}

/* ---------------------------------------------------------------- preview: plan */
/* The plan fades in where the building panel stood, so nothing jumps. It takes
   focus when it arrives (for the keyboard and screen readers) but is not a
   control, so it shows no ring. */
.plancard { animation: fade-in .25s ease-out both; }
.plancard:focus, .plancard:focus-visible { outline: none; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.planhead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.planhead .ph-text { min-width: 0; }
.card h2.planname { margin: 0; font: 600 var(--fs-24)/1.25 var(--font); letter-spacing: -.02em; color: var(--ink); overflow-wrap: anywhere; }
.plansub { margin-top: 6px; font-size: var(--fs-13); line-height: 1.5; color: var(--ink-3); font-variant-numeric: tabular-nums; text-wrap: pretty; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px;
  border: 1px solid rgba(47, 140, 255, .4);
  border-radius: 999px;
  background: var(--band);
  color: var(--blue-2);
  font: 500 var(--fs-12)/1.3 var(--font);
}
.pill.ok { border-color: rgba(61, 220, 151, .4); background: rgba(61, 220, 151, .1); color: var(--ok); }
.pill.warn { border-color: rgba(245, 181, 68, .45); background: rgba(245, 181, 68, .1); color: var(--warn); }

/* What the keywords were built from: one slim line under the title. Inline
   rather than flex, so on a phone the summary flows on beside its tag instead
   of dropping under it. */
.productline {
  margin: 0 0 16px;
  font-size: var(--fs-14);
  line-height: 1.75;
  color: var(--ink-2);
}
.productline .ptag {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 8px; margin-right: 8px; vertical-align: 1px;
  border-radius: 6px;
  background: var(--band);
  border: 1px solid rgba(47, 140, 255, .28);
  color: var(--blue-2);
  font: 500 var(--fs-12)/1 var(--font);
}
.productline .ptext .ico { display: inline-block; margin-right: 8px; vertical-align: -3px; }
.productline .textbtn { display: inline; margin-left: 12px; font-size: var(--fs-13); }
.productline .textbtn .ico { display: inline-block; margin-right: 4px; vertical-align: -2px; }
.productline.warn .ptext { color: var(--warn); }
.productline .pwhy { margin-top: 2px; font-size: var(--fs-13); line-height: 1.5; color: var(--ink-3); }

/* Metric tiles. The row is a size container: four tiles while it is wide, two
   once it narrows, and the figures scale with it so a crore-scale number never
   clips (the page also steps a figure down if it would). */
.metricwrap { container: metrics / inline-size; margin: 0 0 16px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric {
  position: relative;
  min-width: 0;
  padding: 16px 16px 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .015));
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
@media (hover: hover) {
  .metric:hover {
    border-color: rgba(124, 184, 255, .3);
    transform: translateY(-1px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 10px 24px rgba(0, 0, 0, .3);
  }
}
.metric .k { font: 500 var(--fs-12)/1.3 var(--font); color: var(--ink-3); }
.metric .v {
  margin-top: 8px;
  font: 600 clamp(20px, 2.9cqi, 28px)/1.1 var(--font);
  letter-spacing: -.025em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.metric .mnote { margin-top: 6px; font-size: var(--fs-12); line-height: 1.4; color: var(--ink-3); }
@container metrics (max-width: 680px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric .v { font-size: clamp(20px, 5.2cqi, 28px); }
}

/* Check before sending: the one note the planner must read */
.checkcard {
  margin: 0 0 16px;
  padding: 14px 18px 14px 16px;
  background: rgba(245, 181, 68, .055);
  border: 1px solid rgba(245, 181, 68, .24);
  border-radius: var(--r);
  font-size: var(--fs-14);
}
.checkcard .ck-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font: 600 var(--fs-13)/1.3 var(--font); color: var(--warn); }
.checkcard ul { margin: 0; padding-left: 41px; line-height: 1.55; color: var(--ink); }
.checkcard li { margin: 4px 0; padding-left: 2px; }
.checkcard li::marker { color: var(--warn); }

/* Sections of the plan card: a name on the left; on the right the workbook
   sheet it becomes, or the section's own actions. */
.sec {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  margin: 32px 0 16px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.sec h3 { margin: 0; font: 600 var(--fs-16)/1.3 var(--font); letter-spacing: -.01em; color: var(--ink); }
.sec .sheet {
  flex: none;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .025);
  font: 500 var(--fs-12)/1.3 var(--font);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.sec-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.sec-actions .unsaved { font-size: var(--fs-13); color: var(--ink-2); margin-right: 4px; }
.sec-actions .ghost .ico { color: var(--ink-3); }

/* The plan tables */
.tablewrap {
  position: relative;
  overflow-x: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: rgba(3, 5, 9, .25);
  scrollbar-width: thin;
}
table.plan { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-13); color: var(--ink); }
table.plan th {
  padding: 12px 8px;
  background: rgba(255, 255, 255, .03);
  border-bottom: 1px solid var(--line);
  color: var(--ink-3);
  font: 500 var(--fs-12)/1.3 var(--font);
  text-align: left;
  vertical-align: bottom;
  white-space: nowrap;
}
table.plan td { padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.plan tbody tr:last-child td { border-bottom: 0; }
table.plan tbody tr { transition: background-color .12s; }
table.plan tbody td { transition: background-color .12s ease, box-shadow .12s ease; }
table.plan tbody tr:hover td { background: rgba(47, 140, 255, .045); }
/* The row in hand also carries a 2px blue mark on its left edge. */
@media (hover: hover) {
  table.plan tbody tr:not(.editrow):hover td:first-child { box-shadow: inset 2px 0 0 var(--blue); }
}
table.plan th[title] { cursor: help; text-decoration: underline dotted rgba(128, 137, 160, .55); text-underline-offset: 4px; }
table.plan td.num, table.plan th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.plan td strong { color: var(--ink); font-weight: 600; }
table.plan td .muted { margin-top: 4px; font-size: var(--fs-12); }
table.plan tfoot td { background: rgba(255, 255, 255, .03); border-top: 1px solid var(--line-2); border-bottom: 0; color: var(--ink-2); vertical-align: middle; }
table.plan tfoot .tf-label { font-weight: 600; color: var(--ink); margin-right: 12px; }
table.plan tfoot .tf-meta { color: var(--ink-3); }
table.plan tfoot td.num { color: var(--ink); font: 600 var(--fs-16)/1.2 var(--font); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.plan th:first-child, table.plan td:first-child { padding-left: 16px; }
table.plan th:last-child, table.plan td:last-child { padding-right: 16px; }
table.plan .tag { font-size: var(--fs-12); padding: 1px 8px; vertical-align: 1px; }
table.plan .tag.obj { margin-bottom: 4px; }

/* The lines table reads as a plan: one figure per column, the line's device and
   flight under its name, the buy type and rate under its cost. Its wrapper is a
   size container, so on a narrower card (a 1280px laptop) the cells tighten
   and the whole table still fits. */
.plancard .tablewrap { container: planlines / inline-size; }
table.plan.lines td:first-child { min-width: 184px; }
@container planlines (max-width: 820px) {
  table.plan.lines th, table.plan.lines td { padding-left: 6px; padding-right: 6px; }
  table.plan.lines th:first-child, table.plan.lines td:first-child { padding-left: 14px; min-width: 156px; }
  table.plan.lines th:last-child, table.plan.lines td:last-child { padding-right: 14px; }
}
table.plan.lines td.num { white-space: nowrap; }
table.plan.lines .lmeta { margin-top: 4px; font-size: var(--fs-12); color: var(--ink-3); }
table.plan.lines .val { display: block; }
table.plan.lines .u { display: block; margin-top: 4px; font-size: var(--fs-12); color: var(--ink-3); font-weight: 400; }
table.plan.lines td.cost .val { font-weight: 500; }
table.plan.lines .cur { display: none; }
/* The cost column is pinned while the table scrolls inside its card, so the
   figure that matters never hides behind a scroll. It takes an opaque fill and
   an edge shadow only while something can pass under it. */
table.plan.lines th:last-child, table.plan.lines td:last-child {
  position: sticky;
  right: 0;
  z-index: 1;
}
.tablewrap.scrolls table.plan.lines tbody tr.line td:last-child {
  background: var(--table-solid);
  box-shadow: -12px 0 12px -12px rgba(0, 0, 0, .7);
}
.tablewrap.scrolls table.plan.lines th:last-child,
.tablewrap.scrolls table.plan.lines tfoot td:last-child {
  background: var(--table-solid-head);
  box-shadow: -12px 0 12px -12px rgba(0, 0, 0, .7);
}
.tablewrap.scrolls table.plan.lines tbody tr.line:hover td:last-child { background: #0D1521; }
/* A line's controls, shown only while the table is edited. */
table.plan.lines tr.editrow { display: none; }
table.plan.lines.editing tr.editrow { display: table-row; }
table.plan.lines.editing tr.line td { border-bottom-color: transparent; }
table.plan.lines tr.editrow td {
  position: static;
  padding: 0 16px 16px;
  background: transparent;
  box-shadow: none;
}
table.plan.lines tbody tr.editrow:hover td { background: transparent; }
.ectls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  padding: 12px 16px;
  background: rgba(47, 140, 255, .045);
  border: 1px solid rgba(47, 140, 255, .18);
  border-radius: 10px;
}
.ectl, label.ectl { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; font: 500 var(--fs-12)/1.3 var(--font); color: var(--ink-3); }
.ectl .pair { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 34px; }
table.plan .ectl input, table.plan .ectl select {
  width: auto;
  min-height: 34px;
  padding: 4px 8px;
  border-radius: 8px;
  font: 400 var(--fs-13)/1.2 var(--font);
  font-variant-numeric: tabular-nums;
}
table.plan .ectl select { padding-right: 28px; background-position: right 8px center; }
table.plan .ectl input.flightIn { width: 136px; }
table.plan .ectl input.rateIn { width: 92px; text-align: right; }
table.plan .ectl input[type=range] { width: 120px; min-height: 0; padding: 0; box-shadow: none; border: 0; background: none; }
.ectl output { min-width: 32px; color: var(--ink); font: 500 var(--fs-13)/1 var(--font); font-variant-numeric: tabular-nums; }
/* A line's dates that cannot be used, said under its controls. */
table.plan.lines tr.editrow .flighterr { margin: 8px 2px 0; }
.plancard .subcard { margin-top: 16px; }

/* Targeting: a definition grid, the heading quiet on the left, the value beside it */
.targeting {
  padding: 4px 18px;
  background: var(--glass-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.targeting .tline {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  font-size: var(--fs-14);
  line-height: 1.6;
  color: var(--ink-2);
}
.targeting .tline:first-child { border-top: 0; }
.targeting .tline b { color: var(--ink-3); font-weight: 500; font-size: var(--fs-13); line-height: 1.75; }
.targeting .tline.plain span { grid-column: 1 / -1; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-2);
  font: 400 var(--fs-13)/1.45 var(--font);
}
.tag .tag-n { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tag.more { color: var(--ink-3); border-style: dashed; background: transparent; }

/* Keywords in the plan: every term as a chip. Hovered or focused, a chip
   shows a small round x on its top-right corner (always shown on a touch
   screen); a term taken off folds away. Terms the planner typed in carry a
   blue dot. The last chip opens a box to type a new one. */
.sec .sec-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.kwacts { gap: 16px; }
.kwacts .textbtn { font-size: var(--fs-13); }
.kwlist {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 4px 0 0;
  list-style: none;
}
.kwchip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 30px;
  padding: 4px 10px;
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-2);
  font: 400 var(--fs-13)/1.45 var(--font);
  white-space: nowrap;
  outline: none;
  transition: border-color .14s ease, background-color .14s ease, color .14s ease, box-shadow .14s ease,
    width .18s ease, padding .18s ease, margin .18s ease, opacity .18s ease;
}
.kwchip .kwt { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (hover: hover) {
  .kwchip:hover { z-index: 1; border-color: rgba(124, 184, 255, .4); background: #121A27; color: var(--ink); }
}
.kwchip:focus-visible { z-index: 1; border-color: var(--blue); color: var(--ink); box-shadow: 0 0 0 3px rgba(47, 140, 255, .22); }
.kwchip.added::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 8px rgba(47, 140, 255, .7);
}
.kwchip.added { border-color: rgba(47, 140, 255, .32); }
/* Past the sheet's 100: shown, struck through, until room is made again. Quiet
   by colour rather than opacity, so the term still reads at 5.5:1. */
.kwchip.out { background: transparent; border-style: dashed; color: var(--ink-3); }
.kwchip.out .kwt { text-decoration: line-through; text-decoration-color: rgba(128, 137, 160, .7); }
.kwchip.leaving {
  min-width: 0;
  padding-left: 0;
  padding-right: 0;
  margin-right: -8px;
  border-width: 0;
  opacity: 0;
  overflow: hidden;
  width: 0 !important;
  pointer-events: none;
}
.kwchip.entering { animation: kw-in .24s ease both; }
@keyframes kw-in { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
.kwx {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 2;
  display: grid;
  place-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: var(--raise);
  color: var(--ink-2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .45);
  cursor: pointer;
  opacity: 0;
  transform: scale(.6);
  pointer-events: none;
  transition: opacity .14s ease, transform .14s ease, background-color .14s ease, color .14s ease, border-color .14s ease;
}
/* A larger target than the 18px it shows. */
/* A larger target than the 18px it shows, grown outward only: it covers
   neither the end of the term (so selecting the last letters never removes
   it) nor much of the next chip. */
.kwx::before { content: ""; position: absolute; inset: -6px -6px -1px -1px; border-radius: 50%; }
.kwchip:hover .kwx, .kwchip:focus-visible .kwx { opacity: 1; transform: none; pointer-events: auto; }
@media (hover: hover) {
  .kwx:hover { background: #D93355; border-color: #D93355; color: #fff; }   /* white 4.6:1 */
}
/* On a touch screen the x is always there, so it sits inside the chip, after
   the term, rather than on its corner: a quiet glyph with a 28 by 36 target
   that stays within its own chip, so a tap meant for one chip never removes
   its neighbour. */
@media (hover: none) {
  .kwchip { padding-right: 2px; gap: 2px; }
  .kwchip.added::before { margin-right: 4px; }
  /* In the flow, but still positioned: the larger target (::before) must
     measure from the x, not from the chip, or the whole chip would remove. */
  .kwx {
    position: relative;
    top: auto;
    right: auto;
    width: 24px;
    height: 24px;
    margin: -4px 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    box-shadow: none;
    color: var(--ink-3);
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
  .kwx::before { inset: -6px -2px; border-radius: 8px; }
  .kwx:active { background: rgba(255, 92, 122, .16); color: var(--danger); }
}
.kwempty { padding: 4px 0; font-size: var(--fs-13); color: var(--ink-3); }
.kwaddli { display: inline-flex; flex-direction: column; gap: 6px; max-width: 100%; }
.kwaddli.editing { flex: 0 1 280px; }
.kwadd {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 12px 4px 10px;
  border: 1px dashed rgba(124, 184, 255, .45);
  border-radius: 8px;
  background: transparent;
  color: var(--blue-2);
  font: 500 var(--fs-13)/1.45 var(--font);
  cursor: pointer;
  transition: background-color .14s ease, border-color .14s ease, color .14s ease, transform .12s ease;
}
.kwadd:hover { border-style: solid; border-color: var(--blue); background: var(--band); color: #fff; }
.kwadd:active { transform: scale(.97); }
.kwaddli input.kwinput {
  width: 100%;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: var(--fs-13);
}
.kwaddli.checking input.kwinput { cursor: progress; color: var(--ink-2); }
.kwaddli input.kwinput.bad, .kwaddli input.kwinput.bad:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 92, 122, .15);
}
.kwinput.shake { animation: kw-shake .32s ease; }
@keyframes kw-shake {
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}
.kwreason:empty { display: none; }
.kwreason { font: 500 var(--fs-12)/1.4 var(--font); color: var(--danger); white-space: normal; }

/* ---------------------------------------------------------------- toasts */
.toasts {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 20px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  /* One width for every toast, so a stack lines up and its actions sit in one
     column (planner.html TOAST_W). */
  width: min(440px, 100%);
  min-height: 44px;
  padding: 6px 6px 6px 14px;
  /* Nearly opaque, so the page under a toast never shows through its text. */
  background: rgba(17, 23, 34, .97);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .06);
  color: var(--ink);
  font: 500 var(--fs-13)/1.4 var(--font);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .22s cubic-bezier(.2, .8, .2, 1);
}
.toast.in { opacity: 1; transform: none; }
.toast.out { opacity: 0; transform: translateY(4px); }
.toast > .ico { color: var(--ink-3); }
.toast.ok > .ico { color: var(--ok); }
.toast.err > .ico { color: var(--danger); }
.toast .tmsg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast .tact {
  flex: none;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--blue-2);
  font: 600 var(--fs-13)/1 var(--font);
  cursor: pointer;
  transition: background-color .14s ease, color .14s ease;
}
.toast .tact:hover { background: var(--band); color: #A8D0FF; }
.toast .tclose {
  display: grid;
  place-content: center;
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: background-color .14s ease, color .14s ease;
}
.toast .tclose:hover { background: rgba(255, 255, 255, .06); color: var(--ink); }

/* Creative showcase: the first rows, the rest one click away */
table.plan.creatives td { color: var(--ink-2); }
table.plan.creatives td:first-child { color: var(--ink); font-weight: 500; }
table.plan.creatives:not(.all) tr.more { display: none; }
a.viewlink { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; text-decoration: none; }
a.viewlink:hover { text-decoration: underline; }
button.showall { margin-top: 12px; font-size: var(--fs-13); }
button.showall .ico { transition: transform .2s; }
button.showall[aria-expanded="true"] .ico { transform: rotate(180deg); }

/* Plan notes: information only, folded until asked for */
details.plannotes { margin: 32px 0 0; padding-top: 24px; border-top: 1px solid var(--line); font-size: var(--fs-14); color: var(--ink-2); }
details.plannotes > summary { display: flex; align-items: center; gap: 8px; font: 600 var(--fs-16)/1.3 var(--font); color: var(--ink); }
details.plannotes > summary .count {
  display: inline-grid; place-content: center;
  min-width: 22px; height: 20px; padding: 0 6px;
  border-radius: 999px;
  background: var(--raise);
  border: 1px solid var(--line);
  font: 500 var(--fs-12)/1 var(--font);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
details.plannotes > summary .ico { margin-left: auto; color: var(--ink-3); transition: transform .2s; }
details.plannotes[open] > summary .ico { transform: rotate(180deg); }
details.plannotes > summary:hover .ico { color: var(--ink); }
details.plannotes ul { margin: 12px 0 0; padding-left: 20px; line-height: 1.6; }
details.plannotes li { margin: 4px 0; }
details.plannotes li::marker { color: var(--ink-3); }

/* Errors and soft flags */
.errbox {
  margin-bottom: 16px;
  padding: 14px 18px 14px 16px;
  background: rgba(255, 92, 122, .06);
  border: 1px solid rgba(255, 92, 122, .3);
  border-radius: var(--r);
  color: var(--ink);
  font-size: var(--fs-14);
}
.errbox strong { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font: 600 var(--fs-13)/1.3 var(--font); color: var(--danger); }
.errbox ul { margin: 0; padding-left: 42px; line-height: 1.55; }
.errbox li::marker { color: var(--danger); }
/* A failed download sits by the button that was used, and the plan stays. */
.errbox.dlerr { margin: 28px 0 0; }
.planhead + .errbox.dlerr { margin: 0 0 16px; }
/* A re-cost that did not go through sits above the table it left as it was. */
.errbox.recosterr { margin: 0 0 12px; }
.flag {
  margin: 6px 0;
  padding: 8px 12px;
  background: rgba(245, 181, 68, .08);
  border: 1px solid rgba(245, 181, 68, .35);
  border-radius: 8px;
  color: var(--warn);
  font-size: var(--fs-13);
}

/* ---------------------------------------------------------------- footer */
.foot {
  max-width: 1720px;
  margin: 56px auto 0;
  padding: 24px var(--gutter) 32px;
  border-top: 1px solid rgba(255, 255, 255, .05);
  font-size: var(--fs-13);
  color: var(--ink-3);
  text-align: center;
}

/* ---------------------------------------------------------------- admin.html */
/* The admin page keeps its own markup (a sub line under the logo, nav pills),
   so these rules keep it readable on the dark theme without redesigning it. */
header.topbar .sub { margin-top: 6px; font-size: var(--fs-12); color: var(--ink-3); }
header.topbar nav { display: flex; gap: 8px; }
header.topbar nav a {
  padding: 8px 14px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  color: var(--ink-2);
  font: 500 var(--fs-13)/1 var(--font);
  text-decoration: none;
  transition: background-color .15s, color .15s, border-color .15s;
}
header.topbar nav a:hover { border-color: rgba(148, 163, 184, .4); color: var(--ink); }
header.topbar nav a.active { background: var(--band); border-color: var(--blue); color: #fff; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.admin-tabs button {
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font: 500 var(--fs-13)/1 var(--font);
  cursor: pointer;
  transition: background-color .12s, color .12s, border-color .12s;
}
.admin-tabs button:hover { border-color: rgba(148, 163, 184, .4); color: var(--ink); }
.admin-tabs button.active { background: var(--band); border-color: var(--blue); color: #fff; }
table.edit { width: 100%; border-collapse: collapse; font-size: var(--fs-13); color: var(--ink); }
table.edit th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px;
  background: var(--raise);
  color: var(--ink-3);
  font: 500 var(--fs-12)/1.3 var(--font);
  text-align: left;
  border-bottom: 1px solid var(--line-2);
}
table.edit td { padding: 2px; border: 1px solid var(--line); }
table.edit td.num, table.edit th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.edit input { width: 100%; min-height: 0; padding: 6px; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: var(--ink); font: var(--fs-13) var(--font); }
table.edit input:focus { outline: 2px solid var(--blue); outline-offset: -2px; background: var(--raise); box-shadow: none; }
table.edit button.ghost { min-height: 28px; padding: 0 10px; font-size: var(--fs-12); }
table.edit a.ghost { min-height: 28px; font-size: var(--fs-12); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 16px 0 0; }
.toolbar button.primary { width: auto; min-height: 38px; font-size: var(--fs-14); }
.blue-note { color: var(--blue-2); font-weight: 600; }
.savemsg { font-size: var(--fs-13); }
/* admin.html colours its save message inline with light-theme greens and reds;
   on black those fall under 4.5:1, so they are lifted to the theme's own. */
.savemsg[style*="1e7d3c"], .savemsg[style*="30, 125, 60"] { color: var(--ok) !important; }
.savemsg[style*="a2231d"], .savemsg[style*="162, 35, 29"] { color: var(--danger) !important; }

/* ---------------------------------------------------------------- responsive */
/* On a laptop the gutters tighten and the brief gives up 20px. */
@media (max-width: 1500px) {
  :root { --gutter: 24px; }
  .wrap.wide .grid2 { grid-template-columns: 420px minmax(0, 1fr); }
  .card.plancard { padding: 24px 20px; }
}
/* The common office laptops (1366x768, 1280x800): a tighter hero and brief,
   so the brief shows more of itself and the empty state's copy, and the plan
   table, fit the first screen. */
@media (max-width: 1400px) {
  .wrap.wide .grid2 { grid-template-columns: 400px minmax(0, 1fr); }
}
@media (min-width: 961px) and (max-height: 860px) {
  .hero { padding: 28px 0 24px; }
  .hero-pill { margin-bottom: 14px; }
  .hero h1 { font-size: clamp(34px, 3.4vw, 46px); }
  .card.empty { height: clamp(420px, calc(100vh - 300px), 760px); min-height: 420px; }
  .previewcol:has(#errors .errbox) .card.empty { height: clamp(380px, calc(100vh - 390px), 760px); min-height: 380px; }
}
@media (max-width: 960px) {
  .grid2, .wrap.wide .grid2 { grid-template-columns: minmax(0, 1fr); }
  .previewcol { align-self: start; }
  .stage { position: static; }
  .card.empty, .previewcol:has(#errors .errbox) .card.empty { height: 440px; min-height: 0; }
}
/* iOS zooms the page into any field under 16px, on an iPad as on a phone, so
   every field is 16px up to a tablet's width (an iPad is 1024px wide). */
@media (max-width: 1024px) {
  input[type=text], input[type=number], input[type=date], input[type=search],
  select, textarea, details.pastebox textarea, label.inline input[type=number],
  .raterow input.fRate, .raterow input.fSplit, input.mixpct,
  table.plan .ectl input, table.plan .ectl select, .kwaddli input.kwinput { font-size: var(--fs-16); }
}
@media (max-width: 640px) {
  :root { --header-h: 56px; --gutter: 16px; }
  .brandmark img { height: 22px; }
  .wrap { padding: 16px; }
  .hero { padding: 32px 0 24px; }
  .hero-pill { margin-bottom: 16px; }
  .hero h1 { font-size: 36px; line-height: 1.06; }
  .card { padding: 20px 16px; border-radius: 16px; }
  .card.plancard { padding: 20px 16px; }
  .step { padding: 24px 0; }
  .cardhead { flex-wrap: wrap; }
  .cardhint { text-align: left; }
  .row { flex-wrap: wrap; }
  .row > div, .row > div:has(> input[type=date]) { flex: 1 1 130px; }
  .row > div:has(> #weeks) { flex-basis: 100%; }
  /* The generate bar spans the card on a phone, as on a laptop. */
  .genbar { margin: 8px -16px 0; padding: 12px 16px 14px; gap: 12px; border-radius: 0 0 16px 16px; }
  .genbar #genBtn { padding: 0 16px; }
  .kwsec { flex-wrap: wrap; }
  .kwsec .kwacts { margin-left: auto; margin-right: -8px; gap: 8px; }
  /* Thumb-sized: the header's text buttons, the add chip and "Show all" sit
     beside a hundred removable chips. */
  .kwacts .textbtn { min-height: 44px; padding: 0 8px; }
  .kwadd { min-height: 40px; padding: 8px 14px 8px 12px; }
  button.kwmore { min-height: 44px; margin-top: 4px; }
  .kwaddli.editing { flex: 1 1 100%; }
  /* A full sheet is four screens of chips on a phone: the list shows its first
     eight rows, fading out, until "Show all" (planner.html updateKwClamp). The
     side padding keeps a focused chip's ring inside the clip. */
  .kwlist.clamped {
    max-height: 304px;
    overflow: hidden;
    margin: 0 -4px;
    padding: 4px 4px 0;
    -webkit-mask-image: linear-gradient(#000 75%, transparent);
    mask-image: linear-gradient(#000 75%, transparent);
  }
  /* The lit section's panel and accent keep clear of the card's edge. */
  .step::before { left: -10px; right: -10px; }
  .step::after { left: -10px; }
  .card.empty, .previewcol:has(#errors .errbox) .card.empty { height: 360px; }
  .empty-overlay { padding: 24px 20px; }
  .card.empty .empty-overlay h2 { font-size: var(--fs-20); }
  .gen-panel { bottom: 12px; width: calc(100% - 24px); padding: 16px 16px 4px; }
  .gstep { gap: 10px; min-height: 44px; padding: 10px 0; }
  .metric { padding: 12px 14px 14px; }
  .card h2.planname { font-size: var(--fs-20); }
  /* By the title on a phone the download is its icon alone; the full button
     with its label ends the card. */
  button.dl-compact { width: 40px; padding: 0; justify-content: center; }
  button.dl-compact .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .planhead { padding-bottom: 16px; margin-bottom: 16px; }
  .sec { margin-top: 24px; padding-top: 20px; }
  .targeting { padding: 4px 14px; }
  .targeting .tline { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .checkcard { padding: 14px; }
  .checkcard ul, .errbox ul { padding-left: 20px; }
  button.primary.gradient { flex-wrap: wrap; gap: 4px 10px; padding: 12px 16px; }
  button.primary.gradient .fn { max-width: 100%; order: 3; flex-basis: 100%; text-align: center; }
  .ratehead, .raterow { grid-template-columns: minmax(0, 1fr) 64px 92px; }
  .lenrow { grid-template-columns: minmax(0, 1fr) 164px; }
  .foot { margin-top: 40px; }

  /* Each plan line becomes a card: its name and cost on the first line, then
     one labelled figure per row. No column hides off-screen. */
  .tablewrap:has(table.plan.lines) { overflow: visible; }
  table.plan.lines, table.plan.lines tbody, table.plan.lines tfoot { display: block; }
  table.plan.lines thead { display: none; }
  table.plan.lines tbody tr.line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
  }
  table.plan.lines.editing tbody tr.line { border-bottom: 0; }
  table.plan.lines td, table.plan.lines td:first-child,
  table.plan.lines th:last-child, table.plan.lines td:last-child {
    position: static;
    min-width: 0;
    background: transparent;
    box-shadow: none;
  }
  table.plan.lines tbody tr.line td {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 4px 0;
    border: 0;
    text-align: right;
  }
  table.plan.lines tbody tr.line td::before { content: attr(data-label); color: var(--ink-3); font-size: var(--fs-12); text-align: left; }
  table.plan.lines tbody tr.line td.fmt { grid-column: 1; grid-row: 1; display: block; padding: 0 0 10px; text-align: left; }
  table.plan.lines tbody tr.line td.cost { grid-column: 2; grid-row: 1; display: block; padding: 0 0 10px; }
  table.plan.lines tbody tr.line td.fmt::before, table.plan.lines tbody tr.line td.cost::before { content: none; }
  table.plan.lines tbody tr.line td.cost .val { font: 600 var(--fs-16)/1.3 var(--font); color: var(--ink); }
  table.plan.lines .cur { display: inline; }
  table.plan.lines .u { display: inline; margin: 0 0 0 4px; }
  table.plan.lines td.cost .u { display: block; margin: 4px 0 0; font-weight: 400; }
  table.plan.lines tbody tr.line:hover td, table.plan.lines tbody tr.line:hover td:last-child,
  .tablewrap.scrolls table.plan.lines tbody tr.line td:last-child,
  .tablewrap.scrolls table.plan.lines tfoot td:last-child { background: transparent; box-shadow: none; }
  table.plan.lines.editing tr.editrow { display: block; }
  table.plan.lines tr.editrow td { display: block; padding: 0 16px 16px; border-bottom: 1px solid var(--line); }
  table.plan.lines tfoot tr { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; background: rgba(255, 255, 255, .03); border-top: 1px solid var(--line-2); border-radius: 0 0 var(--r) var(--r); }
  table.plan.lines tfoot td { display: block; padding: 0; border: 0; background: transparent; }
  table.plan.lines tfoot .tf-label { display: block; margin: 0; }
  table.plan.lines tfoot .tf-meta { display: block; margin-top: 2px; font-size: var(--fs-12); }
  .ectls { padding: 12px; gap: 12px; }
  .ectl:has(.flightIn) { flex-basis: 100%; }
  table.plan .ectl input.flightIn { width: 100%; }
  .sec-actions .unsaved { flex-basis: 100%; text-align: right; margin: 0; }

  /* The creatives keep brand, creative and a thumb-sized View link. */
  table.plan.creatives th:nth-child(2), table.plan.creatives td:nth-child(2) { display: none; }
  table.plan.creatives td { vertical-align: middle; }
  table.plan.creatives td.num { padding-top: 0; padding-bottom: 0; }
  a.viewlink { min-height: 44px; min-width: 44px; justify-content: flex-end; }
}

/* As a card (a narrow window with a mouse), a plan line carries its hover mark
   on the card's own left edge rather than beside its name. */
@media (hover: hover) and (max-width: 640px) {
  table.plan.lines tbody tr.line:not(.editrow):hover td:first-child { box-shadow: none; }
  table.plan.lines tbody tr.line:hover { background: rgba(47, 140, 255, .045); box-shadow: inset 2px 0 0 var(--blue); }
}

/* ---------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .aurora i, button.primary.gradient::before, .plancard, .gen-panel,
  #genBtn.busy .spin, .gstep[data-state="active"] .gicon { animation: none !important; }
  button.primary.gradient::before { display: none; }
  /* A static thin bar instead of the sweep. */
  .gen-bar::after { animation: none !important; width: 100%; opacity: .55; transform: none; }
  .gen-panel.done .gen-bar::after { opacity: 1; }
  /* Nothing lifts, presses, slides or shakes: hover and selection change
     colour only. */
  .chip:hover, .chip:active, .metric:hover, .kwadd:active,
  button.primary:hover:not(:disabled), button.primary:active:not(:disabled),
  button.ghost:active:not(:disabled), a.ghost:active,
  button.primary:hover:not(:disabled) .arr { transform: none !important; }
  .step::after, .step:is(:focus-within, .active)::after { transform: none !important; }
  .step.done .stephead .idx::after, .chip.on.pop, .chip.on.pop::before,
  .kwchip.entering, .kwinput.shake { animation: none !important; }
  .kwx, .toast, .toast.in, .toast.out { transform: none !important; }
  .geomenu .geohl { transition: none !important; }
  button.dl.busy .spin { animation: none !important; border-color: var(--blue-2); border-top-color: var(--blue-2); opacity: .7; }
}

/* Exact ages: a two-handle slider, 18 to 60+, under the age-band chips. */
.agerange { margin: 8px 0 14px; }
.agerange .arhead { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted, #8a93a6); }
.agerange .arhead output { font-weight: 600; color: inherit; }
.agerange.exact .arhead output { color: var(--blue); }
.agerange .dual { position: relative; height: 28px; }
.agerange .dual input[type=range] { position: absolute; left: 0; right: 0; top: 2px; width: 100%; height: 24px; min-height: 24px; margin: 0; padding: 0; border: 0; background: none; box-shadow: none; pointer-events: none; -webkit-appearance: none; appearance: none; }
.agerange .dual input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: rgba(127,127,127,.35); }
.agerange .dual input[type=range] + input[type=range]::-webkit-slider-runnable-track { background: transparent; }
.agerange .dual input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(127,127,127,.35); }
.agerange .dual input[type=range] + input[type=range]::-moz-range-track { background: transparent; }
.agerange .dual input[type=range]::-webkit-slider-thumb { pointer-events: auto; -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--blue); border: 2px solid #fff; cursor: pointer; }
.agerange .dual input[type=range]::-moz-range-thumb { pointer-events: auto; width: 14px; height: 14px; border-radius: 50%; background: var(--blue); border: 2px solid #fff; cursor: pointer; }
.agerange .dual input[type=range]:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
.agerange .hint { display: block; font-size: 11px; opacity: .7; margin-top: 2px; }

/* The quality check's corrections to the targeting, under the targeting cell. */
.qcbox { margin: 10px 0 18px; padding: 8px 12px; border: 1px solid rgba(127,127,127,.25); border-radius: 10px; font-size: 13px; }
.qcbox summary { cursor: pointer; font-weight: 600; }
.qcbox .aifind { margin: 8px 0 2px; padding-left: 18px; line-height: 1.45; }
.qcbox .aifind li { margin: 3px 0; }
.qcbox q { font-style: italic; }
.linkbtn { background: none; border: 0; padding: 0 2px; margin-left: 6px; color: var(--blue); font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; }
.linkbtn:hover { opacity: .8; }
.linkbtn:disabled { opacity: .4; cursor: default; }
