/* ==========================================================================
   Fonts (Inter, served locally)
   ========================================================================== */

@font-face {
  font-family: "Inter Var";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
  font-family: "Inter Var";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Inter Var";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ==========================================================================
   Design tokens
   ========================================================================== */

:root {
  --bg: #f7f7f8;
  --sidebar: #f1f1f3;
  --surface: #ffffff;
  --surface-2: #f8f8f9;
  --surface-3: #eeeef1;
  --hover: #e8e8ec;
  --border: #e5e5e9;
  --border-strong: #d4d4da;
  --text: #17171a;
  --text-2: #55555f;
  --text-3: #8e8e99;
  --ink: #17171a;
  --ink-text: #ffffff;

  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --focus-ring: rgb(79 70 229 / 0.22);

  --claude: #c96442;
  --codex: #10a37f;

  --ok: #16803c;
  --ok-soft: #e6f5eb;
  --bad: #d12f2f;
  --bad-soft: #fdecec;
  --warn: #b45309;
  --warn-soft: #fdf3e2;

  --shadow-xs: 0 1px 1px rgb(16 16 24 / 0.04);
  --shadow-sm: 0 1px 2px rgb(16 16 24 / 0.04), 0 1px 3px rgb(16 16 24 / 0.03);
  --shadow-lg: 0 10px 30px rgb(16 16 24 / 0.16), 0 2px 6px rgb(16 16 24 / 0.08);

  --radius: 12px;
  --font: "Inter Var", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0d10;
    --sidebar: #111114;
    --surface: #17171b;
    --surface-2: #1b1b20;
    --surface-3: #232329;
    --hover: #26262d;
    --border: #27272e;
    --border-strong: #36363f;
    --text: #ededf0;
    --text-2: #a3a3ae;
    --text-3: #6f6f7b;
    --ink: #ededf0;
    --ink-text: #111114;

    --accent: #8f93ff;
    --accent-soft: rgb(99 102 241 / 0.16);
    --focus-ring: rgb(143 147 255 / 0.3);

    --claude: #d4724e;
    --codex: #0fa27f;

    --ok: #4ccf7c;
    --ok-soft: rgb(34 197 94 / 0.13);
    --bad: #f47a7a;
    --bad-soft: rgb(239 68 68 / 0.13);
    --warn: #f0b649;
    --warn-soft: rgb(245 158 11 / 0.12);

    --shadow-xs: none;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.5);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0d0d10;
  --sidebar: #111114;
  --surface: #17171b;
  --surface-2: #1b1b20;
  --surface-3: #232329;
  --hover: #26262d;
  --border: #27272e;
  --border-strong: #36363f;
  --text: #ededf0;
  --text-2: #a3a3ae;
  --text-3: #6f6f7b;
  --ink: #ededf0;
  --ink-text: #111114;

  --accent: #8f93ff;
  --accent-soft: rgb(99 102 241 / 0.16);
  --focus-ring: rgb(143 147 255 / 0.3);

  --claude: #d4724e;
  --codex: #0fa27f;

  --ok: #4ccf7c;
  --ok-soft: rgb(34 197 94 / 0.13);
  --bad: #f47a7a;
  --bad-soft: rgb(239 68 68 / 0.13);
  --warn: #f0b649;
  --warn-soft: rgb(245 158 11 / 0.12);

  --shadow-xs: none;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.5);
  color-scheme: dark;
}

[data-agent="claude"] { --agent: var(--claude); }
[data-agent="codex"] { --agent: var(--codex); }

[data-status] { --st: var(--text-3); --st-soft: var(--surface-3); }
[data-status="running"] { --st: var(--accent); --st-soft: var(--accent-soft); }
[data-status="done"] { --st: var(--ok); --st-soft: var(--ok-soft); }
[data-status="failed"] { --st: var(--bad); --st-soft: var(--bad-soft); }
[data-status="skipped"],
[data-status="stopped"],
[data-status="interrupted"] { --st: var(--warn); --st-soft: var(--warn-soft); }

/* ==========================================================================
   Base
   ========================================================================== */

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

html, body { margin: 0; }
/* The scrollbar's room is kept even on short pages, so switching pages doesn't shift them sideways. */
html { scrollbar-gutter: stable; }

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea { font: inherit; color: inherit; }

[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.spacer { flex: 1; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ==========================================================================
   App shell
   ========================================================================== */

.app {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 16px 10px 12px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 8px;
}

.brand-mark {
  position: relative;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 8px;
  background: #17171a;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08);
}

.brand-mark i {
  position: absolute;
  top: 9px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.brand-mark i:first-child { left: 6px; background: var(--claude); }
.brand-mark i:last-child { left: 12px; background: var(--codex); mix-blend-mode: screen; }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 650; font-size: 14.5px; letter-spacing: -0.01em; }
.brand-sub { font-size: 12px; color: var(--text-3); }

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-2);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

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

.nav-item[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border), var(--shadow-xs);
}

.nav-item[aria-current="page"] .icon { color: var(--accent); }

.sb-section { display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.sb-history { flex: 1; }

.sb-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
}

.history {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
}

.history-item button {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  column-gap: 9px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
  cursor: pointer;
}

.history-item button:hover { background: var(--hover); }

.history-item[aria-current="true"] button {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border), var(--shadow-xs);
}

/* Kind icon with a status dot on its corner. */
.h-kind {
  position: relative;
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: var(--text-3);
}

.h-kind .icon { width: 15px; height: 15px; }

.status-dot {
  position: absolute;
  right: -2px;
  bottom: -1px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--st);
  box-shadow: 0 0 0 2px var(--sidebar);
}

[data-status="running"] .status-dot { animation: pulse 1.4s ease-in-out infinite; }

.h-title {
  grid-column: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.h-meta { grid-column: 2; font-size: 12px; color: var(--text-3); }

.history-empty { padding: 6px 10px; font-size: 12.5px; color: var(--text-3); }

.sb-footer { flex: none; gap: 0; }

.conn {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 9px;
  padding: 6px 10px;
  font-size: 13px;
}

/* 5-hour plan usage under each connection. */
.conn-meter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-basis: 100%;
  padding-left: 29px;
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.conn-bar {
  position: relative;
  flex: 1;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, var(--surface-3));
}

.conn-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: var(--accent);
}

.conn-bar[data-level="warning"] i { background: var(--warn); }
.conn-bar[data-level="danger"] i { background: var(--bad); }

.conn-name { flex: 1; font-weight: 500; }

.conn-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
}

.conn-state::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
}

.conn[data-state="checking"] .conn-state::before { animation: pulse 1.2s ease-in-out infinite; }
.conn[data-state="ready"] .conn-state { color: var(--text-2); }
.conn[data-state="ready"] .conn-state::before { background: var(--ok); }
.conn[data-state="problem"] .conn-state { color: var(--bad); }
.conn[data-state="problem"] .conn-state::before { background: var(--bad); }

.sb-tools {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.sb-tool {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

.sb-tool:hover { background: var(--hover); color: var(--text); }
.sb-tool .icon { width: 15px; height: 15px; }

/* The signed-in person (team sign-in through the public address). */
.sb-user {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  padding: 8px 10px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.sb-user .avatar { --agent: var(--accent); }
.sb-user-text { display: flex; flex: 1; flex-direction: column; min-width: 0; line-height: 1.3; }
.sb-user-name { overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.sb-user-role { color: var(--text-3); font-size: 12px; }

/* No desktop to open folders on (signed in from elsewhere, or a server). */
.no-desktop #open-workspace,
.no-desktop #open-folder { display: none; }

/* People who aren't admins see Campaigns only. */
.app.campaigns-only .nav-item:not([data-view="campaigns"]),
.app.campaigns-only .sb-history,
.app.campaigns-only .sb-footer > .sb-heading,
.app.campaigns-only .conn,
.app.campaigns-only #open-workspace { display: none; }

.signin {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px 16px;
}

.signin-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 380px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.signin-card .brand { padding: 0; }
.signin-text h1 { margin: 0 0 6px; font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.signin-text p { margin: 0; color: var(--text-2); font-size: 13.5px; line-height: 1.5; }
.signin-card .error-box { margin: 0; }

.btn.signin-google {
  height: 40px;
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.btn.signin-google:hover { background: var(--surface-2); }
.g-logo { width: 18px; height: 18px; flex: none; }
.signin-hint { margin: 0; color: var(--text-3); font-size: 12.5px; line-height: 1.45; }

.main { min-width: 0; padding: 32px 40px 56px; }

.view { max-width: 1160px; margin: 0 auto; }

/* The Chats view is exactly one screen tall; panels fill what's left. */
.app[data-view="chats"] .main {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-bottom: 24px;
}

.app[data-view="chats"] .view-chats {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1400px;
  display: flex;
  flex-direction: column;
}

.app[data-view="chats"] .banner { width: 100%; max-width: 1400px; }

/* ==========================================================================
   Page furniture
   ========================================================================== */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.page-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.page-sub { margin: 5px 0 0; max-width: 640px; color: var(--text-2); }

.banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 1160px;
  margin: 0 auto 22px;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--warn) 28%, transparent);
  border-radius: 10px;
  background: var(--warn-soft);
  font-size: 13.5px;
}

.banner > .icon { margin-top: 2px; color: var(--warn); }
.banner-lines { display: flex; flex-direction: column; gap: 4px; }

code {
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 12.5px;
}

.stepper {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

.stepper li { display: flex; align-items: center; gap: 8px; }

.stepper li + li::before {
  content: "";
  width: 36px;
  height: 1px;
  background: var(--border-strong);
}

.stepper button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text-3);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
}

.stepper button:not(:disabled):hover { background: var(--hover); }
.stepper button:disabled { cursor: default; }

.step-dot {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  font-size: 11.5px;
  font-weight: 600;
}

.step-dot .icon { display: none; width: 12px; height: 12px; stroke-width: 3; }

.stepper [data-state="current"] button { color: var(--text); }
.stepper [data-state="current"] .step-dot { border-color: var(--ink); background: var(--ink); color: var(--ink-text); }
.stepper [data-state="complete"] button,
.stepper [data-state="available"] button { color: var(--text-2); }
.stepper [data-state="complete"] .step-dot { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
.stepper [data-state="complete"] .step-dot span { display: none; }
.stepper [data-state="complete"] .step-dot .icon { display: block; }

.stack { display: flex; flex-direction: column; gap: 20px; }

.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 -8px;
}

.section-head h3 { margin: 0; font-size: 14px; font-weight: 600; }

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 0;
}

.card-header h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-header p {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 3px 0 0;
  color: var(--text-2);
  font-size: 13.5px;
}

.card-body { padding: 16px 20px 20px; }

.card-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface-2);
}

.count {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.count:empty { display: none; }

/* ==========================================================================
   Controls
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s, box-shadow 0.15s;
}

.btn .icon { width: 15px; height: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn.primary { background: var(--ink); color: var(--ink-text); box-shadow: var(--shadow-xs); }
.btn.primary:not(:disabled):hover { opacity: 0.88; }

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

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

.btn.danger { border-color: color-mix(in srgb, var(--bad) 32%, var(--border)); background: var(--surface); color: var(--bad); }
.btn.danger:not(:disabled):hover { background: var(--bad-soft); }

.btn.sm { height: 30px; padding: 0 11px; border-radius: 7px; font-size: 13px; }
.btn.icon-only { width: 32px; height: 32px; padding: 0; }

.btn.busy .icon { display: none; }
.btn.busy::before {
  content: "";
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text-3);
  cursor: pointer;
}

.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.xs { width: 22px; height: 22px; border-radius: 6px; }
.icon-btn.xs .icon { width: 13px; height: 13px; }
.icon-btn.remove:hover { background: var(--bad-soft); color: var(--bad); }

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
}

.link-btn:hover { text-decoration: underline; }

.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder { color: var(--text-3); }
textarea.input { resize: vertical; line-height: 1.55; }

.input:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.goal { min-height: 124px; font-size: 15px; }

.select {
  appearance: none;
  height: 36px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  outline: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e99' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 14px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.select.sm {
  height: 28px;
  padding: 0 26px 0 9px;
  border-radius: 7px;
  background-position: right 7px center;
  background-size: 12px;
  font-size: 13px;
}

.select.bare {
  height: 20px;
  padding: 0 20px 0 0;
  border-color: transparent;
  background-color: transparent;
  background-position: right 2px center;
  background-size: 12px;
  color: var(--text-3);
  font-size: 12.5px;
}

.select.bare:hover { color: var(--text); }
.select.bare:focus { box-shadow: none; border-color: transparent; color: var(--text); }

kbd {
  display: inline-block;
  min-width: 20px;
  margin-right: 3px;
  padding: 0 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}

.hint {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--text-3);
  font-size: 12.5px;
}

.card-footer .hint { margin-right: auto; }

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  font-size: 13.5px;
  cursor: pointer;
}

.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.switch-track {
  position: relative;
  width: 34px;
  height: 20px;
  flex: none;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background 0.15s;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
  transition: transform 0.15s;
}

.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--focus-ring); }

.avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 9px;
  background: var(--agent, var(--text-3));
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
}

.avatar.sm { width: 26px; height: 26px; border-radius: 7px; font-size: 12.5px; }
.avatar.xs { width: 20px; height: 20px; border-radius: 6px; font-size: 10.5px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  flex: none;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--st-soft);
  color: var(--st);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge[data-status="running"]::before { animation: pulse 1.2s ease-in-out infinite; }

.spinner {
  width: 12px;
  height: 12px;
  flex: none;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.error-box {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bad-soft);
  color: var(--bad);
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.error-box .icon { width: 15px; height: 15px; margin-top: 1px; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 12px;
  color: var(--text-3);
  font-size: 13.5px;
  text-align: center;
}

.empty-state .icon { width: 28px; height: 28px; stroke-width: 1.5; }
.empty-state p { margin: 0; }

/* ==========================================================================
   Task brief
   ========================================================================== */

.settings {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 24px;
  margin-top: 18px;
}

.setting { display: flex; flex-direction: column; gap: 6px; }
.setting-label { font-size: 12px; font-weight: 600; color: var(--text-2); }

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

.member {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 4px 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.member input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.member:has(input:checked) { border-color: color-mix(in srgb, var(--agent) 50%, var(--border-strong)); background: color-mix(in srgb, var(--agent) 6%, var(--surface)); }
.member:not(:has(input:checked)) .avatar { opacity: 0.4; filter: grayscale(1); }
.member:not(:has(input:checked)) .member-name { color: var(--text-3); }
.member .select { border-color: transparent; background-color: var(--surface-3); }

.inline-setting {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 13px;
}

/* ==========================================================================
   Plan editor
   ========================================================================== */

.plan-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 16px 20px 20px;
  list-style: none;
}

.plan-item {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 14px 14px 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.plan-item::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: -1px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--agent, var(--border-strong));
}

.plan-index, .job-index {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.plan-index { margin-top: 5px; }

.plan-main { display: flex; flex: 1; flex-direction: column; gap: 8px; min-width: 0; }
.plan-row { display: flex; align-items: center; gap: 8px; }
.plan-row .title { height: 34px; padding: 0 10px; font-weight: 600; }

.assignee-select {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  flex: none;
  padding-left: 7px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
}

.assignee-select .select { height: 32px; border: 0; background-color: transparent; font-weight: 500; }
.assignee-select .select:focus { box-shadow: none; }
.assignee-select:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }

.instructions { min-height: 60px; font-size: 13.5px; }

.deps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 12.5px;
}

.deps:empty { display: none; }

.dep {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 280px;
  height: 24px;
  padding: 0 9px;
  border: 1px dashed var(--border-strong);
  border-radius: 999px;
  background: none;
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
}

.dep:hover { border-color: var(--text-3); color: var(--text); }
.dep .icon { width: 12px; height: 12px; stroke-width: 2.4; }
.dep .ic-check { display: none; }
.dep-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dep[aria-pressed="true"] {
  border-style: solid;
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: var(--accent-soft);
  color: var(--accent);
}

.dep[aria-pressed="true"] .ic-plus { display: none; }
.dep[aria-pressed="true"] .ic-check { display: block; }

.plan-item.skeleton::before { background: var(--border-strong); }
.plan-item.skeleton .plan-main { gap: 10px; padding: 6px 0; }

.sk {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-3) 0%, var(--hover) 50%, var(--surface-3) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.sk-title { width: 38%; height: 16px; }
.sk-line { width: 92%; }
.sk-line.short { width: 64%; }

/* ==========================================================================
   Results
   ========================================================================== */

.run-card { padding: 18px 20px; }

.run-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.run-heading { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }

.run-heading h2 {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.run-actions { display: flex; flex: none; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.progress {
  height: 6px;
  margin: 16px 0 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--st, var(--accent));
  transition: width 0.4s ease;
}

.run-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  color: var(--text-2);
  font-size: 13px;
}

.run-stats > span { display: inline-flex; align-items: center; gap: 5px; }
.run-stats .icon { width: 14px; height: 14px; color: var(--text-3); }
#stat-time { font-variant-numeric: tabular-nums; }
#stat-message:empty, .dot-sep:has(+ #stat-message:empty) { display: none; }

.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }

.board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.job {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 150px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.job::before, .final::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--agent, var(--border));
}

.job[data-status="running"] {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.job-head { display: flex; align-items: flex-start; gap: 10px; }
.job-title { flex: 1; margin: 2px 0 0; font-size: 14px; font-weight: 600; line-height: 1.4; }

.job-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-top: 10px;
  color: var(--text-2);
  font-size: 12.5px;
}

.job-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.job-meta .icon { width: 13px; height: 13px; color: var(--text-3); }
.assignee-name { font-weight: 500; color: var(--text); }
.job-timer { font-variant-numeric: tabular-nums; }

.activity-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-top: 12px;
  padding: 7px 10px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 12px;
}

.activity-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.job .output {
  position: relative;
  max-height: 300px;
  margin-top: 14px;
  padding-top: 14px;
  overflow: hidden;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
}

.job .output:empty { display: none; }
.job[data-status="running"] .output { overflow-y: auto; }

.job.clipped .output::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 64px;
  background: linear-gradient(transparent, var(--surface));
  pointer-events: none;
}

.job.expanded .output { max-height: none; }
.job.expanded .output::after { display: none; }
.job .expand { align-self: flex-start; margin-top: 10px; }

.final { position: relative; overflow: hidden; }
.final .card-header { flex-wrap: wrap; }
.final-heading { display: flex; flex: 1 1 260px; align-items: center; gap: 12px; min-width: 0; }
.final-actions { display: flex; flex-wrap: wrap; gap: 8px; }
a.btn { text-decoration: none; }
.final > .activity-line { margin: 14px 20px 0; }
.final .card-body { padding: 18px 20px 24px; }
.final .error-box { margin-top: 0; }
.final #final-body:empty { display: none; }

.prose { max-width: 80ch; font-size: 14.5px; line-height: 1.65; }
.prose.collapsed { max-height: 120px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 40%, transparent); mask-image: linear-gradient(#000 40%, transparent); }
#final-more { margin-top: 8px; }

/* ==========================================================================
   Chats
   ========================================================================== */

/* Side by side when there's room; stacked panels keep a usable height and
   the page scrolls instead. */
.chat-grid {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  grid-auto-rows: minmax(460px, 1fr);
  gap: 16px;
}

.chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 12px 12px 14px;
  border-bottom: 1px solid var(--border);
}

.chat-id { display: flex; flex-direction: column; min-width: 0; }
.chat-id h2 { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.3; }

.toggle-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.toggle-chip input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.toggle-chip .icon { width: 14px; height: 14px; }
.toggle-chip:hover { background: var(--hover); }
.toggle-chip:has(input:checked) { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
.toggle-chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
  padding: 20px 18px;
  overflow-y: auto;
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 300px;
  margin: auto;
  text-align: center;
}

.chat-empty .avatar { width: 44px; height: 44px; margin-bottom: 4px; border-radius: 12px; font-size: 18px; }
.chat-empty h3 { margin: 0; font-size: 15px; font-weight: 600; }
.chat-empty p { margin: 0; color: var(--text-3); font-size: 13px; }

.msg.user { align-self: flex-end; max-width: 85%; }

.msg.user .bubble {
  padding: 9px 14px;
  border-radius: 14px 14px 4px 14px;
  background: var(--surface-3);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg.ai { display: flex; align-items: flex-start; gap: 12px; }
.msg-body { flex: 1; min-width: 0; }
.msg-name { margin: 3px 0 4px; font-size: 13px; font-weight: 600; }
.msg-time { margin-left: 6px; color: var(--text-3); font-size: 12px; font-weight: 400; }
.msg .md { font-size: 14px; line-height: 1.6; }
.msg .activity-line { margin: 2px 0 8px; }
.msg .error-box { margin-top: 8px; }

.thinking { display: none; gap: 4px; padding: 8px 0 4px; }
.msg.pending .thinking { display: flex; }
.msg.pending .md:not(:empty) + .thinking { display: none; }

.thinking i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-3);
  animation: bounce 1.2s ease-in-out infinite;
}

.thinking i:nth-child(2) { animation-delay: 0.15s; }
.thinking i:nth-child(3) { animation-delay: 0.3s; }

.steps { margin: 0 0 8px; color: var(--text-3); font-size: 12.5px; }

.steps summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  list-style: none;
  cursor: pointer;
}

.steps summary::-webkit-details-marker { display: none; }
.steps summary:hover { color: var(--text); }
.steps summary .icon { width: 13px; height: 13px; }

.steps ol {
  margin: 8px 0 0;
  padding-left: 22px;
  font-family: var(--mono);
  font-size: 12px;
}

.steps li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.composer { padding: 0 14px 14px; }

.composer-box {
  padding: 10px 10px 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.composer-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }

.composer textarea {
  display: block;
  width: 100%;
  max-height: 200px;
  padding: 2px 0;
  border: 0;
  outline: none;
  background: transparent;
  line-height: 1.5;
  resize: none;
}

.composer textarea::placeholder { color: var(--text-3); }
.composer-bar { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.composer-bar .hint { margin-right: auto; font-size: 12px; }

/* ==========================================================================
   Toasts
   ========================================================================== */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: 400px;
  padding: 10px 8px 10px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--ink-text);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  animation: toast-in 0.2s ease;
}

.toast.error { background: var(--bad); color: #fff; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity 0.18s, transform 0.18s; }
.toast-text { flex: 1; }

.toast-action {
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: rgb(127 127 127 / 0.22);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.toast .icon-btn { width: 26px; height: 26px; color: inherit; opacity: 0.7; }
.toast .icon-btn:hover { background: rgb(127 127 127 / 0.22); opacity: 1; }

/* ==========================================================================
   Markdown
   ========================================================================== */

.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md pre, .md table, .md blockquote { margin: 0 0 0.85em; }
.md h1, .md h2, .md h3, .md h4 { margin: 1.3em 0 0.5em; line-height: 1.3; letter-spacing: -0.01em; font-weight: 650; }
.md h1 { font-size: 1.4em; }
.md h2 { font-size: 1.2em; }
.md h3 { font-size: 1.05em; }
.md h4 { font-size: 1em; }
.md ul, .md ol { padding-left: 1.4em; }
.md li + li { margin-top: 0.25em; }
.md li::marker { color: var(--text-3); }
.md a { color: var(--accent); text-underline-offset: 2px; }
.md strong { font-weight: 620; }
.md code { font-size: 0.86em; }
.md pre { padding: 12px 14px; overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.md pre code { padding: 0; border: 0; background: none; font-size: 0.84em; }
.md blockquote { margin-left: 0; padding-left: 14px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.md table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 0.93em; }
.md th, .md td { padding: 7px 12px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.md th { background: var(--surface-2); font-weight: 600; }
.md hr { margin: 1.4em 0; border: 0; border-top: 1px solid var(--border); }

/* ==========================================================================
   Shared new pieces
   ========================================================================== */

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-bottom: 14px;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-3);
}

.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
}

.segmented button:hover { color: var(--text); }
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }
.segmented button .icon { width: 15px; height: 15px; }
.segmented.compact { margin: 0; }
.segmented.compact button { height: 28px; font-size: 13px; }

.setting.grow { flex: 1 1 220px; min-width: 200px; }
.setting-block { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.optional { margin-left: 4px; color: var(--text-3); font-weight: 400; }
.setting-label.sub { font-weight: 500; color: var(--text-3); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
}

.tag .icon { width: 12px; height: 12px; }

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px -2px;
  padding: 2px 6px 2px 2px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.crumb:hover { background: var(--hover); color: var(--text); }
.crumb .icon { width: 14px; height: 14px; }

.run-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.danger-text { color: var(--bad); }
.btn.armed { background: var(--bad); color: #fff; }
.muted { color: var(--text-3); }
.refreshing { opacity: 0.6; transition: opacity 0.2s; }
.card-body.flush { padding: 8px 0 4px; }

/* ==========================================================================
   Files, thumbnails and galleries
   ========================================================================== */

.job-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.thumb {
  display: block;
  width: 88px;
  height: 88px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-3);
}

.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s; }
.thumb:hover img { transform: scale(1.04); }

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 220px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
}

.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip .icon { width: 14px; height: 14px; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.shot { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.shot.hero { grid-column: span 2; }

.shot-img {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background:
    repeating-conic-gradient(var(--surface-3) 0% 25%, var(--surface) 0% 50%) 50% / 16px 16px;
}

.shot-img img { display: block; max-width: 100%; max-height: 560px; object-fit: contain; }
.shot figcaption { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.shot-name { overflow: hidden; color: var(--text-2); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }

/* ==========================================================================
   Attachments
   ========================================================================== */

#compose-card { position: relative; }

.attach { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.attach-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.attach-bar .btn { margin-left: -6px; }
.attach-bar .hint { font-size: 12px; }

.attach-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }

.attach-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 280px;
  padding: 5px 6px 5px 5px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
}

.attach-chip.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.attach-chip.uploading { opacity: 0.75; }

.attach-preview {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  overflow: hidden;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--text-2);
}

.attach-preview img { width: 100%; height: 100%; object-fit: cover; }
.attach-preview .icon { width: 17px; height: 17px; }

.attach-ext {
  position: absolute;
  bottom: 2px;
  padding: 0 3px;
  border-radius: 3px;
  background: var(--bad);
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  line-height: 11px;
}

.attach-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.attach-name { overflow: hidden; font-size: 13px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.attach-size { color: var(--text-3); font-size: 11.5px; }

.drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent-soft) 88%, transparent);
  color: var(--accent);
  font-weight: 600;
  pointer-events: none;
}

.drop-overlay .icon { width: 28px; height: 28px; }

.run-attachments { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.run-attach-label { color: var(--text-2); font-size: 13px; font-weight: 550; }
a.file-chip { text-decoration: none; }
a.file-chip:hover { border-color: var(--accent); color: var(--text); }

/* ==========================================================================
   Video studio
   ========================================================================== */

.connect-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.connect-row[data-state="problem"] { border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); background: var(--warn-soft); }

.connect-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-2);
}

.connect-row[data-state="ready"] .connect-icon { background: var(--ok-soft); color: var(--ok); }
.connect-text { display: flex; flex: 1; flex-direction: column; gap: 1px; min-width: 0; }
.connect-text strong { font-size: 13.5px; }
.connect-text span { color: var(--text-2); font-size: 12.5px; }

.avatar.step-you { background: var(--text-2); }
.avatar.step-you .icon { width: 14px; height: 14px; stroke: #fff; }

.video-list { display: flex; flex-direction: column; gap: 8px; }

.video-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px 8px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.video-item:hover { border-color: var(--accent); }
.video-item .status-dot { position: static; box-shadow: none; }

.video-thumb {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  flex: none;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text-3);
}

.video-thumb img { width: 100%; height: 100%; object-fit: cover; }
.video-text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.video-text strong { overflow: hidden; font-size: 13.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.video-text span { color: var(--text-3); font-size: 12px; }

.video-result { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 20px; }
.video-result video { display: block; max-width: 100%; max-height: 70vh; border-radius: 10px; background: #000; }
.video-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; width: 100%; }
.video-meta { flex: 1; color: var(--text-2); font-size: 13px; }

.shots { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }

.shot-bible {
  padding: 12px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  font-size: 13px;
}

.shot-bible p { margin: 4px 0 0; color: var(--text-2); }

.shot-card { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }

.shot-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.shot-head strong { flex: 1; font-size: 14px; }

.shot-num {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--ink-text);
  font-size: 12px;
  font-weight: 700;
}

.shot-body { display: flex; gap: 14px; padding: 12px 14px; }
.shot-frame-box { display: flex; flex: none; flex-direction: column; align-items: center; gap: 6px; }
.shot-frame { display: block; width: 120px; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; }
.shot-frame img { display: block; width: 100%; }
.shot-text { flex: 1; min-width: 0; }
.shot-prompt { margin: 0; font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; }
.shot-line { margin: 8px 0 0; color: var(--text-2); font-size: 12.5px; }

/* ==========================================================================
   Continue and related runs
   ========================================================================== */

.continue-card { border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.continue-card .card-body { display: flex; flex-direction: column; gap: 12px; }
.continue-card .settings { margin-top: 2px; }
.continue-card textarea { min-height: 72px; }
.segmented button:disabled { opacity: 0.45; cursor: not-allowed; }

.quick-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
}

.chip:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.run-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 12px; }
.run-followups { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.run-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 320px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
}

.run-link:hover { border-color: var(--accent); }
.run-link .icon { width: 13px; height: 13px; color: var(--text-3); }
.run-link .status-dot { position: static; box-shadow: none; }
.run-link-label { color: var(--text-2); font-size: 12.5px; font-weight: 550; }
.run-link .run-link-label { color: var(--text-3); }
.run-link-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ==========================================================================
   Creative studio
   ========================================================================== */

.flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  counter-reset: flow;
}

.flow li {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.flow li + li::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -13px;
  width: 14px;
  height: 1px;
  background: var(--border-strong);
}

.flow div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.flow strong { font-size: 13.5px; }
.flow span:not(.avatar) { color: var(--text-2); font-size: 12.5px; line-height: 1.4; }

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

.format {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.format:hover { background: var(--surface-2); }
.format[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }

.format-frame {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 7px;
  background: var(--surface-3);
}

.format-frame i { display: block; border: 1.5px solid var(--text-2); border-radius: 3px; }
.format[aria-checked="true"] .format-frame i { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); }
.format-text { display: flex; flex-direction: column; line-height: 1.3; }
.format-text strong { font-size: 13px; font-weight: 600; }
.format-text span { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }

.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}

.recent-shot {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.recent-shot:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.recent-shot img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface-3); }
.recent-caption { display: flex; flex-direction: column; gap: 1px; padding: 10px 12px; min-width: 0; }
.recent-caption strong { overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.recent-caption span { color: var(--text-3); font-size: 12px; }

.recent-shot { position: relative; }
.recent-shot.portrait img { aspect-ratio: 4 / 5; object-position: center 30%; }

.play-mark {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.55);
  color: #fff;
}

.play-mark .icon { width: 13px; height: 13px; fill: currentColor; stroke: none; margin-left: 2px; }

.flow.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.flow.five li { flex-direction: column; gap: 8px; padding: 12px 14px; }

/* Your apps ----------------------------------------------------------- */

.app-picker { display: flex; flex-wrap: wrap; gap: 8px; }

.app-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 280px;
  padding: 7px 14px 7px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.app-chip:hover { background: var(--surface-2); }
.app-chip[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.app-chip-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.app-chip-text strong { font-size: 13.5px; font-weight: 600; }
.app-chip-text span { overflow: hidden; color: var(--text-3); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.app-icon {
  display: grid;
  flex: none;
  place-items: center;
  overflow: hidden;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.app-icon.md { width: 36px; height: 36px; font-size: 15px; }
.app-icon img { width: 100%; height: 100%; object-fit: cover; }

.app-empty {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  color: var(--text-2);
}

.app-empty .icon { flex: none; width: 22px; height: 22px; color: var(--text-3); }
.app-empty div { display: flex; flex-direction: column; gap: 2px; }
.app-empty strong { color: var(--text); font-size: 13.5px; }
.app-empty span { font-size: 12.5px; }

.app-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

.app-checks { display: flex; flex-wrap: wrap; gap: 6px; }

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
}

.check-pill .icon { width: 12px; height: 12px; }
.check-pill.ok { background: var(--ok-soft); color: var(--ok); }
.check-pill.warn { background: var(--warn-soft); color: var(--warn); }
.check-pill.bad { background: var(--bad-soft); color: var(--bad); }
.check-pill.neutral { background: var(--surface-3); color: var(--text-2); }

.input.narrow { width: 96px; }
.input.sm { height: 30px; padding: 4px 10px; font-size: 13px; }

.source-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 16px;
}

.source-row .segmented { margin: 0; }
.source-row .hint { font-size: 12.5px; }

.attach-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 24px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.attach-pair .attach { margin-top: 0; gap: 8px; }

/* Finished video ads ---------------------------------------------------- */

.ad-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.ad-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.ad-card[data-state="failed"] { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }

.ad-media {
  display: grid;
  place-items: center;
  aspect-ratio: 9 / 16;
  background: #0b0b0e;
  color: #c9c9d2;
  font-size: 13px;
}

.ad-media video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.ad-media .icon { width: 22px; height: 22px; }
.ad-card[data-state="failed"] .ad-media { grid-auto-flow: row; align-content: center; gap: 8px; aspect-ratio: 9 / 8; }

.ad-body { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px; min-width: 0; }
.ad-name { font-size: 12.5px; font-weight: 600; overflow-wrap: anywhere; }
.ad-facts { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.ad-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ad-notes { margin: 0; color: var(--text-2); font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.ad-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

/* App dialog ------------------------------------------------------------ */

.dialog.wide { width: min(720px, calc(100vw - 32px)); }

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

.color-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  font-size: 13px;
  cursor: pointer;
}

.color-field input {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  cursor: pointer;
}

.color-field input::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input::-webkit-color-swatch { border: 1px solid rgb(0 0 0 / 0.15); border-radius: 6px; }

.app-file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.app-file.disabled { opacity: 0.55; }

.app-file-preview {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 9px;
  background: var(--surface-3);
  color: var(--text-3);
}

.app-file-preview img { width: 100%; height: 100%; object-fit: cover; }
.app-file-preview .icon { width: 18px; height: 18px; }
.app-file-text { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.app-file-text strong { font-size: 13.5px; }
.app-file-text > span { color: var(--text-2); font-size: 12.5px; line-height: 1.45; }
.app-file-actions { display: flex; flex: none; align-items: center; gap: 6px; }
.app-file-actions .input.narrow { width: 64px; }

.badge-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.badge-list:empty { display: none; }

.badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 3px 3px 4px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 550;
}

.badge-chip img { height: 22px; border-radius: 3px; }

.design-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.design-list:empty { display: none; }

.design-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  padding: 4px 4px 4px 4px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
}

.design-chip img { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; background: var(--surface-3); }
.design-chip-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.design-chip-text strong { overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.design-chip-text span { color: var(--text-3); font-size: 11.5px; }

.design-row { align-items: center; }

.design-preview {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-2);
  font-size: 12.5px;
  text-decoration: none;
}

.design-preview img {
  height: 64px;
  max-width: 120px;
  border: 1px solid var(--border);
  border-radius: 8px;
  object-fit: contain;
  background: var(--surface-3);
}

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


/* Campaigns ------------------------------------------------------------------ */

.launcher-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }

.lc-tabs {
  display: flex;
  gap: 4px;
  margin: -8px 0 20px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}

.lc-tabs::-webkit-scrollbar { display: none; }

.lc-tabs button {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 7px;
  margin-bottom: -1px;
  padding: 10px 10px 11px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-3);
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
}

.lc-tabs button:hover { color: var(--text); }
.lc-tabs button[aria-selected="true"] { border-bottom-color: var(--text); color: var(--text); }
.lc-tabs button .icon { width: 15px; height: 15px; }

.lc-view { gap: 18px; }
.lc-loading { display: flex; align-items: center; gap: 10px; padding: 24px 4px; color: var(--text-2); }

/* the older card style, still used by the settings card and empty states */
.lc-card .card-header h2 { font-size: 15px; }
.lc-card .card-body > * + * { margin-top: 14px; }
.lc-card .card-body.flush { padding: 0; }
.lc-card .card-body.flush > * + * { margin-top: 0; }

/* panels: a slim header bar over the content */
.lc-panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.lc-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 10px 14px 10px 18px;
  border-bottom: 1px solid var(--border);
}

.lc-panel-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.lc-panel-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.lc-panel-body { padding: 16px 18px 18px; }
.lc-panel-body > * + * { margin-top: 14px; }
.lc-panel-flush > .lc-empty { border-top: 0; }
.lc-panel + .lc-panel { margin-top: 0; }

.lc-count {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.lc-count:empty { display: none; }

/* small pieces */
.lc-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.lc-pill::before { content: ""; width: 6px; height: 6px; flex: none; border-radius: 50%; background: currentColor; }
.lc-pill.plain::before { display: none; }
.lc-pill.ok { background: var(--ok-soft); color: var(--ok); }
.lc-pill.warn { background: var(--warn-soft); color: var(--warn); }
.lc-pill.bad { background: var(--bad-soft); color: var(--bad); }
.lc-pill.info { background: var(--accent-soft); color: var(--accent); }

.lc-ib { width: 30px; height: 30px; }
.lc-ib .icon { width: 15px; height: 15px; }
.lc-ib.danger:hover { background: var(--bad-soft); color: var(--bad); }
.lc-actions { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }

.lc-info { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 2px; color: var(--text-3); vertical-align: -3px; cursor: help; }
.lc-info .icon { width: 14px; height: 14px; }
.lc-info:hover, .lc-info:focus-visible { color: var(--text); outline: none; }

.lc-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  background: color-mix(in srgb, hsl(var(--hue) 65% 55%) 16%, var(--surface));
  color: color-mix(in srgb, hsl(var(--hue) 60% 45%) 75%, var(--text));
  font-size: 14px;
  font-weight: 650;
}

.lc-mark.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 12px; }

.lc-facts { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 8px 12px; margin: 0; font-size: 12.5px; line-height: 1.45; }
.lc-facts dt { color: var(--text-3); }
.lc-facts dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }

.lc-notes:empty { display: none; }
.lc-note { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--text-2); font-size: 12.5px; }
.lc-note .icon { width: 14px; height: 14px; flex: none; }
.lc-note.bad { color: var(--bad); }
.lc-note .link-btn { margin-left: 4px; font-size: 12.5px; }

.lc-muted { color: var(--text-3); font-size: 12.5px; }
.lc-err { color: var(--bad); font-size: 12.5px; }
.lc-ok { color: var(--ok); }
.lc-req { color: var(--bad); }
.lc-help { color: var(--text-3); font-size: 12px; line-height: 1.45; }
.lc-nowrap { white-space: nowrap; }
.lc-trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lc-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 36px 20px; color: var(--text-3); font-size: 13px; text-align: center; }
.lc-empty .icon { width: 26px; height: 26px; stroke-width: 1.5; }

/* forms */
.lc-field { min-width: 0; }
.lc-field .input, .lc-field .select { width: 100%; }
.lc-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.lc-form-grid > .lc-wide { grid-column: 1 / -1; }
.lc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.lc-grid > .lc-wide { grid-column: 1 / -1; }
.lc-grid > .lc-span2 { grid-column: span 2; }
.lc-form-section { margin: 10px 0 -2px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--text); font-size: 13px; font-weight: 650; }
.lc-grid > .lc-form-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.lc-end { justify-content: flex-end; }

.lc-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.lc-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
}

.lc-check { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-size: 13.5px; cursor: pointer; }
.lc-check input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.lc-check-field { min-height: 36px; }
.lc-checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.lc-choices { display: flex; flex-direction: column; gap: 6px; }
.lc-choice { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.lc-choice .input { width: 320px; max-width: 100%; height: 30px; font-size: 13px; }
.lc-inline-add { display: flex; gap: 8px; }
.lc-inline-add .input, .lc-inline-add .select { flex: 1; }
.lc-pick { display: grid; gap: 6px; }

/* toggle chips, e.g. who can use an app */
.lc-toggles { display: flex; flex-wrap: wrap; gap: 6px; }

.lc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
}

.lc-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.lc-toggle .icon { display: none; width: 13px; height: 13px; stroke-width: 2.5; }
.lc-toggle:hover { border-color: var(--text-3); color: var(--text); }
.lc-toggle:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); color: var(--accent); }
.lc-toggle:has(input:checked) .icon { display: block; }
.lc-toggle:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--focus-ring); }

/* tables */
.lc-tbl { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.lc-tbl th { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text-3); font-size: 12px; font-weight: 550; text-align: left; white-space: nowrap; }
.lc-tbl td { padding: 11px 12px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
.lc-tbl tr:last-child td { border-bottom: 0; }
.lc-tbl tbody tr { transition: background 0.1s; }
.lc-tbl tbody tr:hover { background: var(--surface-2); }
.lc-tbl th:first-child, .lc-tbl td:first-child { padding-left: 18px; }
.lc-tbl th:last-child, .lc-tbl td:last-child { padding-right: 12px; }
.lc-tbl .lc-act-col { width: 112px; }
.lc-tbl tr.clickable { cursor: pointer; }
.lc-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lc-cell-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lc-cell-title { overflow: hidden; color: var(--text); font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.lc-cell-sub { overflow: hidden; color: var(--text-3); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.lc-tbl-foot { display: flex; align-items: center; justify-content: center; padding: 10px; border-top: 1px solid var(--border); }

.lc-searchbox { position: relative; display: flex; flex: 1 1 200px; align-items: center; max-width: 280px; }
.lc-searchbox .icon { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--text-3); pointer-events: none; }
.lc-searchbox .input { height: 32px; padding: 0 10px 0 32px; border-radius: 8px; font-size: 13px; }

/* the campaign composer: setup and library on the left, the review on the right */
.lc-compose { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.lc-compose-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.lc-compose-side { position: sticky; top: 20px; min-width: 0; }

.lc-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lc-toolbar .segmented { margin: 0; }
.lc-sel-info { color: var(--accent); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.lc-sel-info:empty { display: none; }
.lc-seg-count { color: var(--text-3); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.lc-seg-picked { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 650; }
.lc-sync-info { font-size: 12px; white-space: nowrap; }
.lc-panel-actions .select.sm { width: auto; }

.lc-library { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 14px 10px; }

.lc-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.lc-tile-media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 9px;
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--border);
  transition: box-shadow 0.15s;
}

.lc-tile-media img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s ease, opacity 0.15s; }
.lc-tile-media > .lc-muted { display: grid; place-items: center; height: 100%; font-size: 12px; }
.lc-tile:hover .lc-tile-media img { transform: scale(1.04); }
.lc-tile:focus-visible { outline: none; }
.lc-tile:focus-visible .lc-tile-media { box-shadow: 0 0 0 3px var(--focus-ring); }
.lc-tile.on .lc-tile-media { box-shadow: 0 0 0 2px var(--accent); }
.lc-tile.on .lc-tile-media img { opacity: 0.82; }
.lc-tile-name { overflow: hidden; padding: 0 2px; color: var(--text-2); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.lc-tile.on .lc-tile-name { color: var(--text); }

.lc-tick {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1.5px solid rgb(255 255 255 / 0.95);
  border-radius: 50%;
  background: rgb(0 0 0 / 0.3);
  color: transparent;
  opacity: 0;
  transition: opacity 0.15s;
}

.lc-tick .icon { width: 12px; height: 12px; stroke-width: 3; }
.lc-tile:hover .lc-tick, .lc-tile.on .lc-tick { opacity: 1; }
.lc-tile.on .lc-tick { border-color: var(--accent); background: var(--accent); color: #fff; }

.lc-lib-empty { display: flex; flex-direction: column; grid-column: 1 / -1; align-items: center; gap: 8px; padding: 44px 0; color: var(--text-3); font-size: 13px; }
.lc-lib-empty .icon { width: 26px; height: 26px; stroke-width: 1.5; }

.lc-library-panel { position: relative; }

.lc-library-panel.dragging::after {
  content: "Drop to upload to Meta";
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent-soft) 88%, transparent);
  color: var(--accent);
  font-size: 14px;
  font-weight: 650;
}

.lc-upload { display: flex; flex-direction: column; gap: 7px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.lc-upload-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--text-2); font-size: 12.5px; font-variant-numeric: tabular-nums; }

.lc-lib-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 4px; }
.lc-lib-footer .select { width: auto; }
.lc-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.lc-pg { min-width: 30px; height: 28px; padding: 0 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text-2); font-size: 12.5px; font-variant-numeric: tabular-nums; cursor: pointer; }
.lc-pg:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.lc-pg.on { border-color: var(--text); background: var(--text); color: var(--surface); font-weight: 650; }
.lc-pg:disabled { opacity: 0.4; cursor: default; }

.lc-review .lc-panel-body { padding: 0; }
.lc-review .lc-panel-body > * + * { margin-top: 0; }
.lc-review .lc-panel-body > :first-child { padding: 14px 18px 16px; }
.lc-side-sec { padding: 14px 18px 16px; border-top: 1px solid var(--border); }
.lc-side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.lc-picked { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; }
.lc-picked-thumb { width: 32px; height: 40px; overflow: hidden; border-radius: 6px; background: var(--surface-3); }
.lc-picked-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.lc-picked-more { padding: 0 4px; color: var(--text-2); font-size: 12px; font-weight: 600; }
.lc-plan { margin: 10px 0 0; color: var(--text-2); font-size: 12.5px; line-height: 1.45; }
.lc-plan:empty { display: none; }
.lc-side-fields { display: flex; flex-direction: column; gap: 12px; }
.lc-side-fields .setting { gap: 6px; }
.lc-side-go { display: flex; flex-direction: column; gap: 10px; border-radius: 0 0 var(--radius) var(--radius); background: var(--surface-2); }
.lc-launch { width: 100%; height: 40px; }
.lc-launch-hint { margin: 0; color: var(--text-2); font-size: 12.5px; line-height: 1.45; }
.lc-launch-hint.lc-err { color: var(--bad); }

/* performance (Ads Manager, mirrored) */
.lc-perf-top { display: flex; flex-direction: column; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.lc-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.lc-kpi { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.lc-kpi-label { color: var(--text-3); font-size: 12px; font-weight: 550; }
.lc-kpi strong { font-size: 20px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.lc-kpi-sub { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.lc-perf-meta { margin-left: auto; font-size: 12px; }
.lc-perf-scroll { position: relative; overflow-x: auto; }
.lc-perf { min-width: 760px; }
.lc-perf th { white-space: normal; vertical-align: bottom; line-height: 1.3; }
/* Every Campaigns tab is as wide as the window (Performance's table needs it), so switching tabs moves nothing. */
#view-campaigns { max-width: none; }
.lc-perf tfoot td { border-top: 2px solid var(--border); border-bottom: 0; background: var(--surface-2); color: var(--text); font-weight: 650; }
.lc-perf tfoot td.num { font-variant-numeric: tabular-nums; }
.lc-perf tfoot .lc-muted { font-weight: 400; }
.lc-profit { display: flex; flex-direction: column; gap: 10px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.lc-profit[hidden] { display: none; }
.lc-profit-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.lc-profit-head h3 { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13.5px; font-weight: 650; color: var(--text); }
.lc-profit-head .lc-muted { font-size: 12px; }
.lc-profit .lc-note { margin: 0; }
.lc-kpi.lc-pos strong { color: var(--ok); }
.lc-kpi.lc-neg strong { color: var(--bad); }
.lc-perf-nets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.lc-perf-nets .segmented { margin: 0; }
.lc-col-picker { display: flex; flex-direction: column; gap: 16px; }
.lc-col-picker section { display: flex; flex-direction: column; gap: 8px; }
.lc-col-picker h3 { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--text); }
.lc-col-picker h3 .lc-muted { font-weight: 400; }
.lc-col-picker .lc-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 16px; }
.lc-col-picker .lc-check .lc-info { margin-left: -2px; }
.lc-col-picker > .link-btn { align-self: flex-start; }
.lc-perf-notes { display: flex; flex-direction: column; gap: 6px; }
.lc-adjust-links td:first-child { width: 180px; }
.lc-adjust-links .lc-adjust-edit { width: 40px; text-align: right; }
.lc-adjust-choices { margin-top: 12px; }
.lc-adjust-choices .lc-check { align-items: flex-start; }
.lc-adjust-choices .lc-pill { margin-left: 8px; }
.lc-perf .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lc-perf td.num { color: var(--text); }
.lc-perf th.lc-sort { cursor: pointer; user-select: none; }
.lc-perf th.lc-sort:hover { color: var(--text); }
.lc-perf th.lc-sort.asc::after { content: " ↑"; }
.lc-perf th.lc-sort.desc::after { content: " ↓"; }
.lc-perf tr.lc-sub td { background: var(--surface-2); }
/* an open campaign's ad sets / ad groups (and countries): pushed in, with a line down from the campaign's arrow */
.lc-perf tr.lc-sub td.lc-name { position: relative; padding-left: 56px; }
.lc-perf tr.lc-sub td.lc-name::before { content: ""; position: absolute; top: -1px; bottom: 0; left: 22px; width: 1px; background: var(--border-strong); }
.lc-perf tr.lc-sub .lc-cell-title { font-weight: 500; }
.lc-budget { display: inline-flex; align-items: center; gap: 3px; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lc-budget .lc-ib { width: 26px; height: 26px; opacity: 0; transition: opacity 0.1s; }
.lc-perf tr:hover .lc-budget .lc-ib, .lc-budget .lc-ib:focus-visible { opacity: 1; }
.lc-twist { display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--text-3); cursor: pointer; }
.lc-twist:hover { background: var(--hover); color: var(--text); }
.lc-twist .icon { width: 14px; height: 14px; transition: transform 0.15s; }
.lc-twist.open .icon { transform: rotate(90deg); }

.lc-switch { position: relative; width: 34px; height: 20px; flex: none; padding: 0; border: 0; border-radius: 999px; background: var(--border-strong); cursor: pointer; transition: background 0.15s; }
.lc-switch-knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 0.25); transition: transform 0.15s; }
.lc-switch[aria-checked="true"] { background: var(--accent); }
.lc-switch[aria-checked="true"] .lc-switch-knob { transform: translateX(14px); }
.lc-switch:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }
.lc-switch:disabled { opacity: 0.5; cursor: wait; }

/* apps */
.lc-apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.lc-app { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.lc-app-head { display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 14px; }
.lc-app-name { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }
.lc-app-name strong { overflow: hidden; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.lc-app-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.lc-app-body { padding: 4px 14px 14px; }
.lc-app-access { display: flex; flex-direction: column; gap: 8px; margin-top: auto; padding: 12px 14px 14px; border-top: 1px solid var(--border); }
.lc-app-access > span { color: var(--text-3); font-size: 12px; font-weight: 550; }

/* connections */
.lc-conns { display: flex; flex-direction: column; }
.lc-conn { border-top: 1px solid var(--border); }
.lc-conn:first-child { border-top: 0; }
.lc-conn-head { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 18px; }
.lc-conn-main { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.lc-conn-main strong { font-size: 13.5px; font-weight: 600; }
.lc-conn-details { padding: 0 18px 16px 64px; }
.lc-conn-details > * + * { margin-top: 12px; }
.lc-conn-details summary { color: var(--text-2); font-size: 12.5px; font-weight: 550; cursor: pointer; }
.lc-conn-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; }
.lc-conn-grid h3, .lc-conn-details > h3 { margin: 0 0 8px; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.lc-mini-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.lc-mini-tbl td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--border); color: var(--text-2); }
.lc-mini-tbl tr:last-child td { border-bottom: 0; }

.lc-settings-rows { display: flex; flex-direction: column; }
.lc-setting-row { display: grid; grid-template-columns: 230px minmax(0, 1fr) minmax(0, 1fr) auto; align-items: start; gap: 14px; padding: 16px 18px; border-top: 1px solid var(--border); }
.lc-setting-save { padding-top: 24px; }
.lc-pad-x { padding: 0 18px; }
.lc-pad-x .error-box { margin: 0 0 16px; }
.lc-setting-row:first-child { border-top: 0; }
.lc-setting-row > .lc-setting-name { align-self: center; display: flex; flex-direction: column; gap: 2px; }
.lc-setting-name strong { font-size: 13.5px; font-weight: 600; }
.lc-setting-name span { color: var(--text-3); font-size: 12px; }
.lc-setting-row .setting-label + .lc-help { margin-top: -2px; }
.lc-found { min-height: 16px; color: var(--ok); font-size: 12px; }

/* editors (template, app, TikTok): a full-width panel with a back button */
.lc-editor .lc-panel-head h2 { gap: 6px; }
.lc-editor-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); background: var(--surface-2); }
.lc-editor-foot .spacer { flex: 1; }

/* dialogs */
.lc-dialog-form { display: contents; }
.lc-dialog .dialog-body > * + * { margin-top: 14px; }
.lc-dialog .dialog-body > p { margin: 0; }
.lc-dialog .lc-facts { grid-template-columns: 116px minmax(0, 1fr); gap: 9px 14px; font-size: 13px; }
.lc-dialog-note { margin: 0; color: var(--text-3); font-size: 12.5px; line-height: 1.5; }

/* pickers */
.lc-picker { display: flex; flex-direction: column; gap: 8px; }
.lc-loc-chips { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.lc-loc-row { display: flex; align-items: baseline; gap: 10px; }
.lc-loc-label { min-width: 62px; color: var(--ok); font-size: 12px; font-weight: 600; }
.lc-loc-label.exc { color: var(--bad); }
.lc-loc-controls { display: flex; align-items: flex-start; gap: 8px; max-width: 760px; }
/* beats .lc-field .select { width: 100% }, which would squeeze the search box */
.lc-loc-controls .lc-loc-mode { flex: none; width: 116px; }
.lc-loc-controls .lc-suggest-wrap { flex: 1 1 auto; min-width: 0; max-width: none; }
.lc-loc-controls .btn { flex: none; }
.lc-loc-controls .btn.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

.lc-sel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 4px 0 10px;
  border-radius: 999px;
  background: var(--surface-3);
  font-size: 12.5px;
  font-weight: 550;
}

.lc-sel.region { background: var(--accent-soft); color: var(--accent); }
.lc-sel.excluded { background: var(--bad-soft); color: var(--bad); }
.lc-code { color: var(--text-3); font-size: 11px; }
.lc-x { width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text-3); font-size: 15px; line-height: 1; cursor: pointer; }
.lc-x:hover { background: var(--bad-soft); color: var(--bad); }
.lc-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lc-suggest-wrap { position: relative; flex: 1; max-width: 520px; }

.lc-suggest {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 10;
  padding: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.lc-suggest-item { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 7px; font-size: 13.5px; cursor: pointer; }
.lc-suggest-item.on, .lc-suggest-item:hover { background: var(--hover); }

.lc-tree { max-width: 760px; max-height: 360px; padding: 6px 0; overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.lc-tree-row { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 13.5px; font-weight: 550; cursor: pointer; }
.lc-tree-row:hover { background: var(--hover); }
.lc-tree-row label { display: flex; flex: 1; align-items: center; gap: 8px; cursor: pointer; }
.lc-tree-row input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.lc-tree-row .lc-muted { margin-left: auto; }
.lc-tree-row.kid { padding-left: 50px; font-weight: 400; }
.lc-tree-row.kid.is-excluded { color: var(--bad); }
.lc-exc-tag { margin-left: auto; color: var(--bad); font-size: 11px; }
.lc-tree-sep { margin: 6px 0; border-top: 1px solid var(--border); }
.lc-twisty { width: 18px; padding: 0; border: 0; background: none; color: var(--text-3); font-size: 12px; cursor: pointer; }

/* launch progress */
.lc-progress { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.lc-progress-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; font-size: 13px; }
.lc-pct { color: var(--text-2); font-weight: 650; font-variant-numeric: tabular-nums; }
.lc-bar { height: 6px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.lc-fill { width: 0; height: 100%; border-radius: 999px; background: var(--accent); transition: width 0.4s ease; }
.lc-progress[data-state="done"] .lc-fill { background: var(--ok); }
.lc-progress[data-state="failed"] .lc-fill { background: var(--bad); }
.lc-progress[data-state="done"] strong { color: var(--ok); }
.lc-progress[data-state="failed"] strong { color: var(--bad); }
.lc-progress .lc-muted { margin-top: 6px; }
.lc-result { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 13px; }
.lc-result[data-state="ok"] { border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); background: var(--ok-soft); }
.lc-result[data-state="err"] { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); background: var(--bad-soft); }
.lc-result-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.lc-details summary { color: var(--text-2); font-size: 12.5px; font-weight: 550; cursor: pointer; }
.lc-details .lc-log { margin-top: 8px; max-height: 300px; }

.lc-sum-note { margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: var(--surface-3); font-size: 13px; }
.lc-sum-note.warn { border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); background: var(--warn-soft); font-weight: 550; }
.lc-dup { display: flex; flex-direction: column; gap: 14px; }
.lc-dup-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 14px; }

@media (max-width: 1180px) {
  .lc-compose { grid-template-columns: minmax(0, 1fr); }
  .lc-compose-side { position: static; }
}

@media (max-width: 960px) {
  .lc-grid, .lc-form-grid, .lc-conn-grid, .lc-setting-row { grid-template-columns: minmax(0, 1fr); }
  .lc-grid > .lc-span2 { grid-column: auto; }
  .lc-library { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .lc-dup-row, .lc-choice { grid-template-columns: minmax(0, 1fr); }
  .lc-loc-controls { flex-wrap: wrap; }
  .lc-hide-sm { display: none; }
  .lc-apps { grid-template-columns: minmax(0, 1fr); }
  .lc-conn-details { padding-left: 18px; }
  .lc-panel-head { flex-wrap: wrap; }
  .lc-searchbox { max-width: none; }
}

.publish-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.publish-controls .settings { margin-top: 6px; }
.publish-switches { gap: 10px 22px; }
.publish-note { margin: 8px 0 0; font-size: 12.5px; }
.publish-note:empty { display: none; }
.publish-note.warn { color: var(--warn); }

.publish-card h2 { display: flex; align-items: center; gap: 8px; }
.publish-card h2 .icon { width: 17px; height: 17px; color: var(--text-2); }
.publish-record { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.publish-state { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.publish-state[data-state="done"] strong { color: var(--ok); }
.publish-state[data-state="failed"] strong { color: var(--bad); }
.publish-state span { color: var(--text-2); font-size: 13px; }
.publish-campaign { display: flex; align-items: center; gap: 8px; font-size: 13px; font-variant-numeric: tabular-nums; }

.publish-log {
  max-height: 180px;
  margin: 0;
  padding: 8px 12px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  list-style: none;
}

.publish-log li { display: flex; gap: 10px; }
.publish-log li.warn { color: var(--warn); }
.publish-log li.error { color: var(--bad); }
.publish-log li.ok { color: var(--ok); }
.publish-time { flex: none; color: var(--text-3); }

/* ==========================================================================
   Discuss
   ========================================================================== */

.discussion { display: flex; flex-direction: column; }
.disc-title { margin-top: 8px !important; line-height: 1.45; }

.transcript {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 64vh;
  min-height: 200px;
  margin-top: 14px;
  padding: 20px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}

.transcript .msg.ai { max-width: 820px; }
.transcript .msg.user { display: flex; flex-direction: column; align-items: flex-end; max-width: 70%; }
.user-name { margin-right: 4px; }
#disc-comment-form { padding-top: 12px; border-top: 1px solid var(--border); }

.plan-preview { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }

.preview-item {
  position: relative;
  padding: 12px 14px 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.preview-item::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: -1px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--agent);
}

.preview-head { display: flex; align-items: center; gap: 10px; }
.preview-head strong { flex: 1; font-size: 14px; }
.preview-agent { color: var(--text-2); font-size: 12.5px; }
.preview-text {
  display: -webkit-box;
  margin: 6px 0 0 34px;
  overflow: hidden;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
  cursor: pointer;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.preview-text.open { display: block; }
.preview-deps { display: inline-block; margin: 6px 0 0 34px; color: var(--text-3); font-size: 12px; }

/* ==========================================================================
   Schedules
   ========================================================================== */

.startup-card { padding: 16px 20px; }
.startup-row { display: flex; align-items: center; gap: 14px; }

.startup-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}

.startup-text { display: flex; flex: 1; flex-direction: column; gap: 2px; }
.startup-text span { color: var(--text-2); font-size: 13px; }

.schedule-list { display: flex; flex-direction: column; gap: 12px; }
.schedule { padding: 16px 18px; }
.schedule[data-enabled="false"] { opacity: 0.72; }
.schedule-top { display: flex; align-items: center; gap: 14px; }

.avatar-stack { display: flex; flex: none; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar + .avatar { margin-left: -8px; }

.schedule-title { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.schedule-title h3 { margin: 0; overflow: hidden; font-size: 14.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.schedule-what { color: var(--text-2); font-size: 13px; }

.schedule-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 12px 0 0 58px;
  color: var(--text-2);
  font-size: 13px;
}

.schedule-meta span { display: inline-flex; align-items: center; gap: 6px; }
.schedule-meta .icon { width: 14px; height: 14px; color: var(--text-3); }

.schedule-error {
  display: flex;
  gap: 8px;
  margin: 10px 0 0 58px;
  color: var(--warn);
  font-size: 12.5px;
}

.schedule-error .icon { width: 14px; height: 14px; margin-top: 2px; }

.schedule-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0 58px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.schedule-last { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.empty-card { padding: 12px; }

/* ==========================================================================
   Dialog
   ========================================================================== */

.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.dialog::backdrop { background: rgb(10 10 14 / 0.45); backdrop-filter: blur(2px); }

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.dialog-header h2 { margin: 0; font-size: 16px; font-weight: 600; }
.dialog-body { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; }
.dialog-body .settings { margin-top: 0; }

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.dialog-note { margin: 0; color: var(--text-2); font-size: 13px; }
.dialog-section { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.dialog .error-box { margin: 0; }

.days { display: flex; flex-wrap: wrap; gap: 6px; }

.day {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 46px;
  height: 32px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
}

.day input { position: absolute; opacity: 0; }
.day:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.day:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

input[type="time"].input, input[type="date"].input { width: auto; height: 36px; padding: 0 10px; }

/* ==========================================================================
   Usage
   ========================================================================== */

.limits { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }

.limit-card { padding: 16px 18px; }
.limit-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.limit-title { display: flex; flex: 1; flex-direction: column; line-height: 1.3; }
.limit-title strong { font-size: 14.5px; }
.limit-title span { color: var(--text-3); font-size: 12px; }
.limit-empty { margin: 8px 0 0; color: var(--text-3); font-size: 13px; }

.meter-row { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.meter-label { display: flex; justify-content: space-between; font-size: 13px; }
.meter-label span { color: var(--text-2); }
.meter-label strong { font-weight: 600; font-variant-numeric: tabular-nums; }

.meter {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-3));
}

.meter i {
  position: absolute;
  inset: 0 auto 0 0;
  min-width: 4px;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.4s ease;
}

.meter[data-level="warning"] { background: color-mix(in srgb, var(--warn) 16%, var(--surface-3)); }
.meter[data-level="warning"] i { background: var(--warn); }
.meter[data-level="danger"] { background: color-mix(in srgb, var(--bad) 16%, var(--surface-3)); }
.meter[data-level="danger"] i { background: var(--bad); }
.meter-reset { color: var(--text-3); font-size: 12px; }

.filter-row { display: flex; align-items: center; gap: 10px; }
.filter-label { color: var(--text-2); font-size: 13px; font-weight: 550; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; }
.tile-label { color: var(--text-2); font-size: 13px; }
.tile-value { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; }
.tile-split { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--text-2); font-size: 12.5px; }
.tile-part { display: inline-flex; align-items: center; gap: 6px; }
.tile-note { color: var(--text-3); font-size: 12px; line-height: 1.4; }

.key, .swatch, .line-key { display: inline-block; flex: none; background: var(--agent); }
.key { width: 8px; height: 8px; border-radius: 2px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; }
.line-key { width: 12px; height: 2px; border-radius: 1px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; color: var(--text-2); font-size: 13px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }

.chart { width: 100%; }
.chart svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { stroke: var(--border-strong); stroke-width: 1; }
.chart .tick { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .peak { fill: var(--text-2); font-size: 11.5px; font-weight: 600; }
.chart .seg { fill: var(--agent); transition: opacity 0.15s; }
.chart .seg[data-agent="claude"] { --agent: var(--claude); }
.chart .seg[data-agent="codex"] { --agent: var(--codex); }
.chart .col.active .seg { opacity: 0.8; }
.chart .hit { fill: transparent; cursor: default; outline: none; }
.chart .hit:focus-visible { stroke: var(--accent); stroke-width: 2; }

.chart-tip {
  position: fixed;
  z-index: 60;
  min-width: 140px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  pointer-events: none;
}

.tip-title { margin-bottom: 4px; color: var(--text-2); font-weight: 550; }
.tip-row { display: flex; align-items: center; gap: 8px; }
.tip-row strong { min-width: 34px; font-variant-numeric: tabular-nums; }
.tip-row span { color: var(--text-2); }
.tip-row.total { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border); }

.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.table-wrap { overflow-x: auto; }
.table-caption { margin: 0 0 8px; color: var(--text-2); font-size: 13px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { padding: 8px 20px; border-bottom: 1px solid var(--border); color: var(--text-3); font-size: 12px; font-weight: 600; text-align: left; white-space: nowrap; }
.data-table td { padding: 9px 20px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.chart-table .data-table th, .chart-table .data-table td { padding-left: 0; }

.agent-cell { display: inline-flex; align-items: center; gap: 8px; }
.result-cell { font-weight: 600; }
.result-cell.ok { color: var(--ok); }
.result-cell.bad { color: var(--bad); }

/* ==========================================================================
   Motion
   ========================================================================== */

@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ==========================================================================
   Small screens
   ========================================================================== */

@media (max-width: 960px) {
  /* minmax(0, …) stops the scrolling nav row from widening the whole page. */
  .app { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    z-index: 20;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .brand { padding: 0; }
  .brand-sub, .sb-history, .sb-footer .sb-heading, .conn-name, .sb-tool span { display: none; }
  .nav { flex-direction: row; }
  .sb-footer { flex-direction: row; align-items: center; gap: 2px; margin-left: auto; }
  .conn { gap: 4px; padding: 4px 6px; }
  .conn-state { font-size: 0; gap: 0; }
  .sb-tools { margin: 0; padding: 0 0 0 6px; border-top: 0; border-left: 1px solid var(--border); }
  .sb-tool { flex: none; width: 30px; }
  .sb-user { margin: 0; padding: 0 0 0 6px; border-top: 0; border-left: 1px solid var(--border); }
  .sb-user-text { display: none; }

  .main { padding: 22px 16px 40px; }
  .app[data-view="chats"] .main { height: auto; overflow: visible; }
  .chat-grid { grid-template-columns: 1fr; grid-auto-rows: minmax(70vh, auto); }
  .run-top { flex-direction: column; }
  .run-actions { justify-content: flex-start; }
  .board { grid-template-columns: 1fr; }

  /* Icon-only navigation in the top bar; labels stay for screen readers. */
  .sidebar { flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { flex: none; padding: 0 9px; }
  .conn-meter { display: none; }
  .flow { grid-template-columns: 1fr; }
  .flow li + li::before { display: none; }
  .flow.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow.five li { flex-direction: row; }
  .attach-pair { grid-template-columns: minmax(0, 1fr); }
  .shot.hero { grid-column: auto; }
  .schedule-meta, .schedule-footer, .schedule-error { margin-left: 0; }
  .transcript .msg.user { max-width: 90%; }
}

@media (max-width: 560px) {
  .nav-item span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .page-header { flex-direction: column; }
  .plan-row { flex-wrap: wrap; }
  .plan-row .title { flex-basis: 100%; }
  .settings { flex-direction: column; align-items: stretch; }
  .shot-body { flex-direction: column; }
  .flow.five { grid-template-columns: 1fr; }
  .app-file { flex-wrap: wrap; }
  .ad-results { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
.lc-admob-setup { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.lc-perf td.lc-id { text-align: left; color: var(--text-2); font-size: 12px; user-select: all; }
.lc-perf td.lc-good { color: var(--ok); font-weight: 600; }
.lc-perf td.lc-bad { color: var(--bad); font-weight: 600; }
.lc-perf th.lc-drag { cursor: grab; }
.lc-perf th.lc-dragging { opacity: 0.45; }
.lc-drop-line { position: absolute; top: 0; bottom: 0; z-index: 2; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--accent); pointer-events: none; }
.lc-drop-line[hidden] { display: none; }
.lc-perf-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); }
.lc-perf-footer .select { width: auto; }
.lc-perf thead th { position: relative; }
.lc-perf th.lc-filler, .lc-perf td.lc-filler { padding: 0; }
.lc-resize { position: absolute; top: 0; right: -4px; bottom: 0; z-index: 3; width: 8px; cursor: col-resize; }
.lc-resize::after { content: ""; position: absolute; top: 22%; bottom: 22%; left: 3px; width: 2px; border-radius: 1px; background: var(--border-strong); opacity: 0; transition: opacity 0.1s; }
.lc-perf thead tr:hover .lc-resize::after { opacity: 1; }
.lc-resize:hover::after, .lc-resizing .lc-resize::after { background: var(--accent); }
body.lc-resizing, body.lc-resizing * { cursor: col-resize !important; user-select: none; }
.lc-perf tr.lc-mode-row td { padding-top: 6px; padding-bottom: 6px; }
.lc-perf .lc-mode { margin: 0; }
.lc-perf tr.lc-country .lc-cell-title { font-weight: 500; }
.btn.lc-on { border-color: var(--accent); color: var(--accent); }
.lc-country-picker { display: flex; flex-direction: column; gap: 10px; }
.lc-country-picker > .link-btn { align-self: flex-start; }
.lc-country-list { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow: auto; padding-right: 4px; }
.lc-country-list .lc-check { display: flex; }
.lc-country-list .lc-check[hidden] { display: none; }
.lc-country-list .lc-check .lc-muted { margin-left: auto; font-size: 12.5px; font-variant-numeric: tabular-nums; }
/* automated rules: the tick boxes and bar on Performance, the dialog, the Rules tab */
.lc-perf .lc-lead { display: flex; align-items: center; gap: 12px; }
.lc-perf .lc-pickbox { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.lc-perf tr.lc-row-picked td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.lc-perf .lc-rule-tag { display: inline-flex; align-items: center; gap: 3px; margin-left: 4px; }
.lc-perf .lc-rule-tag .icon { width: 11px; height: 11px; }
.lc-perf .lc-cell-sub { display: flex; align-items: center; gap: 4px; }
.lc-rule-form { display: flex; flex-direction: column; gap: 16px; }
.lc-rule-sec { display: flex; flex-direction: column; gap: 8px; }
.lc-rule-sec h3 { margin: 0; color: var(--text); font-size: 12.5px; font-weight: 600; }
.lc-rule-sec > .link-btn { align-self: flex-start; }
.lc-rule-camps { display: flex; flex-wrap: wrap; gap: 6px; }
.lc-rule-camps .lc-chip { max-width: 260px; gap: 4px; }
.lc-rule-camps .lc-chip > span { overflow: hidden; text-overflow: ellipsis; }
.lc-chip-x { display: inline-grid; place-items: center; width: 16px; height: 16px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--text-3); cursor: pointer; }
.lc-chip-x:hover { color: var(--text); background: var(--hover); }
.lc-chip-x .icon { width: 11px; height: 11px; }
.lc-rule-conds { display: flex; flex-direction: column; gap: 6px; }
.lc-rule-cond, .lc-rule-line, .lc-rule-params, .lc-rule-at { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lc-rule-cond .select, .lc-rule-line .select, .lc-rule-params .select { width: auto; }
.lc-rule-cond .input, .lc-rule-params .input, .lc-rule-at .input { width: 110px; }
.lc-rule-params[hidden], .lc-rule-at[hidden], .lc-rule-preview[hidden], .lc-rule-runs[hidden] { display: none; }
.lc-rule-unit { min-width: 28px; }
.lc-rule-sentence { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: 13px; line-height: 1.45; }
.lc-rule-preview { display: flex; flex-direction: column; gap: 8px; }
.lc-rule-results { display: flex; flex-direction: column; gap: 6px; overflow-x: auto; }
.lc-rule-tbl { table-layout: auto; font-size: 12.5px; }
.lc-rule-tbl td, .lc-rule-tbl th { padding: 7px 10px; }
.lc-rule-tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lc-rule-tbl .lc-rule-name { max-width: 260px; overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
.lc-rule-tbl tr.lc-rule-met td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.lc-good-text { color: var(--ok); }
.lc-bad-text { color: var(--bad); }
.lc-rule-choices { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.lc-rule-choice { align-items: flex-start; }
.lc-rule-choice > span { display: flex; flex-direction: column; gap: 2px; }
.lc-rule-choice .lc-muted { font-size: 12.5px; }
.lc-rules { display: flex; flex-direction: column; gap: 18px; }
.lc-rule-app { display: flex; flex-direction: column; gap: 10px; }
.lc-rule-app-name { margin: 0; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.lc-rule { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.lc-rule.off { opacity: 0.7; }
.lc-rule-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.lc-rule-title { display: flex; flex: 1 1 220px; flex-direction: column; gap: 2px; min-width: 0; }
.lc-rule-title .lc-muted { font-size: 12px; }
.lc-rule-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.lc-rule-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.lc-rule-runs { display: flex; flex-direction: column; gap: 6px; }
.lc-rule-run summary { cursor: pointer; font-size: 12.5px; }
.lc-rule-run .lc-rule-results { margin-top: 8px; }
.lc-rule-two { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 12px; }
@media (max-width: 640px) { .lc-rule-two { grid-template-columns: 1fr; } }
.lc-rule-two .select { width: 100%; }
.lc-rule-campaigns { display: flex; flex-direction: column; gap: 8px; }
.lc-rule-group { display: flex; flex-direction: column; gap: 4px; }
.lc-rule-place { color: var(--text-3); font-size: 11.5px; font-weight: 600; }
.lc-rules-empty { flex-direction: column; gap: 10px; }
.lc-camp-picker { display: flex; flex-direction: column; gap: 10px; }
.lc-camp-picker .lc-rule-line .select { width: auto; }
.lc-camp-picker .lc-rule-line .select[hidden] { display: none; }
.lc-camp-list { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow: auto; padding-right: 4px; }
.lc-camp-row { display: flex; gap: 10px; padding: 6px 4px; border-radius: 6px; }
.lc-camp-row:hover { background: var(--hover); }
.lc-camp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-camp-spend { min-width: 96px; font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; }
.lc-camp-foot { justify-content: space-between; }
/* automated rules: a rule's steps (the dialog's step forms, the card's steps table) */
.lc-steps { display: flex; flex-direction: column; gap: 8px; }
.lc-step { border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.lc-step[open] { background: var(--surface); }
.lc-step > summary { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; cursor: pointer; list-style: none; }
.lc-step > summary::-webkit-details-marker { display: none; }
.lc-step-head { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.lc-step-title { color: var(--text); font-size: 13px; }
.lc-step-sum { overflow: hidden; color: var(--text-3); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.lc-step[open] .lc-step-sum { white-space: normal; }
.lc-step-ctl { display: flex; gap: 2px; }
.lc-step-ctl .lc-ib { width: 26px; height: 26px; }
.lc-step-body { display: flex; flex-direction: column; gap: 12px; padding: 4px 12px 14px; border-top: 1px solid var(--border); }
.lc-step-body > .lc-field { max-width: 420px; }
.lc-rule-hours .select { width: auto; }
.lc-rule-cond .select[hidden] { display: none; }
.lc-rule-steps > summary { cursor: pointer; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.lc-rule-steps[open] > summary { margin-bottom: 8px; }
.lc-steps-tbl { table-layout: auto; font-size: 12.5px; }
.lc-steps-tbl th, .lc-steps-tbl td { padding: 6px 10px; vertical-align: top; }
.lc-steps-tbl .lc-step-name { color: var(--text); font-weight: 550; }
.lc-steps-tbl .lc-nowrap { white-space: nowrap; }

/* automated rules: the campaign picker (numbers, warnings, what the rule would do now) */
.dialog.wide.lc-pick-dialog { width: min(1080px, calc(100vw - 32px)); max-width: none; }
.lc-camp-picker .lc-rule-line .input[type=search] { flex: 1; min-width: 180px; }
.lc-pick-box { max-height: 52vh; overflow: auto; border: 1px solid var(--border); border-radius: 9px; }
.lc-pick-tbl { table-layout: auto; font-size: 12.5px; }
.lc-pick-tbl thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.lc-pick-tbl th, .lc-pick-tbl td { padding: 7px 10px; }
.lc-pick-tbl th:first-child, .lc-pick-tbl td:first-child { width: 28px; padding-left: 12px; }
.lc-pick-tbl input[type=checkbox] { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.lc-pick-tbl tbody tr { cursor: pointer; }
.lc-pick-tbl tbody tr.on td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.lc-pick-tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lc-pick-name { min-width: 220px; max-width: 360px; }
.lc-pick-name > span:first-child { display: block; overflow: hidden; color: var(--text); font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.lc-pick-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.lc-pick-flags .lc-pill { font-size: 11px; }
.lc-pick-now { min-width: 170px; }
.lc-pick-would { color: var(--accent); }
.lc-pick-empty { margin: 0; padding: 18px; }
.lc-camp-picker .lc-camp-foot { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 6px 16px; }
.lc-pick-sum { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.lc-pick-warn { max-width: 380px; font-size: 12px; text-align: right; }

/* signing the dashboard in to Claude / ChatGPT from the website */
.banner-btn { margin-left: 6px; vertical-align: middle; }
.signin-dialog .dialog-body { display: flex; flex-direction: column; gap: 10px; }
.signin-dialog .dialog-body > p { margin: 0; }
.signin-dialog a.btn { align-self: flex-start; }
.signin-line { display: flex; align-items: center; gap: 8px; }
.signin-line .input { flex: 1; }
.signin-code { padding: 6px 12px; border-radius: 8px; background: var(--surface-3); color: var(--text); font-size: 20px; font-weight: 700; letter-spacing: 0.08em; }
.signin-status { margin: 0; color: var(--text-2); font-size: 13px; }
.signin-good { color: var(--ok); font-weight: 600; }
.signin-bad { color: var(--bad); }

/* Campaigns → Log: rule actions and manual actions */
.lc-log-top { display: flex; flex-direction: column; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.lc-log-top .segmented { align-self: flex-start; margin: 0; }
.lc-log-top .select.sm { width: auto; max-width: 220px; }
.lc-log-scroll { overflow-x: auto; }
.lc-log { min-width: 900px; }
.lc-log-rules { min-width: 1120px; }
.lc-log td { vertical-align: top; }
.lc-log-failed td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.lc-log-rulename { display: block; max-width: 100%; padding: 0; color: var(--text); text-align: left; }
.lc-change { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.lc-change-line strong { color: var(--text); font-weight: 600; }
.lc-status-failed { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 12.5px; }
.lc-status-failed .lc-bad-text { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.lc-log-notes:empty { display: none; }
.lc-why { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.lc-why-item { max-width: 100%; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.lc-why-item strong { color: var(--text); font-weight: 600; }
.lc-rule-links { display: inline-flex; gap: 14px; }
@media (max-width: 640px) {
  .lc-log-top { padding: 12px 16px; }
  .lc-log-top .segmented { align-self: stretch; }
}

/* The sidebar folds into a rail of icons (the button next to the brand; kept per browser). Big screens only:
   small ones have the top bar instead. */
.sb-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.sb-top .brand { min-width: 0; }
.sb-collapse .icon { width: 17px; height: 17px; }
@media (min-width: 961px) {
  .app { transition: grid-template-columns 0.18s ease; }
  .app.sb-collapsed { grid-template-columns: 64px minmax(0, 1fr); }
  .app.sb-collapsed .sidebar { padding: 16px 8px 12px; overflow: hidden; }
  .app.sb-collapsed .sb-top { flex-direction: column; gap: 12px; }
  .app.sb-collapsed .brand { justify-content: center; padding: 0; }
  .app.sb-collapsed .brand-text,
  .app.sb-collapsed .nav-item span,
  .app.sb-collapsed .sb-history,
  .app.sb-collapsed .sb-footer > .sb-heading,
  .app.sb-collapsed .conn-name,
  .app.sb-collapsed .conn-state,
  .app.sb-collapsed .conn-meter,
  .app.sb-collapsed .sb-tool span,
  .app.sb-collapsed .sb-user-text { display: none; }
  .app.sb-collapsed .nav-item { justify-content: center; padding: 0; }
  .app.sb-collapsed .sb-footer { margin-top: auto; }
  .app.sb-collapsed .conn { justify-content: center; padding: 7px 0; }
  /* a connection's state as a ring round its letter */
  .app.sb-collapsed .conn .avatar { box-shadow: 0 0 0 2px var(--sidebar), 0 0 0 3.5px var(--text-3); }
  .app.sb-collapsed .conn[data-state="ready"] .avatar { box-shadow: 0 0 0 2px var(--sidebar), 0 0 0 3.5px var(--ok); }
  .app.sb-collapsed .conn[data-state="problem"] .avatar { box-shadow: 0 0 0 2px var(--sidebar), 0 0 0 3.5px var(--bad); }
  .app.sb-collapsed .sb-user { flex-direction: column; gap: 6px; padding: 8px 0 0; }
  .app.sb-collapsed .sb-tools { flex-direction: column; }
  .app.sb-collapsed .sb-tool { flex: none; }
}
@media (max-width: 960px) {
  .sb-top { display: contents; }
  .sb-collapse { display: none; }
}

/* Performance: what to do to the ticked campaigns (lc-bulk.js) */
.dialog.wide.lc-bulk-dialog { width: min(880px, calc(100vw - 32px)); max-width: none; }
.lc-dialog .lc-bulk-body > * + * { margin-top: 0; }
.lc-bulk-result .spinner { width: 14px; height: 14px; }
.lc-bulk-body { display: flex; flex-direction: column; gap: 12px; }
.lc-bulk-how { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lc-bulk-how .select { width: auto; }
.lc-bulk-by { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }
.lc-bulk-by .input { width: 130px; }
.lc-bulk-rename { align-items: flex-end; }
.lc-bulk-find, .lc-bulk-text { display: flex; flex: 1 1 200px; flex-direction: column; gap: 4px; }
.lc-bulk-find[hidden] { display: none; }
.lc-bulk-lbl { color: var(--text-3); font-size: 12px; font-weight: 550; }
.lc-bulk-summary { margin: 0; }
.lc-bulk-list { max-height: 50vh; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.lc-bulk-tbl { font-size: 12.5px; }
.lc-bulk-tbl td { vertical-align: top; }
.lc-bulk-tbl thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.lc-bulk-skip td { color: var(--text-3); }
.lc-bulk-name { display: block; overflow-wrap: anywhere; }
.lc-bulk-why { display: block; margin-top: 4px; font-size: 12px; overflow-wrap: anywhere; }
.lc-bulk-warn { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--bad-soft); color: var(--text); }
.lc-bulk-warn > .icon { flex: none; width: 18px; height: 18px; color: var(--bad); }
.lc-bulk-warn p { margin: 4px 0 10px; color: var(--text-2); font-size: 13px; }
.lc-bulk-unit { min-width: 2.5em; }

/* Performance: what to do to the ticked campaigns, above the table (greyed out until some are ticked) */
.lc-actionbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.lc-actionbar[hidden] { display: none; }
.lc-actionbar-count { margin-right: 4px; color: var(--text); font-size: 13px; font-weight: 600; }
.lc-actionbar-count.lc-muted { font-weight: 500; }
.lc-actionbar-clear { margin-left: 6px; }

/* Pill pickers (lc-pickers.js): a pill that opens a panel under it */
.lc-pop-wrap { position: relative; display: inline-flex; }
.lc-pop-wrap[hidden] { display: none; }
.lc-pillbtn { display: inline-flex; align-items: center; gap: 7px; height: 32px; max-width: 260px; padding: 0 10px 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; font-weight: 550; cursor: pointer; }
.lc-pillbtn:hover { border-color: var(--border-strong); }
.lc-pop-wrap.open .lc-pillbtn, .lc-pillbtn:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); outline: 0; }
.lc-pillbtn > .icon { width: 15px; height: 15px; color: var(--text-3); }
.lc-pill-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-pill-caret { display: inline-flex; color: var(--text-3); transform: rotate(90deg); transition: transform 0.15s; }
.lc-pill-caret .icon { width: 13px; height: 13px; }
.lc-pop-wrap.open .lc-pill-caret { transform: rotate(-90deg); }
.lc-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); box-shadow: 0 12px 32px rgb(0 0 0 / 0.32); }
.lc-pop[hidden] { display: none; }
.lc-pop.lc-pop-right { right: 0; left: auto; }
.lc-menu { display: flex; flex-direction: column; min-width: 200px; max-height: 320px; padding: 6px; overflow-y: auto; }
.lc-menu-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; white-space: nowrap; cursor: pointer; }
.lc-menu-item:hover, .lc-menu-item:focus-visible { background: var(--hover); outline: 0; }
.lc-menu-item[aria-selected="true"] { color: var(--accent); font-weight: 600; }
.lc-menu-check { display: inline-flex; width: 15px; }
.lc-menu-check .icon { width: 15px; height: 15px; }

/* the date range panel */
.lc-pop-dates { width: min(560px, calc(100vw - 32px)); }
.lc-dr-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--border); font-size: 15px; }
.lc-dr-body { display: grid; grid-template-columns: 170px minmax(0, 1fr); }
.lc-dr-presets { display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; border-right: 1px solid var(--border); }
.lc-dr-preset { padding: 9px 12px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: 13.5px; font-weight: 500; text-align: left; cursor: pointer; }
.lc-dr-preset:hover { background: var(--hover); }
.lc-dr-preset[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.lc-dr-main { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; }
.lc-dr-boxes { display: flex; align-items: center; gap: 8px; }
.lc-dr-box { display: flex; flex: 1; flex-direction: column; gap: 2px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 550; text-align: left; cursor: pointer; }
.lc-dr-box.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.lc-dr-box-label { color: var(--text-3); font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.lc-dr-dash { color: var(--text-3); }
.lc-dr-nav { display: flex; align-items: center; justify-content: space-between; }
.lc-dr-month { font-size: 14px; text-transform: uppercase; letter-spacing: 0.03em; }
.lc-dr-nav .icon-btn { border: 1px solid var(--border); }
.lc-dr-nav .icon-btn + .icon-btn { margin-left: 6px; }
.lc-dr-prev .icon { transform: rotate(180deg); }
.lc-dr-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px 0; }
.lc-dr-wd { padding: 4px 0; color: var(--text-3); font-size: 11.5px; font-weight: 600; text-align: center; }
.lc-dr-day { position: relative; height: 34px; border: 0; background: none; color: var(--text); font: inherit; font-size: 13px; font-weight: 550; cursor: pointer; }
.lc-dr-day.out { color: var(--text-3); font-weight: 400; }
.lc-dr-day:disabled { color: var(--text-3); opacity: 0.4; cursor: default; }
.lc-dr-day.in { background: var(--accent-soft); }
.lc-dr-day.lo { border-radius: 999px 0 0 999px; }
.lc-dr-day.hi { border-radius: 0 999px 999px 0; }
.lc-dr-day.lo.hi { border-radius: 999px; }
.lc-dr-day.lo, .lc-dr-day.hi { background: var(--accent); color: #fff; }
.lc-dr-day:not(.in):not(:disabled):hover { border-radius: 999px; background: var(--hover); }
.lc-dr-day.today::after { content: ""; position: absolute; bottom: 4px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--bad); }
.lc-dr-day.lo.today::after, .lc-dr-day.hi.today::after { background: #fff; }
.lc-dr-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
@media (max-width: 640px) {
  .lc-dr-body { grid-template-columns: 1fr; }
  .lc-dr-presets { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--border); }
  .lc-pillbtn { max-width: 180px; }
}
