/* ============================================================
   FIVE NODES HOSPITAL — teal + white clinical theme
============================================================ */

:root, :root[data-theme="light"] {
  --sans:  "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:  "Geist Mono", "SF Mono", Menlo, monospace;

  --bg:         #f7fafa;
  --bg-elev:    #ffffff;
  --bg-soft:    #ecf3f5;
  --fg:         #0c3a47;
  --fg-1:       #1e5a6e;
  --fg-2:       #4a7080;
  --fg-3:       #7a98a3;
  --fg-4:       #b0c2c8;
  --line:       #dde6e9;
  --line-2:     #c7d3d8;

  --accent:       #0d9488;     /* teal-600 */
  --accent-deep:  #0f766e;     /* teal-700 */
  --accent-soft:  #d1f0ec;
  --accent-line:  #99d6cf;
  --accent-ink:   #ffffff;

  --pos:  #047857;
  --neg:  #b91c1c;
  --warn: #b45309;

  --radius:    6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(12, 58, 71, 0.06);
  --shadow-md: 0 4px 14px rgba(12, 58, 71, 0.10);
}

:root[data-theme="dark"] {
  --bg:         #0a1f24;
  --bg-elev:    #122830;
  --bg-soft:    #1a3640;
  --fg:         #e8f4f6;
  --fg-1:       #c5dde2;
  --fg-2:       #95b5be;
  --fg-3:       #6c8893;
  --fg-4:       #4a626c;
  --line:       #1f3d47;
  --line-2:     #2a4d59;

  --accent:       #2dd4bf;
  --accent-deep:  #14b8a6;
  --accent-soft:  #134e4a;
  --accent-line:  #1a6660;
  --accent-ink:   #0a1f24;

  --pos:  #10b981;
  --neg:  #ef4444;
  --warn: #f59e0b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 14px;
  font-feature-settings: "ss01","cv01";
  -webkit-font-smoothing: antialiased;
}
em { font-family: var(--serif); font-style: italic; font-weight: 500; }
.mono { font-family: var(--mono); }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--line);
  padding: 20px 16px;
  display: flex; flex-direction: column;
  min-height: 100vh; position: sticky; top: 0;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 6px 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-style: italic;
  font-size: 20px; font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.brand-name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.brand-sub  { font-size: 10.5px; color: var(--fg-3); font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 2px; }

.nav-section { margin-bottom: 14px; }
.nav-label {
  padding: 6px 8px 4px;
  font-family: var(--mono); font-size: 9.5px;
  color: var(--fg-3);
  text-transform: uppercase; letter-spacing: 0.14em;
}
.nav-item {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: transparent; border: none;
  color: var(--fg-1);
  font-size: 13px; text-align: left;
  border-radius: 6px; cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.nav-item:hover { background: var(--bg-soft); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 600;
}
.nav-item .count {
  margin-left: auto;
  font-family: var(--mono); font-size: 10px;
  padding: 1px 6px; border-radius: 10px;
  background: var(--bg-soft); color: var(--fg-3);
}
.nav-item.active .count { background: var(--accent); color: var(--accent-ink); }

.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 14px;
}
.sidebar-meta { display: flex; flex-direction: column; gap: 6px; padding: 2px; }
.sidebar-meta .row {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 10.5px;
  color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.1em;
}
.sidebar-meta .row b { color: var(--fg); font-weight: 600; }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--bg-soft); border-radius: 8px;
  border: 1px solid var(--line);
}
.user-chip .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.user-chip .name { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .role { font-size: 10.5px; color: var(--fg-3); font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.08em; }

/* ---------- Main + TopBar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg); border-bottom: 1px solid var(--line);
  padding: 16px 28px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px;
}
.topbar-left { display: flex; flex-direction: column; gap: 4px; }
.topbar .path {
  font-family: var(--mono); font-size: 10.5px;
  color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.14em;
}
.topbar h1 { margin: 0; font-size: 22px; font-weight: 500; letter-spacing: -0.015em; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

/* Easy / Advanced mode switch — prominent control in the top bar */
.mode-switch {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px;
  background: var(--bg-soft);
  border: 1px solid var(--line-2);
  border-radius: 11px;
  margin-inline-end: 4px;
}
.mode-switch-label {
  font-family: var(--mono);
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--fg-4);
  padding: 0 8px 0 6px;
}
.mode-switch button {
  padding: 6px 14px; border-radius: 8px;
  font-size: 12.5px; font-weight: 600;
  color: var(--fg-3);
  background: transparent; border: none; cursor: pointer;
  transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}
.mode-switch button:hover { color: var(--fg); }
.mode-switch button.active {
  background: var(--accent);
  color: var(--accent-ink, #fff);
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
@media (max-width: 720px) {
  .mode-switch-label { display: none; }
  .mode-switch button { padding: 6px 10px; font-size: 12px; }
}

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elev); border: 1px solid var(--line);
  padding: 7px 12px; border-radius: 8px;
  min-width: 280px; color: var(--fg-3);
}
.search input {
  border: none; outline: none; background: transparent;
  flex: 1; font: inherit; color: var(--fg);
}
.search input::placeholder { color: var(--fg-3); }
.search .kbd {
  font-family: var(--mono); font-size: 10px;
  padding: 2px 6px; border-radius: 4px;
  background: var(--bg-soft); color: var(--fg-3); border: 1px solid var(--line);
}

.icon-btn {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--bg-elev); border: 1px solid var(--line);
  color: var(--fg-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--fg); }
.icon-btn .dot { position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 8px;
  background: var(--bg-elev); border: 1px solid var(--line);
  color: var(--fg-1); font: inherit; font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.btn:hover { background: var(--bg-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--fg-2); }
.btn.ghost:hover { background: var(--bg-soft); color: var(--fg); }

/* ---------- Content ---------- */
.content { padding: 24px 28px; }
.view { animation: fade 0.2s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; margin-bottom: 18px;
}
.section-head .sub {
  font-family: var(--mono); font-size: 10.5px;
  color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.12em;
  margin-bottom: 6px;
}
.section-head h2 { margin: 0; font-size: 22px; font-weight: 500; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.card-head .sub {
  font-family: var(--mono); font-size: 10px;
  color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.12em;
  margin-bottom: 4px;
}
.card-head h3 { margin: 0; font-size: 16px; font-weight: 500; }
.card-body { padding: 18px 20px; }
.card-body.flush { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: 1.4fr 1fr; }
.grid.cols-2-3 { grid-template-columns: 1fr 1.2fr; }

/* ---------- Tags / pills ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
  background: var(--bg-soft); color: var(--fg-2);
  border: 1px solid var(--line);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.tag.accent { background: var(--accent-soft); color: var(--accent-deep); border-color: var(--accent-line); }
.tag.pos    { background: rgba(4,120,87,0.1); color: var(--pos); border-color: rgba(4,120,87,0.25); }
.tag.neg    { background: rgba(185,28,28,0.1); color: var(--neg); border-color: rgba(185,28,28,0.25); }
.tag.warn   { background: rgba(180,83,9,0.1); color: var(--warn); border-color: rgba(180,83,9,0.25); }

.pill-tabs {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 8px;
}
.pill-tabs button {
  padding: 5px 12px; border: none; background: transparent;
  color: var(--fg-2); font: inherit; font-size: 12px; font-weight: 500;
  border-radius: 6px; cursor: pointer;
}
.pill-tabs button.active { background: var(--accent); color: var(--accent-ink); }

/* ---------- Chat / Inbox ---------- */
.chat-shell {
  display: grid;
  grid-template-columns: 280px 1fr 340px;
  height: calc(100vh - 73px);
  overflow: hidden;
  min-height: 0;
}
.chat-side {
  background: var(--bg-elev); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.chat-side-head { padding: 18px 18px 12px; border-bottom: 1px solid var(--line); }
.chat-side-head h3 { margin: 0; font-size: 16px; font-weight: 500; }
.chat-side-head .sub { margin-top: 2px; font-family: var(--mono); font-size: 10.5px; color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.1em; }
.new-thread-btn {
  margin: 12px 14px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 12px;
  background: var(--accent); color: var(--accent-ink);
  border: none; border-radius: 8px;
  font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer;
}
.new-thread-btn:hover { background: var(--accent-deep); }
.thread-list { flex: 1; overflow-y: auto; padding: 0 8px 14px; }
.thread { padding: 10px 12px; margin: 2px 0; border-radius: 8px; cursor: pointer; }
.thread:hover { background: var(--bg-soft); }
.thread.active { background: var(--accent-soft); }
.t-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.t-title { font-weight: 500; font-size: 13px; }
.t-time { font-family: var(--mono); font-size: 10px; color: var(--fg-3); }
.t-prev { font-size: 12px; color: var(--fg-3); margin-top: 3px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-main { display: flex; flex-direction: column; background: var(--bg); min-height: 0; min-width: 0; overflow: hidden; }
.chat-head {
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.chat-head .title-row { display: flex; align-items: center; gap: 12px; }
.chat-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.chat-head h3 { margin: 0; font-size: 15px; font-weight: 500; }
.chat-head .status { font-family: var(--mono); font-size: 10px; color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 2px; }

.chat-body { flex: 1; overflow-y: auto; padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 10px; max-width: 80%; }
.msg.out { flex-direction: row-reverse; margin-left: auto; }
.m-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--fg-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.msg.out .m-avatar { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.m-bubble { flex: 1; min-width: 0; }
.m-meta { font-family: var(--mono); font-size: 9.5px; color: var(--fg-4); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 4px; }
.msg.out .m-meta { text-align: right; }
.m-text {
  padding: 10px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px; line-height: 1.55; white-space: pre-wrap; color: var(--fg);
}
.msg.out .m-text {
  background: var(--bg-soft);
  border-color: var(--accent-line);
  border-left: 2px solid var(--accent);
  color: var(--fg);
}

.typing { display: inline-flex; gap: 4px; align-items: center; height: 14px; }
.typing span {
  width: 6px; height: 6px;
  background: var(--fg-3); border-radius: 50%;
  display: inline-block;
  animation: fnhsp-bounce 1.4s infinite ease-in-out both;
}
.typing span:nth-child(2) { animation-delay: 0.16s; }
.typing span:nth-child(3) { animation-delay: 0.32s; }
@keyframes fnhsp-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1;   }
}

.chat-input { padding: 14px 24px 18px; border-top: 1px solid var(--line); flex-shrink: 0; }
.chat-input .wrap {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
  background: var(--bg-elev); border: 1px solid var(--line);
  padding: 6px 10px; border-radius: 12px;
}
.chat-input textarea {
  border: none; outline: none; background: transparent;
  font: inherit; font-size: 13px; color: var(--fg);
  resize: none; padding: 8px 0; max-height: 120px; line-height: 1.5;
}
.chat-input .tool, .chat-input .send {
  background: transparent; border: none;
  width: 34px; height: 34px; border-radius: 8px;
  color: var(--fg-3); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.chat-input .send { background: var(--accent); color: var(--accent-ink); }
.chat-input .send:disabled { background: var(--bg-soft); color: var(--fg-4); cursor: default; }

/* ---------- VOICE MESSAGE + RECORDING ---------- */
.chat-input .wrap.is-recording { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,0.12); }
.chat-input .tool.rec-cancel { color: #ef4444; }
.chat-input .tool.rec-cancel:hover { background: rgba(239,68,68,0.1); color: #b91c1c; }
.rec-meter { display: flex; align-items: center; gap: 10px; padding: 6px 4px; font-size: 13px; color: var(--fg-2); min-width: 0; flex: 1; }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: #ef4444; animation: rec-pulse 1.1s ease-in-out infinite; flex-shrink: 0; }
.rec-time { font-size: 12.5px; font-weight: 600; color: var(--fg); font-variant-numeric: tabular-nums; }
.rec-hint { font-size: 12px; color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes rec-pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.85); } }

.m-voice { display: flex; flex-direction: column; gap: 6px; max-width: 360px; }
.msg.in .m-voice { align-items: flex-start; }
.msg.out .m-voice { align-items: flex-end; margin-left: auto; }
.voice-player { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 14px; padding: 6px 10px; display: flex; align-items: center; }
.msg.out .voice-player { background: var(--accent); border-color: var(--accent); }
.voice-player audio { width: 260px; max-width: 100%; height: 36px; display: block; }
.msg.out .voice-player audio { filter: invert(1) hue-rotate(180deg); }
.voice-loading { width: 260px; height: 36px; display: grid; place-items: center; }
.voice-tx-toggle { align-self: flex-start; font-size: 11.5px; font-weight: 500; color: var(--fg-3); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; cursor: pointer; transition: background 120ms ease, color 120ms ease, border-color 120ms ease; }
.msg.out .voice-tx-toggle { align-self: flex-end; }
.voice-tx-toggle:not(:disabled):hover { background: var(--bg-soft); color: var(--fg); }
.voice-tx-toggle:disabled { cursor: default; opacity: 0.7; }
.voice-tx-toggle.is-error { color: #b91c1c; border-color: rgba(239,68,68,0.3); }
.voice-tx-text { font-size: 12.5px; line-height: 1.55; color: var(--fg-1); background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; white-space: pre-wrap; }

.chat-analysis {
  background: var(--bg-elev); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}

/* ---------- Kanban ---------- */
.kanban { display: grid; gap: 14px; grid-template-columns: repeat(5, 1fr); align-items: flex-start; }
.kanban.cols-6 { grid-template-columns: repeat(6, 1fr); }
.col {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 10px; min-height: 300px;
  display: flex; flex-direction: column;
  transition: border-color 0.1s;
}
.col.drop-target { border-color: var(--accent); background: var(--accent-soft); }
.col-head { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.col-head .row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; }
.col-head .name { display: flex; align-items: center; gap: 7px; font-weight: 600; }
.col-head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fg-3); }
.col-head .dot.win { background: var(--pos); }
.col-head .count { font-family: var(--mono); color: var(--fg-3); }
.col-head .value { font-family: var(--mono); font-size: 10.5px; color: var(--fg-3); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.1em; }
.col-head .bar { height: 3px; background: var(--bg-soft); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.col-head .bar .fill { height: 100%; background: var(--fg-3); }

.col-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.col-empty {
  padding: 24px 14px; text-align: center;
  font-family: var(--mono); font-size: 10.5px;
  color: var(--fg-4); text-transform: uppercase; letter-spacing: 0.1em;
  border: 1px dashed var(--line); border-radius: 8px;
}

.lead-card {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 11px 12px;
  cursor: grab;
  transition: transform 0.08s, box-shadow 0.08s;
}
.lead-card:active { cursor: grabbing; }
.lead-card.dragging { opacity: 0.4; transform: scale(0.97); }
.lead-card:hover { box-shadow: var(--shadow-sm); }
.lead-card .top { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 10px; }
.lead-card .name { font-size: 13px; font-weight: 500; }
.lead-card .vehicle, .lead-card .program {
  font-family: var(--mono); font-size: 10.5px; color: var(--fg-3);
  text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px;
}
.lead-card .price {
  font-size: 15px; font-weight: 600;
  display: flex; align-items: baseline; gap: 4px;
}
.lead-card .price .cur { font-family: var(--mono); font-size: 10px; color: var(--fg-3); }
.lead-card .score {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  padding: 2px 7px; border-radius: 4px;
  background: var(--bg-soft); color: var(--fg-3);
  border: 1px solid var(--line);
  display: inline-flex; align-items: center; gap: 6px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.lead-card .score.hot { color: var(--accent-deep); background: var(--accent-soft); border-color: var(--accent-line); }
.lead-card .score .bar { display: inline-flex; gap: 2px; }
.lead-card .score .bar i { display: inline-block; width: 3px; height: 7px; background: var(--line); border-radius: 1px; }
.lead-card .score .bar i.on { background: currentColor; }
.lead-card .foot {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 10px;
  color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.08em;
}
.lead-card .foot .a {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-deep);
  border: 1px solid var(--accent-line);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700;
}

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--fg-4); }

.hidden { display: none !important; }

/* ============================================================
   RESPONSIVE — drawer sidebar, stacked layouts
============================================================ */
.mobile-menu-btn,
.mobile-close-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  color: var(--fg-1);
  cursor: pointer;
  flex-shrink: 0;
}
.mobile-menu-btn:hover,
.mobile-close-btn:hover { background: var(--bg-soft); }
.mobile-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
}
.mobile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
  animation: fadeIn 0.2s ease;
}
.mobile-backdrop.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Tablet (≤1024px): collapse multi-column grids ---------- */
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 280px;
    height: 100vh;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-md);
    overflow-y: auto;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .mobile-menu-btn { display: inline-flex; }
  .mobile-close-btn { display: inline-flex; }

  .topbar { padding: 14px 18px; gap: 12px; }
  .topbar h1 { font-size: 20px; }

  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-2-3 { grid-template-columns: 1fr; }

  .card-head { flex-wrap: wrap; }
  .content { padding: 16px 14px 22px; }

  .chat-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
  }
  .chat-side {
    border-right: none;
    border-bottom: 1px solid var(--line);
    max-height: 220px;
  }
  .chat-analysis { display: none; }

  .kanban,
  .kanban.cols-6 {
    grid-template-columns: 1fr 1fr;
    overflow-x: visible;
  }

  .search { min-width: 0; flex: 1; }
}

/* ---------- Phone (≤640px): single column, condensed ---------- */
@media (max-width: 640px) {
  .topbar {
    padding: 12px 14px;
    flex-wrap: wrap;
  }
  .topbar h1 { font-size: 17px; }
  .topbar .path { font-size: 9.5px; }

  .kanban,
  .kanban.cols-6 { grid-template-columns: 1fr; }

  /* Tables — allow horizontal scroll instead of breaking */
  [class*="grid"][style*="gridTemplateColumns"],
  div[style*="grid-template-columns"] {
    overflow-x: auto;
  }

  .sidebar { width: 86vw; }
}

/* ---------- SPINNER ---------- */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--line-2, var(--line));
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner.sm { width: 14px; height: 14px; border-width: 2px; }
.spinner.lg { width: 38px; height: 38px; border-width: 3px; }
.loading-block {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  width: 100%;
}

/* ---------- iPad landscape (1025-1280px): hide chat analysis panel ---------- */
@media (min-width: 1025px) and (max-width: 1280px) {
  .chat-shell { grid-template-columns: 280px 1fr; }
  .chat-analysis { display: none; }
}

/* ============================================================
   Appointment-appears tutorial popup + pulse highlight
   ============================================================ */
.lead-tutorial-overlay {
  position: fixed; inset: 0;
  background: rgba(8, 10, 14, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: lead-tutorial-fade 220ms ease-out;
}
.lead-tutorial-modal {
  width: 100%; max-width: 520px;
  background: var(--bg-1, #fff);
  color: var(--fg, #111);
  border: 1px solid var(--line, rgba(0,0,0,0.08));
  border-radius: 18px;
  padding: 32px;
  box-shadow: 0 32px 96px -24px rgba(0,0,0,0.4);
  animation: lead-tutorial-pop 360ms cubic-bezier(0.2,0.8,0.2,1);
}
.lead-tutorial-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 5px 11px; border-radius: 99px;
  background: var(--accent-soft, rgba(13,148,136,0.10));
  color: var(--accent, #0d9488);
  margin-bottom: 18px;
}
.lead-tutorial-badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent, #0d9488);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.25);
  animation: lead-tutorial-dot 1.2s ease-in-out infinite;
}
.lead-tutorial-title {
  font-size: 26px; font-weight: 500; letter-spacing: -0.4px;
  margin: 0 0 14px;
  color: var(--fg, #111);
}
.lead-tutorial-body {
  font-size: 14.5px; line-height: 1.6;
  color: var(--fg-2, #555);
  margin: 0 0 26px;
}
.lead-tutorial-body strong { color: var(--accent, #0d9488); font-weight: 600; }
.lead-tutorial-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  flex-wrap: wrap;
}
@keyframes lead-tutorial-fade { from {opacity:0;} to {opacity:1;} }
@keyframes lead-tutorial-pop {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
@keyframes lead-tutorial-dot {
  0%, 100% { transform: scale(1);   opacity: 1;   }
  50%      { transform: scale(1.4); opacity: 0.55;}
}
.appt-card.is-pulsing {
  position: relative; z-index: 5;
  animation: appt-card-pulse 1.6s ease-out 3;
  outline: 2px solid var(--accent, #0d9488);
  outline-offset: 1px;
}
@keyframes appt-card-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(13,148,136,0.7); }
  70%  { box-shadow: 0 0 0 14px rgba(13,148,136,0); }
  100% { box-shadow: 0 0 0 0 rgba(13,148,136,0); }
}

/* Captured-data preview chip inside the tutorial modal */
.lead-tutorial-preview {
  display: flex; flex-direction: column;
  gap: 8px;
  margin: 0 0 26px;
  padding: 16px 18px;
  background: var(--bg-2, rgba(0,0,0,0.03));
  border: 1px solid var(--line, rgba(0,0,0,0.06));
  border-radius: 12px;
}
.lead-tutorial-preview-row {
  display: flex; align-items: baseline; gap: 12px;
  font-size: 13.5px;
}
.lead-tutorial-preview-label {
  flex: 0 0 90px;
  font-family: var(--mono, monospace);
  font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-3, #999);
}
.lead-tutorial-preview-value {
  flex: 1; min-width: 0;
  color: var(--fg, #111);
  font-weight: 500;
  word-break: break-word;
}
