/* EtaxFlow theme — deep blue primary (matches etaxflow.com's #073D7F),
   neutral gray-scale UI, semantic pill colors for pipeline stages. */

:root {
  --brand: #0B4F8A;
  --brand-dark: #073D7F;
  --brand-light: #EAF2FB;
  --brand-text-on: #FFFFFF;

  --ink: #101828;
  --slate: #475467;
  --slate-light: #98A2B3;
  --border: #E4E7EC;
  --bg: #F9FAFB;
  --paper: #FFFFFF;

  --success: #0D8A56;
  --success-bg: #E7F7EF;
  --amber: #B25E09;
  --amber-bg: #FFF6E5;
  --purple: #6941C6;
  --purple-bg: #F4F3FF;
  --danger: #C4291F;
  --danger-bg: #FEF1F0;
  --gray-pill-bg: #F2F4F7;
  --gray-pill-text: #475467;

  --radius: 8px;
  --shadow-modal: 0 20px 60px rgba(16, 24, 40, 0.25);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

.page { max-width: 1320px; margin: 0 auto; padding: 24px 28px 60px; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- header */

.header {
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 14px; margin-bottom: 18px;
}
.header-title { font-size: 24px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.header-sub { font-size: 13px; color: var(--slate); margin-top: 2px; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--radius);
  padding: 9px 14px; font-size: 13.5px; font-weight: 500; cursor: pointer;
  font-family: inherit; white-space: nowrap;
}
.btn-outline { background: var(--paper); border-color: var(--border); color: var(--ink); }
.btn-outline:hover { background: #F9FAFB; }
.btn-primary { background: var(--brand); color: var(--brand-text-on); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-improve { background: var(--purple-bg); color: var(--purple); border-color: #E3DEFA; }
.compose-ai-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 2px 0 6px; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-ghost-inverse { background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.25); }
.btn-primary-inverse { background: #fff; color: var(--brand-dark); }

.icon-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--paper); border-radius: var(--radius); cursor: pointer; color: var(--slate);
}
.icon-btn:hover { background: #F9FAFB; }

/* ---------------------------------------------------------------- tabs */

.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; border: none; background: none; cursor: pointer;
  font-family: inherit; font-size: 13.5px; font-weight: 500; color: var(--slate);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--brand-dark); border-bottom-color: var(--brand); }

.tab-panel { animation: fadeIn 0.12s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------------------------------------------------------------- banner */

.banner {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 14px; font-size: 13.5px; color: var(--slate);
}

/* ---------------------------------------------------------------- filters */

.filter-bar {
  display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap;
}
.search-wrap {
  flex: 1 1 260px; min-width: 220px; display: flex; align-items: center; gap: 8px;
  background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 12px; color: var(--slate-light);
}
.search-wrap input {
  border: none; outline: none; font-size: 13.5px; flex: 1; font-family: inherit; color: var(--ink);
}
.filter-bar select {
  background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 10px; font-size: 13px; font-family: inherit; color: var(--ink); min-width: 130px;
}

.result-count { font-size: 12.5px; color: var(--slate-light); margin-bottom: 14px; }

/* ---------------------------------------------------------------- bulk bar */

.bulk-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--brand-dark); color: #fff;
  padding: 10px 16px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13px;
}
.spacer { flex: 1; }

/* ---------------------------------------------------------------- table */

.table-card {
  background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.table-card.pad { padding: 24px; }

table { width: 100%; border-collapse: collapse; }
thead tr { background: #FAFBFC; border-bottom: 1px solid var(--border); }
th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.03em;
  color: var(--slate-light); padding: 10px 14px; text-transform: uppercase;
}
.col-check { width: 36px; }
.col-actions { text-align: right; }
td { padding: 12px 14px; vertical-align: top; border-bottom: 1px solid var(--border); font-size: 13.5px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FAFBFC; }
.empty { text-align: center; color: var(--slate-light); padding: 40px; }

.contact-name { font-weight: 600; color: var(--ink); text-decoration: none; }
.contact-name:hover { color: var(--brand); }
.cell-sub { font-size: 12px; color: var(--slate-light); margin-top: 1px; }

.email-cell .email { color: var(--ink); }
.validity-tag { display: block; font-size: 11px; font-weight: 600; margin-top: 3px; letter-spacing: 0.02em; }
.validity-valid { color: var(--success); }
.validity-risky { color: var(--amber); }
.validity-invalid { color: var(--danger); }
.validity-bounced { color: var(--danger); }
.validity-unchecked { color: var(--slate-light); }

.status-stack { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
}
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.stage-notcontacted { background: var(--gray-pill-bg); color: var(--gray-pill-text); }
.stage-firstoutreachdone { background: #E6F0FB; color: #1D5FA8; }
.stage-followup1sent { background: var(--amber-bg); color: var(--amber); }
.stage-followup2sent { background: var(--purple-bg); color: var(--purple); }
.stage-suppressedwarmaccount { background: var(--danger-bg); color: var(--danger); }

.subpill {
  font-size: 10.5px; font-weight: 500; padding: 2px 7px; border-radius: 999px;
  background: var(--gray-pill-bg); color: var(--gray-pill-text); border: none; cursor: pointer; font-family: inherit;
}
.subpill.active-reply { background: var(--danger-bg); color: var(--danger); }
.subpill.active-outcome { background: var(--success-bg); color: var(--success); }

.next-followup { font-size: 13px; font-weight: 600; }
.next-followup.due { color: var(--amber); }
.next-followup.none { color: var(--slate-light); font-weight: 400; }

.last-updated { color: var(--slate); font-size: 12.5px; }

.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.send-btn {
  width: 30px; height: 30px; border-radius: 6px; border: none; cursor: pointer;
  background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center;
}
.send-btn:hover { background: var(--brand-dark); }
.kebab-btn {
  width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--border); background: var(--paper);
  cursor: pointer; color: var(--slate); font-weight: 700; letter-spacing: 1px;
}
.kebab-btn:hover { background: #F9FAFB; }

/* ---------------------------------------------------------------- kebab menu */

.kebab-menu {
  position: fixed; z-index: 90; background: var(--paper); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow-modal); min-width: 210px; padding: 6px; font-size: 13px;
}
.kebab-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 8px 10px; border: none; background: none; cursor: pointer; border-radius: 6px; font-family: inherit; color: var(--ink);
}
.kebab-menu button:hover { background: #F2F4F7; }
.kebab-divider { height: 1px; background: var(--border); margin: 6px 2px; }
.kebab-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--slate-light); padding: 4px 10px 2px; }

/* ---------------------------------------------------------------- inline panels (import summary / previews) */

.inline-panel {
  background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 14px; font-size: 13px;
}
.inline-panel .ok { color: var(--success); font-weight: 700; }
.inline-panel .warn { color: var(--danger); }
.log-line { font-size: 12px; color: var(--slate); padding: 3px 0; }

/* ---------------------------------------------------------------- scheduler / warm tabs */

.panel-title { font-size: 17px; font-weight: 700; margin: 0 0 8px; }
.panel-desc { font-size: 13.5px; color: var(--slate); line-height: 1.6; max-width: 640px; margin-bottom: 20px; }

.toggle-row { display: flex; align-items: center; gap: 14px; font-size: 14px; font-weight: 500; }
.toggle-row.bordered { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-top: 14px; justify-content: space-between; }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0; background: #D0D5DD; border-radius: 999px; transition: 0.15s;
}
.slider::before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
  background: white; border-radius: 50%; transition: 0.15s;
}
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(18px); }

.scheduler-meta { font-size: 12.5px; color: var(--slate-light); margin-top: 10px; }
.scheduler-actions { display: flex; gap: 10px; margin-top: 20px; }

.add-domain-row { display: flex; gap: 10px; margin-bottom: 18px; }
.add-domain-row input {
  flex: 1; border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 12px; font-size: 13.5px; font-family: inherit;
}
#warmTable { border: 1px solid var(--border); border-radius: var(--radius); }
#warmTable th { background: #FAFBFC; }
.remove-domain-btn { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 12.5px; font-weight: 600; }

/* ---------------------------------------------------------------- modals */

.modal {
  position: fixed; inset: 0; background: rgba(16, 24, 40, 0.45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-card {
  background: var(--paper); border-radius: 12px; width: 460px; max-width: 100%;
  box-shadow: var(--shadow-modal); display: flex; flex-direction: column; max-height: 90vh;
}
.modal-card-xl { width: 1080px; }

.modal-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-sub { font-size: 12.5px; color: var(--slate); margin-top: 2px; }
.modal-x { border: none; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--slate-light); padding: 4px; }
.modal-x:hover { color: var(--ink); }

.modal-body { padding: 18px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-body label {
  display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--slate);
}
.modal-body input, .modal-body textarea {
  font-size: 13.5px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 6px;
  font-family: inherit; font-weight: 400; color: var(--ink);
}
.req { color: var(--danger); }
.modal-note { font-size: 13px; color: var(--slate); line-height: 1.6; margin: 0; }

.modal-actions {
  display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px;
  border-top: 1px solid var(--border);
}

/* ---------------------------------------------------------------- compose modal */

.compose-body { display: flex; gap: 0; overflow: hidden; flex: 1; min-height: 0; }
.compose-left {
  flex: 1; padding: 18px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px;
  border-right: 1px solid var(--border);
}
.compose-left label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--slate); }
.compose-left label.grow { flex: 1; min-height: 160px; }
.compose-left input, .compose-left textarea {
  font-size: 13.5px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 6px;
  font-family: inherit; font-weight: 400; color: var(--ink);
}
.compose-left textarea { flex: 1; resize: vertical; min-height: 140px; line-height: 1.5; }
.compose-left input[readonly] { background: #F9FAFB; color: var(--slate); }
.compose-row { display: flex; gap: 12px; }
.compose-row label { flex: 1; }
.compose-linkedin-row { display: flex; gap: 8px; }

.chip {
  border: 1px solid var(--border); background: var(--paper); color: var(--slate);
  padding: 6px 12px; font-size: 12.5px; font-weight: 500; border-radius: 6px; cursor: pointer; font-family: inherit;
}
.chip.active { background: var(--brand-light); border-color: #BFDBF7; color: var(--brand-dark); }
.subject-toggle, .template-toggle { display: flex; gap: 6px; margin-bottom: 6px; }

.compose-right { width: 500px; flex-shrink: 0; padding: 18px 20px; background: #FAFBFC; overflow-y: auto; }
.live-preview-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--slate-light); margin-bottom: 10px; }
.live-preview-card { background: var(--paper); border: 1px solid var(--border); border-radius: 8px; padding: 14px; }
.lp-row { display: flex; gap: 8px; font-size: 12.5px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.lp-label { color: var(--slate-light); min-width: 62px; flex-shrink: 0; }
.lp-subject { font-weight: 600; }
.lp-body { white-space: pre-wrap; font-size: 13px; line-height: 1.6; padding-top: 12px; color: var(--ink); }

.compose-actions { align-items: center; }
.sending-as { font-size: 12.5px; color: var(--slate); }

.lp-frame { width: 100%; height: 420px; border: 1px solid var(--border); border-radius: 6px; background: #fff; margin-top: 12px; }

/* ---------------------------------------------------------------- sidebar layout */

.layout { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; }

.sidebar {
  width: 224px; flex: none; position: sticky; top: 0; height: 100vh;
  background: var(--paper); border-right: 1px solid var(--border);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 22px;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 0 8px;
  font-size: 17px; font-weight: 700; color: var(--brand-dark); letter-spacing: -0.01em;
}
.sidebar-brand img { border-radius: 6px; object-fit: contain; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 10px 12px; border: none; border-radius: var(--radius); background: none;
  font-family: inherit; font-size: 14px; font-weight: 500; color: var(--slate); cursor: pointer;
}
.nav-item:hover { background: #F2F4F7; color: var(--ink); }
.nav-item.active { background: var(--brand-light); color: var(--brand-dark); font-weight: 600; }
.nav-badge {
  margin-left: auto; font-size: 10.5px; font-weight: 600; padding: 2px 7px;
  border-radius: 999px; background: var(--gray-pill-bg); color: var(--gray-pill-text);
}

@media (max-width: 820px) {
  .layout { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; flex-direction: row; align-items: center; gap: 12px; padding: 10px 12px; border-right: none; border-bottom: 1px solid var(--border); overflow-x: auto; }
  .sidebar-nav { flex-direction: row; }
  .nav-item { white-space: nowrap; width: auto; }
  .page { padding: 18px 14px 50px; }
}

/* ---------------------------------------------------------------- dashboard */

.seg { display: inline-flex; background: var(--gray-pill-bg); border-radius: var(--radius); padding: 3px; }
.seg-btn {
  border: none; background: none; padding: 7px 14px; border-radius: 6px; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 500; color: var(--slate);
}
.seg-btn.active { background: var(--paper); color: var(--brand-dark); font-weight: 600; box-shadow: 0 1px 2px rgba(16,24,40,0.12); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; border-top: 3px solid var(--border); }
.stat-card.c-email1 { border-top-color: var(--brand); }
.stat-card.c-followup1 { border-top-color: #E89A2E; }
.stat-card.c-followup2 { border-top-color: var(--purple); }
.stat-card.c-total { border-top-color: var(--success); }
.stat-label { font-size: 12.5px; font-weight: 600; color: var(--slate); }
.stat-value { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 2px; }
.stat-foot { font-size: 12.5px; min-height: 18px; }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--slate-light); }
.stat-all { font-size: 12px; color: var(--slate-light); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }

.chart-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.chart-head .panel-title { margin: 0; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--slate); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.dot-email1 { background: var(--brand); }
.dot-followup1 { background: #E89A2E; }
.dot-followup2 { background: var(--purple); }

.chart { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.chart-col { flex: 1 0 64px; display: flex; flex-direction: column; align-items: center; padding: 8px 4px 6px; border-radius: 8px; }
.chart-col.current { background: var(--brand-light); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 190px; width: 100%; justify-content: center; }
.bar-wrap { flex: 1; max-width: 16px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.bar { width: 100%; border-radius: 3px 3px 0 0; min-height: 2px; }
.bar-val { font-size: 10.5px; font-weight: 600; color: var(--slate); margin-bottom: 2px; }
.bar-val.zero { color: var(--slate-light); font-weight: 400; }
.chart-label { font-size: 11.5px; color: var(--slate); margin-top: 8px; text-align: center; line-height: 1.25; }
.chart-col.current .chart-label { color: var(--brand-dark); font-weight: 600; }

.placeholder { text-align: center; padding: 60px 24px; color: var(--slate); }
.placeholder svg { width: 40px; height: 40px; color: var(--slate-light); margin-bottom: 8px; }
.placeholder .panel-title { margin-bottom: 6px; }

/* ---------------------------------------------------------------- sortable table headers */

th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--ink); }
th.sortable:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
th.sortable .sort-ind { margin-left: 5px; font-size: 10px; opacity: 0.45; }
th.sortable.sorted { color: var(--brand-dark); }
th.sortable.sorted .sort-ind { opacity: 1; }


/* ---------------------------------------------------------------- wide table: scroll sideways, keep Actions visible */

.table-card { overflow-x: auto; overflow-y: hidden; }
#contactsTable { min-width: 980px; }
#contactsTable td, #contactsTable th { padding-left: 10px; padding-right: 10px; }
#contactsTable tbody tr { background: var(--paper); }
#contactsTable tbody tr:hover { background: #FAFBFC; }
#contactsTable th.col-actions, #contactsTable td.col-actions {
  position: sticky; right: 0; z-index: 1; background: inherit;
  box-shadow: -8px 0 8px -8px rgba(16, 24, 40, 0.18);
}
#contactsTable .last-updated, #contactsTable .next-followup { white-space: nowrap; }

/* ---------------------------------------------------------------- pager */

.pager { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.pg-info { font-size: 13px; color: var(--slate); }
.pg-buttons { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pg-btn {
  min-width: 34px; height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--paper); color: var(--ink); font-family: inherit; font-size: 13px; cursor: pointer;
}
.pg-btn:hover:not(:disabled):not(.active) { background: #F2F4F7; }
.pg-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pg-btn:disabled { opacity: 0.45; cursor: default; }
.pg-gap { color: var(--slate-light); padding: 0 4px; }

/* ---------------------------------------------------------------- WhatsApp page */

.wa-setup { max-width: 760px; }
.wa-code {
  background: #101828; color: #E4E7EC; border-radius: 8px; padding: 14px 16px; font-size: 13px;
  line-height: 1.6; overflow-x: auto; margin: 10px 0;
}
.wa-setup code { background: var(--gray-pill-bg); padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }
.wa-qr-wrap { display: flex; gap: 32px; align-items: center; flex-wrap: wrap; }
.wa-qr-wrap > div:first-child { flex: 1 1 280px; }
.wa-steps { padding-left: 20px; line-height: 1.9; color: var(--slate); }
.wa-qr { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.wa-qr img { display: block; }
.wa-qr-loading { width: 260px; height: 260px; display: flex; align-items: center; justify-content: center; color: var(--slate-light); }
.wa-demo { background: var(--amber-bg); color: var(--amber); border-radius: 8px; padding: 8px 12px; font-size: 12.5px; }

.wa-app {
  display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 150px); min-height: 480px;
  background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.wa-list { display: flex; flex-direction: column; border-right: 1px solid var(--border); min-height: 0; }
.wa-list-head { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); }
.wa-list-head input, .wa-newchat input {
  flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
  font-family: inherit; font-size: 13px; outline: none;
}
.wa-newchat { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px; background: #FAFBFC; border-bottom: 1px solid var(--border); }
.wa-newchat-err { flex-basis: 100%; font-size: 12px; color: var(--danger); }
.wa-newchat-err:empty { display: none; }
.wa-chats { flex: 1; overflow-y: auto; min-height: 0; }
.wa-chat { display: flex; gap: 10px; padding: 11px 12px; cursor: pointer; border-bottom: 1px solid #F2F4F7; }
.wa-chat:hover { background: #F9FAFB; }
.wa-chat.active { background: var(--brand-light); }
.wa-avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%; background: #DDE3EA; color: #475467;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px;
}
.wa-avatar.group { background: #E7F7EF; font-size: 17px; }
.wa-chat-main { flex: 1; min-width: 0; }
.wa-chat-top, .wa-chat-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.wa-chat-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-chat-time { font-size: 11px; color: var(--slate-light); flex: none; }
.wa-chat-preview { font-size: 12.5px; color: var(--slate); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-unread { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #25D366; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

.wa-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #EFEAE2; }
.wa-thread-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--paper); border-bottom: 1px solid var(--border); }
.wa-messages { flex: 1; overflow-y: auto; padding: 14px 18px; min-height: 0; display: flex; flex-direction: column; gap: 4px; }
.wa-empty { margin: auto; color: var(--slate); background: rgba(255,255,255,0.7); padding: 8px 14px; border-radius: 8px; font-size: 13px; }
.wa-empty.small { background: none; padding: 30px 14px; text-align: center; }
.wa-day { display: flex; justify-content: center; margin: 10px 0 6px; }
.wa-day span { background: rgba(255,255,255,0.85); color: var(--slate); font-size: 11.5px; padding: 3px 10px; border-radius: 8px; }
.wa-msg { max-width: 68%; padding: 6px 9px 4px; border-radius: 8px; box-shadow: 0 1px 1px rgba(16,24,40,0.12); font-size: 13.5px; }
.wa-msg.in { align-self: flex-start; background: #fff; border-top-left-radius: 2px; }
.wa-msg.out { align-self: flex-end; background: #D9FDD3; border-top-right-radius: 2px; }
.wa-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.wa-author { font-size: 11.5px; font-weight: 600; color: var(--brand); margin-bottom: 2px; }
.wa-meta { text-align: right; font-size: 10.5px; color: var(--slate-light); margin-top: 2px; }
.wa-ticks.read { color: #34B7F1; }
.wa-composer { display: flex; gap: 10px; align-items: flex-end; padding: 10px 14px; background: #F0F2F5; border-top: 1px solid var(--border); }
.wa-composer textarea { flex: 1; border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; font-family: inherit; font-size: 13.5px; resize: none; outline: none; max-height: 140px; }
.wa-error { background: var(--danger-bg); color: var(--danger); font-size: 12.5px; padding: 8px 16px; }

@media (max-width: 820px) {
  .wa-app { grid-template-columns: 1fr; height: auto; }
  .wa-list { max-height: 260px; border-right: none; border-bottom: 1px solid var(--border); }
  .wa-thread { min-height: 480px; }
}

/* ---------------------------------------------------------------- Replies page */

.nav-count {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.stat-card.c-replies { border-top-color: #25B36B; }
.dot-replies { background: #25B36B; }

.rep-alert { border-radius: var(--radius); padding: 10px 14px; font-size: 13px; margin-bottom: 12px; line-height: 1.5; }
.rep-alert.warn { background: var(--amber-bg); color: #8A5A00; }
.rep-alert.error { background: var(--danger-bg); color: var(--danger); }
.rep-alert code, .rep-setup code { background: rgba(16,24,40,0.07); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.rep-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

.rep-app {
  display: grid; grid-template-columns: 380px 1fr; height: calc(100vh - 330px); min-height: 400px;
  background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.rep-list { overflow-y: auto; border-right: 1px solid var(--border); min-height: 0; }
.rep-item { padding: 12px 14px; border-bottom: 1px solid #F2F4F7; cursor: pointer; border-left: 3px solid transparent; }
.rep-item:hover { background: #F9FAFB; }
.rep-item.active { background: var(--brand-light); }
.rep-item.unread { border-left-color: var(--brand); }
.rep-item.unread .rep-item-name, .rep-item.unread .rep-item-subject { font-weight: 700; }
.rep-item-top { display: flex; justify-content: space-between; gap: 8px; }
.rep-item-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-item-time { font-size: 11.5px; color: var(--slate-light); flex: none; }
.rep-item-co { font-size: 12px; color: var(--slate-light); }
.rep-item-subject { font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-item-snippet { font-size: 12.5px; color: var(--slate); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-tags { display: flex; gap: 6px; margin-top: 4px; }
.rep-tags:empty { display: none; }
.rep-tag { font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; }
.rep-tag.auto { background: var(--gray-pill-bg); color: var(--gray-pill-text); }
.rep-tag.bounce { background: var(--danger-bg); color: var(--danger); }
.rep-tag.none { background: var(--amber-bg); color: #8A5A00; }

.rep-detail { padding: 20px 24px; overflow-y: auto; min-height: 0; }
.rep-detail-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.rep-detail-who { font-size: 15px; }
.rep-match { font-size: 12px; color: #8A5A00; margin-top: 4px; }
.rep-match.ok { color: var(--success); }
.rep-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rep-actions a.btn { text-decoration: none; }
.rep-subject { font-size: 17px; margin: 18px 0 10px; }
.rep-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.6; }
.rep-quoted { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12.5px; color: var(--slate); border-left: 3px solid var(--border); padding-left: 12px; margin-top: 10px; }
.link-btn { background: none; border: none; color: var(--brand); cursor: pointer; font-family: inherit; font-size: 12.5px; padding: 0; margin-top: 14px; }

.rep-setup { margin-top: 16px; background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; font-size: 13px; color: var(--slate); }
.rep-setup summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.rep-setup ol { line-height: 1.7; padding-left: 20px; }

@media (max-width: 820px) {
  .rep-app { grid-template-columns: 1fr; height: auto; }
  .rep-list { max-height: 300px; border-right: none; border-bottom: 1px solid var(--border); }
}
.wa-list-error { color: var(--danger); }
.wa-list-error .cell-sub { color: var(--slate); }

/* ---------------------------------------------------------------- WhatsApp: pictures, media, attachments, voice */

.wa-icon-btn {
  flex: none; width: 38px; height: 38px; border: none; border-radius: 50%; background: transparent; color: var(--slate);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 15px;
}
.wa-icon-btn:hover:not(:disabled) { background: rgba(16, 24, 40, 0.08); color: var(--ink); }
.wa-icon-btn:disabled { opacity: 0.45; cursor: default; }

.wa-avatar { overflow: hidden; }
.wa-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wa-avatar.has-img { background: #DDE3EA; }

.wa-thread.drop { outline: 3px dashed var(--brand); outline-offset: -6px; }

.wa-attachbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #fff; border-top: 1px solid var(--border); }
.wa-attach-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.wa-attach-info { flex: 1; min-width: 0; }
.wa-attach-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-asdoc { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--slate); margin-top: 4px; cursor: pointer; }

.wa-recorder { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: #F0F2F5; border-top: 1px solid var(--border); font-size: 14px; }
.wa-rec-dot { width: 11px; height: 11px; border-radius: 50%; background: #E5484D; animation: wa-pulse 1s infinite; }
.wa-rec-spacer { flex: 1; }
@keyframes wa-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.wa-composer .btn, .wa-composer .wa-icon-btn { align-self: center; }

.wa-media { margin: 2px 0; }
.wa-media-ph { width: 220px; height: 120px; display: flex; align-items: center; justify-content: center; background: rgba(16,24,40,0.06); border-radius: 6px; color: var(--slate-light); font-size: 12.5px; }
.wa-img { display: block; max-width: 280px; max-height: 320px; border-radius: 6px; cursor: zoom-in; }
.wa-media-sticker .wa-img { max-width: 140px; max-height: 140px; }
.wa-video { display: block; max-width: 300px; max-height: 320px; border-radius: 6px; background: #000; }
.wa-media audio { display: block; width: 260px; height: 38px; }
.wa-play { border: none; background: rgba(16,24,40,0.07); border-radius: 18px; padding: 8px 14px; font-family: inherit; font-size: 13px; cursor: pointer; color: var(--ink); }
.wa-play:hover { background: rgba(16,24,40,0.12); }
.wa-media-err { font-size: 12.5px; color: var(--danger); max-width: 260px; }
.wa-doc { display: flex; align-items: center; gap: 10px; min-width: 240px; padding: 8px 10px; background: rgba(16,24,40,0.06); border-radius: 8px; }
.wa-doc-icon { font-size: 24px; }
.wa-doc-info { flex: 1; min-width: 0; }
.wa-doc-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.wa-dl { border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 5px 10px; font-family: inherit; font-size: 12px; cursor: pointer; }
.wa-quote { border-left: 3px solid var(--brand); background: rgba(16,24,40,0.06); padding: 4px 8px; border-radius: 4px; font-size: 12.5px; color: var(--slate); margin-bottom: 4px; max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-fwd { font-size: 11.5px; color: var(--slate-light); font-style: italic; }
.wa-deleted { color: var(--slate-light); font-style: italic; }
.wa-loc { color: var(--brand); text-decoration: none; font-size: 13.5px; }
.wa-text a { color: var(--brand); }
.wa-msg.k-sticker { background: transparent; box-shadow: none; }
.wa-empty-note { text-align: center; line-height: 1.7; max-width: 360px; }
.wa-empty-note .btn { margin-top: 6px; }
.wa-diag { font-size: 11px; color: var(--slate-light); word-break: break-word; display: inline-block; margin-top: 6px; }

.img-warn { border-radius: 8px; padding: 9px 12px; font-size: 12.5px; line-height: 1.5; margin: 0 0 10px; }
.img-warn.bad { background: var(--danger-bg); color: var(--danger); }
.img-warn.bad span { color: var(--slate); }
.img-warn.note { background: var(--amber-bg); color: #8A5A00; }
.img-warn a { color: inherit; text-decoration: underline; }

.rep-tag.answered { background: var(--success-bg); color: var(--success); }
.rep-sent { margin-top: 18px; padding: 12px 14px; background: #F3FAF6; border-left: 3px solid var(--success); border-radius: 6px; }
.rep-sent-head { font-size: 12px; color: var(--slate); margin-bottom: 6px; }
.rep-sent-head.just-sent { color: var(--success); font-weight: 600; }
.rep-sent-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.55; }
.rep-composer { margin-top: 20px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: #FAFBFC; }
.rep-note { font-size: 12.5px; border-radius: 6px; padding: 7px 10px; margin-bottom: 10px; }
.rep-note.warn { background: var(--amber-bg); color: #8A5A00; }
.rep-field { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.rep-field > span { width: 58px; color: var(--slate-light); flex: none; }
.rep-field input { flex: 1; border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; font-family: inherit; font-size: 13px; }
.rep-to { padding: 7px 10px; background: var(--gray-pill-bg); border-radius: 6px; }
.rep-composer textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-family: inherit; font-size: 14px; line-height: 1.55; resize: vertical; margin-bottom: 6px; }
.rep-composer-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.rep-send-msg { font-size: 12.5px; }
.rep-send-msg.bad { color: var(--danger); }

.rep-attach-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 8px; }
.rep-attach-bar .btn { display: inline-flex; align-items: center; gap: 6px; }
.rep-files { display: flex; flex-wrap: wrap; gap: 8px; }
.rep-files:empty { display: none; }
.rep-files:not(:empty) { margin-bottom: 8px; }
.rep-sent .rep-files { margin: 10px 0 0; }
.rep-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; background: var(--paper); border: 1px solid var(--border); border-radius: 999px; padding: 4px 6px 4px 10px; font-size: 12.5px; color: var(--ink); }
.rep-sent .rep-chip { padding-right: 10px; }
.rep-chip-name { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-chip-x { border: none; background: #EAECF0; color: var(--slate); width: 18px; height: 18px; border-radius: 50%; cursor: pointer; line-height: 1; font-size: 13px; padding: 0; }
.rep-chip-x:hover { background: #D0D5DD; color: var(--ink); }
.rep-composer.dragging { outline: 2px dashed var(--brand); outline-offset: 2px; background: var(--brand-light); }

/* ---------------------------------------------------------------- bounces */
.stat-card.c-bounced { border-top-color: var(--danger); }
.dot-bounced { background: var(--danger); }
.table-scroll { overflow-x: auto; }
.bounce-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bounce-table th { text-align: left; font-size: 11.5px; letter-spacing: 0.04em; color: var(--slate-light); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.bounce-table td { padding: 10px; border-bottom: 1px solid #F2F4F7; vertical-align: top; }
.bounce-subject { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- WhatsApp: message menu, reactions, reply, emoji, find */

.wa-msg { position: relative; }
.wa-msg-menu {
  position: absolute; top: 2px; right: 4px; width: 22px; height: 22px; border: none; border-radius: 50%;
  background: rgba(255,255,255,0.85); color: var(--slate); cursor: pointer; font-size: 14px; line-height: 1;
  opacity: 0; transition: opacity .12s; padding: 0;
}
.wa-msg:hover .wa-msg-menu, .wa-msg-menu:focus-visible { opacity: 1; }
.wa-msg.out .wa-msg-menu { background: rgba(217,253,211,0.95); }
.wa-reactions { display: flex; gap: 4px; flex-wrap: wrap; margin: 4px 0 -2px; }
.wa-react { border: 1px solid var(--border); background: var(--paper); border-radius: 999px; padding: 0 7px; height: 22px; font-size: 12.5px; cursor: pointer; font-family: inherit; }
.wa-react.mine { background: var(--brand-light); border-color: #BFDBF7; }
.wa-older-wrap { text-align: center; margin: 4px 0 10px; }
.wa-msg.wa-hit { outline: 2px solid #F5C451; outline-offset: 1px; }
.wa-msg.wa-current { outline: 3px solid #E89A2E; background-image: linear-gradient(rgba(245,196,81,0.18), rgba(245,196,81,0.18)); }

.wa-menu {
  position: fixed; z-index: 60; min-width: 210px; max-width: 280px; background: var(--paper); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 28px rgba(16,24,40,0.18); padding: 6px; display: flex; flex-direction: column;
}
.wa-menu button { text-align: left; border: none; background: none; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-family: inherit; font-size: 13.5px; color: var(--ink); }
.wa-menu button:hover { background: #F2F4F7; }
.wa-menu button.danger { color: var(--danger); }
.wa-menu-react { display: flex; gap: 2px; padding: 2px 2px 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.wa-menu .wa-menu-emoji { font-size: 20px; padding: 4px 6px; border-radius: 50%; }
.wa-menu .wa-menu-emoji.mine { background: var(--brand-light); }
.wa-menu-info { font-size: 11.5px; color: var(--slate-light); padding: 6px 10px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 4px 0; }

.wa-replybar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: #F0F2F5; border-top: 1px solid var(--border); border-left: 4px solid var(--brand); }
.wa-replybar-text { flex: 1; min-width: 0; font-size: 12.5px; display: flex; flex-direction: column; }
.wa-replybar-text b { color: var(--brand-dark); }
.wa-replybar-text span { color: var(--slate); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.wa-emoji-panel { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; padding: 8px; background: var(--paper); border-top: 1px solid var(--border); max-height: 170px; overflow-y: auto; }
.wa-emoji { border: none; background: none; font-size: 21px; padding: 4px; border-radius: 6px; cursor: pointer; }
.wa-emoji:hover { background: #F2F4F7; }
#waEmojiBtn, #wbEmojiBtn { font-size: 20px; }

.wa-findbar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--paper); border-bottom: 1px solid var(--border); }
.wa-findbar input { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-family: inherit; font-size: 13px; outline: none; }

.wa-thread-head { gap: 12px; }
.wa-head-title { flex: 1; min-width: 0; }
.wa-head-actions { display: flex; gap: 2px; }
.wa-archived-row { padding: 6px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.wa-chat-flags { display: inline-flex; align-items: center; gap: 4px; flex: none; font-size: 12px; }
.wa-unread.muted { background: #98A2B3; }
.wa-unread.dot { min-width: 10px; width: 10px; height: 10px; padding: 0; }

.result-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.result-row .result-count { margin: 0; }
.bounce-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- WhatsApp: message menu extras, dialogs, pinned banner */
.wa-menu .wa-menu-more { font-size: 18px; background: #F2F4F7; }
.wa-menu-sep { height: 1px; background: var(--border); margin: 4px 0; }
.wa-modal { position: fixed; inset: 0; z-index: 80; background: rgba(16,24,40,0.45); display: flex; align-items: center; justify-content: center; padding: 20px; }
.wa-modal-card { background: var(--paper); border-radius: 14px; padding: 20px 22px; width: min(460px, 100%); max-height: 86vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(16,24,40,0.3); }
.wa-modal-card h3 { margin: 0 0 12px; font-size: 17px; }
.wa-modal-body { font-size: 13.5px; color: var(--slate); margin-bottom: 12px; }
.wa-info-text { background: #F0F2F5; border-radius: 8px; padding: 8px 12px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 90px; overflow: auto; }
.wa-info-row { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; border-bottom: 1px solid #F2F4F7; font-size: 13.5px; color: var(--ink); }
.wa-info-group { margin-top: 8px; font-size: 13.5px; } .wa-info-group > b { display: block; margin-bottom: 2px; }
.wa-modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.wa-modal-actions.col { flex-direction: column; align-items: stretch; margin-bottom: 10px; }
.wa-modal-actions .danger, .btn.danger { color: var(--danger); }
.wa-radio { display: flex; align-items: center; gap: 10px; padding: 8px 4px; font-size: 14px; cursor: pointer; }
.wa-modal-search { width: 100%; box-sizing: border-box; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-family: inherit; font-size: 13px; margin-bottom: 8px; }
.wa-fwd-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.wa-fwd-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; border-bottom: 1px solid #F2F4F7; font-size: 13.5px; }
.wa-fwd-item:hover { background: #F9FAFB; } .wa-fwd-item .wa-avatar { width: 32px; height: 32px; font-size: 13px; }
.wa-emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 280px; overflow-y: auto; }
.wa-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #101828; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 13.5px; z-index: 90; box-shadow: 0 8px 24px rgba(0,0,0,0.25); }
.wa-toast.bad { background: var(--danger); }
.wa-pinned { display: flex; align-items: center; gap: 6px; background: var(--paper); border-bottom: 1px solid var(--border); padding: 4px 8px 4px 14px; }
.wa-pinned-main { flex: 1; min-width: 0; border: none; background: none; text-align: left; cursor: pointer; font-family: inherit; display: flex; flex-direction: column; gap: 1px; padding: 4px 0; }
.wa-pinned-main b { font-size: 12px; color: var(--brand-dark); }
.wa-pinned-main span { font-size: 13px; color: var(--slate); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-icon-btn.active { background: var(--brand-light); border-radius: 6px; }
.wa-messages.wa-starred-only .wa-msg:not(.starred), .wa-messages.wa-starred-only .wa-day, .wa-messages.wa-starred-only .wa-older-wrap { display: none; }

/* ---------------------------------------------------------------- Facebook: posts and page views */

.fb-chart-card { margin-bottom: 18px; }
.fb-bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; }
.fb-bar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.fb-bar span { display: block; width: 100%; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 2px; }
.fb-bar:hover span { background: var(--brand-dark); }
.fb-posts-head { margin-top: 6px; }
.fb-posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.fb-post { background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.fb-post-img { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--gray-pill-bg); }
.fb-post-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fb-post-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.fb-post-meta { font-size: 12px; color: var(--slate-light); text-transform: capitalize; }
.fb-post-text { font-size: 13.5px; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.fb-post-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; }
.fb-post-stats { display: inline-flex; gap: 10px; color: var(--slate); }

/* ---------------------------------------------------------------- login */

.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 26px; }
.login-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--brand-dark); margin-bottom: 18px; }
.login-brand img { border-radius: 6px; object-fit: contain; }
.login-title { font-size: 18px; margin: 0 0 16px; }
.login-label { display: block; font-size: 13px; font-weight: 600; color: var(--slate); margin: 14px 0 6px; }
.login-input { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; }
.login-input:focus { outline: 2px solid var(--brand-light); border-color: var(--brand); }
.login-btn { width: 100%; margin-top: 16px; justify-content: center; }
.login-hint { font-weight: 400; color: var(--slate-light); font-size: 12px; }
.sidebar-logout { margin-top: auto; }

/* ---------------------------------------------------------------- phone layout */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nav-toggle, .m-back { display: none; }

@media (max-width: 820px) {
  /* Top bar with a menu button instead of a sideways-scrolling strip. */
  .sidebar {
    position: sticky; top: 0; z-index: 50; flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 8px; padding: 8px 12px; overflow: visible; height: auto;
  }
  .sidebar-brand { padding: 0; font-size: 16px; }
  .sidebar-brand img { width: 26px; height: 26px; }
  .nav-toggle {
    display: inline-flex; align-items: center; gap: 8px; margin-left: auto; padding: 8px 10px; min-height: 40px;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--paper);
    font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer;
  }
  .sidebar-nav, .sidebar-logout { display: none; flex-basis: 100%; }
  .sidebar.open .sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 0 4px; border-top: 1px solid var(--border); margin-top: 4px; }
  .sidebar.open .sidebar-logout { display: block; margin-top: 0; }
  .sidebar.open .nav-item { width: 100%; padding: 12px; font-size: 15px; }

  .page { padding: 16px 12px 40px; }
  .header-title { font-size: 21px; }

  /* Two stat cards per row instead of one per screen. */
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { padding: 12px 12px 10px; }
  .stat-value { font-size: 26px; }

  /* Chat-style pages: the list, or one open item with a back button. */
  .wa-app, .rep-app { display: block; height: auto; min-height: 0; }
  .wa-list, .rep-list { max-height: none; border-right: none; border-bottom: none; }
  .wa-list { height: calc(100dvh - 190px); min-height: 360px; }
  .rep-list { max-height: calc(100dvh - 240px); }
  .wa-app:not(.thread-open) .wa-thread, .rep-app:not(.thread-open) .rep-detail { display: none; }
  .wa-app.thread-open .wa-list, .rep-app.thread-open .rep-list { display: none; }
  .wa-app.thread-open .wa-thread { display: flex; min-height: 360px; }
  .rep-app.thread-open .rep-detail { padding: 14px; }
  .thread-open > .m-back {
    display: flex; align-items: center; width: 100%; padding: 12px 14px; border: none; border-bottom: 1px solid var(--border);
    background: var(--paper); font: inherit; font-size: 14px; font-weight: 600; color: var(--brand-dark); cursor: pointer; text-align: left;
  }
  .wa-messages { padding: 10px; }
  .wa-composer { padding: 8px; gap: 6px; }

  /* 16px text boxes: smaller ones make iPhones zoom in on every tap. */
  input, select, textarea, .wa-composer textarea { font-size: 16px; }

  /* Pop-ups slide up from the bottom and use the full width. */
  .modal { padding: 0; align-items: flex-end; }
  .modal-card, .modal-card-xl { width: 100%; max-height: 92dvh; border-radius: 14px 14px 0 0; }

  .btn { min-height: 38px; }
}
@media (max-width: 820px) {
  .legend { flex-wrap: wrap; gap: 6px 12px; }
  .legend span { white-space: nowrap; }
}

/* ---------------------------------------------------------------- AI (Claude) */

.wa-ai-btn { color: var(--purple); }
.rep-ai { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; padding: 8px 12px;
          background: var(--purple-bg); border-radius: var(--radius); font-size: 13px; }
.rep-ai-summary { color: var(--ink); }
.rep-ai-error { color: var(--danger); }
.btn-improve svg { vertical-align: -2px; }
.rep-tag.ai-interested { background: var(--success-bg); color: var(--success); }
.rep-tag.ai-question { background: var(--brand-light); color: var(--brand-dark); }
.rep-tag.ai-not_interested { background: var(--gray-pill-bg); color: var(--gray-pill-text); }
.rep-tag.ai-out_of_office { background: var(--amber-bg); color: #8A5A00; }
.rep-tag.ai-unsubscribe { background: var(--danger-bg); color: var(--danger); }
.rep-tag.ai-other { background: var(--gray-pill-bg); color: var(--slate); }

/* ---------------------------------------------------------------- app dialogs (instead of the browser's pop-ups) */
.ui-dialog-backdrop { position: fixed; inset: 0; z-index: 120; background: rgba(16,24,40,0.5); display: flex; align-items: center; justify-content: center; padding: 20px; animation: ui-fade .12s ease-out; }
.ui-dialog { background: var(--paper); border-radius: 16px; width: min(480px, 100%); padding: 22px 24px 20px; box-shadow: 0 24px 70px rgba(16,24,40,0.35); border-top: 4px solid var(--brand); animation: ui-pop .14s ease-out; max-height: 90vh; overflow-y: auto; }
.ui-dialog.danger { border-top-color: var(--danger); }
.ui-dialog.warn { border-top-color: #E89A2E; }
.ui-dialog.ok { border-top-color: var(--success); }
.ui-dialog.error { border-top-color: var(--danger); }
.ui-dialog-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ui-dialog-head h3 { margin: 0; font-size: 18px; line-height: 1.3; }
.ui-icon { font-size: 24px; line-height: 1; }
.ui-msg { margin: 0 0 12px; font-size: 14px; line-height: 1.55; color: var(--slate); }
.ui-rows { border: 1px solid var(--border); border-radius: 10px; margin: 6px 0 12px; overflow: hidden; }
.ui-row { display: flex; gap: 12px; padding: 8px 12px; font-size: 13.5px; border-bottom: 1px solid #F2F4F7; }
.ui-row:last-child { border-bottom: none; }
.ui-row span { width: 78px; flex: none; color: var(--slate-light); }
.ui-row b { font-weight: 600; word-break: break-word; }
.ui-preview { background: #F7F8FA; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.5; color: var(--slate); white-space: pre-wrap; max-height: 150px; overflow-y: auto; margin-bottom: 12px; }
.ui-note { border-radius: 8px; padding: 8px 12px; font-size: 13px; line-height: 1.45; margin-bottom: 8px; }
.ui-note.warn { background: var(--amber-bg); color: #8A5A00; }
.ui-note.info { background: var(--brand-light); color: var(--brand-dark); }
.ui-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.btn-danger { background: var(--danger); color: #fff; border: 1px solid var(--danger); }
.btn-danger:hover { filter: brightness(0.93); }
.ui-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #101828; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 13.5px; z-index: 130; box-shadow: 0 8px 24px rgba(0,0,0,0.25); }
.ui-toast.bad { background: var(--danger); }
@keyframes ui-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ui-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.rep-note.info { background: var(--brand-light); color: var(--brand-dark); }

/* ---------------------------------------------------------------- Company Lists */
.ld-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 10px; }
.ld-bar .input { height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--paper); color: inherit; font: inherit; font-size: 13px; }
.ld-bar input[type=search] { min-width: 240px; }
.ld-spacer { flex: 1; }
.ld-pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.ld-pill.ok { background: var(--success-bg); color: var(--success, #0E7A4D); }
.ld-pill.warn { background: var(--amber-bg); color: #8A5A00; }
.ld-pill.bad { background: var(--danger-bg); color: var(--danger); }
.ld-pill.run { background: var(--brand-light); color: var(--brand-dark); }
.ld-pill.auto { background: var(--gray-pill-bg); color: var(--gray-pill-text); }
.ld-filter { background: var(--brand-light); color: var(--brand-dark); font-size: 12.5px; }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.kebab-menu button.danger { color: var(--danger); }
.kebab-menu button.danger:hover { background: var(--danger-bg); }

/* ---------------------------------------------------------------- Website Requests */
.wr-row.wr-new td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.wr-status { height: 30px; padding: 0 6px; font-size: 12.5px; border: 1px solid var(--border); border-radius: 6px; background: var(--paper); color: inherit; }
.wr-link { color: var(--brand); text-decoration: none; font-weight: 500; word-break: break-all; }
.wr-link:hover { text-decoration: underline; }
.wr-phone { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.wr-wa { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: var(--success-bg); color: var(--success); font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.wr-wa:hover { filter: brightness(.96); }
.wr-actions { white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.wr-more td { background: #F7F8FA; }
/* AI score + reply drafts inside a website request's Details */
.wr-ai { border: 1px solid var(--border); border-radius: 12px; background: var(--paper); padding: 12px 14px; margin: 4px 0 10px; }
.wr-ai-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.wr-ai-head > b { color: var(--purple); font-size: 12px; letter-spacing: .06em; }
.wr-ai-head .btn { margin-left: auto; }
.wr-ai-sum { flex: 1 1 260px; min-width: 0; color: var(--ink); }
.wr-ai-drafts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.wr-ai-draft { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.wr-ai-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--slate-light); }
.wr-ai-subj { font-weight: 600; font-size: 13px; }
.wr-ai-text { font-size: 13px; line-height: 1.5; color: var(--slate); word-break: break-word; flex: 1; }
.wr-ai-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wr-wa-btn { background: var(--success); color: #fff; border-color: transparent; }
@media (max-width: 820px) { .wr-ai-drafts { grid-template-columns: 1fr; } .wr-ai-head .btn { margin-left: 0; } }
.wr-detail { display: flex; gap: 12px; padding: 4px 0; font-size: 13px; }
.wr-detail span { width: 140px; flex: none; color: var(--slate-light); text-transform: capitalize; }
.wr-detail div { word-break: break-word; }
@media (max-width: 820px) { .wr-detail { flex-direction: column; gap: 2px; } .wr-detail span { width: auto; } }

/* ---------------------------------------------------------------- Website Analytics */
.ga-live { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; margin-bottom: 14px; min-height: 20px; }
.ga-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px var(--success-bg); }
.ga-up { color: var(--success); font-weight: 600; }
.ga-down { color: var(--danger); font-weight: 600; }
.ga-section { margin: 22px 0 10px; }
.ga-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; margin-top: 18px; align-items: start; }
.ga-col { display: flex; flex-direction: column; gap: 16px; }
.ga-table-head { padding: 16px 18px 4px; }
.ga-grid th.num, .ga-grid td.num { text-align: right; }
.ga-grid td:first-child { word-break: break-all; }
.ga-setup ol { margin: 10px 0 0 18px; padding: 0; line-height: 1.7; font-size: 14px; }
.ga-setup li { margin-bottom: 6px; }
@media (max-width: 820px) { .ga-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- phone: app-style layout
   Bottom tab bar + compact top bar with the page name; the sidebar menu moves into the "More" sheet. */
.tabbar, .sheet, .sheet-backdrop, .m-title { display: none; }

@media (max-width: 820px) {
  html { -webkit-tap-highlight-color: transparent; }
  body { background: #F4F6FA; overscroll-behavior-y: none; }

  /* Compact top bar: logo + current page name, under the phone's status bar. */
  .sidebar {
    flex-wrap: nowrap; gap: 10px; padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
    background: rgba(255,255,255,0.94); -webkit-backdrop-filter: saturate(160%) blur(12px); backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--border);
  }
  .sidebar-brand span { display: none; }
  .m-title { display: block; flex: 1; min-width: 0; font-size: 17px; font-weight: 700; color: var(--ink);
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav-toggle, .sidebar .sidebar-nav, .sidebar .sidebar-logout, .sidebar.open .sidebar-nav, .sidebar.open .sidebar-logout { display: none; }

  /* Room for the tab bar under every page. */
  .page { padding: 14px 12px calc(84px + env(safe-area-inset-bottom)); }
  .page .header { margin-bottom: 14px; }
  .page .header-title { display: none; }               /* the page name is in the top bar */
  .page .header-sub { font-size: 12.5px; }
  .header-actions { gap: 8px; }

  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: rgba(255,255,255,0.97);
    -webkit-backdrop-filter: saturate(160%) blur(12px); backdrop-filter: saturate(160%) blur(12px);
    border-top: 1px solid var(--border); box-shadow: 0 -4px 18px rgba(16,24,40,0.06);
  }
  .tabbar-item {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px 4px;
    border: none; background: none; font: inherit; font-size: 11px; font-weight: 600; color: var(--slate-light);
    cursor: pointer; border-radius: 12px; min-height: 52px; justify-content: center;
  }
  .tabbar-item svg { width: 23px; height: 23px; }
  .tabbar-item.active { color: var(--brand-dark); }
  .tabbar-item.active svg { stroke-width: 2.4; }
  .tabbar-item.active::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
  .tabbar-item:active { background: var(--brand-light); }
  .tabbar-badge {
    position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: var(--danger); color: #fff; font-size: 10.5px; line-height: 18px; text-align: center; font-weight: 700;
    box-shadow: 0 0 0 2px #fff;
  }
  .tabbar-dot { position: absolute; top: 6px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%;
                background: var(--danger); box-shadow: 0 0 0 2px #fff; }
  .tabbar-badge.hidden, .tabbar-dot.hidden { display: none; }

  /* An open chat / reply uses the whole screen, like a messaging app. */
  .layout:has(.thread-open) .tabbar { display: none; }
  .layout:has(.thread-open) .page { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .wa-list { height: calc(100dvh - 250px); }
  .rep-list { max-height: calc(100dvh - 300px); }

  /* "More" bottom sheet. */
  .sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(16,24,40,0.42); animation: ui-fade .15s ease-out; }
  .sheet {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 71; max-height: 80dvh; overflow-y: auto;
    padding: 8px 12px calc(14px + env(safe-area-inset-bottom)); background: var(--paper); border-radius: 18px 18px 0 0;
    box-shadow: 0 -10px 40px rgba(16,24,40,0.2); animation: sheet-up .2s ease-out;
  }
  .sheet.hidden, .sheet-backdrop.hidden { display: none; }
  .sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--border); margin: 2px auto 10px; }
  .sheet-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .sheet-list .sheet-item {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 100%;
    min-height: 82px; padding: 12px 6px; border: 1px solid var(--border); border-radius: 14px; background: #F8FAFC;
    font-size: 12.5px; font-weight: 600; color: var(--ink); text-align: center;
  }
  .sheet-list .sheet-item svg { width: 22px; height: 22px; color: var(--brand); }
  .sheet-list .sheet-item.active { border-color: var(--brand); background: var(--brand-light); }
  .sheet-list .sheet-item .nav-count { position: absolute; top: 6px; right: 6px; margin: 0; }
  .sheet-logout { grid-column: 1 / -1; margin: 4px 0 0; }
  .sheet-logout .sheet-item { flex-direction: row; min-height: 48px; color: var(--danger); }
  .sheet-logout .sheet-item svg { color: var(--danger); }
  body.sheet-open { overflow: hidden; }

  /* Cards and controls feel more native. */
  .stat-card, .table-card { border-radius: 14px; }
  .btn { border-radius: 10px; }
  .chip { min-height: 34px; }
  .rep-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .rep-filters::-webkit-scrollbar { display: none; }
  .rep-filters .chip { flex: none; }
  .ld-bar { flex-wrap: wrap; }
  .ld-bar input[type=search] { min-width: 0; flex: 1 1 100%; }

  /* Tables marked .m-cards become one card per row, with the column name in front of each value. */
  table.m-cards thead { display: none; }
  table.m-cards, table.m-cards tbody { display: block; }
  table.m-cards tr { display: flex; flex-direction: column; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  table.m-cards td.m-head { order: -1; }
  table.m-cards tr:last-child { border-bottom: none; }
  table.m-cards td { display: flex; gap: 10px; justify-content: space-between; align-items: center; padding: 3px 0; border: none; text-align: right; }
  table.m-cards td::before { content: attr(data-label); flex: none; color: var(--slate-light); font-size: 12.5px; text-align: left; }
  table.m-cards td[data-label=""]::before, table.m-cards td:not([data-label])::before { content: none; }
  table.m-cards td.m-head { display: block; text-align: left; font-size: 15px; padding-bottom: 6px; }
  table.m-cards td.m-head::before { content: none; }
  table.m-cards td.wr-actions { justify-content: flex-start; flex-wrap: wrap; padding-top: 8px; }
  table.m-cards tr.wr-more td { display: block; text-align: left; }
  table.m-cards .wr-status { flex: 1; max-width: 190px; }
  table.m-cards tr.wr-new { box-shadow: inset 4px 0 0 var(--brand); }
  table.m-cards tr.wr-new td:first-child { box-shadow: none; }
}
@keyframes sheet-up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Installed as an app (home-screen icon): no browser bar, so give the top bar the status-bar space. */
@media (display-mode: standalone) and (max-width: 820px) {
  .sidebar { padding-top: calc(10px + env(safe-area-inset-top)); }
}

/* ---------------------------------------------------------------- health checks (Home + Settings) */
.hc-list { display: flex; flex-direction: column; gap: 8px; }
.hc-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 12px; background: var(--paper); border: 1px solid var(--border); font-size: 14px; }
.hc-item.error { border-color: #F5C2C0; background: #FFF6F5; }
.hc-item.warn { border-color: #F3DDA8; background: #FFFBF0; }
.hc-item.ok { border-color: #BDE5CF; background: #F3FBF6; }
.hc-icon { font-size: 16px; line-height: 1.3; }

/* ---------------------------------------------------------------- Home overview */
.home-overview { margin-bottom: 8px; }
.home-checks { margin-bottom: 16px; }
.home-checks .link-btn { align-self: flex-start; }
.home-h { margin: 6px 0 10px; }
.home-card { text-align: left; font: inherit; color: inherit; cursor: pointer; width: 100%; }
.home-card:hover { box-shadow: 0 4px 14px rgba(16,24,40,0.08); }
.home-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.home-split { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; margin: 16px 0 22px; }
.home-funnel { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.home-stage { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 4px; border-radius: 12px; border: 1px solid var(--border);
              background: #F8FAFC; font: inherit; cursor: pointer; color: var(--ink); }
.home-stage b { font-size: 22px; }
.home-stage span { font-size: 12px; color: var(--slate); text-align: center; }
.home-rems { display: flex; flex-direction: column; gap: 6px; }
.home-rem { display: flex; gap: 10px; align-items: center; text-align: left; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px;
            background: var(--paper); font: inherit; font-size: 13.5px; cursor: pointer; color: var(--ink); }

/* ---------------------------------------------------------------- Pipeline */
.sp-funnel { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.sp-funnel::-webkit-scrollbar { display: none; }
.sp-step { flex: none; display: flex; flex-direction: column; align-items: center; min-width: 86px; padding: 10px 12px; border-radius: 12px;
           border: 1px solid var(--border); background: var(--paper); font: inherit; cursor: pointer; color: var(--ink); }
.sp-step b { font-size: 20px; }
.sp-step span { font-size: 12px; color: var(--slate); white-space: nowrap; }
.sp-step.active { border-color: var(--brand); background: var(--brand-light); }
.sp-board { display: grid; grid-template-columns: repeat(6, minmax(200px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.sp-board.single { grid-template-columns: 1fr; }
.sp-board.single .sp-col-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.sp-col { background: #F1F4F9; border-radius: 14px; padding: 10px; min-height: 120px; }
.sp-col-head { display: flex; justify-content: space-between; font-weight: 700; font-size: 13.5px; padding: 2px 4px 8px; }
.sp-col-body { display: flex; flex-direction: column; gap: 8px; }
.sp-none { padding: 6px 4px; }
.sp-card { display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--paper);
           font: inherit; cursor: pointer; color: var(--ink); box-shadow: 0 1px 2px rgba(16,24,40,0.04); }
.sp-card:hover { border-color: var(--brand); }
.sp-card-name { font-weight: 700; font-size: 14px; }
.sp-card-co { font-size: 12.5px; color: var(--slate); margin-top: 1px; }
.sp-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.sp-card-note { font-size: 12.5px; color: var(--slate); margin-top: 6px; font-style: italic; }
.sp-modal-card { width: 640px; }
.sp-stage-row { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-contact { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; background: #F8FAFC; border-radius: 12px; padding: 12px 14px; font-size: 13.5px; }
.sp-facts span { display: block; color: var(--slate-light); font-size: 12px; text-transform: capitalize; }
.sp-facts .sp-msg { grid-column: 1 / -1; }
.sp-facts b { font-weight: 600; word-break: break-word; white-space: pre-wrap; }
.sp-h { font-size: 14.5px; margin: 6px 0 -4px; }
.sp-reminders { display: flex; flex-direction: column; gap: 6px; }
.sp-rem { display: flex; align-items: center; gap: 8px; font-size: 14px; flex-direction: row !important; font-weight: 400 !important; }
.sp-rem.done span { text-decoration: line-through; color: var(--slate-light); }
.sp-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.sp-add .input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font: inherit; background: var(--paper); }
.sp-add input[type=text], .sp-add textarea { flex: 1 1 220px; min-width: 0; }
.sp-notes { display: flex; flex-direction: column; gap: 8px; }
.sp-note { padding: 10px 12px; border-radius: 10px; background: #F8FAFC; border: 1px solid var(--border); font-size: 14px; }
.sp-step.sp-customer b, .home-stage.sp-customer b { color: var(--success); }
.sp-step.sp-trial b, .home-stage.sp-trial b { color: #0E7A4D; }

/* ---------------------------------------------------------------- Settings */
.st-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.st-wide { grid-column: 1 / -1; }
.st-card p { margin: 0 0 10px; line-height: 1.55; }
.st-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.st-row { margin: 6px 0; }
.st-team { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 12px; }
.st-member { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; }
.st-member > div { flex: 1 1 220px; }
.st-add { display: grid; grid-template-columns: 1fr 1.3fr 1.3fr auto auto; gap: 8px; }
.st-add .input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font: inherit; background: var(--paper); min-width: 0; }
.ga-tip { margin: 12px 0 0; line-height: 1.9; font-size: 14px; }

@media (max-width: 820px) {
  .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-checks .hc-item { padding: 8px 12px; font-size: 13.5px; }
  .home-checks .hc-item .cell-sub { display: none; }   /* titles only on phones; details in Settings */
  .home-split { grid-template-columns: 1fr; }
  .home-funnel { grid-template-columns: repeat(5, minmax(56px, 1fr)); overflow-x: auto; }
  .home-stage b { font-size: 18px; }
  .sp-board { grid-template-columns: repeat(6, minmax(240px, 82vw)); scroll-snap-type: x mandatory; margin: 0 -12px; padding: 0 12px 8px; }
  .sp-col { scroll-snap-align: start; }
  .sp-board.single { margin: 0; padding: 0; }
  .sp-board.single .sp-col-body { grid-template-columns: 1fr; }
  .sp-facts { grid-template-columns: 1fr; }
  .sp-modal-card { width: 100%; }
  .st-grid { grid-template-columns: 1fr; }
  .st-add { grid-template-columns: 1fr; }
}
.ga-hours { display: flex; justify-content: space-between; font-size: 11px; color: var(--slate-light); margin-top: 6px; font-variant-numeric: tabular-nums; }

/* ================================================================ 2026 brand refresh
   Matches etaxflow.com/signup: brand blue, ETaxFlow gradient, Inter + Space Grotesk, softer cards.
   Overrides the rules above; component markup is unchanged. */
:root {
  --brand: #1f5fe0;
  --brand-dark: #1747b8;
  --brand-light: #e8f0ff;
  --ink: #0b1b3f;
  --slate: #4a5a78;
  --slate-light: #8a98b3;
  --border: #e3eaf6;
  --bg: #f4f7fd;
  --paper: #ffffff;
  --success: #0e9f6e;
  --success-bg: #e3f7ef;
  --purple: #7b3fe4;
  --purple-bg: #f1ebff;
  --danger: #e5484d;
  --danger-bg: #fdeeee;
  --radius: 10px;
  --radius-lg: 16px;
  --navy: #0b1b3f;
  --navy-2: #12285a;
  --card-shadow: 0 1px 2px rgba(15, 40, 100, .04), 0 8px 24px rgba(15, 40, 100, .05);
  --brand-grad: linear-gradient(90deg, #7b3fe4 0%, #2c6be8 45%, #12c39a 100%);
  --btn-grad: linear-gradient(90deg, #2c6ff0, #1747b8);
}
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: radial-gradient(1100px 500px at 100% -10%, #e9f0ff 0%, rgba(233, 240, 255, 0) 60%), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
.header-title, .panel-title, .stat-value, .modal-title, .login-title, .m-title, .home-stage b, .sp-step b {
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
}
.header-title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.header-sub { font-size: 13.5px; color: var(--slate); }
.panel-title { font-size: 17px; letter-spacing: -0.01em; }

/* ---- buttons, inputs, chips ---- */
.btn { border-radius: 10px; font-weight: 600; transition: background .15s, box-shadow .15s, transform .15s, filter .15s; }
.btn-primary { background: var(--btn-grad); color: #fff; box-shadow: 0 6px 16px rgba(31, 95, 224, .22); }
.btn-primary:hover { background: var(--btn-grad); filter: brightness(1.06); box-shadow: 0 8px 20px rgba(31, 95, 224, .28); }
.btn-outline { background: var(--paper); border-color: var(--border); color: var(--ink); }
.btn-outline:hover { background: #f6f9ff; border-color: #cfdaf0; }
a.btn, a.btn:hover { text-decoration: none; }
.btn:focus-visible, .chip:focus-visible, .seg-btn:focus-visible, .nav-item:focus-visible { outline: 3px solid rgba(31, 95, 224, .3); outline-offset: 2px; }
.chip { border-radius: 999px; border: 1px solid var(--border); background: var(--paper); color: var(--slate); font-weight: 600; }
.chip:hover { border-color: #cfdaf0; color: var(--ink); }
.chip.active { background: var(--brand-light); border-color: #c9d9fb; color: var(--brand-dark); }
.seg { background: #e9eff9; border-radius: 12px; padding: 4px; }
.seg-btn { border-radius: 9px; font-weight: 600; }
.seg-btn.active { color: var(--brand-dark); box-shadow: 0 1px 3px rgba(15, 40, 100, .12); }
input[type=text], input[type=email], input[type=search], input[type=password], input[type=date], select, textarea { border-radius: 10px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand) !important; box-shadow: 0 0 0 3px rgba(31, 95, 224, .12); outline: none; }

/* ---- cards ---- */
.table-card, .stat-card, .hc-item, .sp-col, .st-member, .modal-card, .ui-dialog { border-color: var(--border); }
.table-card { border-radius: var(--radius-lg); box-shadow: var(--card-shadow); }
.stat-card {
  --accent: var(--brand);
  position: relative; border-radius: var(--radius-lg); border-top: 1px solid var(--border);
  box-shadow: var(--card-shadow); transition: box-shadow .15s, transform .15s;
}
.stat-card::before {
  content: ""; display: block; width: 30px; height: 30px; border-radius: 10px; margin-bottom: 10px;
  background: color-mix(in srgb, var(--accent) 14%, #fff);
  box-shadow: inset 0 0 0 7px color-mix(in srgb, var(--accent) 14%, #fff), inset 0 0 0 30px var(--accent);
}
.stat-card.c-email1 { --accent: #1f5fe0; border-top-color: var(--border); }
.stat-card.c-followup1 { --accent: #e8932e; border-top-color: var(--border); }
.stat-card.c-followup2 { --accent: #7b3fe4; border-top-color: var(--border); }
.stat-card.c-total { --accent: #0e9f6e; border-top-color: var(--border); }
.stat-card.c-replies { --accent: #12c39a; border-top-color: var(--border); }
.stat-card.c-bounced { --accent: #e5484d; border-top-color: var(--border); }
.stat-label { font-size: 12.5px; font-weight: 600; color: var(--slate); text-transform: none; }
.stat-value { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
button.stat-card:hover, .home-card:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(15, 40, 100, .05), 0 14px 30px rgba(15, 40, 100, .08); }
.stat-all { border-top-color: var(--border); }

/* ---- tables ---- */
thead tr { background: #f6f8fd; border-bottom: 1px solid var(--border); }
th { color: #6b7a99; font-size: 11px; letter-spacing: .06em; }
td { border-bottom-color: #edf1f9; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: #f8faff; }

/* ---- pills, alerts ---- */
.rep-alert, .rep-note { border-radius: 12px; }
.hc-item { border-radius: 14px; box-shadow: var(--card-shadow); }
.ld-pill { border-radius: 999px; }
.nav-count { background: var(--danger); color: #fff; border-radius: 999px; font-weight: 700; }

/* ---- pipeline / home / settings ---- */
.sp-col { background: #eef3fb; border-radius: 18px; }
.sp-card { border-radius: 14px; box-shadow: 0 1px 2px rgba(15, 40, 100, .05); }
.sp-card:hover { box-shadow: 0 6px 18px rgba(15, 40, 100, .08); }
.sp-step, .home-stage { border-radius: 14px; }
.sp-step.active { box-shadow: 0 0 0 1px #c9d9fb; }
.home-stage { background: #f6f9ff; }
.st-member { border-radius: 14px; }

/* ---- modals ---- */
.modal-card, .ui-dialog { border-radius: 18px; }
.ui-dialog { border-top-width: 0; box-shadow: 0 30px 80px rgba(11, 27, 63, .3); }

/* ---- desktop sidebar: navy with the ETaxFlow mark ---- */
.brand-word { font-family: "Space Grotesk", "Inter", sans-serif; font-weight: 700; font-size: 20px; letter-spacing: -.02em;
  background: linear-gradient(90deg, #b9a3ff 0%, #7fb0ff 45%, #4fe3bd 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
@media (min-width: 821px) {
  .sidebar {
    width: 236px; background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
    border-right: none; padding: 22px 14px; gap: 26px; box-shadow: 4px 0 24px rgba(11, 27, 63, .08);
  }
  .sidebar-brand { padding: 0 8px; gap: 10px; color: #fff; }
  .sidebar-brand img { width: 26px; height: 36px; border-radius: 0; object-fit: contain; }
  .nav-item { color: #b8c4dd; border-radius: 10px; padding: 10px 12px; font-weight: 500; transition: background .12s, color .12s; }
  .nav-item svg { opacity: .9; }
  .nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
  .nav-item.active { background: rgba(79, 141, 255, .18); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 #5b93ff; }
  .nav-item.active svg { color: #8fb6ff; }
  .sidebar-logout .nav-item { color: #9fb0cf; }
  .nav-count { box-shadow: 0 0 0 2px var(--navy); }
  .page { padding: 28px 32px 64px; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
  .home-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---- phone: keep the light top bar, use the mark ---- */
@media (max-width: 820px) {
  .brand-word { display: none; }
  .sidebar-brand img { width: 22px; height: 30px; border-radius: 0; }
  .stat-card::before { width: 24px; height: 24px; border-radius: 8px; margin-bottom: 8px;
    box-shadow: inset 0 0 0 6px color-mix(in srgb, var(--accent) 14%, #fff), inset 0 0 0 24px var(--accent); }
  .tabbar-item.active { color: var(--brand); }
  .tabbar-item.active::before { background: var(--btn-grad); }
}
@media (prefers-reduced-motion: reduce) { .btn, .stat-card, .sp-card, tbody tr { transition: none; } }
.fb-bar span { background: linear-gradient(180deg, #5b93ff 0%, #1f5fe0 100%); border-radius: 6px 6px 2px 2px; }
.fb-bar:hover span { background: linear-gradient(180deg, #7b3fe4 0%, #1f5fe0 100%); }

/* ============================== Ask the dashboard (ask.js) ============================== */
.ask-fab { position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 70;
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px 11px 14px; border: none; border-radius: 999px; cursor: pointer;
  font: 600 14px inherit; font-family: inherit; color: #fff; background: linear-gradient(135deg, var(--purple), var(--brand));
  box-shadow: 0 10px 28px rgba(31, 95, 224, 0.32); }
.ask-fab:hover { filter: brightness(1.06); }
.ask-fab.hidden, .ask-panel.hidden { display: none; }
.ask-panel { position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 75;
  width: min(420px, calc(100vw - 32px)); height: min(620px, calc(100vh - 40px)); display: flex; flex-direction: column;
  background: var(--paper); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-modal); overflow: hidden; }
.ask-head { display: flex; align-items: center; gap: 6px; padding: 14px 14px 12px 18px; border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--purple-bg), var(--brand-light)); }
.ask-head > div { flex: 1; min-width: 0; }
.ask-head b { font-size: 15px; color: var(--ink); }
.ask-icon { width: 32px; height: 32px; border: none; border-radius: 8px; background: transparent; color: var(--slate); font-size: 20px; cursor: pointer; line-height: 1; }
.ask-icon:hover { background: rgba(255, 255, 255, 0.7); }
.ask-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.ask-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; color: var(--slate); font-size: 13.5px; }
.ask-empty p { margin: 0 0 4px; line-height: 1.5; }
.ask-starter { text-align: left; white-space: normal; }
.ask-msg { max-width: 88%; padding: 9px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; word-break: break-word; }
.ask-msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.ask-msg.assistant { align-self: flex-start; background: var(--paper); border: 1px solid var(--border); color: var(--ink); border-bottom-left-radius: 4px; }
.ask-msg p { margin: 0 0 6px; } .ask-msg p:last-child { margin-bottom: 0; }
.ask-msg ul { margin: 4px 0 6px; padding-left: 18px; } .ask-msg li { margin: 2px 0; }
.ask-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.ask-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--slate-light); animation: ask-dot 1s infinite ease-in-out; }
.ask-typing span:nth-child(2) { animation-delay: .15s; } .ask-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes ask-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.ask-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--paper); }
.ask-form textarea { flex: 1; min-width: 0; resize: none; max-height: 120px; font: inherit; font-size: 14px; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: 12px; outline: none; background: var(--paper); color: var(--ink); field-sizing: content; }
.ask-form textarea:focus { border-color: var(--brand); }
@media (max-width: 820px) {
  .ask-fab { bottom: calc(76px + env(safe-area-inset-bottom)); right: 14px; padding: 12px; }
  .ask-fab span { display: none; }
  .ask-panel { inset: 0; width: auto; height: auto; border-radius: 0; border: none; z-index: 110; }
  .ask-head { padding-top: calc(12px + env(safe-area-inset-top)); }
  .ask-form textarea { font-size: 16px; }
  .layout:has(.thread-open) ~ .ask-fab { display: none; }
}
