/* =========================================================
   SalesPro CRM — Design System
   Single-color icon set, Inter typeface, blue/white palette
   ========================================================= */

:root{
  --page-bg: #e8edfb;
  --shell-bg: #f4f6fc;
  --card-bg: #ffffff;
  --sidebar-bg: #ffffff;

  --primary: #3b66f5;
  --primary-dark: #2b4fd6;
  --primary-light: #eaf0ff;

  --text-1: #111827;
  --text-2: #667085;
  --text-3: #98a2b3;

  --border: #eef1f6;
  --border-strong: #e3e7f0;

  --green: #12b76a;
  --green-bg: #e7f9f1;
  --red: #f04438;
  --red-bg: #fef1f0;
  --amber: #f79009;
  --amber-bg: #fff6e8;
  --purple: #7a5af8;
  --purple-bg: #f2effe;
  --blue-bg: #eaf0ff;

  /* Dedicated card pastels — richer/more saturated than the badge -bg
     tokens above on purpose, so a status badge never disappears against
     a card of the same hue (e.g. a green "Paid" badge on a card tinted
     with the same pale green it uses). Kept as their own set rather
     than reusing --green-bg etc. */
  --card-pastel-blue: #dbe6ff;
  --card-pastel-green: #d3f3e4;
  --card-pastel-purple: #e6def9;
  --card-pastel-amber: #ffe9c7;
  --card-pastel-rose: #ffe0e6;

  /* Guided-tour popup theme — a warm, light, "look here" background that
     reads as distinct from the app's ordinary white cards/dialogs, while
     keeping text dark enough to stay easily readable. */
  --tour-bg-1: #f2fbf6;
  --tour-bg-2: #d5f3e3;
  --tour-border: #a3e3c3;
  --tour-accent: #19a970;
  --tour-accent-dark: #0d7a50;
  --tour-text-1: #0f2e21;
  --tour-text-2: #335c4a;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --shadow-card: 0 1px 2px rgba(16,24,40,0.04), 0 1px 3px rgba(16,24,40,0.04);
  --shadow-pop: 0 8px 24px rgba(16,24,40,0.12);

  --sidebar-w: 264px;
}

*,*::before,*::after{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
  background:var(--page-bg);
  color:var(--text-1);
  -webkit-font-smoothing:antialiased;
  font-size:14px;
  line-height:1.5;
}
a{ color:inherit; text-decoration:none; }
ul{ margin:0; padding:0; list-style:none; }
button{ font-family:inherit; cursor:pointer; }
input,select,textarea{ font-family:inherit; font-size:14px; }
img{ max-width:100%; display:block; }
svg.icon{ display:block; flex-shrink:0; }

::-webkit-scrollbar{ width:8px; height:8px; }
::-webkit-scrollbar-thumb{ background:#d3d9e6; border-radius:8px; }
::-webkit-scrollbar-track{ background:transparent; }

/* ---------------- App shell layout ---------------- */
.app{
  display:flex;
  min-height:100vh;
  padding:14px;
  gap:14px;
}

.sidebar{
  width:var(--sidebar-w);
  flex-shrink:0;
  background:var(--sidebar-bg);
  border-radius:var(--radius-lg);
  padding:22px 16px;
  display:flex;
  flex-direction:column;
  box-shadow:var(--shadow-card);
  position:sticky;
  top:14px;
  height:calc(100vh - 28px);
  overflow-y:auto;
  overflow-anchor:none;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  padding:4px 10px 22px;
}
.brand-mark{
  width:38px; height:38px;
  border-radius:11px;
  background:var(--primary);
  color:#fff;
  display:flex;align-items:center;justify-content:center;
  flex-shrink:0;
}
.brand-text strong{ display:block; font-size:15px; font-weight:700; color:var(--text-1); }
.brand-text span{ display:block; font-size:11.5px; color:var(--text-3); }

.nav-label{
  font-size:11px;
  font-weight:700;
  letter-spacing:.04em;
  text-transform:uppercase;
  color:var(--text-3);
  padding:16px 12px 8px;
}
.nav-list{ display:flex; flex-direction:column; gap:2px; }
.nav-item{
  display:flex;
  align-items:center;
  gap:11px;
  padding:10px 12px;
  border-radius:12px;
  color:var(--text-2);
  font-weight:500;
  font-size:14px;
  transition:background .15s ease, color .15s ease;
  position:relative;
}
.nav-item svg{ color:var(--text-3); transition:color .15s ease; }
.nav-item:hover{ background:var(--primary-light); color:var(--primary-dark); }
.nav-item:hover svg{ color:var(--primary); }
.nav-item.active{ background:var(--primary); color:#fff; box-shadow:0 6px 16px rgba(59,102,245,.35); }
.nav-item.active svg{ color:#fff; }
.nav-count{
  margin-left:auto;
  font-size:11.5px;
  font-weight:700;
  background:var(--primary-light);
  color:var(--primary-dark);
  padding:1px 8px;
  border-radius:20px;
}
.nav-item.active .nav-count{ background:rgba(255,255,255,.25); color:#fff; }

.sidebar-promo{
  margin-top:auto;
  background:var(--shell-bg);
  border-radius:var(--radius-md);
  padding:16px;
  text-align:left;
}
.sidebar-promo h4{ margin:0 0 6px; font-size:13.5px; }
.sidebar-promo p{ margin:0 0 12px; font-size:12px; color:var(--text-2); line-height:1.5; }
.btn-upgrade{
  display:flex; align-items:center; justify-content:center; gap:6px;
  width:100%; padding:9px; border-radius:10px;
  background:var(--text-1); color:#fff; border:none; font-weight:600; font-size:13px;
}

/* ---------------- Main column ---------------- */
.main{
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:14px;
}

.topbar{
  background:var(--card-bg);
  border-radius:var(--radius-lg);
  padding:14px 20px;
  display:flex;
  align-items:center;
  gap:16px;
  box-shadow:var(--shadow-card);
}
.menu-toggle{
  display:none;
  background:var(--shell-bg);
  border:none; border-radius:10px; padding:9px; color:var(--text-2);
}
.search-box{
  flex:1;
  display:flex;
  align-items:center;
  gap:10px;
  background:var(--shell-bg);
  border-radius:12px;
  padding:10px 14px;
  color:var(--text-3);
  max-width:420px;
}
.search-box input{
  border:none; background:transparent; outline:none; width:100%;
  color:var(--text-1); font-size:14px;
}
.search-box-btn{
  display:flex; align-items:center; justify-content:center;
  background:none; border:none; padding:0; margin:0;
  color:inherit; cursor:pointer; flex-shrink:0;
}
.search-box-btn:hover{ color:var(--primary); }
.topbar-right{ display:flex; align-items:center; gap:14px; margin-left:auto; }
.icon-btn{
  position:relative;
  width:40px; height:40px;
  border-radius:12px;
  border:1px solid var(--border-strong);
  background:#fff;
  display:flex; align-items:center; justify-content:center;
  color:var(--text-2);
}
.icon-btn .dot{
  position:absolute; top:8px; right:9px;
  width:7px; height:7px; border-radius:50%;
  background:var(--red); border:2px solid #fff;
}
/* Header "Tour" button — a labeled pill (not just a bare icon) so it's
   unmistakable as the way to (re)start the guided tour manually, in the
   same mint-green theme as the tour popup itself. */
.tour-start-btn{
  display:flex; align-items:center; gap:6px;
  height:40px; padding:0 14px; flex-shrink:0;
  border-radius:12px;
  border:1px solid var(--tour-border);
  background:linear-gradient(160deg, var(--tour-bg-1) 0%, var(--tour-bg-2) 100%);
  color:var(--tour-accent-dark);
  font-size:13px; font-weight:700; font-family:inherit;
  cursor:pointer; white-space:nowrap;
  transition:all .15s ease;
}
.tour-start-btn:hover{ border-color:var(--tour-accent); box-shadow:0 3px 10px rgba(25,169,112,.2); transform:translateY(-1px); }
.tour-start-btn .icon{ color:var(--tour-accent-dark); flex-shrink:0; }
@media (max-width: 640px){
  .tour-start-btn{ width:40px; padding:0; justify-content:center; }
  .tour-start-btn span{ display:none; }
}
/* Applied directly to any bell <svg> (topbar, sidebar nav, notification
   rows) whenever it represents something unread. Two quick ring bursts,
   then a rest, repeating — noticeable without being nonstop. */
.bell-ringing{
  transform-origin:50% 15%;
  animation:bell-ring 2.4s ease-in-out infinite;
}
@keyframes bell-ring{
  0%, 100%{ transform:rotate(0deg) scale(1); }
  1%{ transform:rotate(26deg) scale(1.12); }
  3%{ transform:rotate(-24deg); }
  5%{ transform:rotate(19deg); }
  7%{ transform:rotate(-15deg); }
  9%{ transform:rotate(9deg); }
  11%{ transform:rotate(-5deg); }
  13%{ transform:rotate(0deg) scale(1); }
  16%{ transform:rotate(0deg) scale(1); }
  17%{ transform:rotate(22deg) scale(1.1); }
  19%{ transform:rotate(-20deg); }
  21%{ transform:rotate(15deg); }
  23%{ transform:rotate(-11deg); }
  25%{ transform:rotate(6deg); }
  27%{ transform:rotate(-3deg); }
  29%{ transform:rotate(0deg) scale(1); }
}
@media (prefers-reduced-motion: reduce){
  .bell-ringing{ animation:none; }
}
.user-chip{ display:flex; align-items:center; gap:10px; padding:4px; border-radius:12px; position:relative; }
.avatar{
  width:38px; height:38px; border-radius:11px;
  background:var(--primary-light); color:var(--primary-dark);
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:13px; overflow:hidden;
  flex-shrink:0;
}
.avatar img{ width:100%; height:100%; object-fit:cover; }
.user-chip .u-name{ font-weight:600; font-size:13.5px; line-height:1.2; }
.user-chip .u-role{ font-size:11.5px; color:var(--text-3); }
.user-chip-info{ display:none; }
@media (min-width:640px){ .user-chip-info{ display:block; } }

.dropdown-menu{
  position:absolute; top:calc(100% + 8px); right:0;
  background:#fff; border-radius:14px; box-shadow:var(--shadow-pop);
  border:1px solid var(--border); min-width:190px; padding:8px;
  display:none; z-index:40;
}
.dropdown-menu.open{ display:block; }
.dropdown-menu a, .dropdown-menu button{
  display:flex; align-items:center; gap:10px; width:100%;
  padding:9px 10px; border-radius:9px; border:none; background:none;
  font-size:13.5px; color:var(--text-2); text-align:left;
}
.dropdown-menu a:hover, .dropdown-menu button:hover{ background:var(--shell-bg); color:var(--text-1); }

/* ---------------- Searchable select ---------------- */
.searchable-select{ position:relative; display:inline-block; min-width:160px; vertical-align:middle; }
.field .searchable-select{ display:block; width:100%; min-width:0; }
.searchable-select-native{
  position:absolute; opacity:0; height:1px; width:1px; overflow:hidden;
  pointer-events:none; clip:rect(0,0,0,0);
}
.searchable-select-input{
  width:100%; padding:11px 34px 11px 13px; border-radius:11px; border:1px solid var(--border-strong);
  background:#fff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%2398a2b3" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>') no-repeat right 8px center / 18px 18px;
  outline:none; color:var(--text-1); font-family:inherit; font-size:14px;
  transition:border-color .15s ease; cursor:text;
}
.searchable-select-input:focus{ border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-light); }
.searchable-select-input.searchable-select-error{ border-color:var(--red); box-shadow:0 0 0 3px var(--red-bg); }
.searchable-select-input::placeholder{ color:var(--text-3); }
.searchable-select-dropdown{
  display:none;
  position:absolute; top:calc(100% + 6px); left:0; right:0; z-index:45;
  background:#fff; border:1px solid var(--border); border-radius:12px;
  box-shadow:var(--shadow-pop);
  max-height:264px; overflow-y:auto; padding:6px;
}
.searchable-select-dropdown.open{ display:block; }
.searchable-select-group{
  font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.04em;
  color:var(--text-3); padding:9px 10px 4px;
}
.searchable-select-option{
  padding:9px 10px; border-radius:8px; font-size:13.5px; color:var(--text-1); cursor:pointer;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.searchable-select-option:hover, .searchable-select-option.active{ background:var(--shell-bg); }
.searchable-select-option.selected{ font-weight:700; color:var(--primary); }
.searchable-select-empty{ padding:16px 10px; font-size:12.5px; color:var(--text-3); text-align:center; }

.content{
  background:transparent;
  display:flex;
  flex-direction:column;
  gap:16px;
}

.page-header{
  display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap;
}
.page-header h1{ font-size:22px; margin:0; font-weight:700; }
.page-header .sub{ color:var(--text-2); font-size:13.5px; margin-top:2px; }
.page-actions{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
/* Secondary page actions (Export/Import/etc) show inline at desktop
   widths; .page-actions-more (a single "⋮" button) is the mobile
   replacement — see the max-width:640px rule below. Kept inline here,
   hidden by default, so pages that don't opt in are unaffected. */
.page-actions-secondary{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.page-actions-more{ display:none; }

/* Filter bars with lots of controls (leads.php) wrap the non-search
   controls in #filterExtra. display:contents means its children lay
   out exactly as if they were direct children of the surrounding flex
   form — i.e. unchanged at desktop widths — and only the mobile media
   query below turns it into a real collapsible block. */
.filter-extra{ display:contents; }
.filters-toggle-btn{ display:none; }

/* ---------------- Buttons ---------------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:10px 16px; border-radius:11px; font-weight:600; font-size:13.5px;
  border:1px solid transparent; transition:all .15s ease; white-space:nowrap;
}
.btn-primary{ background:var(--primary); color:#fff; }
.btn-primary:hover{ background:var(--primary-dark); }
.btn-outline{ background:#fff; border-color:var(--border-strong); color:var(--text-1); }
.btn-outline:hover{ border-color:var(--primary); color:var(--primary); }
.btn-ghost{ background:var(--shell-bg); color:var(--text-2); }
.btn-ghost:hover{ background:var(--border-strong); }
.btn-danger{ background:var(--red-bg); color:var(--red); }
.btn-danger:hover{ background:var(--red); color:#fff; }
.btn-sm{ padding:7px 12px; font-size:12.5px; border-radius:9px; }
.btn-block{ width:100%; }
.btn[disabled]{ opacity:.55; cursor:not-allowed; }

/* ---------------- Cards ---------------- */
.card{
  background:var(--card-bg);
  border-radius:var(--radius-lg);
  padding:20px;
  box-shadow:var(--shadow-card);
}
.card-header{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:16px; flex-wrap:wrap; }
.card-header h3{ margin:0; font-size:16px; font-weight:700; }
.card-header .sub{ font-size:12.5px; color:var(--text-3); margin-top:2px; }

/* ---------------- Stat cards ---------------- */
.chart-wrap{ position:relative; height:260px; width:100%; }
.stat-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:14px; }
.stat-grid-4{ display:grid; grid-template-columns:repeat(4,1fr); gap:14px; }
.stat-card{
  background:var(--card-bg); border-radius:var(--radius-lg); padding:18px 20px;
  box-shadow:var(--shadow-card); position:relative; overflow:hidden;
}
.stat-top{ display:flex; align-items:center; gap:8px; color:var(--text-2); font-size:13px; font-weight:600; margin-bottom:14px; }
.stat-top .ic{ width:30px; height:30px; border-radius:9px; background:rgba(17,24,39,0.055); display:flex; align-items:center; justify-content:center; color:var(--text-2); }
.stat-value{ font-size:26px; font-weight:800; letter-spacing:-.01em; }
.stat-foot{ display:flex; align-items:center; justify-content:space-between; margin-top:10px; }
.delta{ display:inline-flex; align-items:center; gap:4px; font-weight:700; font-size:12.5px; }
.delta.up{ color:var(--green); }
.delta.down{ color:var(--red); }
.delta-label{ color:var(--text-3); font-weight:500; }
.spark{ width:70px; height:26px; }

/* Light pastel tints, cycling by position, for the summary/stat cards
   that sit directly in a .stat-grid / .stat-grid-4 row (dashboard,
   analytics, accounts, invoices, quotes, leads, reports export cards,
   etc). Uses --card-pastel-* rather than the badge -bg tokens
   (--blue-bg etc.) deliberately: those are also a status badge's own
   background, so reusing them here would make e.g. a green "Paid"
   badge disappear against a card already tinted the same pale green.
   Any card with an inline background (e.g. the red "overdue" callouts)
   keeps that — inline styles always win over these. Plain .card
   containers used anywhere else in the app (forms, tables, settings)
   are untouched. */
.stat-grid > .stat-card:nth-child(3n+1), .stat-grid > .card:nth-child(3n+1),
.stat-grid-4 > .stat-card:nth-child(4n+1), .stat-grid-4 > .card:nth-child(4n+1) { background:var(--card-pastel-blue); }
.stat-grid > .stat-card:nth-child(3n+2), .stat-grid > .card:nth-child(3n+2),
.stat-grid-4 > .stat-card:nth-child(4n+2), .stat-grid-4 > .card:nth-child(4n+2) { background:var(--card-pastel-green); }
.stat-grid > .stat-card:nth-child(3n+3), .stat-grid > .card:nth-child(3n+3),
.stat-grid-4 > .stat-card:nth-child(4n+3), .stat-grid-4 > .card:nth-child(4n+3) { background:var(--card-pastel-purple); }
.stat-grid-4 > .stat-card:nth-child(4n+4), .stat-grid-4 > .card:nth-child(4n+4) { background:var(--card-pastel-amber); }

/* Same treatment for the Customers grid and record-detail pages
   (Lead/Customer/Invoice/Quote view — each shows several related-info
   cards in a row), keyed off a dedicated wrapper class. Five-color
   cycle since these grids often run longer than 3-4 cards. */
.pastel-card-grid > .card:nth-child(5n+1) { background:var(--card-pastel-blue); }
.pastel-card-grid > .card:nth-child(5n+2) { background:var(--card-pastel-green); }
.pastel-card-grid > .card:nth-child(5n+3) { background:var(--card-pastel-purple); }
.pastel-card-grid > .card:nth-child(5n+4) { background:var(--card-pastel-amber); }
.pastel-card-grid > .card:nth-child(5n+5) { background:var(--card-pastel-rose); }


/* ---------------- Grid layouts ---------------- */
.grid-2{ display:grid; grid-template-columns:1.6fr 1fr; gap:14px; align-items:stretch; }
.grid-3{ display:grid; grid-template-columns:repeat(3,1fr); gap:14px; align-items:stretch; }

/* ---------------- Tabs / segmented control ---------------- */
.seg{ display:inline-flex; background:var(--shell-bg); border-radius:11px; padding:4px; gap:2px; }
.seg button, .seg a{ border:none; background:transparent; padding:7px 14px; border-radius:8px; font-size:12.5px; font-weight:600; color:var(--text-2); text-decoration:none; display:inline-flex; align-items:center; cursor:pointer; }
.seg a:hover{ color:var(--primary); }
.seg button.active, .seg a.active{ background:var(--primary); color:#fff; }

/* ---------------- Mobile card list (leads.php) ----------------
   Alternative to the data-table at phone/tablet widths — see the
   max-width:860px rule below, which hides .desktop-table-wrap and shows
   this instead, so leads never force horizontal scrolling on a phone. */
.leads-mobile-list{ display:none; flex-direction:column; gap:10px; }
.mobile-lead-card{
  border:1px solid var(--border); border-radius:14px; padding:14px;
  display:flex; flex-direction:column; gap:10px;
}
.mobile-lead-card-top{ display:flex; align-items:flex-start; gap:10px; }
.mobile-lead-card-badges{ display:flex; flex-wrap:wrap; gap:6px; }
.mobile-lead-card-badges .badge{ font-size:10.5px; padding:3px 8px; }
.mobile-lead-card-actions{ display:flex; align-items:center; gap:8px; padding-top:8px; border-top:1px solid var(--border); }

/* ---------------- Tables ---------------- */
.table-wrap{ overflow-x:auto; }
table.data-table{ width:100%; border-collapse:collapse; min-width:640px; }
.data-table th{
  text-align:left; font-size:11.5px; text-transform:uppercase; letter-spacing:.03em;
  color:var(--text-3); font-weight:700; padding:10px 14px; border-bottom:1px solid var(--border);
  white-space:nowrap;
}
.data-table td{ padding:14px; border-bottom:1px solid var(--border); font-size:13.5px; vertical-align:middle; }
.data-table tr:last-child td{ border-bottom:none; }
.data-table tr:hover td{ background:var(--shell-bg); }
.cell-main{ display:flex; align-items:center; gap:10px; }
.cell-title{ font-weight:600; color:var(--text-1); }
.cell-sub{ font-size:12px; color:var(--text-3); }
.row-actions{ display:flex; gap:6px; justify-content:flex-end; }
.icon-action{
  width:32px; height:32px; border-radius:9px; border:1px solid var(--border-strong);
  background:#fff; display:inline-flex; align-items:center; justify-content:center; color:var(--text-2);
}
.icon-action:hover{ color:var(--primary); border-color:var(--primary); }
.icon-action.danger:hover{ color:var(--red); border-color:var(--red); }

/* ---------------- Badges ---------------- */
.badge{ display:inline-flex; align-items:center; gap:5px; padding:4px 10px; border-radius:20px; font-size:11.5px; font-weight:700; text-transform:capitalize; background:#fff; }
.badge::before{ content:''; width:6px; height:6px; border-radius:50%; background:currentColor; }
.badge-blue{ color:var(--primary-dark); box-shadow:inset 0 0 0 1.25px rgba(43,79,214,0.4); }
.badge-green{ color:var(--green); box-shadow:inset 0 0 0 1.25px rgba(18,183,106,0.42); }
.badge-red{ color:var(--red); box-shadow:inset 0 0 0 1.25px rgba(240,68,56,0.4); }
.badge-amber{ color:#b06a00; box-shadow:inset 0 0 0 1.25px rgba(176,106,0,0.4); }
.badge-purple{ color:var(--purple); box-shadow:inset 0 0 0 1.25px rgba(122,90,248,0.4); }
.badge-gray{ color:var(--text-2); box-shadow:inset 0 0 0 1.25px rgba(17,24,39,0.16); }

/* ---------------- Lists (top reps / deals) ---------------- */
.list-item{ display:flex; align-items:center; gap:12px; padding:12px 0; border-bottom:1px solid var(--border); }
.list-item:last-child{ border-bottom:none; padding-bottom:0; }
.list-thumb{ width:44px; height:44px; border-radius:12px; background:var(--shell-bg); display:flex; align-items:center; justify-content:center; overflow:hidden; flex-shrink:0; color:var(--text-2); font-weight:700; }
.list-thumb img{ width:100%; height:100%; object-fit:cover; }
.list-body{ flex:1; min-width:0; }
.list-title{ font-weight:600; font-size:13.5px; }
.list-sub{ font-size:12px; color:var(--text-3); margin-top:1px; }
.list-value{ text-align:right; font-weight:700; font-size:13.5px; flex-shrink:0; }
.list-value .list-sub{ text-align:right; }
.progress{ height:6px; border-radius:6px; background:var(--shell-bg); margin-top:8px; overflow:hidden; }
.progress > span{ display:block; height:100%; background:var(--primary); border-radius:6px; }

/* ---------------- Location rows (replaces map) ---------------- */
.loc-row{ display:flex; align-items:center; gap:12px; padding:13px 0; border-bottom:1px solid var(--border); }
.loc-row:last-child{ border-bottom:none; }
.loc-flag{ width:38px; height:38px; border-radius:10px; background:var(--blue-bg); color:var(--primary-dark); display:flex; align-items:center; justify-content:center; }
.loc-body{ flex:1; }
.loc-name{ font-weight:600; font-size:13.5px; }
.loc-value{ font-weight:700; font-size:13.5px; }

/* ---------------- Budget usage / donut legend ---------------- */
.legend-row{ display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--text-2); margin-top:6px; }
.legend-dot{ width:9px; height:9px; border-radius:50%; }
.stat-mini{ text-align:center; }
.stat-mini .n{ font-size:18px; font-weight:800; }
.stat-mini .l{ font-size:12px; color:var(--text-3); display:flex; align-items:center; justify-content:center; gap:5px; margin-top:2px; }

/* ---------------- Forms ---------------- */
.form-grid{ display:grid; grid-template-columns:repeat(2,1fr); gap:16px; }
.field{ display:flex; flex-direction:column; gap:6px; }
.field.full{ grid-column:1 / -1; }
.field label{ font-size:12.5px; font-weight:600; color:var(--text-2); }
.field input, .field select, .field textarea{
  padding:11px 13px; border-radius:11px; border:1px solid var(--border-strong);
  background:#fff; outline:none; color:var(--text-1); transition:border-color .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus{ border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-light); }
.field textarea{ resize:vertical; min-height:90px; font-family:inherit; }
.field .hint{ font-size:11.5px; color:var(--text-3); }
.field .error{ font-size:11.5px; color:var(--red); }
.form-actions{ display:flex; justify-content:flex-end; gap:10px; margin-top:6px; }

/* ---------------- Alerts / flash ---------------- */
.alert{ display:flex; align-items:center; gap:10px; padding:13px 16px; border-radius:13px; font-size:13.5px; font-weight:500; }
.alert-success{ background:var(--green-bg); color:#0a7a4c; }
.alert-error{ background:var(--red-bg); color:#b3261e; }
.alert-info{ background:var(--blue-bg); color:var(--primary-dark); }

/* ---------------- Empty state ---------------- */
.empty-state{ text-align:center; padding:50px 20px; color:var(--text-3); }
.empty-state .ic{ width:56px; height:56px; border-radius:16px; background:var(--shell-bg); display:flex; align-items:center; justify-content:center; margin:0 auto 14px; color:var(--text-3); }
.empty-state h4{ color:var(--text-1); margin:0 0 6px; }
.empty-state p{ margin:0 0 16px; font-size:13px; }

/* ---------------- Pagination ---------------- */
.pagination{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding-top:14px; flex-wrap:wrap; }
.pagination .info{ font-size:12.5px; color:var(--text-3); }
.pagination .pages{ display:flex; gap:6px; }
.pagination a, .pagination span{
  min-width:34px; height:34px; padding:0 8px; border-radius:9px; display:flex; align-items:center; justify-content:center;
  border:1px solid var(--border-strong); font-size:12.5px; font-weight:600; color:var(--text-2);
}
.pagination a:hover{ border-color:var(--primary); color:var(--primary); }
.pagination .current{ background:var(--primary); color:#fff; border-color:var(--primary); }

/* ---------------- Modal ---------------- */
.modal-overlay{
  position:fixed; inset:0; background:rgba(17,24,39,.45); display:none;
  align-items:center; justify-content:center; z-index:100; padding:16px;
}
.modal-overlay.open{ display:flex; }
.modal{ background:#fff; border-radius:18px; width:100%; max-width:420px; padding:22px; box-shadow:var(--shadow-pop); }
.modal h3{ margin:0 0 8px; font-size:16px; }
.modal p{ margin:0 0 18px; color:var(--text-2); font-size:13.5px; }
.modal-actions{ display:flex; justify-content:flex-end; gap:10px; }

/* ---------------- Login page ---------------- */
.auth-wrap{ min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px; background:var(--page-bg); }
.auth-card{ width:100%; max-width:400px; background:#fff; border-radius:22px; padding:36px 32px; box-shadow:var(--shadow-pop); }
.auth-logo{ display:flex; align-items:center; gap:10px; margin-bottom:22px; justify-content:center; }
.auth-card h1{ text-align:center; font-size:20px; margin:0 0 4px; }
.auth-card .sub{ text-align:center; color:var(--text-3); font-size:13px; margin-bottom:26px; }
.auth-demo{ background:var(--blue-bg); color:var(--primary-dark); font-size:12px; border-radius:11px; padding:10px 12px; margin-top:16px; text-align:center; }

/* ---------------- Demo quick-login (login page) ---------------- */
.demo-login-section{ margin-top:24px; padding-top:20px; border-top:1px solid var(--border); }
.demo-login-head{ display:flex; align-items:center; justify-content:center; gap:6px; text-align:center; font-size:11.5px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--text-3); margin-bottom:12px; }
.demo-login-grid{ display:flex; flex-direction:column; gap:8px; }
.demo-login-card{ display:flex; align-items:center; gap:12px; width:100%; text-align:left; background:var(--shell-bg); border:1px solid var(--border); border-radius:13px; padding:9px 12px; cursor:pointer; transition:all .15s ease; color:var(--text-2); }
.demo-login-card:hover{ border-color:var(--primary); background:var(--blue-bg); }
.demo-login-card .avatar{ width:32px; height:32px; border-radius:10px; background:var(--primary); color:#fff; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; flex-shrink:0; }
.demo-login-card .info{ flex:1; min-width:0; }
.demo-login-card .info strong{ display:block; font-size:12.5px; color:var(--text-1); }
.demo-login-card .info span{ display:block; font-size:11px; color:var(--text-3); margin-top:1px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.demo-login-foot{ text-align:center; font-size:11px; color:var(--text-3); margin-top:12px; }

/* ---------------- Calendar ---------------- */
.cal-select{ height:36px; border-radius:9px; border:1px solid var(--border-strong); padding:0 10px; font-size:12.5px; font-weight:600; color:var(--text-2); background:#fff; }
.cal-view-toggle{ display:flex; border:1px solid var(--border-strong); border-radius:9px; overflow:hidden; }
.cal-view-toggle button{ display:inline-flex; align-items:center; gap:6px; border:none; background:#fff; padding:8px 14px; font-size:12.5px; font-weight:600; color:var(--text-2); cursor:pointer; transition:all .15s ease; }
.cal-view-toggle button.active{ background:var(--primary); color:#fff; }
.cal-view-toggle button:not(.active):hover{ background:var(--shell-bg); }

.cal-legend{ display:flex; gap:18px; margin:-6px 0 14px; font-size:12px; color:var(--text-2); flex-wrap:wrap; }
.cal-legend .dot{ display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px; vertical-align:middle; }

.cal-grid{ display:grid; grid-template-columns:repeat(7,1fr); gap:6px; }
.cal-dow{ text-align:center; font-size:11px; font-weight:700; color:var(--text-3); text-transform:uppercase; padding-bottom:6px; }
.cal-cell{ min-height:92px; border-radius:12px; background:var(--shell-bg); padding:8px; font-size:12px; color:var(--text-2); position:relative; cursor:pointer; transition:box-shadow .15s ease; }
.cal-cell:hover, .cal-cell:focus-visible{ box-shadow:0 0 0 1.5px var(--primary) inset; outline:none; }
.cal-cell.today{ background:var(--blue-bg); border:1.5px solid var(--primary); }
.cal-cell .d-num{ font-weight:700; color:var(--text-1); font-size:12.5px; }
.cal-cell .evt{ margin-top:5px; font-size:10.5px; border-radius:6px; padding:3px 6px; font-weight:600; background:#fff; color:var(--primary-dark); }
.cal-cell .evt-more{ margin-top:4px; font-size:10.5px; color:var(--text-3); padding:2px 6px; }
.cal-cell.empty{ background:transparent; cursor:default; }
.cal-cell.empty:hover{ box-shadow:none; }

.dot.type-meeting{ background:var(--primary); }
.evt.type-meeting{ background:var(--blue-bg); color:var(--primary-dark); }
.dot.type-call{ background:var(--green); }
.evt.type-call{ background:var(--green-bg); color:#0d8f56; }
.dot.type-follow-up{ background:var(--amber); }
.evt.type-follow-up{ background:var(--amber-bg); color:#b3690a; }

.evt-row{ cursor:pointer; border-radius:10px; margin:0 -8px; padding:12px 8px !important; }
.evt-row:hover{ background:var(--shell-bg); }
.list-thumb.type-meeting{ background:var(--blue-bg); color:var(--primary-dark); }
.list-thumb.type-call{ background:var(--green-bg); color:#0d8f56; }
.list-thumb.type-follow-up{ background:var(--amber-bg); color:#b3690a; }

.agenda-day-heading{ font-size:12px; font-weight:700; color:var(--text-3); margin:18px 0 4px; text-transform:uppercase; letter-spacing:.03em; }
.agenda-day-heading:first-child{ margin-top:0; }

/* ---------------- Utility ---------------- */
.flex{ display:flex; }
.items-center{ align-items:center; }
.items-end{ align-items:flex-end; }
.justify-between{ justify-content:space-between; }
.gap-8{ gap:8px; }
.gap-12{ gap:12px; }
.mt-8{ margin-top:8px; }
.mt-16{ margin-top:16px; }
.text-muted{ color:var(--text-3); }
.text-sm{ font-size:12.5px; }
.w-full{ width:100%; }
.hidden{ display:none !important; }

/* ---------------- Overlay for mobile sidebar ---------------- */
.sidebar-overlay{ display:none; position:fixed; inset:0; background:rgba(17,24,39,.4); z-index:59; }
.sidebar-overlay.open{ display:block; }

/* =========================================================
   Responsive
   ========================================================= */
html{ -webkit-text-size-adjust:100%; }
@keyframes livePulse{ 0%,100%{ opacity:1; } 50%{ opacity:.35; } }
.stat-value.flash{ animation:statFlash .6s ease; }
@keyframes statFlash{ 0%{ color:var(--primary); } 100%{ color:inherit; } }
body{ overscroll-behavior-y:contain; }

/* ---------------- Mobile bottom tab bar ---------------- */
.bottom-bar{ display:none; }
.mobile-page-title{ display:none; }

@media (max-width: 1180px){
  .grid-2{ grid-template-columns:1fr; }
  .grid-3{ grid-template-columns:1fr; }
}

@media (max-width: 980px){
  .stat-grid, .stat-grid-4{ grid-template-columns:1fr 1fr; }
}

@media (max-width: 860px){
  .app{ padding:10px; gap:0; padding-bottom:calc(74px + env(safe-area-inset-bottom)); }
  .sidebar{
    position:fixed; left:10px; top:10px; z-index:60;
    transform:translateX(-120%); transition:transform .25s ease;
    height:calc(100vh - 20px);
  }
  .sidebar.open{ transform:translateX(0); }
  .menu-toggle{ display:none; }
  .main{ width:100%; gap:10px; }
  .form-grid{ grid-template-columns:1fr; }

  /* Leads list: card layout instead of a table that would otherwise need
     horizontal scrolling to see every column on a phone/tablet screen. */
  .desktop-table-wrap{ display:none; }
  .leads-mobile-list{ display:flex; }

  .bottom-bar{
    display:flex;
    position:fixed; left:0; right:0; bottom:0; z-index:55;
    background:rgba(255,255,255,.94);
    -webkit-backdrop-filter:blur(14px); backdrop-filter:blur(14px);
    border-top:1px solid var(--border);
    padding:4px 4px calc(4px + env(safe-area-inset-bottom));
    box-shadow:0 -4px 20px rgba(16,24,40,.06);
  }
  .bottom-bar-item{
    flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px;
    min-height:52px; padding:6px 2px;
    border:none; background:none; border-radius:14px;
    color:var(--text-3); text-decoration:none;
    font-size:10.5px; font-weight:600;
    -webkit-tap-highlight-color:transparent;
  }
  .bottom-bar-item svg{ width:22px; height:22px; stroke-width:2; }
  .bottom-bar-item.active{ color:var(--primary); }
  .bottom-bar-item:active{ background:var(--shell-bg); }
}

@media (max-width: 640px){
  .stat-grid, .stat-grid-4{ grid-template-columns:1fr; }
  /* Only the topbar's own search form (replaced by the page title in the
     same row) hides here — NOT every .search-box. leads.php and
     customers.php reuse that same class for their own in-page filter
     search inputs, which must stay visible on mobile; a bare
     `.search-box{display:none}` here used to wipe those out too. */
  .topbar-search{ display:none; }
  .mobile-page-title{ display:block; font-size:16px; font-weight:700; color:var(--text-1); flex:1; }
  .page-header{ flex-direction:column; align-items:flex-start; }
  .page-actions{ width:100%; }
  .page-actions .btn{ flex:1; }
  /* Collapse the secondary action row into one "More" menu button so a
     page with several outline buttons (Export/Import/Duplicates/Tags…)
     doesn't turn into a tall stack of full-width buttons on a phone. */
  .page-actions-secondary{ display:none; }
  .page-actions-more{ display:block; flex:0 0 auto; }
  .page-actions-more .dropdown-menu{ right:0; left:auto; }

  /* Filter bar: collapse everything except the search box behind one
     "Filters" button instead of a long wrapping stack of selects. */
  .filters-toggle-btn{ display:inline-flex; flex:0 0 auto; width:auto; }
  .filter-extra{
    display:none; width:100%; flex-direction:column; align-items:stretch;
    gap:10px; margin-top:12px; padding-top:12px; border-top:1px solid var(--border);
  }
  .filter-extra.open{ display:flex; }
  .filter-extra select, .filter-extra input{ width:100%; }
  .filter-extra .searchable-select{ display:block; width:100%; }
  .filter-extra .seg{ width:100%; flex-wrap:wrap; justify-content:flex-start; }
  /* The date-range / value-range boxes give their two <input>s a fixed
     124px/80px inline width each — fine inside a wide desktop row, but
     two of those plus a label can run wider than a phone screen. Let
     them shrink and share the row instead of forcing an overflow. */
  .filter-extra input[style*="width:124px"],
  .filter-extra input[style*="width:80px"]{ width:auto !important; flex:1 1 0; min-width:0; }
  .filter-extra > div.flex{ flex-wrap:wrap; width:100%; }
  .filter-extra > div[style*="width:100%; height:0;"]{ display:none; }
  .topbar{ padding:12px 14px; }
  .card{ padding:16px; }
  .auth-card{ padding:28px 20px; }
}

/* =========================================================
   In-app Dialer (assets/js/dialer.js)
   A full-screen call UI used wherever a lead/customer's number can be
   dialed — tel: handoff + optional mic-capture recording, both started
   by the one big Call button. See that file's header comment for the
   constraints (still no telephony provider, this is purely a nicer
   wrapper + auto-recording around the plain tel: link).
   ========================================================= */
.dialer-overlay{
  position:fixed; inset:0; z-index:200; display:none;
  align-items:center; justify-content:center; padding:16px;
  background:rgba(17,24,39,.55);
  -webkit-backdrop-filter:blur(2px); backdrop-filter:blur(2px);
}
.dialer-overlay.open{ display:flex; }
.dialer-card{
  position:relative; width:100%; max-width:360px;
  background:linear-gradient(170deg, #fff 0%, var(--shell-bg) 100%);
  border-radius:28px; padding:36px 28px 30px;
  box-shadow:var(--shadow-pop);
  display:flex; flex-direction:column; align-items:center; text-align:center;
  animation:dialerPopIn .2s ease-out;
}
@keyframes dialerPopIn{ 0%{ opacity:0; transform:scale(.94); } 100%{ opacity:1; transform:scale(1); } }
.dialer-close{
  position:absolute; top:14px; right:14px; width:32px; height:32px;
  border-radius:10px; border:none; background:var(--shell-bg); color:var(--text-2);
  font-size:20px; line-height:1; display:flex; align-items:center; justify-content:center;
  cursor:pointer;
}
.dialer-close:hover{ background:var(--border-strong); color:var(--text-1); }
.dialer-avatar{
  width:72px; height:72px; border-radius:50%;
  background:var(--primary-light); color:var(--primary-dark);
  display:flex; align-items:center; justify-content:center;
  font-size:24px; font-weight:800; margin-bottom:14px; flex-shrink:0;
}
.dialer-name{ font-size:19px; font-weight:800; color:var(--text-1); overflow-wrap:anywhere; }
.dialer-subtitle{ font-size:13px; color:var(--text-3); margin-top:2px; overflow-wrap:anywhere; }
.dialer-phone{
  font-size:17px; font-weight:700; color:var(--text-2); margin-top:12px;
  letter-spacing:.02em; font-family:'SF Mono','Menlo',monospace;
}
.dialer-status{ font-size:13px; font-weight:600; color:var(--primary-dark); margin-top:6px; min-height:18px; }
.dialer-rec-indicator{
  display:none; align-items:center; gap:7px; margin-top:10px;
  background:var(--red-bg); color:#b3261e; font-size:12px; font-weight:700;
  padding:6px 13px; border-radius:20px;
}
.dialer-rec-dot{ width:7px; height:7px; border-radius:50%; background:#f04438; animation:ivrPulse 1.2s infinite; flex-shrink:0; }
.dialer-actions{ display:flex; align-items:center; justify-content:center; gap:22px; margin-top:26px; }
.dialer-btn{
  display:flex; flex-direction:column; align-items:center; gap:7px;
  border:none; background:none; cursor:pointer; text-decoration:none;
  font-family:inherit; font-size:12.5px; font-weight:700; color:var(--text-2);
}
.dialer-btn-ic{
  width:60px; height:60px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 8px 20px rgba(16,24,40,.18);
  transition:transform .12s ease;
}
.dialer-btn:active .dialer-btn-ic{ transform:scale(.93); }
.dialer-btn-call .dialer-btn-ic{ background:var(--green); }
.dialer-btn-call .dialer-btn-ic::before{ content:''; width:24px; height:24px; mask:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.127.96.361 1.903.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0 1 22 16.92z"/></svg>') center/24px no-repeat; -webkit-mask:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.127.96.361 1.903.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0 1 22 16.92z"/></svg>') center/24px no-repeat; background-color:#fff; }
.dialer-btn-end .dialer-btn-ic{ background:var(--red); }
.dialer-btn-end .dialer-btn-ic::before{ content:''; width:22px; height:22px; border-radius:6px; background:#fff; }
.dialer-btn-end-nudge .dialer-btn-ic{ animation:dialerNudge .5s ease 3; box-shadow:0 0 0 6px rgba(240,68,56,.25), 0 8px 20px rgba(16,24,40,.18); }
@keyframes dialerNudge{ 0%,100%{ transform:scale(1); } 50%{ transform:scale(1.1); } }
.dialer-hint{ font-size:11.5px; color:var(--text-3); line-height:1.5; margin-top:22px; max-width:260px; }

.dialer-toast{
  position:fixed; top:16px; left:50%; transform:translateX(-50%) translateY(-12px);
  z-index:210; opacity:0; transition:all .25s ease;
  background:#1f2430; color:#fff; font-size:12.5px; font-weight:600;
  padding:12px 16px; border-radius:14px; box-shadow:0 10px 26px rgba(0,0,0,.25);
  display:flex; align-items:center; gap:12px; max-width:calc(100vw - 32px);
}
.dialer-toast.show{ opacity:1; transform:translateX(-50%) translateY(0); }
.dialer-toast a{ color:#8fb4ff; font-weight:700; white-space:nowrap; text-decoration:underline; }

@media (max-width:640px){
  .dialer-card{ padding:30px 22px 26px; }
  .dialer-actions{ gap:30px; }
}

/* ======================================================================
   Guided Product Tour (assets/js/product-tour.js)
   ====================================================================== */

/* "What would you like to learn?" picker — warm, light, attention-grabbing
   background (not the app's usual plain white) so the whole popup reads
   as "look here, this is a helper", while text stays dark/high-contrast
   for easy reading. */
.tour-picker-overlay{ position:fixed; inset:0; background:rgba(17,24,39,.6); display:none; align-items:center; justify-content:center; z-index:2100; padding:20px; }
.tour-picker-overlay.open{ display:flex; }
.tour-picker{ position:relative; background:linear-gradient(160deg, var(--tour-bg-1) 0%, var(--tour-bg-2) 100%); border:1px solid var(--tour-border); border-radius:22px; width:100%; max-width:640px; max-height:86vh; overflow-y:auto; padding:28px; box-shadow:0 14px 38px rgba(13,122,80,.18), 0 2px 10px rgba(16,24,40,.08); animation:tourPopIn .22s ease-out; }
.tour-picker-body-wrap{ position:relative; min-height:160px; }
.tour-picker-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:4px; padding-right:28px; }
.tour-picker h2{ margin:0 0 4px; font-size:18px; line-height:1.3; color:var(--tour-text-1); overflow-wrap:anywhere; }
.tour-picker .sub{ color:var(--tour-text-2); font-size:13px; margin:0 0 14px; line-height:1.5; overflow-wrap:anywhere; }
.tour-picker .tour-close-btn{ position:absolute; top:22px; right:22px; }
.tour-lang-row{ display:flex; align-items:center; gap:8px; background:rgba(255,255,255,.6); border:1px solid var(--tour-border); border-radius:10px; padding:7px 10px; margin-bottom:16px; }
.tour-lang-row label{ font-size:12px; font-weight:600; color:var(--tour-text-2); white-space:nowrap; }
.tour-lang-icon{ display:flex; align-items:center; color:var(--tour-accent-dark); flex-shrink:0; }
.tour-lang-icon svg{ display:block; }
.tour-lang-row select{ flex:1; min-width:0; border:1px solid var(--tour-border); background:#fff; color:var(--tour-text-1); font-size:12.5px; font-family:inherit; border-radius:7px; padding:5px 6px; cursor:pointer; }
.tour-complete-banner{ background:var(--green-bg); color:#0a7a4c; border-radius:12px; padding:11px 14px; font-size:13px; font-weight:600; margin-bottom:16px; overflow-wrap:anywhere; }
.tour-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(230px,1fr)); gap:12px; }
.tour-card{ text-align:left; border:1px solid var(--tour-border); background:#fffefb; border-radius:16px; padding:16px; display:flex; flex-direction:column; gap:8px; cursor:pointer; transition:all .15s ease; position:relative; font-family:inherit; }
.tour-card:hover{ border-color:var(--tour-accent); box-shadow:0 4px 14px rgba(25,169,112,.18); transform:translateY(-1px); }
.tour-card-icon{ width:38px; height:38px; border-radius:11px; background:var(--primary-light); color:var(--primary); display:flex; align-items:center; justify-content:center; }
.tour-card h4{ margin:0; font-size:14px; color:var(--tour-text-1); overflow-wrap:anywhere; }
.tour-card p{ margin:0; font-size:12.5px; color:var(--tour-text-2); line-height:1.5; overflow-wrap:anywhere; }
.tour-done-badge{ position:absolute; top:12px; right:12px; background:var(--green-bg); color:#0a7a4c; font-size:10px; font-weight:700; padding:3px 8px; border-radius:20px; }
.tour-picker-foot{ margin-top:18px; padding-top:16px; border-top:1px solid var(--tour-border); }
.tour-autoshow-pref{ display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--tour-text-2); cursor:pointer; }
.tour-autoshow-pref input{ width:15px; height:15px; }

/* Spotlight dimming — four strips frame the highlighted element, leaving
   it (and only it) clickable; a single full-screen version is used for
   steps with no specific element to point at. */
.tour-frame{ position:fixed; background:rgba(16,24,40,.58); z-index:2200; pointer-events:auto; }
.tour-ring{ position:fixed; border:2px solid var(--primary); border-radius:12px; z-index:2201; pointer-events:none; animation:tourPulse 1.6s ease-in-out infinite; }
@keyframes tourPulse{
  0%, 100% { box-shadow:0 0 0 4px rgba(59,102,245,.25); }
  50%      { box-shadow:0 0 0 9px rgba(59,102,245,.12); }
}
@keyframes tourPopIn{
  0%   { opacity:0; transform:scale(.96); }
  100% { opacity:1; transform:scale(1); }
}
.tour-tooltip.center{ animation:tourPopInCenter .22s ease-out; }
@keyframes tourPopInCenter{
  0%   { opacity:0; transform:translate(-50%,-50%) scale(.94); }
  100% { opacity:1; transform:translate(-50%,-50%) scale(1); }
}

/* Step tooltip — same mint-green "attention-grabbing" treatment as the
   picker, with a soft glow so it pops against whatever page content it's
   sitting next to. Text stays a dark, high-contrast ink color rather
   than the app's lighter muted gray. */
.tour-tooltip{
  position:fixed; z-index:2202;
  /* No overflow:hidden here (it used to clip content to the box, which
     is exactly what was cutting off longer translated text — a script
     like Malayalam routinely runs longer than the English original).
     Instead, the box is allowed to grow with its content, and only
     scrolls internally as a last resort if it would ever be taller than
     the viewport has room for. */
  max-height:calc(100vh - 24px); overflow-y:auto;
  background:linear-gradient(160deg, var(--tour-bg-1) 0%, var(--tour-bg-2) 100%);
  border:1px solid var(--tour-border);
  border-radius:16px;
  box-shadow:0 12px 32px rgba(13,122,80,.2), 0 2px 10px rgba(16,24,40,.08);
  padding:20px 20px 18px;
  width:320px; max-width:calc(100vw - 24px);
  animation:tourPopIn .2s ease-out;
}
.tour-tooltip.center{ top:50%; left:50%; transform:translate(-50%,-50%); width:360px; text-align:center; }
.tour-step-count{ font-size:10.5px; font-weight:800; color:var(--tour-accent-dark); text-transform:uppercase; letter-spacing:.05em; margin-bottom:7px; padding-right:20px; overflow-wrap:anywhere; }
.tour-tooltip h4{ margin:0 0 7px; font-size:15.5px; font-weight:700; color:var(--tour-text-1); overflow-wrap:anywhere; }
.tour-tooltip p{ margin:0 0 14px; font-size:13.5px; color:var(--tour-text-2); line-height:1.6; overflow-wrap:anywhere; }
.tour-click-hint{ display:flex; align-items:flex-start; gap:6px; background:#fff; border:1px solid var(--tour-accent); color:var(--tour-accent-dark); font-size:12px; font-weight:700; padding:7px 11px; border-radius:10px; margin:-4px 0 14px; overflow-wrap:anywhere; }
/* Stacked (dots, then buttons) rather than a single side-by-side row —
   a translated Back/Next label can run quite a bit longer than the
   English original, and the global .btn style never wraps its own text
   (white-space:nowrap), so a single row forced the buttons wider than
   the tooltip had room for. They used to just get silently clipped by
   the tooltip's old overflow:hidden; now that's gone (it was hiding
   translated paragraph text too), so instead the buttons get a full-
   width row of their own, where they can't run out of room. */
.tour-tooltip-actions{ display:flex; flex-direction:column; gap:10px; }
.tour-progress-dots{ display:flex; gap:4px; align-items:center; justify-content:center; }
.tour-progress-dots span{ width:6px; height:6px; border-radius:50%; background:rgba(13,122,80,.25); transition:all .15s ease; }
.tour-progress-dots span.active{ background:var(--tour-accent); width:16px; border-radius:4px; }
.tour-tooltip-btns{ display:flex; gap:8px; width:100%; }
.tour-tooltip-btns .btn{ flex:1 1 0; min-width:0; white-space:normal; text-align:center; line-height:1.3; }
.tour-tooltip .tour-close-btn{ top:10px; right:10px; width:26px; height:26px; background:rgba(255,255,255,.7); }

.tour-close-btn{ background:var(--shell-bg); border:none; width:30px; height:30px; border-radius:9px; display:flex; align-items:center; justify-content:center; color:var(--text-2); flex-shrink:0; font-size:18px; line-height:1; cursor:pointer; }
.tour-close-btn:hover{ background:var(--border-strong); color:var(--text-1); }

.tour-lang-loading{ font-size:11px; color:var(--tour-accent-dark); font-weight:600; white-space:nowrap; }
.tour-lang-loading.tour-lang-error{ color:var(--red); }

/* Visible reason the last translation attempt didn't fully succeed —
   shown directly in the picker or step tooltip (not just a hidden badge)
   so a failure is never silent, and the detail can be read/screenshotted
   without opening devtools. */
.tour-translate-issue{
  margin-top:10px; padding:8px 10px; border-radius:9px;
  background:rgba(217,45,32,.08); border:1px solid rgba(217,45,32,.25);
  color:#9c2a1d; font-size:11.5px; line-height:1.5; font-weight:600;
  word-break:break-word;
}

/* Full cover over the tour grid while a whole-tour translation fetch is
   in flight — goes straight from English to fully translated instead of
   flashing English content first and swapping pieces in as they arrive. */
.tour-translating-overlay{
  position:absolute; inset:0; z-index:5;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px;
  background:linear-gradient(160deg, var(--tour-bg-1) 0%, var(--tour-bg-2) 100%);
  border-radius:14px;
  color:var(--tour-accent-dark); font-size:13px; font-weight:700;
}
.tour-translating-spinner{
  width:26px; height:26px; border-radius:50%;
  border:3px solid var(--tour-border); border-top-color:var(--tour-accent);
  animation:tourSpin .7s linear infinite;
}
@keyframes tourSpin{ to{ transform:rotate(360deg); } }

@media (max-width:640px){
  .tour-tooltip{ width:auto; left:12px !important; right:12px; }
  .tour-tooltip.center{ left:12px; right:12px; width:auto; transform:translateY(-50%); }
  .tour-lang-row{ flex-wrap:wrap; }
}
