:root {
  --bg: #f4f5fa;
  --surface: #ffffff;
  --ink: #16142b;
  --muted: #6b6884;
  --line: #e7e6f0;
  --soft: #f6f6fb;
  --indigo: #7c5cfc;
  --indigo-deep: #4b33c9;
  --indigo-wash: #efebff;
  --green: #12a46b;
  --green-wash: #e3f6ee;
  --amber: #b06a00;
  --amber-wash: #fff2d9;
  --red: #d9344f;
  --red-wash: #fde8ec;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(22, 20, 43, .04), 0 8px 24px -12px rgba(22, 20, 43, .12);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--indigo-deep); text-underline-offset: 3px; }
small { font-size: 12px; }
code { background: var(--indigo-wash); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ic { width: 18px; height: 18px; flex: 0 0 auto; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 20px 14px 14px;
  background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 22px; font-weight: 800; font-size: 19px; letter-spacing: -0.03em; color: var(--ink); text-decoration: none; }
.brand > span:last-child { color: var(--indigo); margin-left: -5px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #8f74ff, #4b33c9); box-shadow: 0 6px 14px -6px rgba(75, 51, 201, .7);
}
.brand-mark svg { width: 20px; height: 20px; }

.side-list a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 11px;
  color: var(--ink); text-decoration: none; font-weight: 500; font-size: 14px;
}
.side-list a .ic { color: var(--muted); }
.side-list a:hover { background: var(--soft); }
.side-list a[aria-current="page"] { background: var(--indigo-wash); color: var(--indigo-deep); font-weight: 600; }
.side-list a[aria-current="page"] .ic { color: var(--indigo-deep); }
.side-name { flex: 1; min-width: 0; }
.side-list small { color: var(--muted); }
.side-list .side-warn { color: var(--amber); font-weight: 500; }

.side-cta {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin: 16px 2px 6px; min-height: 44px;
  border-radius: 12px; color: #fff; font-weight: 600; font-size: 14px; text-decoration: none;
  background: linear-gradient(135deg, #7c5cfc, #4b33c9); box-shadow: 0 8px 18px -10px rgba(75, 51, 201, .8);
}
.side-cta:hover { filter: brightness(1.08); }
.side-head { display: flex; justify-content: space-between; padding: 18px 12px 8px; font-size: 12px; font-weight: 600; color: var(--muted); }

.side-agents a { display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: 12px; text-decoration: none; color: var(--ink); }
.side-agents a:hover { background: var(--soft); }
.side-agents a[aria-current="page"] { background: var(--indigo-wash); }
.side-agent-text { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.side-agent-text strong { font-size: 14px; font-weight: 600; }
.side-agent-text small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-me { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.side-me .link { font-size: 12px; }

.count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--indigo-deep); color: #fff;
  font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; font-style: normal;
}
.me-dot {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; display: grid; place-items: center;
  background: #0f7a5a; color: #fff; font-weight: 700; font-size: 14px;
}

/* avatars: one colour and icon per agent */
.av { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.av .ic { width: 19px; height: 19px; stroke-width: 2; }
.av-sm { width: 32px; height: 32px; flex-basis: 32px; border-radius: 10px; }
.av-sm .ic { width: 16px; height: 16px; }
.av-lg { width: 56px; height: 56px; flex-basis: 56px; border-radius: 17px; }
.av-lg .ic { width: 26px; height: 26px; }
.av-violet { background: linear-gradient(135deg, #a28bff, #6c4cf5); }
.av-teal { background: linear-gradient(135deg, #3fd2c7, #0f9c8f); }
.av-blue { background: linear-gradient(135deg, #6aa8ff, #3366e6); }
.av-orange { background: linear-gradient(135deg, #ffad5a, #f0660f); }
.av-pink { background: linear-gradient(135deg, #ff8ab8, #e0407e); }
.av-green { background: linear-gradient(135deg, #5fdc9a, #149a5c); }
.av-indigo { background: linear-gradient(135deg, #7c7cff, #3f37c9); }
.av-amber { background: linear-gradient(135deg, #ffd25e, #e89a00); }
.av-ink { background: linear-gradient(135deg, #4a4766, #16142b); }

/* status dots */
.dot { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--line); display: inline-block; }
.dot-ok { background: #20c47f; box-shadow: 0 0 0 3px #dff7ec; }
.dot-error { background: var(--red); box-shadow: 0 0 0 3px var(--red-wash); }
.dot-running { background: var(--indigo); animation: pulse 1s ease-in-out infinite alternate; }
.dot-paused, .dot-off { background: none; border: 2px solid #cfcde0; }
.dot-idle { background: #cfcde0; }
@keyframes pulse { to { opacity: .3; } }

/* ---------- top bar ---------- */
.frame { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 14px 32px;
  background: rgba(255, 255, 255, .86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar-title { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; margin-right: auto; }
.menu-btn { display: none; }
.search {
  display: flex; align-items: center; gap: 8px; width: min(320px, 40vw); padding: 0 12px; height: 40px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--muted);
}
.search:focus-within { border-color: var(--indigo); }
.search input { border: 0; outline: 0; padding: 0; height: 100%; background: none; font: inherit; color: var(--ink); width: 100%; }
.bell { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; color: var(--muted); }
.bell:hover { background: var(--soft); color: var(--ink); }
.bell .ic { width: 21px; height: 21px; }
.bell i { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px #fff; }

.main { padding: 32px 32px 96px; width: 100%; max-width: 1360px; }
.hello { margin-bottom: 26px; }
.hello h1 { font-size: clamp(26px, 3.4vw, 34px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.15; }
.hello p { color: var(--muted); margin-top: 6px; max-width: 70ch; }
.column { max-width: 820px; }
section + section, .column + .column { margin-top: 36px; }
h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 14px; }
h2 small { font-weight: 400; color: var(--muted); margin-left: 6px; }

/* ---------- widget grid ---------- */
.widgets {
  display: grid; gap: 20px; grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-areas:
    "send pipe tasks brief"
    "appr next live brief"
    "appr reps reps reps";
}
.widgets section + section { margin-top: 0; }
.w { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: flex; flex-direction: column; min-width: 0; }
.w header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.w header h2 { margin: 0; font-size: 15px; letter-spacing: -0.01em; flex: 1; }
.w header > span:last-child, .w header > a { font-size: 12px; color: var(--muted); font-weight: 500; }
.w header > a { color: var(--indigo-deep); }
.w-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 30px; }
.w-ic .ic { width: 16px; height: 16px; }
.w-ic-dark { background: var(--ink); color: #ffd25e; }
.w-ic-green { background: var(--green-wash); color: var(--green); }
.w-ic-amber { background: var(--amber-wash); color: var(--amber); }
.w-ic-blue { background: #e6efff; color: #3366e6; }
.w-ic-red { background: var(--red-wash); color: var(--red); }
.w-ic-violet { background: var(--indigo-wash); color: var(--indigo-deep); }
.w-ic-glass { background: rgba(255, 255, 255, .1); color: #c8bdff; }
.w-big { font-size: 46px; font-weight: 800; letter-spacing: -0.05em; line-height: 1; }
.w-big small { font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--muted); margin-left: 8px; }
.w-sub { color: var(--muted); font-size: 13px; margin-top: 6px; }
.w-label { font-size: 12px; font-weight: 600; color: var(--muted); margin: 20px 0 10px; }
.w-empty { color: var(--muted); font-size: 14px; padding: 8px 0; }
.w-more { margin-top: auto; padding-top: 14px; font-size: 13px; font-weight: 600; }

.w-send { grid-area: send; color: #fff; background: radial-gradient(120% 90% at 90% 0%, #9b85ff 0%, transparent 60%), linear-gradient(150deg, #6c4cf5, #3b2bb4); }
.w-send header h2 { color: #fff; }
.w-send header > span:last-child, .w-send .w-sub, .w-send .w-big small { color: rgba(255, 255, 255, .78); }
.w-send .w-big { font-size: 58px; margin-top: 6px; }
.w-days { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: auto; padding-top: 18px; }
.w-days li { background: rgba(255, 255, 255, .14); border-radius: 10px; padding: 7px 4px; text-align: center; font-size: 12px; display: grid; }
.w-days b { font-weight: 600; }
.w-days span { color: rgba(255, 255, 255, .8); }

.w-pipe { grid-area: pipe; background: linear-gradient(160deg, #fff6d8, #ffe7b0); }
.w-pipe .w-sub { color: #6d5a2c; }
.w-pipe-body { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex: 1; }
.pill { display: inline-block; margin-top: 12px; padding: 4px 10px; border-radius: 99px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 600; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 96px; }
.bars li { width: 12px; height: var(--h); border-radius: 99px; background: var(--c); }
.bar-key { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 14px; font-size: 11px; color: #6d5a2c; }
.bar-key li::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c); margin-right: 5px; }
.bar-key b { color: var(--ink); }

.w-tasks { grid-area: tasks; }
.progress { height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; margin-bottom: 14px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, #20c47f, #12a46b); border-radius: inherit; }
.tasks li { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 14px; font-weight: 500; }
.tasks a { color: var(--ink); text-decoration: none; }
.tasks a:hover { color: var(--indigo-deep); text-decoration: underline; }
.tasks s { color: var(--muted); }
.tick { width: 20px; height: 20px; flex: 0 0 20px; border-radius: 6px; border: 1.6px solid #cfcde0; display: grid; place-items: center; }
.tasks .ok .tick { background: #20c47f; border-color: #20c47f; color: #fff; }
.tick .ic { width: 20px; height: 20px; stroke-width: 2.4; }
.tick .ic rect { display: none; }

.w-brief { grid-area: brief; }
.brief-art {
  border-radius: 14px; padding: 22px 18px; display: flex; gap: 22px; color: #fff; min-height: 140px; align-items: flex-end;
  background: radial-gradient(70% 90% at 85% 15%, rgba(255, 255, 255, .35), transparent 60%), linear-gradient(135deg, #8b5cf6, #ec4899 55%, #fb923c);
}
.brief-art p { display: grid; font-size: 12px; font-weight: 500; }
.brief-art b { font-size: 40px; font-weight: 800; letter-spacing: -0.05em; line-height: 1; }
.brief-text { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.45; margin: 16px 0 6px; }
.brief-list li { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.brief-list li:first-child { margin-top: 8px; }
.brief-list div { display: grid; }
.brief-list small { color: var(--muted); }
.brief-list b { font-size: 15px; }

.w-appr { grid-area: appr; }
.mini li + li { margin-top: 8px; }
.mini a { display: flex; gap: 11px; align-items: center; padding: 10px; background: var(--soft); border-radius: 12px; text-decoration: none; color: var(--ink); }
.mini a:hover { background: var(--indigo-wash); }
.mini span:last-child { display: grid; min-width: 0; line-height: 1.3; }
.mini strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini small { color: var(--muted); }

.w-next { grid-area: next; }
.timeline li { display: grid; grid-template-columns: 112px 1fr; gap: 10px; align-items: center; }
.timeline li + li { margin-top: 8px; }
.timeline time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline a { padding: 8px 12px; border-radius: 10px; background: var(--soft); border-left: 3px solid #f59f00; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 13px; }
.timeline li:nth-child(2) a { border-left-color: var(--indigo); }
.timeline li:nth-child(3) a { border-left-color: #22b8cf; }
.timeline li:nth-child(4) a { border-left-color: #e0407e; }

.w-live { grid-area: live; background: linear-gradient(170deg, #1d1b3a, #11102a); color: #fff; }
.w-live header h2 { color: #fff; }
.live { color: #9aa0ff !important; display: inline-flex; align-items: center; gap: 6px; }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #20c47f; animation: pulse 1.2s ease-in-out infinite alternate; }
.feed li { display: flex; gap: 11px; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, .06); }
.feed li + li { margin-top: 8px; }
.feed p { font-size: 13px; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.feed small { color: #8fe3b9; }

.w-reps { grid-area: reps; }
.reps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.reps li { background: var(--soft); border-radius: 14px; padding: 14px; }
.reps strong { display: block; font-size: 14px; margin: 4px 0; }
.reps li > p:last-child { font-size: 13px; color: var(--muted); }
.rep-tag { font-size: 11px; font-weight: 700; color: var(--muted); }
.rep-interested, .rep-question { color: var(--green); }
.rep-not_now, .rep-out_of_office { color: var(--amber); }
.rep-not_interested, .rep-unsubscribe { color: var(--red); }

@media (prefers-reduced-motion: reduce) { .dot-running, .live::before { animation: none; } }

/* ---------- shared bits ---------- */
.link { background: none; border: 0; padding: 4px 0; font: inherit; font-size: 13px; font-weight: 500; color: var(--indigo-deep); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.hint { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.empty { color: var(--muted); padding: 22px; border: 1.5px dashed var(--line); border-radius: var(--radius); background: var(--surface); }
.notice {
  background: var(--amber-wash); color: #6b4100; padding: 12px 16px; border-radius: 14px; margin-bottom: 14px; max-width: 820px;
  font-size: 14px; display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap;
}
.notice-bad { background: var(--red-wash); color: #7d1a2d; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  font: inherit; font-weight: 600; font-size: 14px; padding: 9px 16px; min-height: 42px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn:hover { border-color: var(--indigo); }
.btn-primary { background: linear-gradient(135deg, #7c5cfc, #4b33c9); border-color: transparent; color: #fff; box-shadow: 0 8px 18px -10px rgba(75, 51, 201, .8); }
.btn-primary:hover { filter: brightness(1.08); border-color: transparent; }
.btn-quiet { background: none; border-color: transparent; color: var(--muted); }
.btn-quiet:hover { color: var(--red); border-color: transparent; }
.busy { opacity: .55; pointer-events: none; }

input, textarea, select {
  font: inherit; color: var(--ink); width: 100%; padding: 10px 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 11px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--indigo-wash); border-color: var(--indigo); }
textarea { resize: vertical; line-height: 1.55; }
input[type="file"] { padding: 8px; }
label { display: block; font-size: 13px; font-weight: 600; }
label input, label textarea { display: block; margin-top: 6px; font-weight: 400; }
label small { display: block; font-weight: 400; color: var(--muted); }
.form-error { color: var(--red); font-size: 13px; margin-bottom: 8px; }

/* drafts */
.draft { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; border-top: 4px solid var(--indigo); }
.draft-reply { border-top-color: #20c47f; }
.draft-linkedin_post { border-top-color: #e0407e; }
.draft-head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; margin-bottom: 6px; }
.draft-head span { color: var(--muted); }
.tag { font-style: normal; font-size: 12px; background: var(--amber-wash); color: var(--amber); padding: 2px 9px; border-radius: 99px; }
.why { color: var(--muted); font-size: 13px; margin-bottom: 12px; max-width: 70ch; white-space: pre-line; }
.warn { display: block; color: var(--amber); font-size: 13px; margin: 4px 0 10px; }
.subject { font-weight: 600; margin-bottom: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin-top: 12px; }
.rewrite { flex: 1 1 100%; font-size: 13px; }
.rewrite summary, .panel summary, .lead details summary { cursor: pointer; color: var(--indigo-deep); font-weight: 600; }
.rewrite[open] { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.rewrite[open] summary { grid-column: 1 / -1; }
.post { white-space: pre-wrap; font: inherit; margin: 0; max-width: 62ch; }

/* leads */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.filters a { padding: 7px 13px; border-radius: 99px; background: var(--surface); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 500; }
.filters a small { color: var(--muted); }
.filters a[aria-current="page"] { background: var(--ink); color: #fff; }
.filters a[aria-current="page"] small { color: #c9c6e0; }
.table, .card-table { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; max-width: 980px; overflow: hidden; }
.lead { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; padding: 14px 18px; }
.lead + .lead { border-top: 1px solid var(--line); }
.lead-who { min-width: 0; }
.lead-who > span { display: block; color: var(--muted); font-size: 13px; }
.lead details { font-size: 13px; margin-top: 4px; }
.lead details p { color: var(--muted); margin-top: 4px; max-width: 62ch; }
.lead-stage { flex: 0 0 160px; }
.lead-stage select { padding: 8px 10px; font-size: 13px; }
.panel { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 18px; margin-bottom: 10px; }
.stack { display: grid; gap: 14px; margin-top: 12px; }
.stack .btn { justify-self: start; }
.grid2 { grid-template-columns: 1fr 1fr; }
.grid2 > input[type="hidden"] { display: none; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; align-items: end; }

/* schedules */
.sched-row { display: grid; grid-template-columns: auto 1.4fr 1fr 1fr auto; gap: 16px; align-items: center; padding: 14px 18px; color: var(--ink); text-decoration: none; }
.sched-row + .sched-row { border-top: 1px solid var(--line); }
.sched-row:hover { background: var(--soft); }
.sched-row > span { display: grid; font-size: 14px; }
.sched-row small { color: var(--muted); }

/* settings */
.conns { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 18px; max-width: 820px; }
.conns li { display: flex; gap: 12px; padding: 12px 0; font-size: 13px; }
.conns li + li { border-top: 1px solid var(--line); }
.conns .dot { margin-top: 6px; }
.conns strong { display: block; font-size: 14px; }
.conns span { color: var(--muted); }
#settings form, #log-reply form { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; max-width: 820px; }
.where { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px 18px; max-width: 820px; }
.where li { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; font-size: 14px; }
.where li + li { border-top: 1px solid var(--line); }

/* activity log */
.log { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px 18px; max-width: 820px; }
.log li { display: grid; grid-template-columns: 110px 1fr; gap: 10px; font-size: 13px; padding: 10px 0; }
.log li + li { border-top: 1px solid var(--line); }
.log time { color: var(--muted); }
.log a { color: var(--ink); text-decoration: none; }
.log-error span { color: var(--red); }

/* ---------- agent page ---------- */
.agent-hero { max-width: 900px; }
.agent-hero .av-lg { margin-bottom: 16px; box-shadow: 0 10px 22px -12px rgba(22, 20, 43, .5); }
.agent-hero h1 { font-size: clamp(30px, 4vw, 42px); font-weight: 800; letter-spacing: -0.04em; line-height: 1.05; }
.agent-hero .brief { color: var(--muted); margin-top: 6px; font-size: 16px; }
.agent-state { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.agent-last { margin: 20px 0 16px; padding: 16px 18px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); border-left: 4px solid #20c47f; max-width: 72ch; }
.agent-last-bad { border-left-color: var(--red); background: var(--red-wash); }
.agent-when { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.agent-next { font-size: 13px; color: var(--muted); align-self: center; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-top: 28px; max-width: 900px; }
.stats div { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 4px 0 0; font-size: 26px; font-weight: 800; letter-spacing: -0.04em; }
.stats + section, .agent-cols, .agent-cols + section { margin-top: 36px; }
#queue, #ready, #runs, #settings, #log-reply { max-width: 820px; }
.agent-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 900px; }
.agent-cols section { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-top: 0; }
.how li { position: relative; padding: 0 0 10px 18px; }
.how li::before { content: ""; position: absolute; left: 2px; top: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--indigo); }
.sched fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 6px; }
.sched legend { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.choice { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; }
.choice input, .day input { display: inline-block; width: auto; margin: 0; accent-color: var(--indigo-deep); }
.days { display: flex !important; flex-wrap: wrap; gap: 6px !important; }
.days legend { width: 100%; }
.day span { display: inline-block; padding: 6px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-weight: 500; cursor: pointer; }
.day input { position: absolute; opacity: 0; }
.day input:checked + span { background: var(--indigo-deep); border-color: var(--indigo-deep); color: #fff; }
.day input:focus-visible + span { outline: 2px solid var(--indigo); outline-offset: 2px; }
.short { max-width: 170px; }
.js [data-sched] [data-show][hidden] { display: none !important; }

/* ---------- login ---------- */
.gate { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.gate-box { width: 100%; max-width: 380px; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); padding: 32px; }
.gate-box h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.04em; margin: 22px 0 16px; }
.gate-box form { display: grid; gap: 10px; }
.gate-box .btn { margin-top: 6px; }
.gate-note { color: var(--muted); margin-bottom: 18px; }
.wordmark { font-weight: 800; font-size: 20px; letter-spacing: -0.03em; }
.wordmark span { color: var(--indigo); }

/* ---------- smaller screens ---------- */
@media (max-width: 1280px) {
  .widgets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "send pipe" "tasks brief" "appr brief" "next live" "reps reps";
  }
}
@media (max-width: 900px) {
  .shell { display: block; }
  .menu-btn {
    display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line);
    background: var(--surface); color: var(--ink); margin-left: -4px;
  }
  .topbar { padding: 12px 16px; gap: 10px; }
  .search { width: auto; flex: 1; }
  .topbar-title { display: none; }
  .topbar > .me-dot { display: none; }
  .js .side {
    position: fixed; z-index: 20; inset: 0 auto 0 0; width: min(300px, 86vw); height: 100vh;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(22, 20, 43, .25);
  }
  .js .side.open { transform: none; }
  .side { position: static; height: auto; }
  .main { padding: 22px 16px 80px; }
  .agent-cols, .reps { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .widgets { grid-template-columns: 1fr; grid-template-areas: "appr" "send" "tasks" "pipe" "brief" "next" "live" "reps"; }
  .lead { flex-direction: column; gap: 8px; }
  .lead-stage { flex: none; width: 100%; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .sched-row { grid-template-columns: auto 1fr auto; }
  .sched-last, .sched-next { display: none !important; }
  .log li { grid-template-columns: 1fr; gap: 0; }
  .actions .btn-primary { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) { .js .side { transition: none; } }

/* keep the sidebar's white column running the full page height, and dim the page behind the phone menu */
@media (min-width: 901px) { .shell { background: linear-gradient(90deg, var(--surface) 264px, transparent 264px); } }
@media (max-width: 900px) {
  body.menu-open::after { content: ""; position: fixed; inset: 0; z-index: 15; background: rgba(22, 20, 43, .35); }
}
