/* Autonoma — hand-written stylesheet. No build step, no node_modules.
 *
 * Styled after nxtlevel-tech.com (ink, lime, paper; tight Helvetica headings;
 * spaced capital labels), in three themes chosen per browser: dark (default),
 * light, and system (follows the device).
 */

/* ------------------------------------------------------------------ themes */

:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151918;
  --panel: #1b201f;
  --panel-2: #222826;
  --panel-3: #2a312e;
  --ink: #f4f5ee;
  --ink-2: #d0d6ce;
  --ink-3: #9ba59d;
  --line: #2c3430;
  --line-strong: #3b4540;
  --accent: #c7f464;            /* fills: buttons, toggles, dots */
  --accent-ink: #151918;        /* text on a lime fill */
  --accent-text: #c7f464;       /* links and highlighted text */
  --accent-soft: rgba(199, 244, 100, .10);
  --accent-ring: rgba(199, 244, 100, .28);
  --ok: #8fe3a6;
  --ok-soft: rgba(143, 227, 166, .11);
  --warn: #f2c14e;
  --warn-soft: rgba(242, 193, 78, .12);
  --err: #ff8a7d;
  --err-soft: rgba(255, 138, 125, .12);
  --input: #131716;
  --header: rgba(21, 25, 24, .82);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5ee;
  --panel: #ffffff;
  --panel-2: #f1f3eb;
  --panel-3: #e7eadf;
  --ink: #151918;
  --ink-2: #3b433e;
  --ink-3: #69726b;
  --line: #e2e5db;
  --line-strong: #cdd2c5;
  --accent: #c7f464;
  --accent-ink: #151918;
  --accent-text: #4b7a00;
  --accent-soft: rgba(140, 190, 30, .14);
  --accent-ring: rgba(140, 190, 30, .38);
  --ok: #2e7d32;
  --ok-soft: rgba(46, 125, 50, .10);
  --warn: #946200;
  --warn-soft: rgba(214, 150, 0, .13);
  --err: #bf3a2b;
  --err-soft: rgba(191, 58, 43, .09);
  --input: #ffffff;
  --header: rgba(244, 245, 238, .84);
  --shadow: 0 1px 2px rgba(21, 25, 24, .05), 0 6px 18px rgba(21, 25, 24, .05);
  --shadow-lg: 0 18px 48px rgba(21, 25, 24, .14);
}

@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    color-scheme: light;
    --bg: #f4f5ee;
    --panel: #ffffff;
    --panel-2: #f1f3eb;
    --panel-3: #e7eadf;
    --ink: #151918;
    --ink-2: #3b433e;
    --ink-3: #69726b;
    --line: #e2e5db;
    --line-strong: #cdd2c5;
    --accent: #c7f464;
    --accent-ink: #151918;
    --accent-text: #4b7a00;
    --accent-soft: rgba(140, 190, 30, .14);
    --accent-ring: rgba(140, 190, 30, .38);
    --ok: #2e7d32;
    --ok-soft: rgba(46, 125, 50, .10);
    --warn: #946200;
    --warn-soft: rgba(214, 150, 0, .13);
    --err: #bf3a2b;
    --err-soft: rgba(191, 58, 43, .09);
    --input: #ffffff;
    --header: rgba(244, 245, 238, .84);
    --shadow: 0 1px 2px rgba(21, 25, 24, .05), 0 6px 18px rgba(21, 25, 24, .05);
    --shadow-lg: 0 18px 48px rgba(21, 25, 24, .14);
  }
}

:root {
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --serif: var(--sans);
}

/* ------------------------------------------------------------------ base */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--accent-ink); }

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3 { font-family: var(--sans); font-weight: 500; margin: 0 0 .45em; color: var(--ink); }
h1 { font-size: 32px; line-height: 1.06; letter-spacing: -0.045em; }
h2 { font-size: 20px; line-height: 1.2; letter-spacing: -0.03em; }
h3 { font-size: 15.5px; line-height: 1.3; letter-spacing: -0.015em; font-weight: 600; }

.mono { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }

/* Spaced capitals, as in "SOFTWARE & AUTOMATION STUDIO". */
.label {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--ink-3);
}
a.label:hover { color: var(--accent-text); text-decoration: none; }
p.label::before, .eyebrow::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); margin-right: 10px; vertical-align: 2px;
}

.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.center { text-align: center; }
.stack > * + * { margin-top: 10px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
details summary { cursor: pointer; }

/* ------------------------------------------------------------------ chrome */

.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--header);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  position: sticky; top: 0; z-index: 20;
  flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; letter-spacing: -0.03em; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); font-size: 15px; font-weight: 800; letter-spacing: -0.04em;
}
.topbar nav { display: flex; gap: 6px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.topbar nav > a:not(.btn) {
  color: var(--ink-2); font-size: 13.5px; padding: 6px 10px; border-radius: 8px;
}
.topbar nav > a:not(.btn):hover { background: var(--panel-2); color: var(--ink); text-decoration: none; }
.topbar nav > a.active { color: var(--ink); font-weight: 600; background: var(--panel-2); }

.working-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; margin-right: 4px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent-text);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.working-pill[hidden] { display: none; }

.wrap { max-width: 1560px; margin: 0 auto; padding: 24px; }
.grid { display: grid; grid-template-columns: 300px minmax(0, 1fr) 420px; gap: 18px; align-items: start; }
@media (max-width: 1360px) { .grid { grid-template-columns: 280px minmax(0, 1fr) 380px; } }
@media (max-width: 1100px) { .grid { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card > h2, .card > h3 { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }

.status {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--panel-2);
}
.status .row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 4px 0; color: var(--ink-2); }
.status .row + .row { border-top: 1px dashed var(--line); }
.status .row b { color: var(--ink); font-family: var(--mono); font-weight: 600; font-size: 12px; }

/* Segmented control: autonomy modes. */
.modes {
  display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; margin-bottom: 12px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
}
.modes button {
  font-family: var(--sans); font-size: 12.5px; font-weight: 600; letter-spacing: -0.01em;
  padding: 6px 11px; border: 0; background: transparent; color: var(--ink-3); border-radius: 7px; cursor: pointer;
}
.modes button:hover { color: var(--ink); }
.modes button.on { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); }

/* ------------------------------------------------------------------ tasks */

.task {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  margin-bottom: 8px; background: var(--panel-2);
  transition: border-color .15s ease;
}
.task:hover { border-color: var(--line-strong); }
.task.running { border-color: var(--accent-ring); box-shadow: 0 0 0 3px var(--accent-soft); }
.task h4 { margin: 0 0 4px; font-size: 14.5px; font-family: var(--sans); font-weight: 600; letter-spacing: -0.01em; display: flex; gap: 8px; align-items: center; }
.task h4 a, .list-item > a, .widget-row strong { color: var(--ink); }
.task h4 a:hover, .list-item > a:hover { color: var(--accent-text); }
.task p { margin: 0 0 8px; color: var(--ink-2); font-size: 13px; }
.task .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.badge {
  display: inline-block; font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; background: var(--panel-3); color: var(--ink-2); line-height: 1.5;
}
.badge.running { background: var(--accent-soft); color: var(--accent-text); }
.badge.done, .badge.approved { background: var(--ok-soft); color: var(--ok); }
.badge.failed, .badge.blocked { background: var(--err-soft); color: var(--err); }
.badge.needs_approval, .badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.auto, .badge.night { background: var(--accent-soft); color: var(--accent-text); }

.lanes { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 800px) { .lanes { grid-template-columns: 1fr; } }
.lane-head {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 12px;
}

/* ------------------------------------------------------------------ forms */

label {
  display: block; font-family: var(--sans); font-size: 10.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3); margin: 14px 0 6px;
}
input[type=text], input[type=search], input[type=email], input[type=password], input[type=url],
input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 14px;
  background: var(--input); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-ring); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--sans); font-size: 13.5px; font-weight: 700; letter-spacing: -0.01em;
  padding: 10px 16px; border-radius: var(--radius-sm); cursor: pointer; line-height: 1.2;
  border: 1px solid var(--ink); background: var(--ink); color: var(--bg);
  transition: opacity .15s ease, background .15s ease, border-color .15s ease, transform .05s ease;
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink-2); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--panel-2); color: var(--ink); opacity: 1; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 7px; }
.btn[disabled] { opacity: .45; cursor: default; }

/* Anything the server is working on shows a spinner until the page moves on. */
.is-busy { pointer-events: none; opacity: .8; }
.is-busy::before {
  content: ""; display: inline-block; width: .95em; height: .95em; flex-shrink: 0;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
form.inline { display: inline; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; color: var(--accent-text); padding: 0; }

.notice {
  padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13.5px;
  border: 1px solid transparent;
}
.notice.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-soft); }
.notice.err { background: var(--err-soft); color: var(--err); border-color: var(--err-soft); }

.list-item { padding: 11px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.when { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.when.overdue { color: var(--err); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-family: var(--sans); font-size: 10.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line);
}
td { padding: 10px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
.table-scroll { overflow-x: auto; }

.field-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.field-row > div { flex: 1; min-width: 150px; }
.field-row label { margin-top: 8px; }

.addr { display: flex; align-items: center; gap: 6px; }
.addr input { flex: 1; min-width: 0; }
.addr span { font-family: var(--mono); font-size: 13px; white-space: nowrap; }

.integration-note {
  border-left: 3px solid var(--warn); background: var(--warn-soft);
  padding: 9px 12px; font-size: 12.5px; margin: 10px 0 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

pre.log {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px;
  max-height: 320px; overflow: auto; margin: 10px 0 0;
}

/* ------------------------------------------------------------------ chat */

.chat { max-height: 480px; overflow-y: auto; padding-right: 2px; margin-bottom: 12px; scroll-behavior: smooth; }
.msg { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 10px; }
.msg.user { justify-content: flex-end; }
.msg-avatar { flex-shrink: 0; line-height: 0; }
.bubble {
  padding: 10px 13px; border-radius: 14px; font-size: 13.5px; max-width: 88%; overflow-wrap: anywhere;
}
.bubble.user { background: var(--ink); color: var(--bg); border-bottom-right-radius: 4px; }
.bubble.user a { color: inherit; text-decoration: underline; }
.bubble.agent { background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble .label { display: inline-block; margin-top: 6px; }
.bubble.thinking { color: var(--ink-3); display: inline-flex; align-items: center; gap: 8px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-text); opacity: .3; animation: dot 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 30% { opacity: 1; transform: translateY(-3px); } 60% { opacity: .3; transform: none; } }
.chat-form textarea { min-height: 64px; }
.chat-hint { margin: 8px 0 0; font-size: 12px; color: var(--ink-3); }

/* ------------------------------------------------------------------ the bot */

.bot { display: inline-block; flex-shrink: 0; overflow: visible; color: var(--ink-3); }
.bot .bot-eyes { transform-box: fill-box; transform-origin: center; animation: bot-blink 6s infinite; }
.bot.bot-resting .bot-eyes, .bot.bot-stuck .bot-eyes { animation: none; }
.bot.is-thinking { animation: bot-bob 1.5s ease-in-out infinite; }
.bot.is-thinking .bot-signal { animation: bot-signal 1s ease-in-out infinite; }
.bot.is-thinking .bot-signal-late { animation-delay: .5s; }
.bot .bot-z { animation: bot-z 2.4s ease-in-out infinite; }
@keyframes bot-blink { 0%, 95%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
@keyframes bot-bob { 50% { transform: translateY(-2px); } }
@keyframes bot-signal { 50% { opacity: .25; } }
@keyframes bot-z { 0%, 100% { opacity: .2; transform: translateY(1px); } 50% { opacity: 1; transform: translateY(-2px); } }

.agent-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.agent-head h2 { margin: 0 0 2px; }
.mood { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); }
.mood-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex-shrink: 0; }
.mood-dot.focused { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mood-dot.ready { background: var(--ok); }
.mood-dot.waiting { background: var(--warn); }
.mood-dot.stuck { background: var(--err); }
.mood-detail { font-size: 12.5px; color: var(--ink-3); margin: 0 0 12px; }

@media (prefers-reduced-motion: reduce) {
  .bot, .bot *, .dots i, .is-busy::before { animation: none !important; }
}

/* ------------------------------------------------------------------ menus, tabs */

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30;
  min-width: 230px; max-width: calc(100vw - 32px); padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.menu-panel a, .menu-panel .linklike {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  width: 100%; padding: 8px 10px; border-radius: 7px;
  color: var(--ink-2); font-size: 13.5px; text-align: left;
}
.menu-panel a:hover, .menu-panel .linklike:hover { background: var(--panel-2); color: var(--ink); text-decoration: none; }
.menu-panel form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--line); }
.menu-panel .menu-label { padding: 8px 10px 4px; }
.topbar nav .menu-panel a { color: var(--ink-2); }

.theme-switch { display: flex; gap: 2px; padding: 3px; margin: 0 6px 6px; background: var(--panel-2); border-radius: 9px; }
.theme-switch button {
  flex: 1; border: 0; background: transparent; color: var(--ink-3); font: inherit; font-size: 12px; font-weight: 600;
  padding: 5px 6px; border-radius: 6px; cursor: pointer;
}
.theme-switch button:hover { color: var(--ink); }
.theme-switch button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 18px; }
.tabs a {
  padding: 9px 14px; margin-bottom: -1px; color: var(--ink-3); font-size: 13.5px;
  border-bottom: 2px solid transparent;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent-text); font-weight: 600; }

.subnav {
  display: flex; gap: 2px; flex-wrap: wrap; margin-bottom: 22px; padding: 3px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; width: fit-content; max-width: 100%;
}
.subnav a {
  font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 7px; color: var(--ink-3);
}
.subnav a:hover { color: var(--ink); text-decoration: none; }
.subnav a.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }

/* ------------------------------------------------------------------ pages */

.doc-body { font-size: 15.5px; line-height: 1.75; white-space: pre-wrap; color: var(--ink-2); }

.auth-page { max-width: 420px; margin: 8vh auto; padding: 0 20px; }

.cap {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.cap:last-child { border-bottom: 0; }
.cap p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.plan { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: var(--panel); box-shadow: var(--shadow); }
.plan.current { border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-soft); }
.plan .price { font-size: 30px; font-weight: 500; letter-spacing: -0.04em; }
.plan ul { padding-left: 18px; margin: 10px 0 0; font-size: 13.5px; color: var(--ink-2); }

.hero { max-width: 760px; margin: 12vh auto; padding: 0 22px; }
.hero h1 { font-size: 58px; line-height: 1.02; letter-spacing: -0.058em; }
.hero p.lead { font-size: 19px; color: var(--ink-2); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

.widget { margin-bottom: 16px; }
.widget h3 { font-size: 15px; }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 26px; }
@media (max-width: 700px) { .choice-grid { grid-template-columns: 1fr; } }
.choice {
  display: block; padding: 22px; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.choice:hover { border-color: var(--accent-text); text-decoration: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.choice h2 { margin: 6px 0 8px; }
.choice.disabled { opacity: .5; pointer-events: none; }

details.card.danger { border-color: var(--err-soft); }
details.card.danger[open] { border-color: var(--err); }

.widget-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.widget-row:last-child { border-bottom: 0; }
.widget-row-text { display: flex; flex-direction: column; min-width: 0; }
.widget-row:not(.on) strong { color: var(--ink-3); }
.widget-row .btn[disabled] { opacity: .35; cursor: default; }
.section-label { margin: 18px 0 2px; }
.section-label:first-of-type { margin-top: 4px; }

.toggle {
  font-family: var(--sans); font-size: 11.5px; font-weight: 700; min-width: 52px;
  padding: 5px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--ink-3);
}
.toggle.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--panel-2); flex-shrink: 0; }
.segmented button {
  font-family: var(--sans); font-size: 11.5px; font-weight: 700;
  border: 0; background: transparent; color: var(--ink-3); padding: 5px 12px; border-radius: 999px; cursor: pointer;
}
.segmented button.on { background: var(--accent); color: var(--accent-ink); }
.segmented button:not(.on):hover { color: var(--ink); }

.background-choices { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.background-choices form { margin: 0; }
.background-choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; width: 170px; padding: 10px;
  font: inherit; font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--ink-2); text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; margin: 0;
}
.background-choice.on { border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-soft); color: var(--ink); }
.background-choice[disabled] { cursor: default; }
.swatch {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 84px; border-radius: var(--radius-sm);
  background: var(--panel-2) center / cover no-repeat; border: 1px solid var(--line); color: var(--ink-3); font-size: 26px;
}
.swatch.none { background: repeating-linear-gradient(45deg, var(--panel-2), var(--panel-2) 8px, var(--panel) 8px, var(--panel) 16px); }

body.has-background { background: var(--bg) var(--dashboard-background) center / cover fixed no-repeat; }
body.has-background .wrap > .notice { box-shadow: var(--shadow); }

.dns-connect {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin: 12px 0 4px; padding: 12px 14px; border: 1px solid var(--accent-ring); border-radius: var(--radius);
  background: var(--accent-soft);
}

.dns-steps { margin: 12px 0 2px; padding-left: 20px; font-size: 13.5px; color: var(--ink-2); }
.dns-steps > li { margin-bottom: 12px; padding-left: 4px; }
.dns-steps > li::marker { font-family: var(--mono); color: var(--accent-text); }
.dns-steps .btn { margin-left: 6px; vertical-align: middle; }
.dns-steps .table-scroll { margin-top: 8px; }
.dns-records td { vertical-align: middle; white-space: nowrap; }
.dns-records .mono { font-size: 12.5px; color: var(--ink); }
button.copy {
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; cursor: pointer;
  margin-left: 6px; padding: 3px 7px; border-radius: 5px; border: 1px solid var(--line-strong);
  background: transparent; color: var(--ink-3);
}
button.copy:hover { color: var(--accent-text); border-color: var(--accent-ring); }

/* Page links under long lists. */
.pager { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 16px 0 4px; }
.pager .pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pager .pages a, .pager .pages span {
  min-width: 30px; height: 30px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 7px; font-family: var(--mono); font-size: 12px; color: var(--ink-2); border: 1px solid transparent;
}
.pager .pages a:hover { background: var(--panel-2); color: var(--ink); text-decoration: none; }
.pager .pages .current { border-color: var(--accent-ring); background: var(--accent-soft); color: var(--accent-text); }
.pager .pages .gap { color: var(--ink-3); }
.pager .btn[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.pager .count { margin-left: auto; font-size: 12px; color: var(--ink-3); }

.agent-live { border-color: var(--accent-ring); }
.agent-live .card-head { justify-content: flex-start; }
.agent-live .card-head .badge { margin-left: auto; }

.empty-lane { display: flex; align-items: center; gap: 12px; padding: 6px 0; color: var(--ink-3); font-size: 13px; }

/* ------------------------------------------------------------------ small screens */

@media (max-width: 600px) {
  .wrap { padding: 16px; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .topbar nav { margin-left: 0; }
  .hero h1 { font-size: 36px; }
  h1 { font-size: 27px; }
}

/* ------------------------------------------------------------------ task lane (compact) */

/* A running task: the bot, the title, and a four-step track. */
.now {
  display: flex; gap: 12px; align-items: center; padding: 10px 12px; margin-bottom: 10px;
  border-radius: 12px; color: var(--ink);
  background: linear-gradient(90deg, var(--accent-soft), transparent 70%);
  border: 1px solid var(--accent-ring);
}
.now:hover { text-decoration: none; border-color: var(--accent-text); }
.now-bot { line-height: 0; flex-shrink: 0; }
.now-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.now-title { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track { display: flex; gap: 4px; }
.track .step {
  flex: 1; position: relative; padding-top: 7px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
}
.track .step::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; border-radius: 3px; background: var(--line-strong);
}
.track .step.done { color: var(--ink-2); }
.track .step.done::before { background: var(--accent-text); }
.track .step.current { color: var(--accent-text); }
.track .step.current::before { background: var(--accent); animation: step-pulse 1.4s ease-in-out infinite; }
@keyframes step-pulse { 50% { opacity: .35; } }

/* Waiting tasks: one line each. */
.task-rows { list-style: none; margin: 0; padding: 0; }
.task-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-radius: 8px;
  border-bottom: 1px solid var(--line);
}
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: var(--panel-2); }
.task-row-title {
  flex: 1; min-width: 0; color: var(--ink); font-size: 13.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.task-row-title:hover { color: var(--accent-text); text-decoration: none; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--line-strong); }
.status-dot.queued { background: var(--accent); }
.status-dot.attention { background: var(--warn); }
.status-dot.problem { background: var(--err); }
.chip {
  flex-shrink: 0; font-size: 10.5px; color: var(--ink-3); padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--line-strong); text-transform: lowercase;
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 7px; border: 1px solid var(--line-strong); background: transparent; color: var(--ink-2);
  font-size: 10px; font-weight: 700; cursor: pointer; line-height: 1;
}
.icon-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
.icon-btn.muted { cursor: default; border-color: transparent; color: var(--ink-3); }
.icon-btn.muted:hover { background: transparent; color: var(--ink-3); }
.icon-btn.is-busy::before { width: 10px; height: 10px; }
.icon-btn.is-busy { font-size: 0; }

/* The bot's activity badge pops gently; the reading dots take turns. */
.bot .bot-badge { transform-box: fill-box; transform-origin: center; animation: bot-badge 2.4s ease-in-out infinite; }
.bot .bot-dot { animation: bot-dot 1.2s infinite; }
.bot .bot-dot + .bot-dot { animation-delay: .2s; }
.bot .bot-dot + .bot-dot + .bot-dot { animation-delay: .4s; }
@keyframes bot-badge { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes bot-dot { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .track .step.current::before, .bot .bot-badge, .bot .bot-dot { animation: none !important; } }

/* ------------------------------------------------------------------ scrollbars */

/* Slim, theme-coloured scrollbars everywhere; none at all inside panels that
   scroll on their own (log, chat, menus, modals). */
html { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 2px solid var(--bg); }
.chat, .menu-panel, .modal-scroll, .switcher, #bell-list, .doc-tabs { scrollbar-width: none; -ms-overflow-style: none; }
.chat::-webkit-scrollbar, .menu-panel::-webkit-scrollbar, .switcher::-webkit-scrollbar,
.modal-scroll::-webkit-scrollbar, #bell-list::-webkit-scrollbar, .doc-tabs::-webkit-scrollbar { display: none; }

/* ------------------------------------------------------------------ live log */

.log-card { padding-bottom: 12px; }
.log {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.7; color: var(--ink-2);
  height: 190px; overflow-y: auto; margin: 0 -6px; padding: 0 6px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 22px);
}
.log > div { display: flex; gap: 8px; padding: 1px 0; }
.log > div > time { flex-shrink: 0; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.log > div > span { min-width: 0; overflow-wrap: anywhere; }
.log .success > span { color: var(--accent-text); }
.log .warning > span { color: var(--warn); }
.log .error > span { color: var(--err); }
.log .log-empty { color: var(--ink-3); padding-top: 40px; justify-content: center; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: live 2s infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 var(--accent-ring); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.lane-note { margin: 8px 0 0; font-size: 11.5px; color: var(--ink-3); }
.line-no { font-family: var(--mono); font-size: 10.5px; }

.bubble-meta { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.bubble-meta time { font-size: 10.5px; color: var(--ink-3); }
.bubble.user .bubble-meta { justify-content: flex-end; }
.bubble.user .bubble-meta time { color: inherit; opacity: .6; }
.bubble .bubble-meta .label { margin-top: 0; }

/* ------------------------------------------------------------------ bell */

.bell > summary.bell-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 32px; border-radius: 8px; cursor: pointer; color: var(--ink-2);
}
.bell > summary.bell-btn:hover, .bell[open] > summary.bell-btn { background: var(--panel-2); color: var(--ink); }
.bell-count {
  position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-size: 10px; font-weight: 800; line-height: 16px; text-align: center;
}
.bell-count[hidden] { display: none; }
.menu-panel.bell-panel { width: 360px; padding: 0; overflow: hidden; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.menu-panel .bell-head form { margin: 0; padding: 0; border: 0; }
.menu-panel .bell-head .linklike { width: auto; padding: 0; font-size: 12px; color: var(--accent-text); }
#bell-list { max-height: 380px; overflow-y: auto; padding: 4px; }
.bell-empty { margin: 0; padding: 22px 14px; color: var(--ink-3); font-size: 13px; text-align: center; }
.menu-panel a.bell-all { justify-content: center; border-top: 1px solid var(--line); border-radius: 0; font-size: 12.5px; color: var(--accent-text); padding: 10px; }

a.notice-item, .menu-panel a.notice-item { display: flex; gap: 10px; align-items: flex-start; justify-content: flex-start; padding: 10px; border-radius: 9px; color: var(--ink-2); }
a.notice-item:hover { background: var(--panel-2); text-decoration: none; }
.notice-icon { flex-shrink: 0; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.notice-item.unread .notice-icon { box-shadow: none; background: var(--accent); }
.notice-item.unread.kind-task_failed .notice-icon, .notice-item.unread.kind-task_waiting .notice-icon { background: var(--err); }
.notice-item.unread.kind-task_review .notice-icon { background: var(--warn); }
.notice-item.unread.kind-admin .notice-icon { background: var(--ink); }
.notice-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.notice-text strong { color: var(--ink); font-size: 13px; font-weight: 600; line-height: 1.35; }
.notice-item:not(.unread) .notice-text strong { font-weight: 500; color: var(--ink-2); }
.notice-text > span { font-size: 12.5px; color: var(--ink-2); line-height: 1.4; }
.notice-text time { font-size: 11px; color: var(--ink-3); }
.notice-page { padding: 6px; }
.notice-page .notice-item { border-bottom: 1px solid var(--line); border-radius: 0; }
.notice-page .notice-item:last-child { border-bottom: 0; }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 60; width: min(360px, calc(100vw - 32px));
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 12px 16px;
  background: var(--panel); color: var(--ink-2); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 12.5px;
  animation: toast-in .25s ease-out; transition: opacity .5s, transform .5s;
}
.toast strong { color: var(--ink); font-size: 13.5px; }
.toast:hover { text-decoration: none; border-color: var(--accent-ring); }
.toast.kind-task_failed, .toast.kind-task_waiting { border-left-color: var(--err); }
.toast.kind-task_review { border-left-color: var(--warn); }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ------------------------------------------------------------------ company switcher */

.switcher { display: flex; flex-direction: column; gap: 1px; max-height: 300px; overflow-y: auto; }
.menu-panel .switcher form { margin: 0; padding: 0; border: 0; }
.switch-item {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-2); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.switch-item:hover { background: var(--panel-2); color: var(--ink); }
.switch-item.on { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.switch-item > span:first-of-type { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switch-item .bot { flex-shrink: 0; }
.switch-check { color: var(--accent-text); font-size: 12px; }
.menu-panel a.switch-new { color: var(--accent-text); font-size: 12.5px; }
.menu-rule { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* ------------------------------------------------------------------ modals */

dialog.modal {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
  border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--ink);
  box-shadow: var(--shadow-lg);
}
dialog.modal-wide { width: min(720px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(8, 10, 9, .55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: modal-in .18s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.modal-body { display: flex; flex-direction: column; padding: 22px 24px; max-height: calc(100vh - 50px); overflow-y: auto; scrollbar-width: none; }
.modal-body::-webkit-scrollbar { display: none; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.modal-close {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex-shrink: 0;
  border: 0; border-radius: 8px; background: var(--panel-2); color: var(--ink-2); font-size: 20px; line-height: 1; cursor: pointer;
}
.modal-close:hover { background: var(--panel-3); color: var(--ink); text-decoration: none; }
.modal-scroll { overflow-y: auto; margin: 0 -24px; padding: 0 24px; flex: 1; min-height: 0; }
.modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.modal-foot form { margin: 0; }

/* Credit packs: tiles, not a dropdown. */
.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px 8px; padding-top: 8px; }
.pack {
  position: relative; display: flex; flex-direction: column; gap: 1px; padding: 12px 12px 10px; margin: 0;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); cursor: pointer;
  text-transform: none; letter-spacing: 0; font-family: var(--sans); color: var(--ink);
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.pack:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.pack input { position: absolute; opacity: 0; pointer-events: none; }
.pack:has(input:checked) { border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--panel); }
.pack:has(input:focus-visible) { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.pack-credits { font-size: 20px; font-weight: 600; letter-spacing: -0.03em; }
.pack-price { font-size: 14px; color: var(--ink-2); }
.pack-per { font-size: 10.5px; color: var(--ink-3); }
.pack-flag {
  position: absolute; top: -8px; right: 8px; padding: 1px 7px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: 9.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}

/* ------------------------------------------------------------------ billing */

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }

.wallet {
  display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 22px 24px; margin-bottom: 18px; border-radius: 16px; border: 1px solid var(--accent-ring);
  background: radial-gradient(120% 140% at 0% 0%, var(--accent-soft), transparent 60%), var(--panel);
}
.wallet-balance { font-size: 46px; font-weight: 500; letter-spacing: -0.05em; line-height: 1.05; margin: 2px 0 6px; }
.wallet-balance small { font-size: 14px; letter-spacing: 0; color: var(--ink-3); margin-left: 8px; font-weight: 400; }
.wallet-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.wallet-actions form { margin: 0; }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.plan-card {
  position: relative; display: flex; flex-direction: column; padding: 22px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow);
}
.plan-card.current { border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-soft); }
.plan-card h2 { margin: 0 0 2px; }
.plan-flag {
  position: absolute; top: 16px; right: 16px; padding: 2px 8px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
}
.plan-flag.soft { background: var(--warn-soft); color: var(--warn); }
.plan-tagline { margin: 0 0 12px; color: var(--ink-3); font-size: 13px; }
.plan-price { font-size: 38px; font-weight: 500; letter-spacing: -0.05em; line-height: 1; margin-bottom: 14px; }
.plan-price small { font-size: 13px; letter-spacing: 0; color: var(--ink-3); margin-left: 4px; }
.plan-features { list-style: none; padding: 0; margin: 0 0 18px; flex: 1; font-size: 13.5px; }
.plan-features li { position: relative; padding: 6px 0 6px 22px; border-top: 1px solid var(--line); color: var(--ink-2); }
.plan-features li::before { content: "\2713"; position: absolute; left: 2px; color: var(--accent-text); font-weight: 700; }
.plan-features li.off { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.plan-features li.off::before { content: "\2013"; color: var(--ink-3); }
.plan-btn { width: 100%; justify-content: center; }
.plan-card form { margin: 0; }
span.plan-btn[aria-disabled="true"] { opacity: .6; cursor: default; }

.plans + p + .grid-2 { margin-top: 20px; }
.price-list { list-style: none; padding: 0; margin: 0 0 10px; font-size: 13.5px; }
.price-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); color: var(--ink-2); }
.price-list li:first-child { border-top: 0; }
.price-list b { color: var(--ink); white-space: nowrap; font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.plus { color: var(--ok); }
td.minus { color: var(--ink-2); }

.price-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 18px; }
.price-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0; text-transform: none; letter-spacing: 0; font-family: var(--sans); font-size: 13px; color: var(--ink-2); }
.price-row input { width: 76px; }

/* ------------------------------------------------------------------ documents */

.doc-search { margin: 0; }
.doc-search input { width: 240px; max-width: 100%; }
.doc-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 10px; }
.doc-tabs a {
  display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); font-size: 13px;
}
.doc-tabs a:hover { border-color: var(--line-strong); color: var(--ink); text-decoration: none; }
.doc-tabs a.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.doc-tabs a span { font-family: var(--mono); font-size: 11px; opacity: .7; }
.doc-status { display: flex; gap: 14px; margin: 0 0 14px 4px; font-size: 12.5px; flex-wrap: wrap; }
.doc-status a { color: var(--ink-3); }
.doc-status a.on { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--accent-text); }
.count-pill { display: inline-block; min-width: 16px; padding: 0 5px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 10.5px; font-weight: 700; text-align: center; }

.doc-list { padding: 6px 8px; }
.doc-row { display: flex; align-items: center; gap: 12px; padding: 10px; border-bottom: 1px solid var(--line); }
.doc-row:last-child { border-bottom: 0; }
.doc-row:hover { background: var(--panel-2); border-radius: 10px; }
.doc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.doc-title { color: var(--ink); font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-title:hover { color: var(--accent-text); text-decoration: none; }
.doc-sub { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-sub a { color: var(--ink-3); }
.doc-actions { display: flex; gap: 6px; flex-shrink: 0; }
.doc-actions form { margin: 0; }
@media (max-width: 700px) { .doc-row { flex-wrap: wrap; } .doc-actions { width: 100%; } }

/* One colour per type, on the tabs and the rows. */
.kind-tag {
  flex-shrink: 0; width: 124px; padding: 3px 8px; border-radius: 6px; text-align: center;
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: color-mix(in srgb, var(--kind, #9ba59d) 16%, transparent);
  color: color-mix(in srgb, var(--kind, #9ba59d) 70%, var(--ink));
}
.kind-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--kind, var(--ink-3)); }
.kind-report { --kind: #4fa8f0; }
.kind-strategy { --kind: #a877f0; }
.kind-draft { --kind: #8c968e; }
.kind-post { --kind: #e86aa8; }
.kind-email { --kind: #e5a23a; }
.kind-spec { --kind: #3fb8a0; }
.kind-change { --kind: #86b820; }
.kind-patch { --kind: #e5604f; }
.doc-tabs a.on .kind-dot { box-shadow: 0 0 0 2px var(--bg); }
@media (max-width: 700px) { .kind-tag { width: auto; } }

/* ------------------------------------------------------------------ priority */

.prio-tag {
  flex-shrink: 0; padding: 1px 7px; border-radius: 999px;
  font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  background: var(--panel-3); color: var(--ink-3);
}
.prio-tag.prio-urgent { background: var(--err-soft); color: var(--err); }
.prio-tag.prio-high { background: var(--warn-soft); color: var(--warn); }
.prio-tag.prio-normal { background: var(--panel-3); color: var(--ink-2); }
.prio-tag.prio-low { background: transparent; color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line-strong); }
.line-no-tag { font-family: var(--mono); font-size: 11px; color: var(--accent-text); margin-right: 2px; }
.prio-form select { width: auto; padding: 3px 8px; font-size: 12px; border-radius: 7px; }

/* New task form */
.new-task label { margin-top: 10px; }
.new-task textarea { resize: vertical; }
.prio-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.prio-option {
  position: relative; margin: 0; padding: 9px 6px; border-radius: 10px; text-align: center; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink-2);
  font-family: var(--sans); font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none;
}
.prio-option input { position: absolute; opacity: 0; pointer-events: none; }
.prio-option:hover { border-color: var(--line-strong); color: var(--ink); }
.prio-option:has(input:focus-visible) { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.prio-option.prio-urgent:has(input:checked) { border-color: var(--err); background: var(--err-soft); color: var(--err); }
.prio-option.prio-high:has(input:checked) { border-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.prio-option.prio-normal:has(input:checked) { border-color: var(--accent-text); background: var(--accent-soft); color: var(--ink); }
.prio-option.prio-low:has(input:checked) { border-color: var(--line-strong); background: var(--panel); color: var(--ink); }
.check-row {
  display: flex; align-items: center; gap: 8px; margin: 14px 0 0; cursor: pointer;
  font-family: var(--sans); font-size: 13.5px; letter-spacing: 0; text-transform: none; color: var(--ink-2);
}
.check-row input { width: auto; margin: 0; accent-color: var(--accent); }
@media (max-width: 480px) { .prio-pick { grid-template-columns: repeat(2, 1fr); } }

/* ------------------------------------------------------------------ public site (signed-out pages) */

body.pub { font-size: 15px; }
.pub-wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.pub-skip { position: absolute; left: -9999px; }
.pub-skip:focus { left: 12px; top: 12px; z-index: 50; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: 8px; }

.pub-top { position: sticky; top: 0; z-index: 20; background: var(--header); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.pub-top-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.pub-nav { display: flex; align-items: center; gap: 22px; }
.pub-nav > a:not(.btn) { color: var(--ink-2); font-size: 14px; }
.pub-nav > a:not(.btn):hover { color: var(--ink); text-decoration: none; }

.pub-hero { padding: 76px 0 64px; }
.pub-hero-grid { display: grid; grid-template-columns: 1.08fr .92fr; gap: 56px; align-items: center; }
.pub-hero h1 { font-size: clamp(42px, 6.2vw, 70px); line-height: 1.01; letter-spacing: -0.058em; margin: 10px 0 20px; max-width: 12ch; }
.pub-lead { font-size: 19px; line-height: 1.55; color: var(--ink-2); max-width: 54ch; margin: 0; }
.pub-cta { margin-top: 30px; gap: 10px; }
.pub-proof { margin: 24px 0 0; font-size: 13.5px; color: var(--ink-3); }
.pub-proof strong { color: var(--ink); font-weight: 600; }

.pub-demo {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px;
  box-shadow: var(--shadow-lg);
}
.pub-demo-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.pub-demo-head .badge { margin-left: auto; }
.pub-queue { list-style: none; margin: 0; padding: 0; }
.pub-queue li {
  display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 13px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--panel-2); font-size: 13.5px; color: var(--ink-2); line-height: 1.35;
}
.pub-queue li:first-child { border-color: var(--accent-ring); color: var(--ink); }
.pub-dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--ink-3); }
.pub-dot.run { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); animation: pub-pulse 1.8s ease-in-out infinite; }
.pub-dot.done { border-color: var(--ok); background: var(--ok); }
@keyframes pub-pulse { 50% { box-shadow: 0 0 0 7px transparent; } }
@media (prefers-reduced-motion: reduce) { .pub-dot.run { animation: none; } }
.pub-demo-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; font-family: var(--mono); font-size: 11.5px; }

.pub-section { padding: 88px 0; }
.pub-alt { background: var(--panel); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pub-h2 { font-size: clamp(28px, 3.7vw, 42px); line-height: 1.07; letter-spacing: -0.048em; font-weight: 500; max-width: 22ch; margin: 8px 0 32px; }
.pub-sub { color: var(--ink-2); max-width: 62ch; margin: -14px 0 30px; font-size: 16px; }
.pub-narrow { max-width: 800px; }

.pub-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; counter-reset: step; }
.pub-step { border: 1px solid var(--line); border-radius: 16px; padding: 26px; background: var(--panel); }
.pub-step p, .pub-feature p { color: var(--ink-2); margin: 0; font-size: 14.5px; }
.pub-step h3, .pub-feature h3 { font-size: 17px; margin: 0 0 8px; }
.pub-step-n {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; margin-bottom: 18px;
}

.pub-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.pub-feature { border: 1px solid var(--line); border-radius: 16px; padding: 26px; background: var(--bg); }
.pub-feature h3::before { content: ""; display: block; width: 22px; height: 3px; border-radius: 2px; background: var(--accent); margin-bottom: 16px; }

.pub-showcase { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 18px; }
.pub-case {
  display: flex; flex-direction: column; gap: 8px; padding: 24px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--panel); color: var(--ink-2); font-size: 14px; transition: border-color .15s;
}
.pub-case strong { color: var(--ink); font-size: 18px; letter-spacing: -0.02em; }
.pub-case .mono { color: var(--accent-text); margin-top: auto; padding-top: 6px; }
.pub-case:hover { border-color: var(--accent-ring); text-decoration: none; }

#pricing .plan-card { background: var(--bg); }
.pub-alt#pricing .plan-card { background: var(--bg); }
#pricing .plan-btn { text-align: center; }

.pub-trust { display: grid; grid-template-columns: .8fr 1.2fr; gap: 48px; align-items: start; }
.pub-checks { list-style: none; margin: 8px 0 0; padding: 0; }
.pub-checks li { position: relative; padding: 0 0 16px 32px; color: var(--ink-2); font-size: 15.5px; }
.pub-checks li::before {
  content: ""; position: absolute; left: 0; top: 4px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent-soft) center / 11px no-repeat;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.5l4.5-5' fill='none' stroke='%23c7f464' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  border: 1px solid var(--accent-ring);
}

.pub-faq { border-bottom: 1px solid var(--line); }
.pub-faq summary { cursor: pointer; padding: 18px 0; font-size: 16.5px; font-weight: 600; letter-spacing: -0.015em; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.pub-faq summary::-webkit-details-marker { display: none; }
.pub-faq summary::after { content: "+"; color: var(--accent-text); font-weight: 400; font-size: 20px; line-height: 1; }
.pub-faq[open] summary::after { content: "–"; }
.pub-faq p { margin: -4px 0 18px; color: var(--ink-2); max-width: 68ch; }

.pub-final { padding: 104px 0; }
.pub-final .pub-h2 { margin-left: auto; margin-right: auto; }

.pub-foot { border-top: 1px solid var(--line); padding: 52px 0 30px; }
.pub-foot-grid { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 28px; }
.pub-foot-grid a:not(.brand) { display: block; color: var(--ink-2); font-size: 13.5px; margin: 7px 0; }
.pub-foot-grid a:not(.brand):hover { color: var(--ink); }
.pub-legal { margin: 34px 0 0; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }

@media (max-width: 920px) {
  .pub-hero-grid, .pub-trust { grid-template-columns: 1fr; gap: 40px; }
  .pub-steps, .pub-features { grid-template-columns: 1fr 1fr; }
  .pub-foot-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .pub-wrap { padding: 0 16px; }
  .pub-hide-sm { display: none; }
  .pub-nav { gap: 14px; }
  .pub-hero { padding: 44px 0 40px; }
  .pub-lead { font-size: 17px; }
  .pub-section { padding: 60px 0; }
  .pub-steps, .pub-features, .pub-foot-grid { grid-template-columns: 1fr; }
  .pub-queue li { grid-template-columns: 10px 1fr; }
  .pub-queue li .badge { grid-column: 2; justify-self: start; }
}

/* ------------------------------------------------------------------ chat, roomier (p7) */

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.chat { position: relative; min-height: 360px; max-height: min(70vh, 760px); }
.chat-new-badge {
  display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px; vertical-align: middle;
  background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; letter-spacing: 0;
}
.chat-day {
  display: flex; align-items: center; gap: 10px; margin: 14px 0 10px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
}
.chat-day::before, .chat-day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.chat-new-line {
  display: flex; align-items: center; gap: 10px; margin: 12px 0 10px;
  font-size: 11px; font-weight: 700; color: var(--accent-text);
}
.chat-new-line::after { content: ""; flex: 1; height: 1px; background: var(--accent-ring); }
.msg.new .bubble.agent { border-color: var(--accent-ring); box-shadow: 0 0 0 3px var(--accent-soft); }
.chat-older {
  display: block; margin: 0 auto 12px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-strong); background: transparent; color: var(--ink-2); font: inherit; font-size: 12.5px;
}
.chat-older:hover { color: var(--ink); border-color: var(--accent-ring); }
.bubble-text p { margin: 0 0 .55em; }
.bubble-text p:last-child { margin-bottom: 0; }
.bubble-text ul, .bubble-text ol { margin: .3em 0 .55em; padding-left: 1.2em; }
.bubble-text code { font-family: var(--mono); font-size: 12px; background: var(--panel-3); padding: 1px 4px; border-radius: 4px; }
.bubble.user .bubble-text code { background: rgba(127, 127, 127, .25); }
.bubble-text pre { overflow-x: auto; background: var(--panel-3); padding: 8px 10px; border-radius: 8px; }
.bubble-text h1, .bubble-text h2, .bubble-text h3 { font-size: 14px; font-weight: 700; margin: .4em 0 .3em; }
.bubble-meta { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 11px; color: var(--ink-3); }
.bubble.user .bubble-meta { color: inherit; opacity: .7; }
.bubble-meta .label { margin-top: 0; }
.bubble-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bubble-image img { display: block; max-width: 220px; max-height: 160px; border-radius: 8px; border: 1px solid var(--line); }
.file-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 8px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); font-size: 12px;
}
.file-chip:hover { text-decoration: none; border-color: var(--accent-ring); }
.file-kind { font-size: 9.5px; font-weight: 800; letter-spacing: .08em; color: var(--accent-text); }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.file-size { color: var(--ink-3); font-size: 11px; }
.file-remove { border: 0; background: none; color: var(--ink-3); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.file-remove:hover { color: var(--err); }
.chat-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chat-tools { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.chat-tools .chat-hint { margin: 0 0 0 auto; }
.chat-tool { width: 32px; height: 32px; cursor: pointer; }
.chat-tool.on { background: var(--err); border-color: var(--err); color: #fff; animation: step-pulse 1.4s ease-in-out infinite; }
@media (max-width: 640px) { .chat-tools .chat-hint { display: none; } }

/* ------------------------------------------------------------------ tasks, roomier (p7) */

.task-row { align-items: center; padding: 11px 6px; }
.task-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.task-row-meta { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-row-meta .prio-tag { margin: 0; }
.task-state.state-attention { color: var(--warn); }
.task-state.state-problem { color: var(--err); }
.task-state.state-queued { color: var(--accent-text); }
.now { padding: 13px 14px; margin-bottom: 12px; }
/* The task list grows with the page instead of scrolling inside it. */

/* ------------------------------------------------------------------ credits widget */

.credit-balance { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 12px; }
.credit-balance strong { font-size: 30px; font-weight: 500; letter-spacing: -0.04em; line-height: 1; }
.credit-month { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; }
.credit-month > div { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; background: var(--panel-2); }
.credit-month .label { display: block; font-size: 9.5px; margin-bottom: 2px; }
.credit-month b { font-family: var(--mono); font-size: 14px; color: var(--ink); }
.credit-lines { list-style: none; margin: 12px 0 0; padding: 0; }
.credit-lines li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.credit-lines li:last-child { border-bottom: 0; }
.credit-reason { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.credit-lines time { font-size: 11px; color: var(--ink-3); }
.credit-lines b { font-family: var(--mono); font-size: 12.5px; }
.credit-lines b.minus { color: var(--ink-2); }
.credit-lines b.plus { color: var(--ok); }
.credits-body { min-height: 200px; }

/* hidden always wins over a display rule (badges, file lists, the mic button). */
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ company names */
.name-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.name-head .btn { margin-bottom: 5px; }
.name-ideas { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 12.5px; color: var(--ink-3); }
.name-idea { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
.name-idea:hover { border-color: var(--accent-ring); }
.name-idea.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ------------------------------------------------------------------ task rows and the task modal (p8) */

.task-row { align-items: flex-start; }
.task-row .status-dot { margin-top: 6px; }
.task-row-title { display: block; font-weight: 600; font-size: 14px; letter-spacing: -0.01em; }
.task-row-title .prio-tag { margin: 0 6px 0 0; vertical-align: 1px; }
.task-row-about {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 12.5px; line-height: 1.45; color: var(--ink-3);
}
.icon-btn.attention { border-color: var(--warn); color: var(--warn); }

.task-nav { display: flex; align-items: center; gap: 6px; }
.task-nav .icon-btn { width: 30px; height: 30px; font-size: 16px; }
.task-nav .icon-btn:disabled { opacity: .35; cursor: default; background: transparent; border-color: var(--line-strong); color: var(--ink-3); }
.task-nav .label { margin-left: 6px; }
.task-panel-body { min-height: 240px; }
.task-panel-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.task-panel-meta .prio-tag { margin: 0; }
.task-panel-title { font-size: 22px; margin: 4px 0 10px; }
.task-panel-text { font-size: 14px; color: var(--ink-2); }
.task-panel-text p { margin: 0 0 .6em; }
.task-edit textarea { min-height: 0; }
.task-steps { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.task-step { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-3); }
.task-step.ok { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.task-step.now { color: var(--accent-text); border-color: var(--accent-ring); background: var(--accent-soft); }
.task-step.bad { color: var(--err); border-color: var(--err); background: var(--err-soft); }
.task-doc { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.task-doc:last-child { border-bottom: 0; }
.task-panel-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.task-full-link { margin-left: auto; }

/* ------------------------------------------------------------------ content plan */

.content-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.content-main { flex: 1; min-width: 220px; }
.content-preview { color: var(--ink-3); margin: 6px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.content-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.content-when { display: flex; align-items: center; gap: 6px; }
.content-when input { width: 190px; padding: 6px 8px; font-size: 12.5px; }
.channel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-top: 10px; }
.channel-tile { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--panel-2); }
.notice-item.kind-content .notice-icon, .toast.kind-content strong { color: var(--accent-text); }

/* ------------------------------------------------------------------ round 12: tasks, live log, rollback */

.log { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.log::-webkit-scrollbar { display: block; width: 6px; }
.log-card { position: relative; }
.log-jump {
  position: absolute; right: 16px; bottom: 16px; font: inherit; font-size: 11.5px; cursor: pointer;
  padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

.type-tag {
  display: inline-block; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-3); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-right: 4px; vertical-align: 1px;
}
.now-meta { display: block; font-size: 11.5px; color: var(--ink-3); margin: 2px 0 4px; }

.task-saved { margin-left: 4px; color: var(--ink-3); }
.task-saved.ok { color: var(--accent-text); }
.task-saved.err { color: var(--err); }

.agent-steps { margin-top: 4px; }
.agent-step { display: flex; gap: 8px; font-size: 12.5px; padding: 2px 0; }
.agent-step time { flex-shrink: 0; color: var(--ink-3); font-family: var(--mono); font-size: 11.5px; }
.agent-step .mono { font-family: var(--mono); font-size: 11.5px; }

.run-details { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.run-details summary { cursor: pointer; }
.run-row { display: flex; flex-direction: column; gap: 2px; font-size: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.run-row .muted { color: var(--ink-3); font-family: var(--mono); font-size: 11px; overflow-wrap: anywhere; }
.run-error { color: var(--err); }

.rollback-progress { border-left: 3px solid var(--accent); }
.rollback-progress.ok { border-left-color: var(--accent-text); }
.rollback-progress.bad { border-left-color: var(--err); }
.rollback-row { display: flex; align-items: center; gap: 10px; }
.spinner {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* ---------------------------------------------------------------- company mailbox (/mail) */
.mailbox-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.mailbox-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mailbox { display: grid; grid-template-columns: minmax(260px, 34%) minmax(0, 1fr); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); min-height: 560px; }
.mailbox-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; background: var(--panel-2); }
.mailbox-list-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.mailbox-tabs { display: flex; gap: 4px; }
.mailbox-tabs a { padding: 5px 11px; border-radius: 6px; color: var(--ink-3); font-size: 13px; }
.mailbox-tabs a[aria-current] { background: var(--panel-3); color: var(--ink); font-weight: 600; }
.mailbox-filter { padding: 8px 14px; border-bottom: 1px solid var(--line); }
.mailbox-filter input { margin: 0; font-size: 12.5px; padding: 7px 9px; }
.mailbox-item { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 2px 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--ink-2); text-decoration: none; }
.mailbox-item:hover { background: var(--panel-3); }
.mailbox-item.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.mailbox-item[hidden] { display: none; }
.mailbox-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--panel-3); color: var(--accent-text); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; grid-row: span 2; }
.mailbox-avatar.big { width: 40px; height: 40px; font-size: 16px; flex-shrink: 0; }
.mailbox-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mailbox-when { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); white-space: nowrap; text-align: right; }
.mailbox-subject { grid-column: 2 / 4; font-size: 12.5px; color: var(--ink-3); display: flex; gap: 6px; min-width: 0; }
.mailbox-subject span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mailbox-item.unread .mailbox-name { color: var(--ink); font-weight: 700; }
.mailbox-item.unread .mailbox-subject { color: var(--ink-2); }
.mailbox-item.unread .mailbox-when { color: var(--accent-text); }
.mailbox-pager { display: flex; justify-content: space-between; padding: 12px 14px; margin-top: auto; font-size: 12px; }
.mailbox-empty { padding: 32px 20px; color: var(--ink-3); margin: 0; }
.mailbox-reader { padding: 22px 26px; min-width: 0; overflow-wrap: anywhere; }
.mailbox-reader-head { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.mailbox-reader-head h2 { margin: 0; font-size: 20px; line-height: 1.35; flex: 1; min-width: 200px; }
.mailbox-from { display: flex; gap: 12px; align-items: center; margin: 16px 0 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.mailbox-files { display: grid; gap: 8px; margin-bottom: 18px; }
.mailbox-file { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 1px solid var(--line); background: var(--panel-2); border-radius: 9px; padding: 9px 12px; }
.mailbox-kind { font: 700 10px var(--mono); letter-spacing: 1px; background: var(--accent); color: var(--accent-ink); border-radius: 5px; padding: 4px 6px; }
.mailbox-kind.other { background: var(--ink-3); }
.mailbox-file-name { flex: 1; min-width: 140px; font-size: 13px; }
.mailbox-body { white-space: pre-wrap; font-family: inherit; font-size: 14px; line-height: 1.75; margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.mailbox-body a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.mailbox-compose { max-width: 900px; }
.mailbox-compose textarea { min-height: 280px; line-height: 1.65; }
.mailbox-copies { margin-top: 10px; }
.mailbox-copies summary { cursor: pointer; color: var(--accent-text); }
.mailbox-send { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.mailbox-dns { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.65; }
.mailbox-dns li.ok { color: var(--ok); }
.mailbox-dns li.bad { color: var(--err); }
@media (max-width: 900px) {
  .mailbox { grid-template-columns: 1fr; min-height: 0; }
  .mailbox-list { border-right: 0; border-bottom: 1px solid var(--line); }
  .mailbox.has-message .mailbox-reader { order: -1; border-bottom: 1px solid var(--line); }
  .mailbox-reader { padding: 18px; }
}
.mailbox-switch { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 14px; }
.mailbox-switch a { padding: 5px 11px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 12.5px; color: var(--ink-2); text-decoration: none; font-family: var(--mono); }
.mailbox-switch a[aria-current] { background: var(--accent-soft); border-color: var(--accent-text); color: var(--ink); }
.mailbox-switch .badge { font-family: inherit; margin-left: 4px; }
.mailbox-address { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; }
.mailbox-address .badge { margin-left: 6px; }
.mailbox-more { grid-column: 1 / -1; }
.mailbox-more summary { cursor: pointer; color: var(--accent-text); }
.mailbox-domain { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: var(--panel-2); }
.mailbox-records td { font-size: 12px; vertical-align: top; }
.mailbox-local { display: flex; align-items: center; gap: 6px; }
.mailbox-local input { flex: 1; min-width: 80px; }
.notice.warn { background: var(--warn-soft); color: var(--ink); border-color: var(--warn); }

/* ---------------------------------------------------------------- ads (/ads) */
.ads-totals { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.ads-total { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.ads-total strong { font-size: 20px; font-family: var(--mono); color: var(--ink); }

/* ------------------------------------------------------ sending limit (/mail) */
.mail-meter { height: 8px; border-radius: 999px; background: var(--panel-3); overflow: hidden; }
.mail-meter span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.mail-meter.high span { background: var(--warn); }
.mail-meter.full span { background: var(--err); }
.mailbox-limit { margin: 2px 0 0; }

/* ------------------------------------------ dashboard: channels two to a row */
.widget-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 16px; align-content: start; }
.widget-grid > * { grid-column: 1 / -1; }
.widget-grid > .channel-widget { grid-column: auto; }
@media (max-width: 700px) { .widget-grid > .channel-widget { grid-column: 1 / -1; } }
.channel-widget.soon { opacity: .75; }
.channel-widget.soon .badge { background: var(--warn-soft); color: var(--ink-2); }
.task-more {
  display: block; width: 100%; margin-top: 8px; padding: 8px 10px; border: 1px dashed var(--line-strong); border-radius: 8px;
  background: none; color: var(--accent-text); font: inherit; font-size: 13px; text-align: center; cursor: pointer;
}
.task-more:hover { background: var(--panel-2); }

/* ------------------------------------------ chat: loaded after the page, sent in place */
.chat-loading { margin: 14px 4px; }
.chat-error { margin: 6px 0 2px; font-size: 12.5px; color: var(--err); text-align: right; }

/* ---------------------------------------------- round 23: steadier dashboard */
/* The chat fills the window's height on wide screens and stays in view while
   the page scrolls; the conversation scrolls inside it. It is held exactly where
   it starts, the page's 24px under the header (--topbar-h, measured by the
   layout), so scrolling never nudges it; without a bottom margin, the end of the
   page cannot push it up under the header either. */
@media (min-width: 1101px) {
  .grid > div:last-child { align-self: stretch; }
  .chat-card {
    position: sticky; top: calc(var(--topbar-h, 59px) + 24px); display: flex; flex-direction: column;
    height: calc(100vh - var(--topbar-h, 59px) - 48px); min-height: 460px; margin-bottom: 0;
  }
  .chat-card .chat { flex: 1 1 auto; min-height: 0; max-height: none; }
}
.chat-tools > * { margin: 0; }
.chat-tools .btn { height: 32px; display: inline-flex; align-items: center; }
.chat-tools .chat-tool svg { display: block; }

/* A modal holds the page still behind it. */
html:has(dialog[open]) { overflow: hidden; }

/* The live log: a line where the day changes. */
.log .log-day {
  display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; font-family: var(--sans, inherit);
  font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
}
.log .log-day::before, .log .log-day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.log-jump { z-index: 2; }

/* Chat replies read better with a little structure. */
.bubble.agent ul, .bubble.agent ol { margin: 6px 0; padding-left: 20px; }
.bubble.agent li + li { margin-top: 3px; }
.bubble.agent p { margin: 0 0 6px; }
.bubble.agent p:last-child { margin-bottom: 0; }

/* One scroller per modal: the dialog clips, a list inside (.modal-scroll) scrolls,
   and the heading and buttons stay put. */
dialog.modal { overflow: hidden; }
.modal-body { max-height: calc(100vh - 48px); }
.modal-body:has(.modal-scroll) { overflow: hidden; }

/* A banner over the dashboard (a paused company) spans the two widget columns;
   the chat column starts at the top beside it instead of being pushed down. */
/* Wide screens only: on a phone the grid is one column and the banner simply comes first. */
.grid > .grid-banner { margin: 0; }
@media (min-width: 1101px) {
  .grid > .grid-banner { grid-column: 1 / 3; grid-row: 1; }
  .grid.has-banner > [data-region="col-left"] { grid-column: 1; grid-row: 2; }
  .grid.has-banner > [data-region="col-middle"] { grid-column: 2; grid-row: 2; }
  .grid.has-banner > div:last-child { grid-column: 3; grid-row: 1 / span 2; }
}

/* On the dashboard, the message after an action floats just under the header
   instead of pushing the page (and the chat) down; it fades on its own. */
.floating-notices > [data-region="flash"] {
  position: fixed; top: calc(var(--topbar-h, 64px) + 10px); left: 50%; transform: translateX(-50%); z-index: 50;
  width: min(560px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.floating-notices > [data-region="flash"] .notice {
  margin: 0; pointer-events: auto; cursor: pointer; box-shadow: var(--shadow-lg);
  animation: toast-in .25s ease-out; transition: opacity .5s, transform .5s;
}
.floating-notices > [data-region="flash"] .notice.ok { background: linear-gradient(var(--ok-soft), var(--ok-soft)), var(--panel); border-color: var(--ok); }
.floating-notices > [data-region="flash"] .notice.err { background: linear-gradient(var(--err-soft), var(--err-soft)), var(--panel); border-color: var(--err); }
.floating-notices > [data-region="flash"] .notice.out { opacity: 0; transform: translateY(-6px); }
@media (prefers-reduced-motion: reduce) {
  .floating-notices > [data-region="flash"] .notice { animation: none; transition: none; }
}

/* ---------------------------------------------- round 27: documents and the foundation */
/* The Documents widget: the foundation first, then the latest of the rest, one line each. */
.doc-view-all { background: none; border: 0; padding: 0; cursor: pointer; }
.doc-view-all:hover { color: var(--accent-text); }
.doc-section {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 14px 0 2px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
}
.doc-widget .card-head + .doc-section { margin-top: 0; }
.doc-section span { font-family: var(--mono); font-weight: 500; letter-spacing: 0; text-transform: none; }
.doc-section span.ok { color: var(--ok); }
.doc-lines { list-style: none; margin: 0; padding: 0; }
.doc-line { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.doc-line:last-child { border-bottom: 0; }
.doc-line[hidden] { display: none; }
.doc-line form { margin: 0; }
.doc-ico {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 7px;
  background: color-mix(in srgb, var(--kind, #9ba59d) 15%, transparent); color: color-mix(in srgb, var(--kind, #9ba59d) 80%, var(--ink));
}
.doc-ico.empty { background: none; border: 1px dashed var(--line-strong); color: var(--ink-3); }
.doc-line-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; color: var(--ink); }
a.doc-line-title:hover { color: var(--accent-text); text-decoration: none; }
.doc-line-title strong { font-weight: 600; }
.doc-line-title strong + span { color: var(--ink-3); margin-left: 4px; }
.doc-line-meta { flex-shrink: 0; font-family: var(--mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.doc-line-meta a { color: var(--accent-text); }
.doc-line.state-working .doc-line-meta { color: var(--accent-text); }
.doc-line-empty { color: var(--ink-3); font-size: 13px; }
.doc-update { opacity: .55; }
.doc-line:hover .doc-update, .doc-update:focus-visible { opacity: 1; }
@media (hover: none) { .doc-update { opacity: 1; } }
.doc-write { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 2px; }
.doc-write .small { flex: 1; min-width: 180px; }

/* "View all": the tabs stay at the top while the list scrolls under them. */
.doc-all-tabs { position: sticky; top: 0; z-index: 1; background: var(--panel); padding: 2px 0 10px; margin-bottom: 0; }
.doc-tabs button {
  display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); font: inherit; font-size: 13px; cursor: pointer;
}
.doc-tabs button:hover { border-color: var(--line-strong); color: var(--ink); }
.doc-tabs button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.doc-tabs button span { font-family: var(--mono); font-size: 11px; opacity: .7; }
.doc-all .doc-lines { margin-bottom: 8px; }

/* Writing or editing a document. */
.doc-edit { display: flex; flex-direction: column; gap: 8px; }
.doc-edit label { margin-top: 6px; }
.doc-edit textarea { min-height: 420px; font-family: var(--mono); font-size: 13px; line-height: 1.55; }
.doc-edit .row-actions { margin-top: 8px; }

/* ---------------------------------------------- round 28: switching on company email */
/* The administrator's checklist: numbered steps, done ones ticked, the next one marked. */
.setup-steps { list-style: none; counter-reset: step; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.setup-steps > li {
  counter-increment: step; position: relative; padding: 12px 14px 12px 46px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2);
}
.setup-steps > li::before {
  content: counter(step); position: absolute; left: 14px; top: 11px; width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
  background: var(--panel); border: 1px solid var(--line-strong); color: var(--ink-2);
}
.setup-steps > li.done::before { content: "✓"; background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.setup-steps > li.now { border-color: var(--accent-ring); }
.setup-steps > li.now::before { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.setup-step-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.setup-steps form { margin: 0; }

/* ---------------------------------------------- round 30: terms of service */
/* The sign-up tick box, and the terms page: a readable column of plain text. */
.terms-check {
  display: flex; align-items: flex-start; gap: 10px; margin-top: 16px;
  text-transform: none; letter-spacing: 0; font-family: inherit; font-size: 13.5px; font-weight: 400; line-height: 1.5; color: var(--ink-2);
}
.terms-check input { width: auto; margin: 3px 0 0; flex-shrink: 0; }
.pub-legal-doc { max-width: 760px; }
.pub-legal-doc h2 { font-size: 18px; margin: 30px 0 8px; }
.pub-legal-doc p, .pub-legal-doc li { color: var(--ink-2); line-height: 1.65; }
.pub-legal-doc ul { padding-left: 20px; }
.pub-legal-doc li + li { margin-top: 6px; }

/* Monthly or yearly: which set of plan cards shows (billing page, public pricing). */
.interval-switch { display: flex; justify-content: center; margin: 4px 0 16px; }
.interval-switch .segmented button { font-size: 12.5px; padding: 7px 16px; }
.interval-switch .save { margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-size: 10.5px; }
.interval-switch button.on .save { background: rgba(0, 0, 0, .12); color: inherit; }
.plan-saving { margin: -8px 0 14px; color: var(--ink-3); font-size: 12.5px; }

/* ------------------------------------------------------ round 36: video ads */
/* The Ads page's videos, and the player on a video's document page: vertical, like the phone they are for. */
.video-form textarea { min-height: 72px; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.video-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel-2); min-width: 0; }
.video-still-link { display: block; }
.video-still { display: block; width: 100%; aspect-ratio: 9 / 16; object-fit: cover; background: var(--panel-3); }
.video-still-empty { display: flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: 12.5px; }
.video-meta { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px 10px; min-width: 0; }
.video-meta strong { font-size: 13px; overflow-wrap: anywhere; }
.video-player { display: block; width: 100%; max-width: 340px; aspect-ratio: 9 / 16; max-height: 72vh; background: #000; border-radius: 12px; }
.video-panel { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.video-panel .video-facts { flex: 1; min-width: 220px; }

/* ------------------------------------------------ round 37: Reels ads on Meta */
/* The Ads page: the form that runs a finished video as a Reels ad, and each ad with its state. */
.placement-new > summary { list-style: none; display: inline-flex; cursor: pointer; }
.placement-new > summary::-webkit-details-marker { display: none; }
.placement-form { margin-top: 14px; display: flex; flex-direction: column; gap: 4px; }
.placements { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.placement { border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; background: var(--panel-2); min-width: 0; }
.placement.active { border-left-color: var(--accent); }
.placement.failed { border-left-color: var(--err); }
.placement-head { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.placement-head strong { overflow-wrap: anywhere; }
.placement-start { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.placement-start .check-row { flex: 1; min-width: 240px; font-size: 13px; }

/* The cookie question for the Meta Pixel: public pages only, until the visitor answers. */
.consent { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 60; max-width: 560px; margin: 0 auto;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 14px 16px; }
.consent p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.consent .row-actions { gap: 8px; }

/* ------------------------------------- round 38: posting to Facebook and Instagram */
/* A planned post's picture and button, and a video's "Post as a Reel". */
.content-meta { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.content-meta select { width: auto; max-width: 180px; }
.content-picture { display: inline-flex; gap: 6px; align-items: center; margin: 0; text-transform: none; letter-spacing: 0; }
.content-picture input[type="file"] { max-width: 210px; font-size: 12px; padding: 4px; }
.reel-post { margin-top: 12px; }
.reel-post > summary { list-style: none; display: inline-flex; cursor: pointer; }
.reel-post > summary::-webkit-details-marker { display: none; }
.reel-posted { margin: 10px 0 0; padding-left: 18px; }

/* ------------------------- round 39: Google Business, YouTube, TikTok, Admin › Marketing */
/* A Google Business post's location, button and its address; the Media widget's videos. */
.content-google input[type="url"] { width: auto; min-width: 0; max-width: 220px; font-size: 13px; }
.media-row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.media-row a { min-width: 0; overflow-wrap: anywhere; }
.reel-post .field-row { margin-top: 6px; }
