:root {
  --bg: #eef2f0;
  --bg-deep: #e3e9e6;
  --panel: #ffffff;
  --ink: #14201c;
  --muted: #5a6a64;
  --line: #d5ddd9;
  --teal: #0f6b5c;
  --teal-dark: #0a4f44;
  --teal-soft: #e4f3ef;
  --amber: #c47a18;
  --amber-soft: #fff2df;
  --rose: #b42318;
  --rose-soft: #fdeceb;
  --green: #1f7a45;
  --green-soft: #e8f6ee;
  --blue: #1d5f9c;
  --blue-soft: #e8f1fa;
  --shadow: 0 8px 24px rgba(20, 32, 28, 0.06);
  --radius: 14px;
  --font: "DM Sans", sans-serif;
  --display: "Instrument Sans", sans-serif;
  --sidebar: 250px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.45;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
img { max-width: 100%; }

.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  background: linear-gradient(180deg, #12352f 0%, #0d2823 100%);
  color: #edf6f3;
  padding: 0 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 20;
}

.sidebar .brand {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 -16px 14px;
  padding: 16px 18px;
  background: #fff;
  border-bottom: 1px solid #e4ebe8;
}
.sidebar .brand-logo {
  width: 100%;
  height: auto;
  max-height: 92px;
  border-radius: 0;
  object-fit: contain;
  background: #fff;
}
.brand-logo {
  width: 56px; height: 56px; border-radius: 14px;
  object-fit: contain; flex-shrink: 0; background: #fff;
}
.brand-name { font-family: var(--display); font-weight: 700; font-size: 1rem; line-height: 1.2; }
.brand-sub { color: #9bb8b0; font-size: 0.78rem; }

.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-label {
  color: #7fa199;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 14px 12px 6px;
}
.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #c7ddd7;
  font-weight: 500;
  transition: 0.15s ease;
}
.nav-ico { width: 18px; height: 18px; flex-shrink: 0; }
.side-nav a:hover, .side-nav a.active {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.sidebar-foot { border-top: 1px solid rgba(255,255,255,0.08); padding-top: 14px; }
.user-chip { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; color: inherit; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #1fa88f; display: grid; place-items: center; font-weight: 700;
  flex-shrink: 0;
}
.user-name { font-weight: 600; font-size: 0.9rem; }
.user-role { color: #9bb8b0; font-size: 0.75rem; }
.logout-link {
  display: inline-block;
  color: #9bb8b0;
  font-size: 0.85rem;
  padding: 8px 10px;
  border-radius: 8px;
}
.logout-link:hover { background: rgba(255,255,255,0.06); color: #fff; }

.main {
  flex: 1;
  min-width: 0;
  padding: 0;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.main-body { padding: 24px 28px 40px; flex: 1; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  width: 100%;
  min-height: 78px;
  margin: 0;
  padding: 14px 28px;
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: 0 1px 0 rgba(20, 32, 28, 0.03);
}
.topbar-title { min-width: 0; flex: 1; }
.topbar h1 { font-size: 1.55rem; line-height: 1.15; }
.topbar .muted { margin-top: 2px; }
.muted { color: var(--muted); margin-top: 4px; font-size: 0.92rem; }
.topbar-side { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.top-brand {
  display: flex; align-items: center; gap: 10px;
  min-width: 0; color: var(--ink); font-weight: 700;
  padding-right: 16px;
  border-right: 1px solid var(--line);
}
.top-brand img {
  width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: #fff;
}
.top-brand span {
  max-width: 280px;
  font-family: var(--display);
  font-size: 0.95rem;
  line-height: 1.25;
}
.profile-menu { position: relative; }
.profile-btn {
  display: flex; align-items: center; gap: 10px;
  min-height: 52px;
  border: 1px solid var(--line); background: var(--bg); border-radius: 14px;
  padding: 6px 14px 6px 6px; cursor: pointer; font: inherit; color: inherit;
}
.profile-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; min-width: 0; }
.profile-meta strong { font-size: 0.92rem; white-space: nowrap; }
.profile-meta small { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }
.profile-btn .avatar { width: 40px; height: 40px; }
.profile-drop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  width: 240px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 8px;
}
.profile-drop a, .profile-drop-head {
  display: flex; gap: 10px; align-items: center;
  padding: 10px; border-radius: 10px;
}
.profile-drop a:hover { background: var(--bg); }
.profile-drop-head { border-bottom: 1px solid var(--line); margin-bottom: 4px; border-radius: 0; }
.profile-drop-head img { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; }
.profile-drop-head strong, .profile-drop-head small { display: block; }
.profile-drop-head small { color: var(--muted); font-size: 0.75rem; }
.company-preview {
  width: 72px; height: 72px; border-radius: 16px; object-fit: cover;
  border: 1px solid var(--line); background: #fff;
}
.login-brand .brand-name { color: #12352f; }
.login-brand .brand-sub { color: #5f6b66; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 10px 14px;
  font: inherit; font-weight: 600; cursor: pointer;
  transition: 0.15s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-secondary:hover { background: var(--bg-deep); }
.btn-danger { background: var(--rose); color: #fff; }
.btn-sm { padding: 7px 11px; border-radius: 8px; font-size: 0.85rem; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-weight: 500;
}
.alert-success { background: var(--green-soft); color: var(--green); }
.alert-error { background: var(--rose-soft); color: var(--rose); }
.alert-info { background: var(--blue-soft); color: var(--blue); }

/* KPI / stats */
.stats-grid,
.stats-grid-6,
.leads-summary {
  display: grid !important;
  gap: 14px;
  margin-bottom: 18px;
  width: 100%;
}
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats-grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.leads-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat-card,
.mini-stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.stat-card .label,
.mini-stat .k {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.stat-card .value,
.mini-stat .v {
  font-family: var(--display);
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
}
.stat-card .hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}
.stat-card.accent {
  background: linear-gradient(145deg, #0f6b5c, #148978);
  color: #fff;
  border: 0;
}
.stat-card.accent .label,
.stat-card.accent .hint { color: rgba(255,255,255,0.8); }
.stat-card.accent .value { color: #fff; }
.stat-card.warn { border-color: rgba(180, 35, 24, 0.28); background: #fff8f7; }
.stat-card .hint.up { color: var(--green); font-weight: 600; }
.stat-card .hint.down { color: var(--rose); font-weight: 600; }

.quick-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.quick-chip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--teal-dark);
}
.quick-chip:hover { background: var(--teal-soft); }
.quick-chip.danger { color: var(--rose); background: var(--rose-soft); border-color: transparent; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
  overflow: hidden;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.panel-head h2 { font-size: 1.12rem; }

/* Filters — auto-fit so they never crush */
.filters,
.filters-report {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  align-items: end;
}
.filters .span-2 { grid-column: span 2; }
.filters .filter-actions {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
}
.check-list { display: flex; flex-wrap: wrap; gap: 8px; }
.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: auto;
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: #f4f8f6;
  font-weight: 600;
}
.check-item input, .row-check { width: auto; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.perm-switch {
  display: flex; gap: 12px; align-items: flex-start;
  margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff;
}
.perm-switch input { width: 18px; height: 18px; margin-top: 2px; flex: 0 0 auto; }
.perm-switch strong, .perm-switch small { display: block; }
.perm-switch small { color: var(--muted); font-weight: 500; margin-top: 3px; line-height: 1.35; }
.bulk-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.bulk-bar select { max-width: 280px; }

.intake-status {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
}
.intake-kicker {
  color: var(--teal);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.intake-status h2 { font-size: 1.45rem; }
.intake-status p { max-width: 640px; color: var(--muted); margin-top: 6px; }
.intake-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}
.intake-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8a8174;
}
.intake-pill.is-on { color: var(--green); background: var(--green-soft); border-color: transparent; }
.intake-pill.is-on .intake-dot { background: var(--green); }

.intake-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.intake-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.intake-card.is-live { border-color: #9ec9bf; background: linear-gradient(180deg, #f4fbf8, #fff); }
.intake-num {
  color: var(--teal);
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
}
.intake-card h3 { margin: 8px 0 6px; font-size: 1.05rem; }
.intake-card p, .intake-card span { color: var(--muted); font-size: 0.9rem; }
.intake-card a { display: inline-block; margin-top: 12px; color: var(--teal-dark); font-weight: 700; }

.copy-field { display: flex; gap: 8px; align-items: center; }
.copy-field input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84rem;
}
.intake-actions, .intake-save { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.intake-steps {
  margin: 16px 0 0;
  padding-left: 18px;
  color: #33403c;
  display: grid;
  gap: 8px;
}
.intake-steps li { line-height: 1.45; }
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.agent-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  width: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
}
.agent-pick.is-on { border-color: #7bb8ab; background: var(--teal-soft); }
.agent-pick input { width: 16px; height: 16px; flex: 0 0 auto; }
.agent-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  flex: 0 0 auto;
}
.agent-pick strong, .agent-pick small { display: block; }
.agent-pick small { color: var(--muted); font-weight: 500; font-size: 0.78rem; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.form-grid .full { grid-column: 1 / -1; }

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #33403c;
}
input, select, textarea {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: #7bb8ab;
  box-shadow: 0 0 0 3px rgba(15, 107, 92, 0.12);
}
textarea { min-height: 110px; resize: vertical; }

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
}
table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  background: #fff;
}
th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid #e8eeeB;
  vertical-align: top;
  font-size: 0.9rem;
}
.col-sr { width: 48px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.team-table { min-width: 980px; }
.team-table th, .team-table td { vertical-align: middle; }
.team-table .user-cell {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 210px;
  max-width: 260px;
  background: #fff;
  box-shadow: 8px 0 14px -12px rgba(20, 32, 28, 0.45);
}
.team-table thead .user-cell { z-index: 3; background: #f7faf8; }
.team-table tr:hover .user-cell { background: #f5faf8; }
.team-table .user-cell strong,
.team-table .user-cell .muted { display: block; }
.team-table .user-cell .muted {
  margin-top: 2px;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}
.team-table .actions { flex-wrap: nowrap; }
.perm-pills { display: flex; flex-wrap: wrap; gap: 4px; max-width: 220px; }
.perm-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f0;
  color: #3d4f49;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
th {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  background: #f7faf8;
  position: sticky;
  top: 0;
}
tbody tr:last-child td { border-bottom: 0; }
tr:hover td { background: #f5faf8; }

.badge, .prio {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}
.badge-new { background: var(--blue-soft); color: var(--blue); }
.badge-contacted { background: #efe9ff; color: #5b4aa8; }
.badge-followup { background: var(--amber-soft); color: var(--amber); }
.badge-interested { background: var(--green-soft); color: var(--green); }
.badge-not-interested { background: #f3efe8; color: #6b6257; }
.badge-converted { background: #dff7ea; color: #147a43; }
.badge-lost { background: var(--rose-soft); color: var(--rose); }
.badge-muted { background: #f0ece4; color: #666; }
.prio-high { background: var(--rose-soft); color: var(--rose); }
.prio-medium { background: var(--amber-soft); color: var(--amber); }
.prio-low { background: #eef2f0; color: #5a6a64; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.page-link {
  min-width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 600;
}
.page-link.active { background: var(--teal); color: #fff; border-color: var(--teal); }

.detail-grid,
.charts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.9fr);
  gap: 16px;
  margin-bottom: 4px;
}
.charts-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }

.chart-box { position: relative; height: 280px; width: 100%; }
.chart-box-sm { height: 250px; }

.funnel-list { display: grid; gap: 10px; }
.funnel-row { display: block; }
.funnel-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.88rem;
}
.funnel-bar {
  height: 10px;
  background: #e7eeeB;
  border-radius: 999px;
  overflow: hidden;
}
.funnel-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--teal);
  min-width: 4px;
}
.bar-new { background: var(--blue) !important; }
.bar-contacted { background: #5b4aa8 !important; }
.bar-follow_up { background: var(--amber) !important; }
.bar-interested { background: var(--green) !important; }
.bar-not_interested { background: #8a8174 !important; }
.bar-converted { background: #147a43 !important; }
.bar-lost { background: var(--rose) !important; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.summary-grid .k {
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 6px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.summary-grid p { line-height: 1.5; color: #33403c; }

.meta-list { display: grid; gap: 12px; }
.meta-item {
  padding: 12px;
  border-radius: 12px;
  background: #f4f8f6;
}
.meta-item .k { color: var(--muted); font-size: 0.8rem; margin-bottom: 4px; }
.meta-item .v { font-weight: 600; }

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: #f4f8f6;
  border-radius: 12px;
}

.timeline { display: grid; gap: 12px; }
.timeline-item {
  border-left: 3px solid var(--teal);
  padding: 8px 0 8px 14px;
}
.timeline-item .when { color: var(--muted); font-size: 0.8rem; }

.pipeline-toolbar { margin-bottom: 14px; }
.pipeline-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
}
.pipeline-col {
  background: #f4f8f6;
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
}
.pipeline-col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  background: #fff;
  border-radius: 14px 14px 0 0;
}
.pipeline-col-head strong {
  background: var(--teal-soft);
  color: var(--teal-dark);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.8rem;
}
.pipeline-col-body {
  padding: 10px;
  display: grid;
  gap: 10px;
  align-content: start;
  flex: 1;
}
.pipeline-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--teal);
}
.prio-border-high { border-left-color: var(--rose); }
.prio-border-medium { border-left-color: var(--amber); }
.prio-border-low { border-left-color: #8aa39b; }
.pipeline-title { font-weight: 700; display: block; margin-bottom: 4px; }
.pipeline-title:hover { color: var(--teal); }
.pipeline-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.pipeline-move { margin-top: 10px; }
.pipeline-move select { padding: 8px 10px; font-size: 0.82rem; }
.pipeline-empty {
  color: var(--muted);
  text-align: center;
  padding: 24px 8px;
  font-size: 0.85rem;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(15,107,92,0.18), transparent 35%),
    linear-gradient(160deg, #0d2823, #1a3f37 48%, #eef2f0 48%);
}
.auth-card {
  width: min(440px, 100%);
  background: #fff;
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.18);
}
.auth-card h1 { font-size: 1.7rem; margin-bottom: 6px; }
.auth-card .muted { margin-bottom: 22px; }
.auth-card .btn { width: 100%; margin-top: 8px; }
.auth-meta {
  margin-top: 18px;
  padding: 12px;
  border-radius: 12px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 0.85rem;
  line-height: 1.5;
}
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }

/* Mobile chrome (hidden on desktop) */
.mobile-bar,
.sidebar-close { display: none; }
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 18, 0.45);
  z-index: 80;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.menu-toggle {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1280px) {
  .stats-grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pipeline-board { grid-auto-columns: minmax(220px, 260px); }
}

@media (max-width: 1100px) {
  .stats-grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid,
  .charts-grid { grid-template-columns: 1fr; }
  .filters .span-2 { grid-column: span 1; }
  .chart-box { height: 240px; }
  .chart-box-sm { height: 220px; }
}

@media (max-width: 900px) {
  :root { --sidebar: 240px; }
  .stats-grid,
  .leads-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-grid, .intake-cards { grid-template-columns: 1fr; }
  .intake-status { flex-direction: column; align-items: flex-start; }
  .main-body { padding: 18px 16px 32px; }
  .topbar { padding: 12px 16px; min-height: 68px; gap: 12px; }
  .topbar h1 { font-size: 1.3rem; }
  .top-brand span { max-width: 180px; }
  .panel-head { flex-direction: column; align-items: flex-start; }
  .panel-head .actions { width: 100%; }
  .panel-head .actions .btn { flex: 1; text-align: center; }
}

@media (max-width: 768px) {
  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    position: sticky;
    top: 0;
    z-index: 30;
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 10px 14px;
    min-height: 64px;
  }
  .mobile-bar .top-brand { flex: 1; }
  .mobile-bar .top-brand span { max-width: none; }
  .mobile-bar .avatar { width: 42px; height: 42px; }

  .topbar { display: none; }

  body.nav-open .sidebar-overlay { display: block; }
  body.nav-open { overflow: hidden; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 86vw);
    height: 100vh;
    height: 100dvh;
    z-index: 90;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    border-radius: 0;
    box-shadow: 12px 0 40px rgba(0,0,0,0.25);
  }
  body.nav-open .sidebar { transform: translateX(0); }

  .sidebar-close {
    display: grid;
    place-items: center;
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: #eef2f0;
    color: #12352f;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
  }

  .side-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .side-nav a {
    flex: none;
    width: 100%;
  }

  .app-shell { display: block; }
  .main { width: 100%; padding: 0; }
  .main-body {
    padding: 14px 14px 28px;
    padding-bottom: max(28px, env(safe-area-inset-bottom));
  }

  .stats-grid,
  .stats-grid-6,
  .leads-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card,
  .mini-stat { padding: 14px; }
  .stat-card .value,
  .mini-stat .v { font-size: 1.35rem; }

  .filters,
  .filters-report { grid-template-columns: 1fr 1fr; }
  .filters .span-2,
  .filters .filter-actions { grid-column: 1 / -1; }
  .filter-actions .btn { flex: 1; }
  .form-grid { grid-template-columns: 1fr; }

  .table-wrap {
    margin: 0 -4px;
    border-radius: 10px;
  }
  table { min-width: 680px; }
  th, td { padding: 10px 12px; font-size: 0.86rem; }

  .pipeline-board {
    grid-auto-columns: minmax(260px, 78vw);
    scroll-snap-type: x mandatory;
    padding-bottom: 8px;
  }
  .pipeline-col { scroll-snap-align: start; min-height: 360px; }

  .chart-box { height: 220px; }
  .chart-box-sm { height: 200px; }

  .quick-strip { gap: 6px; }
  .quick-chip { font-size: 0.78rem; padding: 7px 11px; }

  .auth-page {
    padding: 16px;
    background: linear-gradient(180deg, #0d2823 0%, #1a3f37 38%, #eef2f0 38%);
  }
  .auth-card { padding: 24px 18px; border-radius: 16px; }
}

@media (max-width: 480px) {
  .filters,
  .filters-report { grid-template-columns: 1fr; }
  .actions { width: 100%; }
  .actions .btn { flex: 1; }
  .panel { padding: 14px; }
  .pagination { justify-content: center; }
  .stat-card .value,
  .mini-stat .v { font-size: 1.25rem; }
}

.wa-thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  margin-bottom: 14px;
  padding: 4px;
}
.wa-bubble {
  max-width: min(80%, 460px);
  padding: 10px 12px;
  border-radius: 14px;
  line-height: 1.4;
}
.wa-bubble.in { align-self: flex-start; background: var(--bg); }
.wa-bubble.out { align-self: flex-end; background: var(--green-soft); }
.wa-bubble small { display: block; margin-top: 4px; color: var(--muted); font-size: 0.75rem; }
.wa-reply { display: flex; gap: 8px; align-items: flex-end; }
.wa-reply textarea { min-height: 72px; }

@media (hover: none) and (pointer: coarse) {
  .side-nav a,
  .btn,
  .page-link,
  .quick-chip { min-height: 42px; }
  select, input, textarea { font-size: 16px; }
}

