/* Campaign Launcher: warm, calm, Claude-like look.
   Colors are tokens; dark mode follows the system unless the sidebar's theme switch picks one. */
:root {
  --bg: #faf9f5;
  --sidebar: #f3f1ea;
  --card: #ffffff;
  --raised: #ffffff;
  --text: #1f1e1d;
  --text-2: #3d3d3a;
  --muted: #73726c;
  --faint: #a3a198;
  --border: #e6e3d9;
  --border-strong: #d6d2c4;
  --accent: #c96442;
  --accent-hover: #b4552f;
  --accent-soft: #f6e8e1;
  --accent-text: #ffffff;
  --ok: #2f7d4f;
  --ok-soft: #e6f2ea;
  --err: #b53a2b;
  --err-soft: #f9e6e2;
  --warn: #9a6a12;
  --warn-soft: #f7eed9;
  --input: #ffffff;
  --chip: #efece3;
  --hover: #ebe8de;
  --log: #1f1e1d;
  --log-text: #e8e6dc;
  --media: #1f1e1d;
  --shadow-sm: 0 1px 2px rgba(31, 30, 29, .05);
  --shadow: 0 1px 2px rgba(31, 30, 29, .04), 0 4px 14px rgba(31, 30, 29, .05);
  --shadow-lg: 0 12px 40px rgba(31, 30, 29, .16);
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: var(--sans);  /* headings */
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --r-sm: 8px;
  --r: 10px;
  --r-lg: 14px;
  --side-w: 264px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #262624;
    --sidebar: #1f1e1d;
    --card: #2f2f2c;
    --raised: #383834;
    --text: #f5f4ef;
    --text-2: #dcdad2;
    --muted: #a6a39a;
    --faint: #75736b;
    --border: #3d3c38;
    --border-strong: #4d4c47;
    --accent: #d97757;
    --accent-hover: #e2896b;
    --accent-soft: #45302a;
    --ok: #6cc08b;
    --ok-soft: #22362a;
    --err: #ef7d6d;
    --err-soft: #432723;
    --warn: #e0b35a;
    --warn-soft: #3d3321;
    --input: #262624;
    --chip: #3a3935;
    --hover: #353531;
    --log: #1a1a18;
    --media: #141413;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25);
    --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 4px 14px rgba(0, 0, 0, .2);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #262624;
  --sidebar: #1f1e1d;
  --card: #2f2f2c;
  --raised: #383834;
  --text: #f5f4ef;
  --text-2: #dcdad2;
  --muted: #a6a39a;
  --faint: #75736b;
  --border: #3d3c38;
  --border-strong: #4d4c47;
  --accent: #d97757;
  --accent-hover: #e2896b;
  --accent-soft: #45302a;
  --ok: #6cc08b;
  --ok-soft: #22362a;
  --err: #ef7d6d;
  --err-soft: #432723;
  --warn: #e0b35a;
  --warn-soft: #3d3321;
  --input: #262624;
  --chip: #3a3935;
  --hover: #353531;
  --log: #1a1a18;
  --media: #141413;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25);
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 4px 14px rgba(0, 0, 0, .2);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
h1, h2, h3 { font-weight: 500; letter-spacing: -.01em; }
h3 { font-size: 14px; font-weight: 600; margin: 20px 0 10px; }
::selection { background: var(--accent-soft); }
svg.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }

/* ---------- app shell: sidebar + content ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: var(--side-w); flex: none;
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 12px 12px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
}
.brand-mark svg.ico { width: 17px; height: 17px; stroke-width: 2.2; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-family: var(--display); font-size: 16px; font-weight: 700; letter-spacing: -.015em; }
.brand-sub { font-size: 11.5px; color: var(--muted); }

#nav { display: flex; flex-direction: column; gap: 2px; }
#nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 500; text-decoration: none;
  transition: background .12s, color .12s;
}
#nav a svg.ico { color: var(--muted); }
#nav a:hover { background: var(--hover); color: var(--text); }
#nav a.on { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }
#nav a.on svg.ico { color: var(--text); }
#nav a.nav-new { margin-bottom: 8px; color: var(--text); }
#nav a.nav-new .plus {
  width: 24px; height: 24px; margin: -3px -3px -3px -3px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: #fff;
}
#nav a.nav-new .plus svg.ico { width: 15px; height: 15px; color: #fff; stroke-width: 2.4; }
#nav a.nav-new:hover .plus { background: var(--accent-hover); }
.nav-label { font-size: 11.5px; font-weight: 500; color: var(--muted); padding: 14px 10px 6px; }

.recents { display: flex; flex-direction: column; gap: 1px; min-height: 0; overflow-y: auto; flex: 1; margin: 0 -4px; padding: 0 4px; }
.recent {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: var(--r-sm);
  color: var(--text-2); font-size: 13px; text-decoration: none;
}
.recent:hover { background: var(--hover); text-decoration: none; }
.recent .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; }
.recent .dot.ok { background: var(--ok); }
.recent .dot.err { background: var(--err); }
.recent .dot.run { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.recent-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recents-empty { padding: 4px 10px; font-size: 12.5px; color: var(--faint); }
.side-spacer { flex: 1; }
body:not(.ready) .sidebar > :not(.brand), body:not(.ready) .page-head { visibility: hidden; }
.recents + .side-spacer { display: none; }

.side-foot { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.conn {
  display: flex; align-items: center; gap: 8px;
  padding: 2px 10px; font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conn::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.conn.ok::before { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.conn.err { color: var(--err); cursor: help; }
.conn.err::before { background: var(--err); }
.acting { display: flex; flex-direction: column; gap: 4px; padding: 0 2px; font-size: 12px; font-weight: 500; color: var(--muted); }
.acting select { padding: 7px 10px; font-size: 13px; background: var(--card); }
.me {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 6px 6px 8px; border-radius: var(--r);
}
.me:hover { background: var(--hover); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--text); color: var(--bg);
  font-size: 13px; font-weight: 600; text-transform: uppercase;
}
.me-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.me-text > span:first-child { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { font-size: 11.5px; color: var(--muted); }
.side-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 2px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: var(--r-sm);
  border: 0; background: none; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn svg.ico { width: 17px; height: 17px; }
.theme-switch { display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--chip); }
.theme-switch button {
  display: grid; place-items: center; width: 28px; height: 24px; border-radius: 7px;
  border: 0; background: none; color: var(--muted); cursor: pointer;
}
.theme-switch button svg.ico { width: 14px; height: 14px; }
.theme-switch button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }
.version { font-size: 11px; color: var(--faint); }

/* mobile: the sidebar slides in */
.mobile-bar { display: none; }
.scrim { display: none; }

.main { flex: 1; min-width: 0; }
.content { max-width: 1080px; margin: 0 auto; padding: 36px 40px 80px; }
.content.wide { max-width: 1600px; padding-left: 32px; padding-right: 32px; }
.page-head { margin: 0 0 24px; }
.page-head h1 { font-family: var(--display); font-size: 28px; line-height: 1.2; font-weight: 700; margin: 0; letter-spacing: -.025em; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; }
.page-head:empty { display: none; }

.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 24px 4px; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- cards & layout ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 24px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.card h2 {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 16px; font-family: var(--display); font-size: 17px; line-height: 1.3; font-weight: 700; letter-spacing: -.015em;
}
.step {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  font: 600 12.5px/1 var(--sans);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.card-head h2 { margin: 0; }
.card.empty-state { text-align: center; padding: 48px 24px; }
.card.empty-state p { margin: 0; font-size: 14.5px; }
.card.empty-state a { display: inline-block; margin-top: 4px; font-weight: 600; }
.card.signin { max-width: 420px; }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 18px; }
.span2 { grid-column: span 2; }
.span3 { grid-column: 1 / -1; }

label, .field { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 13px; color: var(--text-2); min-width: 0; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; color: var(--text); cursor: pointer; }
.field label.check { padding-top: 24px; }
.field .assign-list label.check { padding-top: 0; }
.help { font-weight: 400; font-size: 12px; color: var(--muted); line-height: 1.45; }
.req { color: var(--accent); }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
.error {
  color: var(--err); font-weight: 500; margin: 12px 0 0;
  padding: 10px 12px; border-radius: var(--r-sm); background: var(--err-soft);
  border: 1px solid color-mix(in srgb, var(--err) 25%, transparent);
}
.chips .error, .muted.small + .error { margin-top: 6px; }
.ok { color: var(--ok); }
.err { color: var(--err); }

input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--input);
  color: var(--text);
  font: inherit;
  font-weight: 400;
  transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--text) 30%, var(--border-strong)); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); flex: none; margin: 0; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2373726c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
select:disabled { color: var(--muted); cursor: default; opacity: .85; }
select option { background: var(--card); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

/* ---------- buttons ---------- */
button.primary, a.button.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-text);
  border: 0; border-radius: var(--r-sm);
  padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12), inset 0 1px 0 rgba(255, 255, 255, .12);
  transition: background .12s, transform .06s;
}
button.primary:hover:not(:disabled), a.button.primary:hover { background: var(--accent-hover); text-decoration: none; }
button.primary:active:not(:disabled) { transform: translateY(1px); }
button.primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
button.link:hover { text-decoration: underline; text-underline-offset: 2px; }
button.ghost {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--border-strong); color: var(--text);
  border-radius: var(--r-sm); padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s;
}
button.ghost:hover:not(:disabled) { background: var(--hover); }
button.ghost:disabled { opacity: .55; cursor: default; }
button.ghost.danger { color: var(--err); }
button.ghost.danger:hover { background: var(--err-soft); border-color: color-mix(in srgb, var(--err) 35%, transparent); }
button.icon {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-size: 18px; line-height: 1; padding: 0 3px; border-radius: 6px;
}
button.icon:hover { color: var(--err); background: var(--err-soft); }

/* ---------- chips / rows / tables ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip {
  display: inline-flex; align-items: center;
  background: var(--chip); border-radius: 7px;
  padding: 3px 9px; font-size: 12px; font-weight: 500; color: var(--text-2); line-height: 1.45;
}

.rows { display: flex; flex-direction: column; }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 20px; align-items: start;
  padding: 16px 4px; border-top: 1px solid var(--border);
}
.row:first-child { border-top: 0; }
.row-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row-main > strong { font-weight: 600; font-size: 14.5px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.card > .row-actions { margin-top: 18px; }
.rows .row:has(.assign) { grid-template-columns: 1.2fr 1fr auto; }
.assign { display: flex; flex-direction: column; gap: 6px; }
.assign-list { display: flex; flex-wrap: wrap; gap: 8px 16px; }

.inline-form { display: grid; grid-template-columns: 1fr 1fr 140px auto; gap: 8px; max-width: 760px; }
.inline-form:has(> :nth-child(3):last-child) { grid-template-columns: 1fr 140px auto; max-width: 560px; }

table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th {
  font-size: 11.5px; color: var(--muted); font-weight: 600; letter-spacing: .02em;
  background: color-mix(in srgb, var(--chip) 55%, transparent); white-space: nowrap;
}
th:first-child { border-top-left-radius: var(--r-sm); }
th:last-child { border-top-right-radius: var(--r-sm); }
tbody tr { transition: background .1s; }
tbody tr:hover { background: color-mix(in srgb, var(--chip) 45%, transparent); }
tbody tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.nowrap { white-space: nowrap; }
.hist-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.lib-search.hist-search { width: min(440px, 100%); }
.hist-count { margin-left: auto; }
.hist-none { text-align: center; padding: 28px 0; margin: 0; }
.history-table .camp-name { min-width: 220px; }
.history-table .clip {
  max-width: 220px; white-space: normal; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.camp-id { display: block; margin-top: 2px; font: 11.5px/1.4 var(--mono); color: var(--muted); }
.cell-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; white-space: nowrap; }
.camp-name { display: block; min-width: 220px; overflow-wrap: anywhere; font-weight: 500; }
.clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pick { display: grid; grid-template-columns: 1fr; gap: 6px; }
.inline-add { display: flex; gap: 8px; max-width: 420px; margin-top: 6px; }

/* template form sections */
.form-section {
  margin: 14px 0 -4px; padding-top: 18px; border-top: 1px solid var(--border);
  font-family: var(--display); font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -.01em;
}
.grid > .form-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }

/* location / language pickers */
.picker-box { display: flex; flex-direction: column; gap: 8px; font-weight: 400; }
.sel-chips { align-items: center; min-height: 26px; }
.chip.sel { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; font-size: 13px; background: var(--chip); }
.chip.sel.region { background: var(--accent-soft); color: var(--accent); }
.chip .code { font-size: 11px; color: var(--muted); }
.chip-x {
  border: 0; background: none; color: var(--muted); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 1px 5px; border-radius: 50%;
}
.chip-x:hover { color: var(--err); background: var(--err-soft); }
button.small, .link.small { font-size: 12px; }
button.ghost.tiny { padding: 3px 9px; font-size: 12px; border-radius: 999px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.suggest-wrap { position: relative; max-width: 520px; flex: 1; }
.loc-controls { display: flex; gap: 8px; align-items: flex-start; max-width: 720px; }
.loc-mode { width: auto; flex: none; }
.loc-controls .ghost { padding: 9px 12px; }
.loc-controls .ghost.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.loc-chips { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.loc-row { display: flex; gap: 10px; align-items: baseline; }
.loc-label { font-size: 12px; font-weight: 600; color: var(--ok); min-width: 62px; }
.loc-label.exc { color: var(--err); }
.chip.sel.excluded { background: var(--err-soft); color: var(--err); }
.loc-tree {
  max-width: 720px; max-height: 360px; overflow: auto;
  border: 1px solid var(--border); border-radius: var(--r); padding: 6px 0; background: var(--card);
}
.tree-row { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-weight: 500; }
.tree-row label { display: flex; flex-direction: row; align-items: center; gap: 8px; font-weight: 600; flex: 1; cursor: pointer; color: var(--text); }
.tree-row.top, .tree-row.kid { cursor: pointer; flex-direction: row; }
.tree-row:hover { background: var(--hover); }
.tree-row.kid { padding-left: 52px; font-weight: 400; }
.tree-row.kid label { font-weight: 400; }
.tree-row.kid.is-excluded { color: var(--err); }
.exc-tag { font-size: 11px; color: var(--err); margin-left: auto; }
.tree-row .muted { margin-left: auto; }
.tree-sep { border-top: 1px solid var(--border); margin: 6px 0; }
.twisty { border: 0; background: none; color: var(--muted); cursor: pointer; width: 18px; padding: 0; font-size: 12px; }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 10;
  background: var(--raised); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-lg); overflow: hidden; padding: 4px;
}
.suggest-item { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.suggest-item.on, .suggest-item:hover { background: var(--hover); }
.inline-add.wide { max-width: none; margin-top: 0; }

.connect-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr) auto; gap: 8px; }
@media (max-width: 1280px) {
  .connect-form:not(.tt) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-auto-flow: dense; max-width: 760px; }
  .connect-form:not(.tt) > :nth-child(2) { grid-column: 1 / -1; }
  .connect-form:not(.tt) > button { justify-self: start; }
}
.connect-form.tt { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); max-width: 760px; }
.connect-form.tt button { justify-self: start; }
.inline-add.paste { max-width: 640px; }
.inline-add.biz { max-width: 520px; margin: 6px 0 12px; }
.page-list { display: flex; flex-direction: column; gap: 6px; }
.page-row { display: grid; grid-template-columns: 200px minmax(0, 360px); gap: 10px; align-items: center; }
.page-row input { padding: 6px 10px; font-size: 13px; }
.acct-row { grid-template-columns: minmax(0, 480px) auto; }
.acct-row .chip { justify-self: start; }
.conn-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 24px; }
@media (max-width: 760px) { .connect-form, .conn-grid { grid-template-columns: 1fr; } }

/* ---------- creatives ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: 22px 18px;
  text-align: center;
  background: color-mix(in srgb, var(--chip) 35%, transparent);
  transition: border-color .12s, background .12s;
}
.dropzone p { margin: 2px 0; }
.drop-ico {
  width: 38px; height: 38px; border-radius: 50%; margin-bottom: 6px;
  display: grid; place-items: center; background: var(--card); color: var(--muted);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.progress { width: 100%; max-width: 420px; height: 6px; background: var(--chip); border-radius: 999px; margin-top: 12px; overflow: hidden; }
.upload-status { margin: 8px 0 0; font-variant-numeric: tabular-nums; }
.progress div { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .15s; }

.lib-bar { display: flex; align-items: center; gap: 8px; margin: 14px 0 12px; }
.lib-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.lib-tools .spacer { flex: 1; }
.lib-search {
  width: 260px; padding: 7px 12px 7px 34px;
  background: var(--input) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%23a3a198' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center;
}
.sync-size { width: auto; padding: 6px 32px 6px 10px; font-size: 13px; }
/* videos / images tabs */
.type-tabs { display: flex; gap: 2px; margin-top: 18px; border-bottom: 1px solid var(--border); }
.type-tab {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: 10px 14px; color: var(--muted); font: inherit; font-weight: 500; cursor: pointer;
}
.type-tab:hover { color: var(--text); }
.type-tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab-count { background: var(--chip); color: var(--text-2); border-radius: 999px; padding: 0 8px; font-size: 12px; font-variant-numeric: tabular-nums; }
.tab-picked { font-size: 11px; font-weight: 600; color: var(--accent); }
.lib-tools.filters { margin-top: 14px; }

/* pages */
.lib-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.pager { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pg {
  min-width: 34px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--card); color: var(--text); font: inherit; font-size: 13px; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.pg:hover:not(:disabled) { background: var(--hover); }
.pg.on { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600; }
.pg:disabled { opacity: .4; cursor: default; }
.pg-gap { padding: 0 4px; color: var(--muted); }
.per-page { width: auto; padding: 6px 32px 6px 10px; font-size: 13px; }
.seg-mini { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r); background: var(--chip); }
.seg-mini button {
  border: 0; background: none; color: var(--muted); padding: 5px 12px; border-radius: 7px;
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.seg-mini button:hover { color: var(--text); }
.seg-mini button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }
.from-meta {
  position: absolute; bottom: 7px; left: 7px; background: rgba(8, 102, 255, .92); color: #fff;
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 5px; letter-spacing: .03em;
}
.tile-media > .muted { display: grid; place-items: center; height: 100%; color: #8f8d85; }
.lib-bar > :first-child { margin-right: auto; }

.library { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 14px; }
.library > p { grid-column: 1 / -1; text-align: center; padding: 32px 0; margin: 0; }
.tile {
  position: relative;
  border: 1px solid var(--border); border-radius: var(--r); overflow: hidden;
  cursor: pointer; background: var(--card); user-select: none;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.tile:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.tile.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.tile-media { position: relative; aspect-ratio: 1; background: var(--media); }
.tile-media img, .tile-media video { width: 100%; height: 100%; object-fit: contain; display: block; }
.tile-media video.hover-play { position: absolute; inset: 0; background: var(--media); }
.poster-wait { display: grid; place-items: center; height: 100%; color: #5f5d57; font-size: 26px; }
.tick {
  position: absolute; top: 7px; left: 7px;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(31, 30, 29, .35); color: transparent;
  border: 1.5px solid rgba(255, 255, 255, .9); font-size: 12px; font-weight: 700;
  opacity: 0; transition: opacity .12s;
}
.tile:hover .tick, .tile.on .tick { opacity: 1; }
.tile.on .tick { background: var(--accent); border-color: var(--accent); color: #fff; }
.kind {
  position: absolute; bottom: 7px; right: 7px;
  background: rgba(20, 20, 19, .7); color: #fff; backdrop-filter: blur(4px);
  font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 5px; letter-spacing: .03em;
}
.tile-meta { display: flex; align-items: center; gap: 4px; padding: 7px 9px; font-size: 12px; color: var(--text-2); }
.tile-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- launch ---------- */
.launch-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border);
}
.launch-row .primary { padding: 11px 20px; font-size: 14.5px; }
.launch-row .err { font-weight: 500; }
.log {
  margin: 14px 0 0;
  background: var(--log); color: var(--log-text);
  border-radius: var(--r); padding: 14px 16px;
  max-height: 340px; overflow: auto;
  font: 12.5px/1.6 var(--mono);
  white-space: pre-wrap; word-break: break-word;
}
.log .err { color: #ff9a8a; }
.log .ok { color: #9be2b0; }
.log .warn { color: #f2cf7e; }
/* launch progress */
.launch-progress { margin-top: 18px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--r); background: color-mix(in srgb, var(--chip) 30%, transparent); }
.lp-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.lp-top strong { font-weight: 600; }
.lp-pct { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); }
.lp-bar { height: 8px; background: var(--chip); border-radius: 999px; overflow: hidden; }
.lp-fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .4s ease; }
.launch-progress.running .lp-fill {
  background-image: linear-gradient(90deg, rgba(255,255,255,0) 0, rgba(255,255,255,.28) 50%, rgba(255,255,255,0) 100%);
  background-size: 200px 100%; animation: lp-shine 1.2s linear infinite;
}
@keyframes lp-shine { from { background-position: -200px 0; } to { background-position: 200px 0; } }
.launch-progress.done .lp-fill { background: var(--ok); }
.launch-progress.failed .lp-fill { background: var(--err); }
.launch-progress.done .lp-top strong { color: var(--ok); }
.launch-progress.failed .lp-top strong { color: var(--err); }
.lp-counts { margin-top: 8px; }
.log-wrap { margin-top: 12px; }
.log-wrap summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 500; }
.log-wrap summary:hover { color: var(--text); }
.log-wrap .log { margin-top: 8px; }

/* dialogs */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(20, 20, 19, .45); backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 16px;
  animation: fade-in .14s ease;
}
.modal {
  width: min(540px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 16px; padding: 24px 26px 22px;
  box-shadow: var(--shadow-lg); animation: pop-in .16s ease;
}
.modal.wide { width: min(760px, 100%); }
.dup { display: flex; flex-direction: column; gap: 16px; }
.dup > p { margin: -6px 0 0; }
.dup-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 14px; }
.dup .sum-note { margin-top: 0; color: var(--text-2); }
@media (max-width: 600px) { .dup-row { grid-template-columns: 1fr; } }
.modal-title { margin: 0 0 14px; font-family: var(--display); font-size: 19px; font-weight: 700; letter-spacing: -.015em; }
.modal-body p { margin: 0; color: var(--text-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.modal-actions button { padding: 9px 16px; font-size: 14px; }
button.primary.danger { background: var(--err); }
button.primary.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--err) 85%, #000); }
.sum-row { display: grid; grid-template-columns: 124px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.sum-label { color: var(--muted); }
.sum-row span:last-child { word-break: break-word; }
.sum-note { margin-top: 16px; padding: 11px 14px; border-radius: var(--r-sm); background: var(--chip); font-size: 13px; }
.sum-note.warn { background: var(--warn-soft); color: var(--text); font-weight: 500; border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }

.result { margin-top: 16px; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.result.ok { border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: var(--ok-soft); }
.result.err { border-color: color-mix(in srgb, var(--err) 35%, transparent); background: var(--err-soft); }
.result strong { font-weight: 600; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  max-width: min(560px, calc(100% - 32px));
  padding: 11px 18px; border-radius: 12px;
  background: var(--text); color: var(--bg); font-weight: 500;
  box-shadow: var(--shadow-lg); z-index: 60;
  animation: toast-in .18s ease;
}
.toast.err { background: var(--err); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- sign-in ---------- */
.signin-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 60%), var(--bg);
}
.signin-box { width: min(400px, 100%); text-align: center; }
.signin-box .brand-mark { width: 48px; height: 48px; border-radius: 14px; margin: 0 auto 22px; }
.signin-box .brand-mark svg.ico { width: 26px; height: 26px; }
.signin-box h1 { font-family: var(--display); font-size: 30px; font-weight: 800; margin: 0 0 8px; letter-spacing: -.03em; }
.signin-box > p { margin: 0 0 28px; color: var(--muted); font-size: 15px; }
.signin-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  padding: 11px 16px; border-radius: var(--r); border: 1px solid var(--border-strong);
  background: var(--card); color: var(--text); font-weight: 500; font-size: 14.5px;
  transition: background .12s;
}
.google-btn:hover { background: var(--hover); text-decoration: none; }
.google-btn svg { width: 18px; height: 18px; }
.signin-card .error { text-align: left; margin: 0 0 14px; }
.signin-note { margin: 14px 0 0; font-size: 12.5px; color: var(--muted); }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .shell { display: block; }
  .mobile-bar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; background: var(--bg); border-bottom: 1px solid var(--border);
  }
  .mobile-bar .brand { padding: 0; }
  .mobile-bar .brand-mark { width: 26px; height: 26px; border-radius: 8px; }
  .mobile-bar .brand-name { font-size: 16px; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; height: auto;
    transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(20, 20, 19, .35); }
  .content { padding: 22px 16px 60px; }
  .page-head h1 { font-size: 25px; }
}
@media (max-width: 760px) {
  .grid, .inline-form, .inline-form:has(> :nth-child(3):last-child) { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .row, .rows .row:has(.assign) { grid-template-columns: 1fr; }
  .card { padding: 18px 16px 20px; border-radius: 12px; }
  .lib-search { width: 100%; }
  .page-row, .acct-row { grid-template-columns: 1fr; }
  .library { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
}
