/* app.css - light, professional design system.
   One accent colour, an 8px spacing rhythm, and restrained shadows. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #f2f4f7;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;

  --text: #101828;
  --text-2: #475467;
  --muted: #98a2b3;

  --brand: #4f46e5;
  --brand-hover: #4338ca;
  --brand-soft: #eef2ff;
  --brand-line: #c7d2fe;

  --good: #039855;
  --good-soft: #ecfdf3;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --bad: #d92d20;
  --bad-soft: #fef3f2;
  --info: #175cd3;
  --info-soft: #eff8ff;

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .1), 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 16px -4px rgba(16, 24, 40, .08), 0 4px 6px -2px rgba(16, 24, 40, .03);
  --shadow-xl: 0 20px 24px -4px rgba(16, 24, 40, .1), 0 8px 8px -4px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px 72px; }

/* ── icons ─────────────────────────────────────────────────────────────────── */
.i {
  width: 18px; height: 18px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -3px;
}
.i-sm { width: 15px; height: 15px; }
.i-lg { width: 22px; height: 22px; }
.i-xl { width: 30px; height: 30px; stroke-width: 1.7; }
.sprite { display: none; }

/* ── top bar ───────────────────────────────────────────────────────────────── */
header.top {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
header.top .nav {
  max-width: 1120px; margin: 0 auto; padding: 0 24px;
  height: 62px; display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 15.5px; }
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand), #7c6df2); color: #fff; box-shadow: var(--shadow-sm);
}
.brand .mark .i { width: 18px; height: 18px; stroke-width: 2.1; }
.spacer { flex: 1; }

/* ── page heading ──────────────────────────────────────────────────────────── */
.page-head { padding: 30px 0 22px; }
.page-head h1 { margin: 0 0 5px; font-size: 25px; letter-spacing: -.02em; font-weight: 680; }
.page-head p { margin: 0; color: var(--text-2); font-size: 14.5px; max-width: 62ch; }
.head-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }

.back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-2); font-size: 13.5px; font-weight: 500; margin-bottom: 14px;
}
.back:hover { color: var(--brand); text-decoration: none; }

/* ── cards / panels ────────────────────────────────────────────────────────── */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  padding: 22px 24px; margin-bottom: 20px;
}
.panel-head { display: flex; align-items: center; gap: 9px; margin: -2px 0 18px; }
.panel-head h2 { margin: 0; font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; }
.panel-head .i { color: var(--muted); }
.panel-head .hint { color: var(--muted); font-size: 13px; font-weight: 400; margin-left: 2px; }
.panel-head .right { margin-left: auto; }
.panel.flush { padding: 0; overflow: hidden; }

section.grid-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 880px) { section.grid-2 { grid-template-columns: 1fr; } }

/* ── buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--brand); color: #fff; border: 1px solid var(--brand);
  border-radius: var(--r-sm); padding: 9px 15px;
  font: inherit; font-size: 14px; font-weight: 570; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s, color .12s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); text-decoration: none; color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .i { width: 16px; height: 16px; }

.btn.secondary { background: var(--surface); color: var(--text-2); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--surface-3); color: var(--text); border-color: var(--line-strong); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--text-2); box-shadow: none; }
.btn.quiet:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { background: var(--surface); color: var(--bad); border-color: #fda29b; }
.btn.danger:hover { background: var(--bad-soft); color: var(--bad); border-color: #f97066; }
.btn.solid-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.solid-danger:hover { background: #b42318; border-color: #b42318; }
.btn.lg { padding: 12px 20px; font-size: 15px; }
.btn.block { width: 100%; }

/* ── forms ─────────────────────────────────────────────────────────────────── */
label { display: block; font-size: 13px; font-weight: 550; color: var(--text-2); margin-bottom: 6px; }
label .opt { color: var(--muted); font-weight: 400; }

input, select, textarea {
  width: 100%; background: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  padding: 9px 12px; font: inherit; font-size: 14px; box-shadow: var(--shadow-sm);
  transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3.5px var(--brand-soft);
}
textarea { resize: vertical; min-height: 76px; line-height: 1.55; }
select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; }

.field { margin-bottom: 16px; }
.field .help { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > .field { flex: 1 1 210px; margin-bottom: 16px; }
.row > .field.sm { flex: 0 0 128px; }
.row > .field.wide { flex: 2 1 320px; }
.input-icon { position: relative; }
.input-icon .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon input { padding-left: 36px; }

.form-actions { display: flex; align-items: center; gap: 10px; padding-top: 4px; }
.form-actions .note { color: var(--muted); font-size: 12.5px; }

details.more { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 14px; }
details.more summary {
  cursor: pointer; color: var(--text-2); font-size: 13.5px; font-weight: 550;
  list-style: none; display: flex; align-items: center; gap: 7px; margin-bottom: 4px;
}
details.more summary::-webkit-details-marker { display: none; }
details.more summary .i { transition: transform .15s; }
details.more[open] summary .i { transform: rotate(90deg); }
details.more > div { padding-top: 14px; }

/* ── badges ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 570; padding: 3px 9px 3px 7px;
  border-radius: 99px; border: 1px solid transparent; white-space: nowrap;
}
.badge .i { width: 13px; height: 13px; stroke-width: 2.2; }
.badge.ready { background: var(--good-soft); color: var(--good); border-color: #a6f4c5; }
.badge.error { background: var(--bad-soft); color: var(--bad); border-color: #fecdca; }
.badge.new { background: var(--surface-3); color: var(--text-2); border-color: var(--line); }
.badge.crawling, .badge.indexing { background: var(--info-soft); color: var(--info); border-color: #b2ddff; }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.badge.crawling .dot, .badge.indexing .dot { animation: blink 1.3s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ── assistant cards ───────────────────────────────────────────────────────── */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); padding: 20px; display: flex; flex-direction: column;
  transition: box-shadow .15s, border-color .15s;
}
.card:hover { box-shadow: var(--shadow-lg); border-color: var(--line-strong); }
.card-top { display: flex; gap: 13px; align-items: flex-start; margin-bottom: 15px; }
.avatar {
  width: 40px; height: 40px; border-radius: 10px; flex: 0 0 auto; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); border: 1px solid var(--brand-line);
  font-weight: 680; font-size: 15px; text-transform: uppercase;
}
.card h3 { margin: 0 0 2px; font-size: 16px; font-weight: 640; letter-spacing: -.01em; }
.card h3 a { color: var(--text); }
.card h3 a:hover { color: var(--brand); text-decoration: none; }
.card .site {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--muted); font-size: 12.5px; word-break: break-all;
}
.card .site .i { width: 13px; height: 13px; }

.metrics { display: flex; gap: 20px; padding: 13px 0; border-top: 1px solid var(--line); margin-top: auto; }
.metric { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 13px; }
.metric .i { color: var(--muted); width: 15px; height: 15px; }
.metric b { color: var(--text); font-weight: 600; }

.card-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 13px; border-top: 1px solid var(--line); }
.card-actions .btn { padding: 8px 12px; font-size: 13.5px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--text-2); cursor: pointer; box-shadow: var(--shadow-sm); transition: all .12s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.danger:hover { background: var(--bad-soft); color: var(--bad); border-color: #fda29b; }

/* ── progress ──────────────────────────────────────────────────────────────── */
.progress { margin-bottom: 14px; }
.bar { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar span {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--brand), #7c6df2);
  transition: width .5s ease;
}
.progress .msg {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-2); margin-top: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.spin { width: 13px; height: 13px; border: 1.8px solid var(--brand-line); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; flex: 0 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── per-assistant tabs ────────────────────────────────────────────────────── */
.asst-head { display: flex; align-items: center; gap: 15px; padding: 4px 0 20px; flex-wrap: wrap; }
.asst-head .avatar { width: 46px; height: 46px; border-radius: 12px; font-size: 17px; }
.asst-head h1 { margin: 0 0 3px; font-size: 22px; font-weight: 680; letter-spacing: -.02em; }
.asst-head .sub { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.asst-head .sub a { color: var(--text-2); display: inline-flex; align-items: center; gap: 5px; }
.asst-head .sub .i { width: 13px; height: 13px; }

.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 14px; font-size: 14px; font-weight: 550; color: var(--text-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.on { color: var(--brand); border-bottom-color: var(--brand); }
.tab .i { width: 16px; height: 16px; }

/* ── voice call ────────────────────────────────────────────────────────────── */
.stage {
  background: linear-gradient(180deg, #fbfbfe, var(--surface));
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  padding: 40px 24px 30px; text-align: center; margin-bottom: 20px;
}
.orb-wrap { position: relative; width: 132px; height: 132px; margin: 0 auto 22px; }
.orb {
  position: absolute; inset: 16px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow); color: var(--muted); transition: color .2s, border-color .2s;
  z-index: 2;
}
.orb .i { width: 34px; height: 34px; stroke-width: 1.7; }
.ring {
  position: absolute; inset: 16px; border-radius: 50%; border: 2px solid transparent; opacity: 0;
}
.stage[data-state="listening"] .orb { color: var(--good); border-color: #6ce9a6; }
.stage[data-state="listening"] .ring { border-color: #6ce9a6; animation: ripple 1.9s ease-out infinite; opacity: 1; }
.stage[data-state="listening"] .ring:nth-child(2) { animation-delay: .65s; }
.stage[data-state="speaking"] .orb { color: var(--brand); border-color: var(--brand-line); }
.stage[data-state="speaking"] .ring { border-color: var(--brand-line); animation: ripple 1.4s ease-out infinite; opacity: 1; }
.stage[data-state="speaking"] .ring:nth-child(2) { animation-delay: .45s; }
.stage[data-state="thinking"] .orb { color: var(--info); border-color: #b2ddff; }
.stage[data-state="connecting"] .orb { color: var(--info); }
@keyframes ripple {
  0%   { transform: scale(1); opacity: .7; }
  100% { transform: scale(1.42); opacity: 0; }
}

.stage .state-label { font-size: 17px; font-weight: 620; letter-spacing: -.01em; margin-bottom: 5px; }
.stage .state-help { color: var(--text-2); font-size: 13.5px; min-height: 20px; }
.stage .controls { display: flex; gap: 10px; justify-content: center; margin-top: 22px; }

.meter { display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 26px; margin: 16px auto 0; }
.meter i {
  display: block; width: 3px; height: 4px; border-radius: 99px;
  background: var(--line-strong); transition: height .08s linear, background .2s;
}
.stage[data-state="listening"] .meter i { background: #32d583; }
.stage[data-state="speaking"] .meter i { background: #a4bcfd; }

/* ── transcript ────────────────────────────────────────────────────────────── */
.transcript { display: flex; flex-direction: column; gap: 14px; max-height: 420px; overflow-y: auto; padding: 4px 2px; }
.turn { display: flex; gap: 11px; align-items: flex-start; }
.turn .who {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--line);
}
.turn .who .i { width: 15px; height: 15px; }
.turn.assistant .who { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-line); }
.turn .body { padding-top: 4px; }
.turn .name { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 3px; letter-spacing: .01em; }
.turn .txt { font-size: 14.5px; color: var(--text); line-height: 1.55; }
.turn.event { align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; padding-left: 3px; }
.turn.event .i { width: 14px; height: 14px; }
.turn.event.err { color: var(--bad); }

/* ── knowledge hits ────────────────────────────────────────────────────────── */
.hit { padding: 16px 0; border-top: 1px solid var(--line); }
.hit:first-child { border-top: 0; padding-top: 4px; }
.hit .meta { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; flex-wrap: wrap; }
.hit .meta a { font-size: 13.5px; font-weight: 570; }
.hit .meta .when { color: var(--muted); font-size: 12px; }
.score {
  font-size: 11.5px; font-weight: 620; padding: 2px 7px; border-radius: 5px;
  background: var(--brand-soft); color: var(--brand); font-variant-numeric: tabular-nums;
}
.score.weak { background: var(--surface-3); color: var(--muted); }
.hit p { margin: 0; font-size: 13.5px; color: var(--text-2); line-height: 1.6; }

/* ── tables ────────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2);
  background: var(--surface-2); padding: 11px 16px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--text-2); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody td.strong { color: var(--text); font-weight: 550; }

/* ── empty states ──────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 46px 24px; }
.empty .glyph {
  width: 46px; height: 46px; border-radius: 12px; margin: 0 auto 14px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--muted); border: 1px solid var(--line);
}
.empty h3 { margin: 0 0 5px; font-size: 15.5px; font-weight: 620; color: var(--text); }
.empty p { margin: 0 auto; color: var(--text-2); font-size: 13.5px; max-width: 46ch; }

/* ── notices ───────────────────────────────────────────────────────────────── */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--r); font-size: 13.5px; margin-bottom: 18px;
  border: 1px solid transparent;
}
.notice .i { margin-top: 1px; }
.notice.info { background: var(--info-soft); color: #174ea6; border-color: #b2ddff; }
.notice.warn { background: var(--warn-soft); color: #93370d; border-color: #fedf89; }
.notice.bad  { background: var(--bad-soft); color: #912018; border-color: #fecdca; }
.notice.good { background: var(--good-soft); color: #05603a; border-color: #a6f4c5; }

/* ── toast ─────────────────────────────────────────────────────────────────── */
.toast-host { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: var(--r); box-shadow: var(--shadow-xl); padding: 12px 15px;
  font-size: 13.5px; min-width: 260px; max-width: 380px;
  animation: slide-in .2s ease-out;
}
.toast.good { border-left-color: var(--good); }
.toast.good .i { color: var(--good); }
.toast.bad { border-left-color: var(--bad); }
.toast.bad .i { color: var(--bad); }
.toast.leaving { animation: fade-out .2s ease-in forwards; }
@keyframes slide-in { from { opacity: 0; transform: translateX(14px); } }
@keyframes fade-out { to { opacity: 0; transform: translateX(14px); } }

/* ── modal ─────────────────────────────────────────────────────────────────── */
.backdrop {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .5); z-index: 70;
  display: grid; place-items: center; padding: 20px;
  animation: fade-in .14s ease-out;
}
@keyframes fade-in { from { opacity: 0; } }
.modal {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-xl);
  width: 100%; max-width: 440px; padding: 24px;
  animation: pop .16s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } }
.modal .glyph {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bad-soft); color: var(--bad); margin-bottom: 16px;
}
.modal h3 { margin: 0 0 7px; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.modal p { margin: 0 0 8px; color: var(--text-2); font-size: 14px; line-height: 1.55; }
.modal ul { margin: 0 0 4px; padding-left: 20px; color: var(--text-2); font-size: 13.5px; }
.modal ul li { margin-bottom: 4px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.modal.confirm-safe .glyph { background: var(--brand-soft); color: var(--brand); }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }

/* ── lead field editor ─────────────────────────────────────────────────────── */
.fields-editor { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.field-row {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.field-row:last-child { border-bottom: 0; }
.field-row.off { background: var(--surface-2); }
.field-row.off .fname { color: var(--muted); text-decoration: line-through; }
.field-row .fname { flex: 1; font-size: 14px; font-weight: 500; color: var(--text); }
.field-row .fname em {
  font-style: normal; font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--brand); background: var(--brand-soft);
  border: 1px solid var(--brand-line); border-radius: 4px; padding: 1px 5px; margin-left: 6px;
}
.chk { display: inline-flex; align-items: center; gap: 6px; margin: 0; cursor: pointer; }
.chk input[type="checkbox"] {
  width: 16px; height: 16px; margin: 0; accent-color: var(--brand);
  box-shadow: none; cursor: pointer; flex: 0 0 auto;
}
.chk.req span { font-size: 12px; font-weight: 550; color: var(--text-2); }
.chk.req input:disabled + span { color: var(--muted); }
.field-row .icon-btn { width: 28px; height: 28px; }

.add-field { display: flex; gap: 8px; margin-top: 12px; }
.add-field input { flex: 1; }

.status-pill {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 550;
  padding: 2px 8px; border-radius: 99px; white-space: nowrap;
}
.status-pill.sent { background: var(--good-soft); color: var(--good); }
.status-pill.failed { background: var(--bad-soft); color: var(--bad); }
.status-pill.other { background: var(--surface-3); color: var(--text-2); }

/* A value that reads like a placeholder. Saved as the caller gave it, marked so
   nobody follows up on "John Doe" without noticing. */
.flagged {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; margin-left: 5px; border-radius: 50%;
  background: var(--warn-soft); color: var(--warn); border: 1px solid #fedf89;
  font-size: 10.5px; font-weight: 700; cursor: help; vertical-align: middle;
}

/* ── stacked panels (lead capture above booking) ───────────────────────────── */
section.stack { display: block; }
section.stack > div { display: block; }

/* ── calendar connection row ──────────────────────────────────────────────── */
.cal-card {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface-2); padding: 14px 16px; margin: 0 0 22px;
}
.cal-card.on { background: var(--surface); border-color: var(--line); }

.cal-mark {
  width: 36px; height: 36px; border-radius: 8px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--muted); border: 1px solid var(--line);
}
.cal-card.on .cal-mark {
  background: var(--good-soft); color: var(--good); border-color: #a6f4c5;
}

.cal-body { flex: 1; min-width: 0; }
.cal-body b { display: block; font-size: 14px; font-weight: 620; color: var(--text); }
.cal-body p {
  margin: 2px 0 0; font-size: 12.5px; color: var(--text-2); line-height: 1.5;
}
.cal-acct { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text); }
.cal-card .btn { flex: 0 0 auto; }

/* Booking and lead-capture panels are full width, so their editors are too. The
   day label takes the slack, which pushes the time inputs to the right edge
   instead of leaving them stranded mid-row. */
#booking-form .row > .field:first-child { flex: 2 1 260px; }
#hours-editor .field-row { gap: 12px; }
#hours-editor .field-row .fname { flex: 1; }
#hours-editor .field-row input[type="time"] { max-width: 130px; }
#services-editor .field-row .fname { flex: 1; }
#booking-form .add-field input:first-child { flex: 1; }
#hours-editor .time-in { max-width: 130px; }

.slot-days { margin-top: 8px; display: grid; gap: 4px; }
.slot-day { display: flex; gap: 10px; font-size: 13px; }
.slot-day b { min-width: 92px; font-variant-numeric: tabular-nums; }
.slot-day span { color: var(--text-2); }

/* ── appointment dialogs: day pills, slot grid, cancel outcomes ────────────── */
.modal-body { margin-top: 4px; }

.tz-note {
  display: flex; align-items: flex-start; gap: 7px;
  margin: 0 0 14px; padding: 9px 11px; border-radius: var(--r-sm);
  background: var(--surface-3); color: var(--text-2); font-size: 12.5px; line-height: 1.5;
}
.tz-note .i { margin-top: 2px; color: var(--muted); }

.day-pills { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: 99px; padding: 6px 12px; font: inherit; font-size: 13px;
  color: var(--text-2); cursor: pointer; transition: all .12s;
}
.pill:hover { border-color: var(--muted); color: var(--text); }
.pill.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pill span {
  font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 99px;
  background: var(--surface-3); color: var(--text-2);
}
.pill.on span { background: rgba(255, 255, 255, .22); color: #fff; }

.slot-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px; max-height: 232px; overflow-y: auto;
}
.slot {
  border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: var(--r-sm); padding: 9px 0; font: inherit; font-size: 13.5px;
  font-variant-numeric: tabular-nums; color: var(--text); cursor: pointer;
  transition: all .12s;
}
.slot:hover { border-color: var(--brand); color: var(--brand); }
.slot.on {
  background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600;
}

.outcome-lead {
  font-size: 12px; font-weight: 620; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); margin: 6px 0 10px;
}
.outcomes { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 11px; }
.outcomes li { display: flex; gap: 10px; font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.outcomes b { color: var(--text); }
.mark {
  width: 20px; height: 20px; border-radius: 50%; flex: 0 0 auto; margin-top: 1px;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.mark.ok { background: var(--good-soft); color: var(--good); }
.mark.warn { background: var(--warn-soft); color: var(--warn); }

.who {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 18px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface-2);
}
.who > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.who span { font-size: 11.5px; color: var(--muted); }
.who b { font-size: 13px; color: var(--text); font-weight: 550; word-break: break-all; }

.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.sm .i { width: 14px; height: 14px; }
