/* Woodfield Outreach dashboard. Palette and type follow the design mockup:
   Space Grotesk + IBM Plex Mono, indigo accent, four status colours. */

:root {
  color-scheme: light;
  --bg: oklch(0.98 0.005 260);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.965 0.005 260);
  --border: oklch(0.91 0.005 260);
  --border-strong: oklch(0.84 0.01 260);
  --text: oklch(0.22 0.02 260);
  --muted: oklch(0.5 0.02 260);
  --faint: oklch(0.66 0.015 260);
  --accent: oklch(0.55 0.18 275);
  --accent-strong: oklch(0.47 0.18 275);
  --accent-soft: oklch(0.935 0.03 275);
  --accent-softer: oklch(0.97 0.012 275);
  --accent-line: oklch(0.87 0.04 275);
  --accent-ink: oklch(0.4 0.15 275);

  --green: oklch(0.65 0.15 145);  --green-soft: oklch(0.94 0.05 145);  --green-ink: oklch(0.4 0.1 145);
  --yellow: oklch(0.75 0.15 85);  --yellow-soft: oklch(0.95 0.045 85); --yellow-ink: oklch(0.45 0.1 85);
  --red: oklch(0.6 0.2 25);       --red-soft: oklch(0.95 0.03 25);     --red-ink: oklch(0.47 0.16 25);
  --grey: oklch(0.72 0.01 260);   --grey-soft: oklch(0.935 0.005 260); --grey-ink: oklch(0.48 0.01 260);

  --radius: 12px;
  --shadow: 0 1px 2px oklch(0.2 0.02 260 / 0.05);
  --shadow-lg: 0 18px 50px oklch(0.2 0.02 260 / 0.18), 0 4px 12px oklch(0.2 0.02 260 / 0.08);
  --sans: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: oklch(0.17 0.01 265);
    --surface: oklch(0.21 0.012 265);
    --surface-2: oklch(0.245 0.012 265);
    --border: oklch(0.3 0.012 265);
    --border-strong: oklch(0.38 0.015 265);
    --text: oklch(0.93 0.01 265);
    --muted: oklch(0.72 0.015 265);
    --faint: oklch(0.58 0.015 265);
    --accent: oklch(0.68 0.16 275);
    --accent-strong: oklch(0.76 0.14 275);
    --accent-soft: oklch(0.31 0.07 275);
    --accent-softer: oklch(0.25 0.035 275);
    --accent-line: oklch(0.4 0.08 275);
    --accent-ink: oklch(0.86 0.08 275);
    --green: oklch(0.7 0.15 145);  --green-soft: oklch(0.3 0.06 145);  --green-ink: oklch(0.86 0.1 145);
    --yellow: oklch(0.8 0.14 85);  --yellow-soft: oklch(0.32 0.06 85); --yellow-ink: oklch(0.88 0.1 85);
    --red: oklch(0.68 0.18 25);    --red-soft: oklch(0.31 0.07 25);    --red-ink: oklch(0.86 0.09 25);
    --grey: oklch(0.6 0.01 265);   --grey-soft: oklch(0.29 0.01 265);  --grey-ink: oklch(0.8 0.01 265);
    --shadow: 0 1px 2px oklch(0 0 0 / 0.3);
    --shadow-lg: 0 18px 50px oklch(0 0 0 / 0.5), 0 4px 12px oklch(0 0 0 / 0.3);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.45 var(--sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); }
[hidden] { display: none !important; }

/* --- Top bar -------------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  height: 64px; padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.menu-btn {
  width: 36px; height: 36px; flex-shrink: 0;
  display: grid; place-items: center;
  border: 0; border-radius: 8px;
  background: var(--accent); color: white;
}
.menu-btn:hover { background: var(--accent-strong); }
.brand { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; color: var(--text); white-space: nowrap; }
.brand:hover { color: var(--text); }
.demo-badge {
  font: 600 11px/1 var(--mono); letter-spacing: 0.04em; text-transform: uppercase;
  padding: 5px 8px; border-radius: 6px;
  background: var(--yellow-soft); color: var(--yellow-ink);
}

.search { position: relative; margin-left: auto; width: min(420px, 100%); }
.search input {
  width: 100%; height: 38px; padding: 0 12px 0 34px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2);
}
.search input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-icon { position: absolute; left: 11px; top: 11.5px; color: var(--faint); pointer-events: none; }
.search-results {
  position: absolute; right: 0; top: 46px; width: min(520px, calc(100vw - 32px));
  max-height: 70vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 6px;
}
.search-group { font: 600 11px var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 10px 10px 4px; }
.search-hit { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.search-hit:hover, .search-hit:focus { background: var(--accent-softer); color: var(--text); outline: none; }
.search-hit .sub { font: 12px var(--mono); color: var(--muted); }
.search-empty { padding: 14px 10px; color: var(--muted); }

/* --- Layout --------------------------------------------------------------- */

.layout { display: flex; min-height: calc(100vh - 64px); }
.domain-menu {
  width: 300px; flex-shrink: 0;
  position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px 16px;
  background: var(--surface); border-right: 1px solid var(--border);
}
body.menu-closed .domain-menu { display: none; }
.menu-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 8px 12px 6px; }
.domain-list { display: flex; flex-direction: column; gap: 2px; }
.domain-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 10px; color: var(--text);
}
.domain-item:hover { background: var(--surface-2); color: var(--text); }
.domain-item.active { background: var(--accent-soft); }
.domain-item.active .domain-name { color: var(--accent-ink); font-weight: 600; }
.domain-item .dot { background: var(--grey); }
.domain-item.active .dot { background: var(--accent); }
.domain-name { flex: 1; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.domain-count { font: 12px var(--mono); color: var(--muted); }
.domain-item.active .domain-count { color: var(--accent-ink); }
.new-domain {
  margin-top: 12px; display: flex; align-items: center; gap: 8px;
  padding: 12px; border-radius: 10px;
  border: 1px dashed var(--border-strong); background: transparent; color: var(--muted); font-size: 13px;
}
.new-domain:hover { color: var(--accent); border-color: var(--accent); }
.scrim { display: none; }

.main { flex: 1; min-width: 0; padding: 20px 32px 48px; }
.main:focus { outline: none; }

/* --- Page chrome ---------------------------------------------------------- */

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs .here { color: var(--text); font-weight: 600; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin: 4px 0 16px; }
.page-title { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.page-title .count { font: 400 14px var(--mono); color: var(--muted); margin-left: 4px; }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 500; font-size: 13px; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: white; }
.btn.small { height: 28px; padding: 0 10px; font-size: 12px; }
/* Destructive actions stay quiet until you reach for them. */
.btn.danger { color: var(--red-ink); }
.btn.danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn.icon-only { width: 28px; padding: 0; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* --- Status --------------------------------------------------------------- */

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot.green { background: var(--green); }
.dot.yellow { background: var(--yellow); }
.dot.red { background: var(--red); }
.dot.grey { background: var(--grey); }

.pill {
  display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
  padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill.green { background: var(--green-soft); color: var(--green-ink); }
.pill.yellow { background: var(--yellow-soft); color: var(--yellow-ink); }
.pill.red { background: var(--red-soft); color: var(--red-ink); }
.pill.grey { background: var(--grey-soft); color: var(--grey-ink); }

.flag {
  display: inline-flex; align-items: center; gap: 5px;
  font: 500 11px var(--mono); padding: 2px 7px; border-radius: 5px;
  background: var(--accent-soft); color: var(--accent-ink); white-space: nowrap;
}
.flag.warn { background: var(--yellow-soft); color: var(--yellow-ink); }
.flag.plain { background: var(--surface-2); color: var(--muted); }

.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; color: var(--text);
}
.chip:hover { border-color: var(--border-strong); }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.chip .n { font-family: var(--mono); color: var(--muted); }
.chip[aria-pressed="true"] .n { color: var(--accent-ink); }

.x { font-family: var(--mono); color: var(--faint); }
.x-tag { font: 600 11px var(--mono); padding: 1px 6px; border-radius: 4px; background: var(--surface-2); color: var(--faint); border: 1px solid var(--border); }

/* --- Rows (companies, contacts, rounds) ----------------------------------- */

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.filter-input {
  height: 34px; padding: 0 12px; width: min(280px, 100%);
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface);
}
.filter-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.rows { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; min-height: 68px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); box-shadow: var(--shadow);
  transition: border-color 0.12s, box-shadow 0.12s;
}
a.row:hover, .row.clickable:hover { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-softer); color: var(--text); }
.row.current { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.row-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; color: var(--text); }
.row-link:hover { color: var(--text); }
.row-link:hover .row-title { color: var(--accent); }
.row:has(.row-link:hover) { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-softer); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 15px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.row-title .role { font: 400 12px var(--mono); color: var(--muted); }
.row-sub { font: 12px var(--mono); color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-side { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.attention-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
/* Get email / Send email sit together, and stay out of the way until hovered. */
.row-actions { display: flex; align-items: center; gap: 6px; }
.row-actions:empty { display: none; }
.row-actions .btn { opacity: .75; transition: opacity .12s ease; }
.row:hover .row-actions .btn, .row-actions .btn:focus-visible { opacity: 1; }

.avatar {
  width: 38px; height: 38px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 9px; background: var(--accent-soft); color: var(--accent-ink);
  font-weight: 700; font-size: 13.5px;
}
.avatar.round { border-radius: 50%; }
.avatar.muted { background: var(--surface-2); color: var(--faint); }

.round-no {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%;
  display: grid; place-items: center;
  font: 600 13px var(--mono);
}
.round-no.replied { background: var(--green-soft); color: var(--green-ink); }
.round-no.no_response { background: var(--grey-soft); color: var(--grey-ink); }

.keep {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: var(--muted);
  padding: 4px 8px; border-radius: 7px; border: 1px solid transparent; user-select: none;
}
.keep:hover { border-color: var(--border); }
.keep input { width: 15px; height: 15px; accent-color: var(--accent); margin: 0; cursor: pointer; }
.keep.locked { cursor: default; }
.keep.locked:hover { border-color: transparent; }

/* Cadres: solid = contacting now, soft = waiting, dashed = reserve / finished. */
.cadres { display: flex; flex-direction: column; gap: 22px; }
.cadre-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  padding: 9px 14px; margin-bottom: 8px; border-radius: 10px;
}
.cadre-name { font-weight: 700; font-size: 15px; }
.cadre-state { font-size: 12.5px; font-weight: 600; }
.cadre-count { font: 12px var(--mono); margin-left: auto; }
.cadre-now .cadre-head { background: var(--accent); color: white; }
.cadre-now .cadre-count { color: oklch(1 0 0 / 0.85); }
.cadre-waiting .cadre-head { background: var(--accent-soft); color: var(--accent-ink); }
.cadre-waiting .cadre-count { color: var(--accent-ink); }
.cadre-done .cadre-head { border: 1px dashed var(--border-strong); color: var(--muted); }
.cadre-done .rows, .cadre-waiting .rows { opacity: 0.92; }
.cadre-head .btn { margin-left: 4px; }
.row.stand-in { border-left: 3px solid var(--green); }
.flag.email-work { background: var(--green-soft); color: var(--green-ink); }
.flag.email-none { background: var(--red-soft); color: var(--red-ink); }

.more-row { text-align: center; padding: 10px; color: var(--muted); font-size: 13px; }
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  text-align: center; padding: 48px 20px; color: var(--muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.empty svg { color: var(--faint); }

/* --- Cards and detail grids ----------------------------------------------- */

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; box-shadow: var(--shadow);
}
.card-label { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.card.accent { background: var(--accent-softer); border-color: var(--accent-line); }
.card.accent .card-label { color: var(--accent-ink); }
.card p { margin: 0; line-height: 1.6; }

.profile { display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: flex-start; margin-bottom: 18px; }
.profile-head { display: flex; align-items: center; gap: 14px; flex: 1 1 260px; min-width: 0; }
.profile-head .avatar { width: 48px; height: 48px; font-size: 16px; }
.profile-name { font-size: 18px; font-weight: 700; }
.profile-meta { font: 12px var(--mono); color: var(--muted); margin-top: 2px; }
.details {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px 20px; width: 100%; margin: 0;
}
.details dt { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.details dd { margin: 3px 0 0; font-size: 13.5px; overflow-wrap: anywhere; }
.details .wide { grid-column: 1 / -1; }

/* --- Contact / thread split ----------------------------------------------- */

.split { display: flex; gap: 20px; align-items: flex-start; }
.split > .primary-col { flex: 1; min-width: 0; }
.context { width: 340px; flex-shrink: 0; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 84px; }

.cadence { display: flex; gap: 4px; margin: 10px 0 8px; }
.cadence span { flex: 1; height: 6px; border-radius: 3px; background: var(--grey-soft); }
.cadence span.done { background: var(--accent); }
.cadence span.stopped { background: repeating-linear-gradient(135deg, var(--grey-soft) 0 4px, transparent 4px 7px); box-shadow: inset 0 0 0 1px var(--grey-soft); }
.cadence-note { font: 12px var(--mono); color: var(--muted); }

.notes-box { width: 100%; min-height: 90px; resize: vertical; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); line-height: 1.5; }
.notes-box:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.notes-actions { display: flex; justify-content: flex-end; margin-top: 8px; }

.thread { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.thread-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.thread-subject { font-weight: 600; font-size: 15px; }
.thread-body { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.bubble { max-width: min(72%, 620px); padding: 14px 16px; border-radius: 14px; }
.bubble.out { align-self: flex-end; background: var(--accent-soft); border-bottom-right-radius: 3px; }
.bubble.in { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 3px; }
.bubble-meta { font: 11px var(--mono); color: var(--muted); margin-bottom: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bubble.out .bubble-meta { color: var(--accent-ink); }
.bubble-text { font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble-class { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.awaiting { align-self: center; font: 12px var(--mono); color: var(--faint); padding: 6px 12px; border: 1px dashed var(--border-strong); border-radius: 999px; }
.round-nav { display: flex; gap: 6px; }

/* --- Overview ------------------------------------------------------------- */

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-sub { font: 11px var(--mono); color: var(--faint); margin-top: 2px; }
.bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--grey-soft); margin: 12px 0 10px; }
.bar span.green { background: var(--green); }
.bar span.yellow { background: var(--yellow); }
.bar span.red { background: var(--red); }
.bar span.grey { background: var(--grey); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-top: 16px; }
.section-title { font-size: 15px; font-weight: 700; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.list-compact { display: flex; flex-direction: column; }
.list-compact a { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-top: 1px solid var(--border); color: var(--text); }
.list-compact a:first-child { border-top: 0; }
.list-compact a:hover .lc-name { color: var(--accent); }
.lc-main { flex: 1; min-width: 0; }
.lc-name { font-weight: 600; }
.lc-sub { font: 12px var(--mono); color: var(--muted); }
.quiet { color: var(--muted); font-size: 13px; padding: 6px 0; }

/* --- Dialog & toast ------------------------------------------------------- */

.dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: oklch(0.2 0.02 260 / 0.35); }
.dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.dialog-head { padding: 18px 22px 6px; font-size: 17px; font-weight: 700; }
.dialog-note { padding: 0 22px; font-size: 12.5px; color: var(--muted); }
.dialog-body { padding: 14px 22px; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field input[type=text], .field input[type=url], .field input[type=email], .field select, .field textarea {
  width: 100%; height: 36px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface);
}
.field textarea { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
/* The letter in the send dialog has to be readable end to end before it goes. */
#f-body { min-height: 360px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field.check { flex-direction: row; align-items: center; gap: 8px; }
.field.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.field.check label { font-size: 13px; color: var(--text); font-weight: 500; }
.dialog-error { padding: 0 22px; color: var(--red-ink); font-size: 13px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; border-top: 1px solid var(--border); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  padding: 10px 16px; border-radius: 10px; background: var(--text); color: var(--bg);
  font-size: 13px; box-shadow: var(--shadow-lg);
}
.toast.error { background: var(--red); color: white; }

.loading { color: var(--muted); padding: 40px 0; }

/* --- Narrow screens -------------------------------------------------------- */

@media (max-width: 1100px) {
  .split { flex-direction: column; }
  .context { width: 100%; position: static; }
}

@media (max-width: 860px) {
  .topbar { padding: 0 16px; gap: 10px; }
  .brand { font-size: 15px; }
  .main { padding: 16px 16px 40px; }
  .domain-menu {
    position: fixed; left: 0; top: 64px; bottom: 0; height: auto; z-index: 25;
    box-shadow: var(--shadow-lg); width: min(300px, 86vw);
  }
  body.menu-closed .domain-menu { display: none; }
  body:not(.menu-closed) .scrim {
    display: block; position: fixed; inset: 64px 0 0 0; z-index: 20;
    background: oklch(0.2 0.02 260 / 0.3);
  }
}

@media (max-width: 600px) {
  .brand { display: none; }
  .demo-badge { display: none; }
  .row { flex-wrap: wrap; padding: 12px 14px; }
  .row-side { width: 100%; justify-content: flex-end; }
  .bubble { max-width: 92%; }
  .dialog-body { grid-template-columns: 1fr; }
  .page-title { font-size: 19px; }
}

.muted-note { font-size: 12px; color: var(--muted); }

/* Send email to all */
.dialog:has(.bulk-dialog) { width: min(780px, calc(100vw - 32px)); }
.bulk-dialog { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.bulk-body { display: block; flex: 1; min-height: 0; padding-top: 4px; }
.bulk-all { display: flex; align-items: center; gap: 10px; margin: 12px 22px 0; padding: 10px 12px;
  border-radius: 10px; background: var(--accent-softer); font-weight: 600; cursor: pointer; }
.bulk-table { display: flex; flex-direction: column; }
.bulk-row { display: grid; grid-template-columns: minmax(0, 1fr) 72px 84px 190px; align-items: center; gap: 12px;
  padding: 8px 4px; border-bottom: 1px solid var(--border); }
.bulk-head { position: sticky; top: 0; z-index: 1; background: var(--surface);
  font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.bulk-name { display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer; }
.bulk-company { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.bulk-name input, .bulk-all input { width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--accent); }
.bulk-count { width: 64px; height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.bulk-dialog .dialog-foot { flex-wrap: wrap; align-items: center; }
.bulk-summary { margin-right: auto; font-size: 13px; color: var(--muted); }
.sent-badge { display: inline-block; min-width: 22px; margin-left: 8px; padding: 1px 7px; border-radius: 10px;
  background: var(--green-soft); color: var(--green-ink); font: 600 12px/1.5 var(--mono); text-align: center; vertical-align: 1px; }
.bulk-row .sent-badge { margin-left: 0; }
.bulk-progress { font-weight: 600; margin-bottom: 10px; }
.bulk-log { max-height: 40vh; overflow-y: auto; margin: 0; padding: 10px; border-radius: 8px; background: var(--surface-2);
  font: 12px/1.5 var(--mono); white-space: pre-wrap; }
@media (max-width: 600px) {
  .bulk-row { grid-template-columns: minmax(0, 1fr) 56px 68px; }
  .bulk-row > :last-child { display: none; }
}

/* Products */
.section-block { margin-top: 28px; }
.section-block .page-title { font-size: 19px; }
.empty.small { padding: 18px; font-size: 13px; }
.product-list { display: flex; flex-direction: column; gap: 12px; }
.product-card { padding: 16px 18px; }
.product-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.product-name { font-weight: 600; font-size: 15px; white-space: pre-wrap; }
.product-pics { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.product-pic { position: relative; margin: 0; }
.product-pic img { display: block; width: 132px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.pic-remove { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%;
  background: oklch(0.2 0.02 260 / 0.65); color: white; font-size: 15px; line-height: 22px; cursor: pointer; }
.pic-remove.inline { position: static; width: 18px; height: 18px; line-height: 18px; font-size: 13px; background: var(--grey-soft); color: var(--muted); }
.pic-remove:hover { background: var(--red); color: white; }
.count-chip { margin-left: 4px; padding: 0 6px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); font: 600 11px/1.6 var(--mono); }
.connected-btn { color: var(--green-ink); border-color: var(--green); background: var(--green-soft); }

/* Connect picker and Connects */
.dialog:has(.picker-dialog) { width: min(640px, calc(100vw - 32px)); }
.picker-dialog { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.picker-top { padding: 12px 22px 0; display: flex; flex-direction: column; gap: 8px; }
.picker-search { width: 100%; }
.picker-trail { font-size: 13px; color: var(--muted); }
.picker-body { display: block; flex: 1; min-height: 160px; }
.picker-list { display: flex; flex-direction: column; }
.picker-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 8px; border: 0; border-bottom: 1px solid var(--border);
  background: none; color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.picker-row:hover { background: var(--surface-2); }
.picker-row.off { cursor: default; opacity: .65; }
.picker-row input { width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--accent); }
.picker-name { flex: 1; min-width: 0; font-weight: 500; }
.picker-name .role { margin-left: 8px; }
.picker-chosen-wrap { padding: 10px 22px 0; border-top: 1px solid var(--border); }
.picker-chosen { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.connects { padding: 6px 18px; }
.connect-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 16px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.connect-row:last-child { border-bottom: 0; }
.connect-who { min-width: 220px; font-weight: 600; color: var(--text); }
.connect-list { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.connect-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 10px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }
.connect-co { color: var(--muted); font-size: 12px; }
.connect-who .role { margin-left: 8px; font-weight: 400; }

/* Picture picker in forms */
.file-pick { display: flex; align-items: center; gap: 10px; }
.file-previews { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.file-preview { margin: 0; }
.file-preview img { display: block; width: 88px; height: 66px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }

/* Sign in */
body.signed-out .domain-menu, body.signed-out .search, body.signed-out .crumbs { display: none; }
.signin-wrap { display: grid; place-items: center; min-height: 70vh; padding: 20px; }
.signin-card { width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px;
  padding: 28px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); }
.signin-title { font-size: 19px; font-weight: 700; }
.signin-note { font-size: 13px; color: var(--muted); }
.signin-card input { height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.signin-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
