:root {
  --bg: #070c18;
  --surface: #0e1628;
  --surface-2: #162038;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --muted: #94a3b8;
  --border: #1f2d47;
  --border-strong: #334155;
  --primary: #3b82f6;
  --primary-btn: #1d4ed8;
  --primary-btn-hover: #2563eb;
  --hot: #fb7185;
  --warm: #fbbf24;
  --cold: #38bdf8;
  --ok: #34d399;
  --danger: #fda4af;
  --radius: 12px;
  --shadow: 0 16px 40px rgba(2, 6, 23, 0.35);
  --font: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --font-display: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --topbar: 4rem;
  --sidebar: 16.5rem;
  --focus: #93c5fd;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  color-scheme: dark;
}

body { font-size: 15px; line-height: 1.5; }

h1, h2, h3, h4, .font-display { font-family: var(--font-display); text-wrap: balance; }

a { color: inherit; text-decoration: none; }

::selection { background: rgba(59, 130, 246, 0.35); color: #dbeafe; }

:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 80;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}

.skip-link:focus { top: 0.75rem; }

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  background: var(--bg);
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.sidebar {
  width: var(--sidebar);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex: none;
  height: 100vh;
  height: 100dvh;
  position: sticky;
  top: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: var(--topbar);
  padding: 0.75rem 0.85rem 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-product {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 0.92rem;
}

.sidebar-tag { color: var(--muted); font-size: 0.72rem; margin-top: 0.1rem; }

.side-nav {
  flex: 1;
  overflow: auto;
  padding: 0.85rem 0.7rem 1rem;
}

.nav-section {
  padding: 0.35rem 0.75rem 0.45rem;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  margin: 0.12rem 0;
  padding: 0.62rem 0.75rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 500;
}

.nav-btn:hover { background: var(--surface-2); color: var(--text); }

.nav-btn.active {
  background: rgba(37, 99, 235, 0.16);
  color: #bfdbfe;
}

.sidebar-foot { padding: 0.7rem; border-top: 1px solid var(--border); }

.sidebar-foot .nav-btn:hover { color: #fda4af; background: rgba(244, 63, 94, 0.08); }

.sidebar-close { display: none; }

.main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: var(--topbar);
  padding: 0.55rem 1rem;
  background: rgba(14, 22, 40, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-start, .topbar-end { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }

.topbar-start { flex: 1; }

.nav-toggle { display: none; }

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
  font-size: 0.92rem;
}

.brand-workspace, .brand-page {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-workspace { font-family: var(--font-display); font-weight: 600; }

.brand-sep, .brand-page { color: var(--muted); }

.user-chip { display: flex; align-items: center; gap: 0.6rem; padding-left: 0.7rem; border-left: 1px solid var(--border); }

.user-meta { text-align: right; min-width: 0; }

.user-name {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role { color: var(--muted); font-size: 0.72rem; line-height: 1.2; }

.avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #1e293b;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  flex: none;
}

.icon {
  width: 1rem;
  height: 1rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.sidebar-brand .icon-btn { border-color: transparent; }

.notif { position: relative; }

.notif-bell { position: relative; }

.notif-bell.is-current { color: #bfdbfe; border-color: rgba(59, 130, 246, 0.45); }

.notif-count {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--primary-btn);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.notif-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  width: min(22rem, calc(100vw - 1.25rem));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 40;
  overflow: hidden;
}

.notif-panel[hidden] { display: none !important; }

.notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
}

.notif-panel-body { max-height: 20rem; overflow: auto; }

.notif-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 0.75rem;
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.notif-item:last-child { border-bottom: 0; }

.notif-item:hover { background: var(--surface-2); }

.notif-item.is-unread { background: rgba(37, 99, 235, 0.08); }

.notif-item-title { font-size: 0.82rem; font-weight: 600; }

.notif-item-time { color: var(--muted); font-family: var(--font-mono); font-size: 0.68rem; }

.notif-item-body { grid-column: 1 / -1; color: var(--muted); font-size: 0.78rem; }

.text-btn {
  border: 0;
  background: transparent;
  color: #93c5fd;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.15rem 0.2rem;
}

.text-btn:hover { color: #dbeafe; }

.content {
  padding: 1.25rem 1.25rem 6.5rem;
  width: 100%;
  max-width: 1440px;
  min-width: 0;
  margin: 0 auto;
  overflow-x: hidden;
}

.page-head { margin: 0 0 1rem; }

.kicker {
  margin: 0 0 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.page-head h2, h2 { margin: 0; font-size: 1.45rem; letter-spacing: -0.02em; }

.grid { display: grid; gap: 0.85rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
}

.card h3 {
  margin: 0;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.kpi { position: relative; overflow: hidden; }

.kpi::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
}

.kpi[data-tone="rose"]::before { background: var(--hot); }
.kpi[data-tone="amber"]::before { background: var(--warm); }
.kpi[data-tone="sky"]::before { background: var(--cold); }
.kpi[data-tone="teal"]::before { background: var(--ok); }
.kpi[data-tone="slate"]::before { background: #64748b; }

.card .value {
  margin-top: 0.55rem;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2vw, 1.7rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem;
  margin-top: 0.9rem;
}

.toolbar, .row { display: flex; gap: 0.65rem; flex-wrap: wrap; align-items: center; }

.toolbar input, .toolbar select { flex: 1 1 16rem; width: auto; min-width: 0; }

.muted { color: var(--muted); }

input, select, textarea {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  width: 100%;
  font: inherit;
}

input::placeholder, textarea::placeholder { color: #94a3b8; }

textarea { min-height: 7rem; resize: vertical; }

button.btn {
  border: 0;
  border-radius: 8px;
  padding: 0.65rem 0.95rem;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 0.86rem;
  background: var(--primary-btn);
  color: #fff;
}

button.btn:hover { background: var(--primary-btn-hover); }

button.btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}

button.btn.secondary:hover { background: var(--surface-2); }

button.btn.btn-sm { padding: 0.4rem 0.65rem; font-size: 0.78rem; }

button.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.badge, .status-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
  text-transform: capitalize;
  line-height: 1.4;
}

.badge.hot { background: rgba(244, 63, 94, 0.14); color: #fecdd3; border-color: rgba(244, 63, 94, 0.28); }
.badge.warm { background: rgba(245, 158, 11, 0.14); color: #fde68a; border-color: rgba(245, 158, 11, 0.28); }
.badge.cold { background: rgba(56, 189, 248, 0.14); color: #bae6fd; border-color: rgba(56, 189, 248, 0.28); }
.badge.mock, .status-pill { background: rgba(148, 163, 184, 0.12); color: #e2e8f0; border-color: rgba(148, 163, 184, 0.28); }
.badge.live, .status-pill.active { background: rgba(16, 185, 129, 0.14); color: #a7f3d0; border-color: rgba(16, 185, 129, 0.3); }
.status-pill.suspended { background: rgba(245, 158, 11, 0.14); color: #fde68a; border-color: rgba(245, 158, 11, 0.3); }

.segment { display: flex; gap: 0.35rem; flex-wrap: wrap; }

.segment-btn {
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.segment-btn.active {
  background: var(--primary-btn);
  border-color: transparent;
  color: #fff;
}

.followup-tz { margin: 0.75rem 0 0.35rem; font-size: 0.82rem; }

.followup-item { align-items: flex-start; }

.followup-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: end; margin-top: 0.65rem; }

.followup-reschedule { display: grid; gap: 0.3rem; min-width: min(100%, 16rem); }

.followup-reschedule input { width: 100%; }

.stage-board {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: scroll;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  padding: 0.15rem 1.5rem 0.55rem 0.15rem;
  margin-bottom: 0.15rem;
  align-items: flex-start;
  scroll-padding-inline-end: 1.5rem;
  scrollbar-width: auto;
  scrollbar-color: #94a3b8 #0e1628;
}

.stage-board::-webkit-scrollbar {
  height: 14px;
}

.stage-board::-webkit-scrollbar-track {
  background: #0e1628;
  border-radius: 999px;
}

.stage-board::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border: 3px solid #0e1628;
  border-radius: 999px;
}

.board-scroll {
  position: relative;
  min-width: 0;
  max-width: 100%;
}

.board-arrow {
  position: absolute;
  top: 4.5rem;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.board-arrow-left { left: 0.15rem; }
.board-arrow-right { right: 0.15rem; }

.board-arrow:hover { background: var(--surface-2); }

.stage-column {
  flex: 0 0 16.5rem;
  min-width: 16.5rem;
  max-width: 16.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 14rem;
  scroll-snap-align: start;
}

.stage-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

.stage-column-head h3 { margin: 0; font-size: 0.92rem; }

.stage-column-body { display: grid; gap: 0.45rem; padding: 0.55rem; }

.stage-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  display: grid;
  gap: 0.35rem;
  cursor: pointer;
}

.stage-card[draggable="true"] { cursor: grab; }

.stage-move { display: grid; gap: 0.25rem; margin-top: 0.25rem; }

.stage-move select, .followup-reschedule input { font-size: 0.85rem; }

.stage-empty { margin: 0.2rem; padding: 0.8rem 0.5rem; }

.activity-list { margin: 0.35rem 0 0.8rem; padding-left: 1.1rem; display: grid; gap: 0.3rem; }

.inbox {
  display: grid;
  grid-template-columns: minmax(15rem, 18.5rem) minmax(0, 1fr) minmax(14rem, 17rem);
  min-height: 34rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  margin-top: 0.9rem;
}

.inbox-list, .inbox-thread, .inbox-lead { min-width: 0; }

.inbox-list {
  border-right: 1px solid var(--border);
  overflow: auto;
  max-height: 42rem;
}

.inbox-person {
  display: grid;
  gap: 0.2rem;
  width: 100%;
  text-align: left;
  background: transparent;
  color: inherit;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 0.9rem;
  cursor: pointer;
  font: inherit;
}

.inbox-person.active { background: rgba(37, 99, 235, 0.16); }

.inbox-person-top { display: flex; justify-content: space-between; gap: 0.5rem; align-items: center; }

.inbox-preview { color: var(--muted); font-size: 0.78rem; }

.inbox-thread {
  display: flex;
  flex-direction: column;
  min-height: 28rem;
  background: rgba(7, 12, 24, 0.35);
}

.thread-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  padding: 0.8rem 0.95rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.thread-log {
  flex: 1;
  overflow: auto;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 28rem;
}

.bubble-row { display: flex; }
.bubble-row.out { justify-content: flex-end; }
.bubble-row.in { justify-content: flex-start; }

.bubble {
  max-width: min(85%, 28rem);
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  font-size: 0.86rem;
  line-height: 1.45;
}

.bubble.in { background: var(--surface-2); border: 1px solid var(--border); }
.bubble.out { background: #1d4ed8; color: #fff; }
.bubble.mock { box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.75); }
.bubble-meta { font-size: 0.7rem; opacity: 0.8; margin-bottom: 0.25rem; }
.bubble .btn { margin-top: 0.55rem; }

.composer {
  display: grid;
  gap: 0.45rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.composer textarea { min-height: 4.5rem; }
.composer-actions { display: flex; justify-content: flex-start; }
.mock-note { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.78rem; }

.inbox-lead {
  border-left: 1px solid var(--border);
  padding: 0.95rem;
  background: var(--surface);
}

.inbox-lead h3 { margin: 0 0 0.6rem; font-size: 0.95rem; }
.lead-facts { margin: 0.4rem 0 0; display: grid; gap: 0.55rem; }
.lead-facts div { display: grid; gap: 0.1rem; }
.lead-facts dt { color: var(--muted); font-size: 0.72rem; }
.lead-facts dd { margin: 0; }

.ai-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr);
  gap: 0.9rem;
  margin-top: 0.75rem;
}

.ai-tasks, .ai-chat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
}

.ai-tasks { padding: 0.45rem; display: grid; gap: 0.25rem; align-content: start; }

.ai-task {
  display: grid;
  gap: 0.15rem;
  text-align: left;
  background: transparent;
  color: inherit;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.65rem 0.7rem;
  cursor: pointer;
  font: inherit;
}

.ai-task:hover { background: var(--surface-2); }
.ai-task span { color: var(--muted); font-size: 0.75rem; }
.ai-chat { display: flex; flex-direction: column; min-height: 32rem; }
.ai-chat .thread-log { max-height: none; }
#ai-out {
  white-space: pre-wrap;
  margin: 0;
  max-height: 8rem;
  overflow: auto;
  font-size: 0.8rem;
  background: var(--bg);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
}

.notif-item-action { color: var(--focus); font-size: 0.75rem; font-weight: 600; }

.list { display: grid; gap: 0.55rem; }

.list-item {
  padding: 0.85rem 0.95rem;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.list-item.is-unread { box-shadow: inset 3px 0 0 #3b82f6; }

.list-main { min-width: 0; }

.list-main strong, .list-item strong { font-weight: 600; }

.list-meta { display: grid; justify-items: end; gap: 0.25rem; text-align: right; }

.empty {
  margin: 0;
  padding: 1.4rem 1rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(14, 22, 40, 0.45);
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 25;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: rgba(14, 22, 40, 0.96);
  border-top: 1px solid var(--border);
  padding: 0.25rem 0.25rem calc(0.3rem + env(safe-area-inset-bottom));
}

.bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 3.15rem;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  padding: 0.25rem 0.1rem;
  font: inherit;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
}

.bottom-nav button.active { color: #dbeafe; background: rgba(37, 99, 235, 0.16); }

.auth-screen { min-height: 100vh; min-height: 100dvh; }

.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.login-layout {
  width: min(920px, 100%);
  display: grid;
  gap: 1.25rem;
}

.login-intro h1 {
  margin: 0.15rem 0 0.4rem;
  font-size: clamp(1.7rem, 3vw, 2.15rem);
  letter-spacing: -0.03em;
}

.login-intro .lede { margin: 0; max-width: 36rem; color: var(--muted); }

.login-card { width: min(440px, 100%); }

.login-card h2 { font-size: 1.15rem; margin-bottom: 0.35rem; }

.field-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
}

.login-card .list { margin-top: 1rem; }

.login-card .btn { width: 100%; }

.demo-note { margin: 0.2rem 0 0; font-size: 0.78rem; }

.linkish {
  border: 0;
  background: transparent;
  color: #93c5fd;
  font: inherit;
  cursor: pointer;
  padding: 0;
}

code, pre, .mono { font-family: var(--font-mono); font-size: 0.78rem; }

pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  min-height: 3rem;
}

code {
  display: block;
  margin-top: 0.45rem;
  padding: 0.55rem 0.65rem;
  background: var(--bg);
  border-radius: 8px;
  word-break: break-all;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 5.5rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid rgba(59, 130, 246, 0.45);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  z-index: 60;
  box-shadow: var(--shadow);
  max-width: min(24rem, calc(100vw - 2rem));
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.75);
  display: grid;
  place-items: center;
  z-index: 80;
  padding: 1rem;
}

.modal { width: min(440px, 100%); box-shadow: var(--shadow); }

.modal h3 { margin: 0 0 0.75rem; font-size: 1.05rem; }

.modal label { display: block; margin: 0.7rem 0 0.3rem; font-size: 0.78rem; }

.modal .error, .error { color: var(--danger); margin: 0.55rem 0 0; }

.modal-actions { display: flex; gap: 0.5rem; margin-top: 0.9rem; }

.field-error { border-color: #fb7185 !important; }

.nav-backdrop { display: none; }

@media (min-width: 800px) {
  .login-layout { grid-template-columns: 1.1fr 0.9fr; align-items: center; }
  .login-card { justify-self: end; }
}

@media (min-width: 960px) {
  .bottom-nav, .nav-toggle, .sidebar-close { display: none; }
  .content { padding-bottom: 1.75rem; }
  .toast { bottom: 1.25rem; }

  .app-shell.is-collapsed .sidebar { width: 4.75rem; }
  .app-shell.is-collapsed .nav-label,
  .app-shell.is-collapsed .nav-section,
  .app-shell.is-collapsed .sidebar-tag,
  .app-shell.is-collapsed .sidebar-product { display: none; }
  .app-shell.is-collapsed .sidebar-brand { justify-content: center; padding-left: 0.45rem; padding-right: 0.45rem; }
  .app-shell.is-collapsed .nav-btn { justify-content: center; }
  .app-shell.is-collapsed .sidebar-foot { padding-left: 0.45rem; padding-right: 0.45rem; }
}

@media (max-width: 959px) {
  .sidebar {
    position: fixed;
    z-index: 50;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }

  .nav-open .sidebar { transform: translateX(0); }

  .nav-open .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(2, 6, 23, 0.72);
  }

  .nav-toggle, .sidebar-close { display: inline-flex; }
  .sidebar-collapse { display: none; }
  .user-meta { display: none; }
  .user-chip { border: 0; padding-left: 0; }
  .grid { gap: 0.55rem; }
  .kpi { padding: 0.65rem 0.8rem 0.7rem; }
  .card .value { margin-top: 0.25rem; font-size: 1.28rem; }
  .page-head { margin-bottom: 0.6rem; }
  .panel { margin-top: 0.65rem; }
}

@media (max-width: 639px) {
  .brand-workspace, .brand-sep { display: none; }
  .content { padding: 1rem 0.9rem 7.25rem; }
  .list-item { align-items: flex-start; }
  .stage-column { flex-basis: 14.25rem; min-width: 14.25rem; max-width: 14.25rem; }
  .followup-actions { flex-direction: column; align-items: stretch; }
  .inbox, .ai-layout { grid-template-columns: 1fr; }
  .inbox-list { max-height: 16rem; border-right: 0; border-bottom: 1px solid var(--border); }
  .inbox-lead { border-left: 0; border-top: 1px solid var(--border); }
  .thread-log { max-height: 22rem; }
  .segment { width: 100%; }
  .segment-btn { flex: 1 1 auto; }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; }
}


.team-card { flex-direction: column; align-items: stretch; }
.team-verify { display: flex; flex-direction: column; gap: 0.45rem; width: 100%; margin-top: 0.35rem; }
.wa-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.18em; font-size: 1.15rem; }
.wa-grid { display: grid; grid-template-columns: 1fr; gap: 0.9rem; align-items: start; }
.wa-grid textarea { min-height: 5.5rem; }

@media (min-width: 960px) {
  .wa-grid { grid-template-columns: 1.15fr 0.85fr; }
}

.report-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: end;
}

.report-filters .field-label { margin: 0; }

.report-filters input[type="date"] { width: auto; min-width: 11rem; }

.table-wrap { overflow-x: auto; }

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.report-table th,
.report-table td {
  text-align: left;
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.integration-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 0.9rem;
}

.integration-card h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text);
  margin: 0.15rem 0 0.55rem;
}

.integration-badges { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-bottom: 0.45rem; }

.settings-grid { display: grid; gap: 0.7rem; }

.check-row {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
}

.check-row input { width: auto; margin-top: 0.2rem; }

.team-member select { margin-top: 0.25rem; }

.invite-result {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.8rem;
  padding: 0.8rem;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
}

.invite-token {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  word-break: break-all;
  background: var(--bg);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
}

@media (max-width: 639px) {
  .report-filters { align-items: stretch; }
  .report-filters input[type="date"],
  .report-filters .btn { width: 100%; }
  .integration-grid { grid-template-columns: 1fr; }
}

@media print {
  body { background: #fff; color: #111; }
  .sidebar, .topbar, .bottom-nav, .nav-backdrop, .no-print, .toast, .skip-link { display: none !important; }
  .app-shell, .main, .content { display: block; width: auto; margin: 0; padding: 0; }
  .card, .panel, .list-item, .report-table { background: #fff; color: #111; box-shadow: none; }
  .report-table th, .report-table td { border-bottom: 1px solid #ccc; }
  .kpi::before { background: #111; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
