:root {
  --blue: #22539F;
  --blue-dark: #1A4080;
  --blue-soft: #EEF3FB;
  --red: #E71E35;
  --red-soft: #FDEEF0;
  --ink: #1B1F27;
  --muted: #667085;
  --line: #E3E7EF;
  --bg: #F4F6FA;
  --card: #FFFFFF;
  --ok: #1E8E5A;
  --ok-soft: #E8F6EF;
  --warn: #B7791F;
  --warn-soft: #FDF4E3;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 14px 34px -10px rgba(16, 24, 40, .22), 0 4px 10px -4px rgba(16, 24, 40, .08);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}
html { scroll-behavior: smooth; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 10px; }
small, .small { font-size: 12.5px; color: var(--muted); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ shell */
#app { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px; flex: 0 0 232px;
  background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand img { width: 136px; height: auto; display: block; }
.brand-tag {
  font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: #fff; background: var(--blue); border-radius: 4px; padding: 2px 6px;
}
.nav { padding: 4px 10px 18px; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 9px;
  color: #3C4453; font-weight: 600; font-size: 14.2px; text-decoration: none;
  position: relative;
  transition: background-color .18s ease, color .18s ease;
}
.nav a:hover { background: #F2F5FA; text-decoration: none; }
.nav a.on { background: var(--blue-soft); color: var(--blue); }
.nav a.on::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--blue);
  animation: ui-grow-y .35s var(--ease) both;
}
.nav .ico { width: 18px; text-align: center; font-size: 15px; flex: 0 0 18px;
            transition: transform .2s var(--ease); }
.nav a:hover .ico { transform: translateX(2px) scale(1.08); }
.nav .pill {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 800; border-radius: 20px; padding: 1px 7px; min-width: 20px; text-align: center;
  animation: ui-pulse 2.4s ease-out infinite;
}
.nav-sep { margin: 10px 11px 4px; font-size: 10.5px; font-weight: 800; letter-spacing: .07em;
           text-transform: uppercase; color: #98A2B3; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 22px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar .who { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--blue); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
.content { padding: 20px 22px 60px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .grow { flex: 1; min-width: 220px; }
.page-head p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; }

/* ------------------------------------------------------------- components */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px;
}
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { flex: 1; min-width: 150px; }

.grid { display: grid; gap: 14px; }
/* Grid and flex children default to min-width:auto, which lets a wide table
   stretch the whole page on a phone. This keeps them inside their column. */
.grid > *, .split > *, .main, .content { min-width: 0; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); }

.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
       padding: 14px 16px; box-shadow: var(--shadow);
       transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s; }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -10px rgba(16, 24, 40, .18); }
.kpi .label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.kpi .foot { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.alert { border-color: #F7C9CF; background: var(--red-soft); }
.kpi.alert .value { color: var(--red); }
.kpi.good .value { color: var(--ok); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 9px; padding: 8px 13px; font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease,
              box-shadow .2s var(--ease), transform .12s var(--ease);
}
.btn:hover { background: #F7F9FC; text-decoration: none; border-color: #D4DAE5; }
.btn:active:not(:disabled) { transform: scale(.96); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(34, 83, 159, .2); }
.btn.pri { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.pri:hover { background: var(--blue-dark); border-color: var(--blue-dark);
                 box-shadow: 0 6px 16px -6px rgba(34, 83, 159, .55); }
.btn.danger { color: var(--red); border-color: #F3C6CC; }
.btn.danger:hover { background: var(--red-soft); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

label { display: block; font-size: 12.5px; font-weight: 700; color: #475467; margin-bottom: 4px; }
/* Matches bare <input> too, which defaults to type=text and would otherwise be unstyled. */
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=submit]):not([type=button]):not([type=hidden]),
select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #D4DAE5; border-radius: 9px;
  font: inherit; font-size: 14.5px; background: #fff; color: var(--ink);
  transition: border-color .16s ease, box-shadow .2s var(--ease), background-color .16s ease;
}
input:not([type=checkbox]):not([type=radio]):not([type=file]):hover, select:hover, textarea:hover { border-color: #B8C2D3; }
input[type=checkbox], input[type=radio] { accent-color: var(--blue); cursor: pointer; }
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(34, 83, 159, .12);
}
.field { margin-bottom: 12px; }
.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.hint { font-size: 12px; color: var(--muted); margin-top: 3px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase;
     letter-spacing: .04em; background: #FAFBFD; white-space: nowrap; }
tbody tr:hover { background: #FAFBFD; }
tbody tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--line);
              border-radius: var(--radius); background: #fff; box-shadow: var(--shadow);
              -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 680px; }
/* Tables sitting inside a narrow column: let them shrink and wrap instead of clipping. */
.table-wrap.flat { border: 0; box-shadow: none; }
.table-wrap.flat table { min-width: 0; }
.table-wrap.flat th, .table-wrap.flat td { padding: 9px 8px; }

.b { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px;
     border-radius: 20px; white-space: nowrap; }
.b.new { background: var(--blue-soft); color: var(--blue); }
.b.contacted { background: #EEF0F4; color: #475467; }
.b.interested { background: var(--warn-soft); color: var(--warn); }
.b.demo { background: #EDE9FE; color: #6D3BEB; }
.b.negotiation { background: #FFF1E6; color: #C2570C; }
.b.converted { background: var(--ok-soft); color: var(--ok); }
.b.lost { background: var(--red-soft); color: var(--red); }
.b.hot { background: var(--red-soft); color: var(--red); }
.b.warm { background: var(--warn-soft); color: var(--warn); }
.b.cold { background: #EEF0F4; color: #667085; }
.b.due { background: var(--red-soft); color: var(--red); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 6px 12px; border-radius: 20px; border: 1px solid var(--line);
          background: #fff; font-size: 13.5px; font-weight: 600; color: #475467;
          transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .12s var(--ease); }
.tabs a.on { background: var(--blue); border-color: var(--blue); color: #fff;
             box-shadow: 0 4px 12px -6px rgba(34, 83, 159, .6); }
.tabs a:hover { text-decoration: none; }
.tabs a:not(.on):hover { background: #F2F5FA; border-color: #D4DAE5; color: var(--ink); }
.tabs a:active { transform: scale(.96); }

/* All leads: Table | Board switch. */
.view-switch { display: inline-flex; gap: 3px; padding: 3px; background: #F2F5FA; border: 1px solid var(--line);
               border-radius: 10px; }
.view-switch a { padding: 6px 13px; border-radius: 7px; font-size: 13.5px; font-weight: 700; color: var(--muted);
                 transition: background-color .18s, color .18s, box-shadow .18s; }
.view-switch a:hover { text-decoration: none; color: var(--ink); }
.view-switch a.on { background: #fff; color: var(--blue); box-shadow: 0 1px 3px rgba(16,24,40,.14); }
.page-head .view-switch + .btn { margin-left: 8px; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty b { display: block; font-size: 15.5px; color: var(--ink); margin-bottom: 4px; }

.toast-wrap { position: fixed; top: 14px; right: 14px; z-index: 100;
              display: flex; flex-direction: column; gap: 8px; max-width: min(92vw, 380px); }
.toast { background: #10233F; color: #fff; padding: 11px 15px 13px; border-radius: 10px;
         font-size: 14px; font-weight: 600; box-shadow: 0 8px 24px rgba(16, 24, 40, .18);
         position: relative; overflow: hidden; cursor: pointer;
         animation: ui-toast-in .45s var(--ease-spring) both; }
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
                background: rgba(255, 255, 255, .35); transform-origin: left;
                animation: ui-shrink 4.6s linear both; }
.toast.out { animation: ui-toast-out .32s var(--ease) forwards; }
.toast.bad { background: var(--red); }

/* --------------------------------------------------------------- pipeline */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { flex: 1 0 205px; min-width: 205px; background: #EFF2F7; border-radius: var(--radius); padding: 10px; }
.col-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.col-head b { font-size: 13.5px; }
.col-head .count { margin-left: auto; background: #fff; border-radius: 20px;
                   padding: 1px 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.lead-card { background: #fff; border: 1px solid var(--line); border-radius: 10px;
             padding: 10px 11px; margin-bottom: 8px; box-shadow: var(--shadow);
             transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s; }
.lead-card:hover { transform: translateY(-2px); border-color: #D4DAE5;
                   box-shadow: 0 10px 22px -10px rgba(16, 24, 40, .2); }
.lead-card a.name { font-weight: 700; font-size: 14px; color: var(--ink); }
.lead-card .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.lead-card .row { display: flex; align-items: center; gap: 6px; margin-top: 7px; flex-wrap: wrap; }

/* --------------------------------------------------------------- timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 28px; }
.timeline li::before {
  content: ""; position: absolute; left: 6px; top: 5px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft);
}
.timeline li::after {
  content: ""; position: absolute; left: 10px; top: 18px; bottom: 0; width: 1px; background: var(--line);
}
.timeline li:last-child::after { display: none; }
.timeline .tl-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.timeline .tl-kind { font-weight: 700; font-size: 13.5px; }
.timeline .tl-when { font-size: 12px; color: var(--muted); }
.timeline .tl-body { font-size: 14px; margin-top: 2px; white-space: pre-wrap; }
.timeline li.k-stage::before { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.timeline li.k-whatsapp::before { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.timeline li.k-note::before { background: #98A2B3; box-shadow: 0 0 0 3px #EEF0F4; }

/* ------------------------------------------------------------------ misc */
.bar { height: 8px; background: #EDF0F5; border-radius: 20px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--blue); border-radius: 20px; }
.funnel-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.funnel-row .nm { width: 108px; font-size: 13.5px; font-weight: 600; flex: 0 0 108px; }
.funnel-row .bar { flex: 1; }
.funnel-row .vl { width: 68px; text-align: right; font-size: 13px; font-weight: 700; flex: 0 0 68px; }

.split { display: grid; gap: 14px; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
           align-items: end; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }

/* ------------------------------------------------------------------ login */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
             background: linear-gradient(160deg, #EEF3FB, #F7F9FC); }
.auth { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line);
        border-radius: 16px; padding: 28px; box-shadow: 0 10px 30px rgba(16, 24, 40, .07); }
.auth img { width: 160px; margin-bottom: 20px; }

/* ----------------------------------------------------------- public form */
.pub-wrap { min-height: 100vh; background: var(--bg); padding: 24px 16px 60px; }
.pub { max-width: 540px; margin: 0 auto; background: #fff; border: 1px solid var(--line);
       border-radius: 16px; padding: 24px; box-shadow: var(--shadow); }
.pub img { width: 160px; margin-bottom: 14px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ------------------------------------------------------------------ phone */
.menu-btn { display: none; }
@media (max-width: 900px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .card { overflow-x: hidden; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60; transform: translateX(-100%);
    transition: transform .32s var(--ease); box-shadow: 0 0 40px rgba(16, 24, 40, .18);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 50;
                         animation: ui-fade .25s ease backwards; }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px 14px 60px; }
  .topbar { padding: 10px 14px; }
  .fields { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .page-head h1 { font-size: 19px; }
  .kpi .value { font-size: 22px; }
}

@media print {
  .sidebar, .topbar, .btn, .tabs, .toast-wrap { display: none !important; }
  body { background: #fff; }
  .card, .table-wrap { border: 0; box-shadow: none; }
}

/* ============================================================== motion */
/* Page entrance: sections rise in one after another. */
@keyframes ui-rise   { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes ui-fade   { from { opacity: 0; } to { opacity: 1; } }
@keyframes ui-slide-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
@keyframes ui-grow   { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes ui-grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes ui-shrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes ui-pulse  { 0% { box-shadow: 0 0 0 0 rgba(231, 30, 53, .45); }
                       70%, 100% { box-shadow: 0 0 0 7px rgba(231, 30, 53, 0); } }
@keyframes ui-toast-in  { from { opacity: 0; transform: translateX(40px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes ui-toast-out { to { opacity: 0; transform: translateX(40px) scale(.96); } }
@keyframes ui-pop-in { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes ui-shake  { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@keyframes ui-flash  { 0% { box-shadow: 0 0 0 0 rgba(34, 83, 159, .45); } 100% { box-shadow: 0 0 0 14px rgba(34, 83, 159, 0); } }
@keyframes ui-opt-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes ui-from-r { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: none; } }
@keyframes ui-from-l { from { opacity: 0; transform: translateX(-22px); } to { opacity: 1; transform: none; } }
@keyframes ui-zoom   { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes ui-load   { 0% { transform: scaleX(0); } 40% { transform: scaleX(.55); } 100% { transform: scaleX(.92); } }

.content > :not(.toast-wrap), .auth, .pub { animation: ui-rise .5s var(--ease) backwards; }
.content > :nth-child(2) { animation-delay: .05s; }
.content > :nth-child(3) { animation-delay: .10s; }
.content > :nth-child(4) { animation-delay: .15s; }
.content > :nth-child(5) { animation-delay: .20s; }
.content > :nth-child(6) { animation-delay: .25s; }
.content > :nth-child(n+7) { animation-delay: .30s; }

.grid > * { animation: ui-rise .5s var(--ease) backwards; }
.grid > :nth-child(2) { animation-delay: .06s; }
.grid > :nth-child(3) { animation-delay: .12s; }
.grid > :nth-child(4) { animation-delay: .18s; }
.grid > :nth-child(n+5) { animation-delay: .22s; }

tbody tr { animation: ui-fade .4s ease backwards; }
tbody tr:nth-child(2) { animation-delay: .03s; } tbody tr:nth-child(3) { animation-delay: .06s; }
tbody tr:nth-child(4) { animation-delay: .09s; } tbody tr:nth-child(5) { animation-delay: .12s; }
tbody tr:nth-child(6) { animation-delay: .15s; } tbody tr:nth-child(7) { animation-delay: .18s; }
tbody tr:nth-child(8) { animation-delay: .21s; } tbody tr:nth-child(n+9) { animation-delay: .24s; }
tbody tr { transition: background-color .15s ease; }

.col { animation: ui-rise .5s var(--ease) backwards; }
.col:nth-child(2) { animation-delay: .05s; } .col:nth-child(3) { animation-delay: .10s; }
.col:nth-child(4) { animation-delay: .15s; } .col:nth-child(5) { animation-delay: .20s; }
.col:nth-child(n+6) { animation-delay: .25s; }
.lead-card { animation: ui-rise .45s var(--ease) backwards; }
.lead-card:nth-child(3) { animation-delay: .08s; } .lead-card:nth-child(4) { animation-delay: .14s; }
.lead-card:nth-child(n+5) { animation-delay: .2s; }

.timeline li { animation: ui-slide-in .45s var(--ease) backwards; }
.timeline li:nth-child(2) { animation-delay: .05s; } .timeline li:nth-child(3) { animation-delay: .1s; }
.timeline li:nth-child(4) { animation-delay: .15s; } .timeline li:nth-child(n+5) { animation-delay: .2s; }

.bar > span { transform-origin: left center; animation: ui-grow .9s var(--ease) .2s backwards; }
.b { transition: transform .15s var(--ease); }

details > summary { transition: opacity .15s; }
details > summary:hover { opacity: .8; }
details[open] > :not(summary) { animation: ui-rise .3s var(--ease) backwards; }

.card:target, .card.flash { animation: ui-flash 1.1s ease-out .35s 2; }

/* Top loading bar while the next page loads. */
.ui-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 300;
               background: linear-gradient(90deg, var(--blue), #4F86D9, var(--red));
               transform: scaleX(0); transform-origin: left; opacity: 0; pointer-events: none; }
.ui-progress.go { opacity: 1; animation: ui-load 6s cubic-bezier(.1, .7, .2, 1) forwards; }

/* ============================================================ dropdown */
.ui-select, .ui-date { position: relative; width: 100%; }
.ui-native { position: absolute !important; inset: 0 !important; width: 100% !important; height: 100% !important;
             opacity: 0 !important; pointer-events: none !important; padding: 0 !important;
             border: 0 !important; margin: 0 !important; }

.ui-trigger {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 9px 11px; border: 1px solid #D4DAE5; border-radius: 9px; background: #fff;
  font: inherit; font-size: 14.5px; color: var(--ink); text-align: left; cursor: pointer;
  transition: border-color .16s ease, box-shadow .2s var(--ease), background-color .16s ease;
}
.ui-trigger:hover { border-color: #B8C2D3; }
.ui-trigger:focus-visible, .ui-trigger.is-open {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(34, 83, 159, .12);
}
.ui-trigger:disabled { background: #F7F9FC; color: var(--muted); cursor: not-allowed; }
.ui-trigger .ui-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-trigger.placeholder .ui-label { color: #98A2B3; }
.ui-trigger .ui-chev { display: grid; color: #98A2B3; transition: transform .25s var(--ease), color .2s; }
.ui-trigger.is-open .ui-chev { transform: rotate(180deg); color: var(--blue); }
.ui-trigger .ui-ico { display: grid; color: var(--blue); flex: 0 0 auto; }
.ui-trigger .ui-rel { font-size: 11px; font-weight: 700; color: var(--blue); background: var(--blue-soft);
                      border-radius: 20px; padding: 1px 8px; flex: 0 0 auto; }
.ui-date { container-type: inline-size; }
@container (max-width: 200px) { .ui-trigger .ui-rel { display: none; } }
.ui-select.invalid .ui-trigger { border-color: var(--red); box-shadow: 0 0 0 3px rgba(231, 30, 53, .12);
                                 animation: ui-shake .4s ease; }

.ui-pop {
  position: fixed; z-index: 200; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  max-width: min(380px, calc(100vw - 16px));
  opacity: 0; transform: translateY(-6px) scale(.97); transform-origin: top center;
  transition: opacity .16s ease, transform .22s var(--ease); pointer-events: none;
}
.ui-pop.up { transform-origin: bottom center; transform: translateY(6px) scale(.97); }
.ui-pop.open { opacity: 1; transform: none; pointer-events: auto; }

.ui-search-wrap { display: flex; align-items: center; gap: 6px; padding: 8px 10px;
                  border-bottom: 1px solid var(--line); color: #98A2B3; }
.ui-search-wrap svg { flex: 0 0 auto; }
input.ui-search { border: 0 !important; box-shadow: none !important; padding: 4px 2px !important;
                  font-size: 14px !important; background: transparent !important; }

.ui-opts { position: relative; max-height: 284px; overflow-y: auto; padding: 6px; outline: none;
           overscroll-behavior: contain; scrollbar-width: thin; }
.ui-opt {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px;
  font-size: 14px; cursor: pointer; user-select: none;
  transition: background-color .12s ease, color .12s ease;
}
.ui-pop.open .ui-opt { animation: ui-opt-in .24s var(--ease) both; animation-delay: calc(var(--i, 0) * 14ms); }
.ui-opt .ui-tick { display: grid; width: 16px; color: var(--blue); opacity: 0; transform: scale(.5);
                   transition: opacity .15s, transform .2s var(--ease-spring); }
.ui-opt .ui-txt { flex: 1; min-width: 0; }
.ui-opt.active { background: #F2F5FA; }
.ui-opt.sel { color: var(--blue); font-weight: 700; background: var(--blue-soft); }
.ui-opt.sel .ui-tick { opacity: 1; transform: none; }
.ui-opt.ph { color: var(--muted); }
.ui-opt.dis { opacity: .4; cursor: not-allowed; }
.ui-opt.hide, .ui-group.hide, .ui-empty.hide { display: none; }
.ui-group { font-size: 10.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
            color: #98A2B3; padding: 10px 10px 4px; }
.ui-group:first-child { padding-top: 4px; }
.ui-empty { padding: 14px 10px; text-align: center; font-size: 13px; color: var(--muted); }

/* ============================================================ calendar */
.ui-cal { width: 326px; padding: 12px; }
.ui-cal-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.ui-nav, .ui-cal-title {
  border: 0; background: none; font: inherit; cursor: pointer; color: var(--ink);
  border-radius: 8px; transition: background-color .15s ease, transform .12s var(--ease);
}
.ui-nav { width: 32px; height: 32px; display: grid; place-items: center; color: #475467; }
.ui-nav:hover, .ui-cal-title:hover { background: #F2F5FA; }
.ui-nav:active { transform: scale(.9); }
.ui-cal-title { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
                font-weight: 800; font-size: 14.5px; padding: 6px 8px; }
.ui-caret { display: grid; color: #98A2B3; transition: transform .25s var(--ease); }
.ui-caret.flip { transform: rotate(180deg); }
.ui-nav:focus-visible, .ui-cal-title:focus-visible, .ui-day:focus-visible, .ui-month:focus-visible,
.ui-chip:focus-visible, .ui-clear:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--blue); }

.ui-cal-body { overflow: hidden; min-height: 248px; }
.ui-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px 0; }
.ui-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding-top: 6px; }
.ui-days.from-r, .ui-months.from-r { animation: ui-from-r .28s var(--ease) both; }
.ui-days.from-l, .ui-months.from-l { animation: ui-from-l .28s var(--ease) both; }
.ui-days.zoom, .ui-months.zoom { animation: ui-zoom .26s var(--ease) both; }
.ui-wd { text-align: center; font-size: 11px; font-weight: 800; color: #98A2B3;
         letter-spacing: .04em; padding: 4px 0 6px; }

.ui-day {
  position: relative; height: 36px; border: 0; background: none; font: inherit;
  font-size: 13.5px; font-weight: 600; color: var(--ink); cursor: pointer; border-radius: 9px;
  transition: background-color .14s ease, color .14s ease, transform .14s var(--ease);
}
.ui-day:hover:not(:disabled):not(.sel) { background: var(--blue-soft); color: var(--blue); }
.ui-day:active:not(:disabled) { transform: scale(.9); }
.ui-day.out { color: #C0C7D3; }
.ui-day.today { color: var(--blue); font-weight: 800; }
.ui-day.today::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px;
                       margin-left: -2px; border-radius: 50%; background: currentColor; }
.ui-day.sel { background: var(--blue); color: #fff; box-shadow: 0 6px 14px -6px rgba(34, 83, 159, .7); }
.ui-day.sel.just { animation: ui-pop-in .3s var(--ease-spring); }
.ui-day.in-range { background: var(--blue-soft); color: var(--blue); border-radius: 0; }
.ui-day.r-start:not(.sel), .ui-day.r-end:not(.sel) { background: #D6E2F5; color: var(--blue); }
.ui-day.dis { color: #D0D5DD; cursor: not-allowed; text-decoration: line-through; }

.ui-month {
  height: 44px; border: 0; border-radius: 10px; background: #F7F9FC; font: inherit;
  font-size: 13.5px; font-weight: 700; color: #344054; cursor: pointer;
  transition: background-color .14s ease, color .14s ease, transform .14s var(--ease);
}
.ui-month:hover { background: var(--blue-soft); color: var(--blue); }
.ui-month:active { transform: scale(.94); }
.ui-month.today { box-shadow: inset 0 0 0 1.5px var(--blue); color: var(--blue); }
.ui-month.sel { background: var(--blue); color: #fff; }

.ui-cal-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
               border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; }
.ui-chip {
  border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 4px 10px;
  font: inherit; font-size: 12.5px; font-weight: 700; color: #344054; cursor: pointer;
  transition: background-color .14s, border-color .14s, color .14s, transform .12s var(--ease);
}
.ui-chip:hover:not(:disabled) { background: var(--blue-soft); border-color: #C7D6EE; color: var(--blue); }
.ui-chip:active:not(:disabled) { transform: scale(.94); }
.ui-chip:disabled { opacity: .4; cursor: not-allowed; }
.ui-clear { margin-left: auto; border: 0; background: none; font: inherit; font-size: 12.5px;
            font-weight: 700; color: var(--red); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.ui-clear:hover { background: var(--red-soft); }

/* Phones: dropdowns and calendars slide up from the bottom. */
.ui-backdrop { position: fixed; inset: 0; z-index: 190; background: rgba(16, 24, 40, .4);
               opacity: 0; transition: opacity .25s ease; }
.ui-backdrop.open { opacity: 1; }
.ui-pop.sheet {
  left: 0 !important; right: 0; bottom: 0; top: auto !important; min-width: 0 !important;
  max-width: none; width: auto; border-radius: 18px 18px 0 0; max-height: 78vh;
  padding-bottom: env(safe-area-inset-bottom, 0); transform: translateY(100%);
  transition: opacity .2s ease, transform .32s var(--ease);
}
.ui-pop.sheet.open { transform: none; }
.ui-pop.sheet::before { content: ""; display: block; width: 38px; height: 4px; border-radius: 4px;
                        background: #D0D5DD; margin: 8px auto 2px; }
.ui-pop.sheet .ui-opts { max-height: 60vh; }
.ui-pop.sheet .ui-opt { padding: 12px; font-size: 15px; }
.ui-cal.sheet { width: auto; }
.ui-cal.sheet > * { max-width: 420px; margin-left: auto; margin-right: auto; }
.ui-cal.sheet .ui-day { height: 44px; }

/* ------------------------------------------------- new enquiry and staff */
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: #F2F5FA; color: var(--ink); }
.notice { padding: 11px 14px; margin-bottom: 12px; font-size: 14px; animation: ui-rise .3s var(--ease) backwards; }
.notice.bad  { border-color: #F7C9CF; background: var(--red-soft); color: var(--red); font-weight: 600; }
.notice.warn { border-color: #F2D9A6; background: var(--warn-soft); color: #7A5212; }
.notice.warn a { font-weight: 700; }
.dup-list { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.dup-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.enq-form { padding: 20px 22px; }
/* Call / walk-in or WhatsApp ad reply, chosen at the top of New enquiry. */
.via-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 22px; }
.via-opt { margin: 0; cursor: pointer; }
.via-opt input { position: absolute; opacity: 0; pointer-events: none; }
.via-opt span { display: flex; align-items: center; justify-content: center; height: 100%; padding: 12px 14px; border-radius: 11px;
                border: 1.5px solid var(--line); background: #fff; color: var(--ink);
                transition: border-color .2s, background-color .2s, box-shadow .2s, transform .12s var(--ease); }
.via-opt b { font-size: 14.5px; }
.via-opt small { font-size: 12px; font-weight: 500; color: var(--muted); }
.via-opt:hover span { border-color: #C9D2E0; }
.via-opt:active span { transform: scale(.98); }
.via-opt input:checked + span { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 6px 16px -10px var(--blue); }
.via-opt.wa input:checked + span { border-color: #16A34A; background: #E9F8EF; box-shadow: 0 6px 16px -10px #16A34A; }
.via-opt.other input:checked + span { border-color: #7C3AED; background: #F1EBFE; box-shadow: 0 6px 16px -10px #7C3AED; }
.via-opt input:focus-visible + span { box-shadow: 0 0 0 3px rgba(34, 83, 159, .25); }
@media (max-width: 560px) {
  .via-switch { gap: 6px; margin-bottom: 18px; }
  .via-opt span { padding: 10px 4px; text-align: center; min-height: 48px; }
  .via-opt b { font-size: 13px; }
}
.enq-step { display: flex; align-items: flex-start; gap: 12px; margin: 26px 0 14px; padding-top: 20px;
            border-top: 1px dashed var(--line); }
.enq-step:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.enq-step > span { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
                   background: var(--blue-soft); color: var(--blue); font-weight: 800; font-size: 13.5px;
                   transition: background-color .25s, color .25s, transform .3s var(--ease-spring); }
.enq-step h2 { margin: 3px 0 0; }
.enq-step p { margin: 2px 0 0; }
/* The step number fills in once you are working inside that step. */
.enq-step.active > span { background: var(--blue); color: #fff; transform: scale(1.08); }
.enq-actions { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }

.dup-live { margin-top: 6px; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; line-height: 1.5;
            background: var(--warn-soft); color: #7A5212; border: 1px solid #F2D9A6;
            animation: ui-rise .25s var(--ease) backwards; }
.dup-live a { font-weight: 700; }

/* Hot / Warm / Cold as one segmented control. */
.seg { display: inline-flex; gap: 4px; padding: 4px; background: #F2F5FA; border-radius: 11px; flex-wrap: wrap; }
.seg-opt { margin: 0; cursor: pointer; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span { display: block; padding: 7px 16px; border-radius: 8px; font-size: 13.5px; font-weight: 700;
                color: var(--muted); transition: background-color .2s, color .2s, box-shadow .2s, transform .15s var(--ease); }
.seg-opt:hover span { color: var(--ink); }
.seg-opt:active span { transform: scale(.95); }
.seg-opt input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(16,24,40,.14); }
.seg-opt.hot  input:checked + span { color: #fff; background: #E11D48; box-shadow: 0 4px 12px -4px #E11D48; }
.seg-opt.warm input:checked + span { color: #fff; background: #F59E0B; box-shadow: 0 4px 12px -4px #F59E0B; }
.seg-opt.cold input:checked + span { color: #fff; background: #0EA5E9; box-shadow: 0 4px 12px -4px #0EA5E9; }
.seg-opt input:focus-visible + span { box-shadow: 0 0 0 3px rgba(34, 83, 159, .25); }

.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.recent-list li:last-child { border-bottom: 0; }
.recent-list a { flex: 1; min-width: 0; display: flex; flex-direction: column; color: var(--ink); }
.recent-list a:hover b { color: var(--blue); }

.staff-form { animation: ui-rise .35s var(--ease) backwards; border-color: #CBD8EE; }
.role-help { background: #F7F9FC; border-radius: 9px; padding: 10px 12px; margin-top: 12px; line-height: 1.6; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 40px !important; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none;
          cursor: pointer; font-size: 15px; padding: 6px 8px; border-radius: 7px; opacity: .45; transition: opacity .15s; }
.pw-eye:hover, .pw-eye.on { opacity: 1; }
.check-row { display: flex; gap: 8px; flex-wrap: wrap; }
.check-pill { margin: 0; cursor: pointer; }
.check-pill input { position: absolute; opacity: 0; pointer-events: none; }
.check-pill span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 20px;
                   border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; color: #475467; background: #fff;
                   transition: background-color .18s, border-color .18s, color .18s, transform .12s var(--ease); }
.check-pill span::before { content: "＋"; font-size: 12px; opacity: .6; }
.check-pill input:checked + span { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.check-pill input:checked + span::before { content: "✓"; opacity: 1; }
.check-pill:active span { transform: scale(.95); }
.check-pill input:focus-visible + span { box-shadow: 0 0 0 3px rgba(34, 83, 159, .2); }

.avatar.sm { width: 30px; height: 30px; font-size: 12.5px; flex: none; }
.staff-table th.num, .staff-table td.num { text-align: right; }
.staff-table tr.off td { opacity: .55; }
.staff-table tr.off td:last-child { opacity: 1; }
.b.role-super   { background: #1B1F27; color: #fff; }
.b.role-manager { background: #EDE9FE; color: #6D3BEB; }
.b.role-sales   { background: var(--blue-soft); color: var(--blue); }
.b.role-teacher { background: var(--ok-soft); color: var(--ok); }
.remove-pop { position: relative; }
.remove-pop > summary { list-style: none; }
.remove-pop > summary::-webkit-details-marker { display: none; }
.remove-box { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 270px; padding: 12px;
              background: #fff; border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow-lg);
              white-space: normal; text-align: left; }

/* ================================================================ colour
   One palette for the whole CRM. Each stage and each priority has its own colour,
   used the same way everywhere: badges, pipeline columns, funnel bars, row edges. */
:root {
  --st-new: #2563EB;         --st-new-soft: #EAF1FE;
  --st-contacted: #0891B2;   --st-contacted-soft: #E6F6FA;
  --st-interested: #D97706;  --st-interested-soft: #FEF5E6;
  --st-demo: #7C3AED;        --st-demo-soft: #F1EBFE;
  --st-negotiation: #EA580C; --st-negotiation-soft: #FEF0E7;
  --st-converted: #16A34A;   --st-converted-soft: #E8F7EE;
  --st-lost: #DC2626;        --st-lost-soft: #FDECEC;
  --pri-hot: #E11D48;  --pri-hot-soft: #FFE8EE;
  --pri-warm: #F59E0B; --pri-warm-soft: #FEF3DA;
  --pri-cold: #0EA5E9; --pri-cold-soft: #E3F5FD;
}

/* Stage badges, re-tinted to the palette. */
.b.new         { background: var(--st-new-soft);         color: var(--st-new); }
.b.contacted   { background: var(--st-contacted-soft);   color: #0E7490; }
.b.interested  { background: var(--st-interested-soft);  color: #B45309; }
.b.demo        { background: var(--st-demo-soft);        color: var(--st-demo); }
.b.negotiation { background: var(--st-negotiation-soft); color: #C2410C; }
.b.converted   { background: var(--st-converted-soft);   color: #15803D; }
.b.lost        { background: var(--st-lost-soft);        color: var(--st-lost); }
.b.hot  { background: var(--pri-hot-soft);  color: var(--pri-hot); }
.b.warm { background: var(--pri-warm-soft); color: #B45309; }
.b.cold { background: var(--pri-cold-soft); color: #0369A1; }

/* Priority badge: a coloured dot and the word. Hot pulses gently. */
.prio { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700;
       padding: 2px 8px 2px 6px; border-radius: 20px; white-space: nowrap; vertical-align: middle; }
.prio i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.prio-hot  { background: var(--pri-hot-soft);  color: var(--pri-hot); }
.prio-warm { background: var(--pri-warm-soft); color: #B45309; }
.prio-warm i { background: var(--pri-warm); }
.prio-cold { background: var(--pri-cold-soft); color: #0369A1; }
.prio-cold i { background: var(--pri-cold); }
.prio-hot i { animation: pri-pulse 1.8s ease-out infinite; }
@keyframes pri-pulse {
  0% { box-shadow: 0 0 0 0 rgba(225, 29, 72, .55); }
  70%, 100% { box-shadow: 0 0 0 5px rgba(225, 29, 72, 0); }
}
.badges { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }

/* A coloured edge on each lead row and pipeline card shows its priority at a glance. */
tr.pri-row > td:first-child { box-shadow: inset 4px 0 0 var(--pri-edge, transparent); }
tr.pri-row-hot  { --pri-edge: var(--pri-hot); }
tr.pri-row-warm { --pri-edge: var(--pri-warm); }
tr.pri-row-cold { --pri-edge: var(--pri-cold); }
tr.pri-row-hot:hover { background: #FFF7F9; }
.lead-card[class*="pri-card-"] { border-left: 4px solid var(--pri-edge, var(--line)); }
.lead-card.pri-card-hot  { --pri-edge: var(--pri-hot); }
.lead-card.pri-card-warm { --pri-edge: var(--pri-warm); }
.lead-card.pri-card-cold { --pri-edge: var(--pri-cold); }

/* Stage colour hooks: .st-<stage> sets --st and --st-soft for whatever is inside. */
.st-new         { --st: var(--st-new);         --st-soft: var(--st-new-soft); }
.st-contacted   { --st: var(--st-contacted);   --st-soft: var(--st-contacted-soft); }
.st-interested  { --st: var(--st-interested);  --st-soft: var(--st-interested-soft); }
.st-demo        { --st: var(--st-demo);        --st-soft: var(--st-demo-soft); }
.st-negotiation { --st: var(--st-negotiation); --st-soft: var(--st-negotiation-soft); }
.st-converted   { --st: var(--st-converted);   --st-soft: var(--st-converted-soft); }
.st-lost        { --st: var(--st-lost);        --st-soft: var(--st-lost-soft); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--st, var(--blue)); flex: none; }

/* Pipeline columns: tinted body, coloured top and count. */
.col[class*="st-"] { background: linear-gradient(180deg, var(--st-soft) 0, #EFF2F7 140px); border-top: 3px solid var(--st); }
.col[class*="st-"] .col-head .count { color: var(--st); font-weight: 800; }

/* Funnel bars and labels. */
.bar[class*="st-"] > span { background: linear-gradient(90deg, var(--st), color-mix(in srgb, var(--st) 70%, #fff)); }
.funnel-row .nm[class*="st-"] { display: inline-flex; align-items: center; gap: 7px; }

/* Stage tabs carry their colour as a dot, and fill with it when chosen. */
.tabs a i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px;
            vertical-align: 1px; background: var(--st, currentColor); transition: background-color .2s; }
.tabs a.st.on { background: var(--st); border-color: var(--st); box-shadow: 0 4px 12px -5px var(--st); }
.tabs a.st.on i { background: #fff; }
.tabs-sep { width: 1px; align-self: stretch; background: #D4DAE5; margin: 4px 6px; }
.tabs-sep.thin { background: transparent; border-left: 1px dashed #D4DAE5; margin: 6px 2px; }

/* Whose leads: a two-way switch, not a filter pill. */
.who-group { display: inline-flex; gap: 2px; padding: 3px; background: #EEF2F8; border-radius: 20px; }
.tabs .who-group a { border: 0; background: transparent; padding: 4px 12px; }
.tabs .who-group a.on { background: #fff; color: var(--blue); box-shadow: 0 1px 3px rgba(16,24,40,.16); }
.tabs .who-group a:not(.on):hover { background: rgba(255,255,255,.6); }

/* Overdue: a red alert toggle that adds to whatever else is chosen. */
.tabs a.due-tab { border-style: dashed; border-color: #F3C6CC; color: var(--red); background: #FFF7F8; }
.tabs a.due-tab:not(.on):hover { background: var(--red-soft); border-color: #EBA3AD; color: var(--red); }
.tabs a.due-tab.on { background: var(--red); border: 1px solid var(--red); color: #fff;
                     box-shadow: 0 4px 12px -5px var(--red); }
.pri-tab-hot  { --st: var(--pri-hot); }
.pri-tab-warm { --st: var(--pri-warm); }
.pri-tab-cold { --st: var(--pri-cold); }
.tabs a.pri-tab.on { background: var(--st); border-color: var(--st); color: #fff; box-shadow: 0 4px 12px -5px var(--st); }
.tabs a.pri-tab.on i { background: #fff; }

/* KPI cards: a coloured accent per card, so the dashboard reads at a glance. */
.kpi { position: relative; overflow: hidden; --k: var(--blue); }
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--k); }
.grid > .kpi:nth-child(4n+1) { --k: #2563EB; }
.grid > .kpi:nth-child(4n+2) { --k: #D97706; }
.grid > .kpi:nth-child(4n+3) { --k: #7C3AED; }
.grid > .kpi:nth-child(4n+4) { --k: #0891B2; }
.grid > .kpi.good  { --k: var(--st-converted); }
.grid > .kpi.alert { --k: var(--st-lost); }
.kpi .value { color: color-mix(in srgb, var(--k) 78%, #1B1F27); }
a.kpi.link { display: block; color: inherit; text-decoration: none; cursor: pointer; }
a.kpi.link:hover { border-color: color-mix(in srgb, var(--k) 45%, #fff); }
a.kpi.link:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--k) 30%, transparent); }
.kpi .label { display: flex; align-items: center; gap: 6px; }
.kpi .go { margin-left: auto; color: var(--k); opacity: 0; transform: translateX(-4px);
           transition: opacity .2s, transform .25s var(--ease); }
a.kpi.link:hover .go, a.kpi.link:focus-visible .go { opacity: 1; transform: none; }

/* Sidebar: each page's icon sits on its own coloured tile. */
.nav .ico { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 8px; display: grid; place-items: center;
            font-size: 13.5px; background: var(--n-soft, #F2F5FA); color: var(--n, var(--muted)); }
.nav a.on .ico { background: var(--n, var(--blue)); color: #fff; box-shadow: 0 4px 10px -4px var(--n, var(--blue)); }
.nav-dashboard { --n: #2563EB; --n-soft: #EAF1FE; }
.nav-enquiry   { --n: #16A34A; --n-soft: #E8F7EE; }
.nav-leads     { --n: #0891B2; --n-soft: #E6F6FA; }
.nav-pipeline  { --n: #7C3AED; --n-soft: #F1EBFE; }
.nav-tasks     { --n: #E11D48; --n-soft: #FFE8EE; }
.nav-reports   { --n: #D97706; --n-soft: #FEF5E6; }
.nav-staff     { --n: #DB2777; --n-soft: #FDEAF4; }
.nav-settings  { --n: #475467; --n-soft: #EEF0F4; }
.nav-out       { --n: #667085; --n-soft: #F2F4F7; }

/* Avatars: a steady colour per person. */
.avatar.tone-0 { background: #2563EB; } .avatar.tone-1 { background: #7C3AED; }
.avatar.tone-2 { background: #DB2777; } .avatar.tone-3 { background: #EA580C; }
.avatar.tone-4 { background: #16A34A; } .avatar.tone-5 { background: #0891B2; }
.avatar.tone-6 { background: #D97706; } .avatar.tone-7 { background: #0D9488; }

/* Brand gradient on the main buttons and the topbar edge. */
.btn.pri { background: linear-gradient(135deg, #2A63BC, var(--blue) 55%, #1A4080); }
.btn.pri:hover { background: linear-gradient(135deg, #2458AA, var(--blue-dark)); }
.topbar { box-shadow: inset 0 3px 0 0 transparent; border-image: linear-gradient(90deg, #2563EB, #7C3AED 35%, #DB2777 65%, #EA580C) 0 0 1 0 / 0 0 2px 0; }
.card-head h2::before { content: ""; display: inline-block; width: 4px; height: 15px; border-radius: 3px;
                        background: linear-gradient(180deg, #2563EB, #7C3AED); margin-right: 8px; vertical-align: -2px; }

/* ------------------------------------------------------ centres and sharing */
.centre { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700;
          padding: 2px 8px; border-radius: 6px; background: #EEF0F4; color: #344054; white-space: nowrap; }
.centre::before { content: "⌂"; font-size: 11px; opacity: .7; }


.pri-group { display: inline-flex; gap: 2px; padding: 3px; margin-left: auto; background: #fff;
             border: 1px solid var(--line); border-radius: 20px; }
.pri-group a { border: 0 !important; padding: 3px 10px !important; font-size: 12.5px; }

/* Settings lists for centres, courses and ad links. */
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mini-list li:last-child { border-bottom: 0; }
.mini-list .grow { flex: 1; min-width: 0; }
.mini-list li.off .grow { color: var(--muted); text-decoration: line-through; }
.mini-list form.inline input { padding: 6px 9px; font-size: 13.5px; }
.ad-table td { padding: 7px 10px; font-size: 13.5px; }
.ad-table input { font-size: 12px !important; padding: 5px 8px !important; color: var(--muted) !important; }

@media print {
  .ui-progress, .ui-pop, .ui-backdrop { display: none !important; }
  .ui-trigger { border: 0; padding: 0; }
  .ui-chev, .ui-ico { display: none !important; }
}

/* People who turn off motion get none of the above. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-delay: 0s !important;
    animation-iteration-count: 1 !important; transition-duration: .001ms !important;
  }
}

/* ------------------------------------------------------------ course guide */
.nav-guide { --n: #0D9488; --n-soft: #E6F6F4; }
.guide-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.guide-grid .stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.guide-grid .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 900px) { .guide-grid { grid-template-columns: 1fr; } }
.course-tabs a .hid { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
                      padding: 1px 6px; border-radius: 6px; background: #EEF0F4; color: #667085; margin-left: 4px; }
.course-tabs a.on .hid { background: rgba(255,255,255,.25); color: #fff; }
.guide-hero { border-top: 4px solid #0D9488; }
.guide-title { margin: 0 0 6px; font-size: 21px; }
.guide-about { margin: 0; color: #475467; font-size: 14.5px; line-height: 1.6; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 14px; }
.fact { background: #F2F8F7; border: 1px solid #D5ECE8; border-radius: 10px; padding: 9px 12px; }
.fact span { display: block; font-size: 11.5px; font-weight: 700; color: #0F766E; text-transform: uppercase; letter-spacing: .04em; }
.fact b { font-size: 14.5px; }
.talk-points { list-style: none; counter-reset: tp; margin: 0; padding: 0; }
.talk-points li { counter-increment: tp; position: relative; padding: 9px 0 9px 40px; border-bottom: 1px solid var(--line);
                  font-size: 14.5px; line-height: 1.5; }
.talk-points li:last-child { border-bottom: 0; }
.talk-points li::before { content: counter(tp); position: absolute; left: 0; top: 8px; width: 26px; height: 26px;
                          border-radius: 50%; background: #E6F6F4; color: #0F766E; font-weight: 800; font-size: 13px;
                          display: grid; place-items: center; }
.module-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.module-list li { padding: 6px 12px; border-radius: 20px; background: #F2F5FA; border: 1px solid var(--line);
                  font-size: 13.5px; font-weight: 600; }
.brochure-file { display: flex; align-items: center; gap: 12px; }
.brochure-file b { word-break: break-word; }
.file-ico { flex: 0 0 44px; height: 52px; border-radius: 8px; background: #FDECEC; color: #C2410C; font-size: 11.5px;
            font-weight: 800; display: grid; place-items: center; border: 1px solid #F8D3CC; }
.wa-preview { font-size: 13px; line-height: 1.5; background: #F7FAF8; resize: vertical; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 10px; cursor: pointer; }
.check-line input { width: auto; }
.guide-link { float: right; font-size: 12px; font-weight: 700; color: #0F766E; }
.tp-head { font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #0F766E;
           margin: 16px 0 2px; padding-top: 12px; border-top: 1px dashed #D5ECE8; }
/* Course guide: Offline | Online switch. */
.mode-switch { display: inline-flex; gap: 4px; padding: 4px; margin: -4px 0 14px; background: #EEF2F8; border-radius: 12px; }
.mode-switch a { display: flex; align-items: center; gap: 8px; padding: 7px 16px 7px 12px; border-radius: 9px;
                 font-weight: 800; font-size: 14px; color: var(--muted); transition: background-color .18s, color .18s, box-shadow .18s; }
.mode-switch a small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.mode-switch a:hover { text-decoration: none; color: var(--ink); background: rgba(255,255,255,.6); }
.mode-switch a.on { background: #fff; box-shadow: 0 1px 3px rgba(16,24,40,.16); }
.mode-switch a.mode-offline.on { color: #0F766E; }
.mode-switch a.mode-online.on  { color: #6D28D9; }
.guide-hero.mode-online { border-top-color: #7C3AED; }
.mode-badge { display: inline-block; vertical-align: 3px; margin-left: 8px; font-size: 12px; font-weight: 800;
              padding: 3px 9px; border-radius: 20px; background: #E6F6F4; color: #0F766E; }
.mode-online .mode-badge { background: #F1EBFE; color: #6D28D9; }

/* ==================================================== phone & web app ==== */
html { -webkit-tap-highlight-color: rgba(34, 83, 159, .12); }
.top-brand, .bottom-nav { display: none; }
.menu-btn { display: none; width: 40px; height: 40px; flex: 0 0 40px; border: 1px solid var(--line); border-radius: 10px;
            background: #fff; cursor: pointer; padding: 0; align-items: center; justify-content: center;
            flex-direction: column; gap: 4px; }
.menu-btn span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--ink);
                 transition: transform .25s var(--ease), opacity .2s; }
body.nav-open .menu-btn span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.nav-open .menu-btn span:nth-child(2) { opacity: 0; }
body.nav-open .menu-btn span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.top-search { flex: 1; max-width: 330px; min-width: 150px; }
.nav-install { color: var(--blue) !important; }
.filter-sum { display: none; }
.filter-card > form { margin: 0; }

@media (max-width: 900px) {
  /* Topbar: menu · logo · you, then centre + search on one row. */
  .topbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px 10px;
            grid-template-areas: "menu brand who" "centre search search";
            padding: calc(8px + env(safe-area-inset-top)) 12px 10px; }
  .menu-btn { display: inline-flex; grid-area: menu; }
  .top-brand { display: block; grid-area: brand; justify-self: start; }
  .top-brand img { height: 30px; width: auto; display: block; }
  .top-centre { grid-area: centre; min-width: 0; }
  .top-centre select, .top-centre .ui-select, .top-centre > * { min-width: 0 !important; width: 128px !important; }
  .top-search { grid-area: search; max-width: none; min-width: 0; }
  .topbar .who { grid-area: who; margin: 0; }
  .who-text { display: none; }

  .sidebar { width: min(280px, 84vw); flex-basis: auto; padding-bottom: env(safe-area-inset-bottom); }

  /* Bottom tab bar. */
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
                background: rgba(255, 255, 255, .96); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
                border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
                box-shadow: 0 -6px 20px -12px rgba(16, 24, 40, .25); }
  .bottom-nav a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
                  min-height: 50px; border-radius: 12px; color: #667085; font-size: 11px; font-weight: 700; text-decoration: none; }
  .bottom-nav .bn-ico { font-size: 19px; line-height: 1; transition: transform .2s var(--ease); }
  .bottom-nav a.on { color: var(--blue); }
  .bottom-nav a.on .bn-ico { transform: translateY(-1px) scale(1.08); }
  .bottom-nav a.on::before { content: ""; position: absolute; top: -6px; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--blue); }
  .bottom-nav a:active { background: #F2F5FA; }
  .bottom-nav .bn-enquiry .bn-ico { width: 44px; height: 44px; margin-top: -20px; border-radius: 50%; display: grid; place-items: center;
                                    font-size: 26px; font-weight: 500; color: #fff;
                                    background: linear-gradient(135deg, #2A63BC, var(--blue) 55%, #1A4080);
                                    box-shadow: 0 8px 18px -6px rgba(34, 83, 159, .7), 0 0 0 4px #fff; }
  .bottom-nav .bn-enquiry.on::before { display: none; }
  .bottom-nav .bn-pill { position: absolute; top: 3px; left: calc(50% + 6px); background: var(--red); color: #fff; font-size: 10px;
                         font-weight: 800; border-radius: 20px; padding: 0 5px; min-width: 16px; text-align: center; line-height: 16px; }
  .content { padding: 14px 12px calc(92px + env(safe-area-inset-bottom)); }
  .toast-wrap { top: auto; bottom: calc(80px + env(safe-area-inset-bottom)); left: 12px; right: 12px; max-width: none; }

  /* Page title: actions go full width below it; "+ New enquiry" lives in the tab bar. */
  .page-head { gap: 10px; margin-bottom: 12px; }
  .page-head .grow { min-width: 0; flex-basis: 100%; }
  .page-head > .btn-row { width: 100%; }
  .page-head > .btn-row > .btn, .page-head > .btn-row > .view-switch { flex: 1; }
  .page-head .view-switch a { flex: 1; text-align: center; }
  .page-head a.btn.pri[href="index.php?p=enquiry"] { display: none; }
  .page-head .view-switch + .btn { margin-left: 0; }

  /* Tab rows scroll sideways instead of wrapping into four lines. */
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -12px 12px; padding: 3px 12px 6px;
          -webkit-overflow-scrolling: touch; scroll-padding: 12px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs > * { flex: 0 0 auto; white-space: nowrap; }
  .tabs a { padding: 8px 13px; }
  .tabs .pri-group { margin-left: 6px; }
  .mode-switch { display: flex; width: 100%; }
  .mode-switch a { flex: 1; justify-content: center; }

  /* Comfortable tap sizes; 16px text stops iPhones zooming into a field. */
  .btn { min-height: 42px; }
  .btn.sm { min-height: 36px; padding: 6px 12px; }
  input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=submit]):not([type=button]):not([type=hidden]),
  select, textarea { font-size: 16px; min-height: 44px; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }

  /* Figures two to a row. */
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 13px; }
  .kpi .foot { font-size: 11.5px; }
  .card { padding: 14px; }

  /* Board: one column per swipe. */
  .board { scroll-snap-type: x mandatory; margin: 0 -12px; padding: 0 12px 10px; scroll-padding: 12px; }
  .col { flex: 0 0 84%; min-width: 0; scroll-snap-align: start; }

  /* Filters fold behind a "Filters" bar. */
  .filter-sum { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; font-weight: 800; font-size: 14.5px; }
  .filter-sum::-webkit-details-marker { display: none; }
  .filter-sum::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform .2s; }
  .filter-card[open] > .filter-sum { margin-bottom: 12px; }
  .filter-card[open] > .filter-sum::after { transform: rotate(180deg); }
  .filter-sum .count { background: var(--blue); color: #fff; border-radius: 20px; font-size: 11.5px; padding: 1px 8px; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .btn-row { grid-column: 1 / -1; }
  .filters .btn-row .btn { flex: 1; }

  .guide-grid .grid-2 { grid-template-columns: 1fr; }
  .funnel-row .nm { width: 96px; flex-basis: 96px; }
}

/* Tables become cards on a phone. */
@media (max-width: 700px) {
  .table-wrap table.rtable { min-width: 0; }
  .rtable, .rtable tbody { display: block; width: 100%; }
  .rtable thead { display: none; }
  .rtable tr { display: block; position: relative; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .rtable tbody tr:last-child { border-bottom: 0; }
  .rtable tr.pri-row { box-shadow: inset 4px 0 0 var(--pri-edge, transparent); }
  .rtable tr.pri-row > td:first-child { box-shadow: none; }
  .rtable td { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0;
               text-align: right; font-size: 13.5px; min-width: 0; }
  .rtable td::before { content: attr(data-label); flex: 0 0 auto; text-align: left; font-size: 11px; font-weight: 700;
                       text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
  .rtable td[data-label=""]::before { display: none; }
  .rtable td.num { text-align: right; }
  .rtable td.rt-main { display: block; text-align: left; padding: 0 34px 6px 0; font-size: 14.5px; }
  .rtable td.rt-main::before { display: none; }
  .rtable td.rt-check { position: absolute; top: 12px; right: 12px; padding: 0; }
  .rtable td.rt-check::before { display: none; }
  .rtable td.rt-act { display: block; padding-top: 10px; text-align: left; }
  .rtable td.rt-act .btn-row { justify-content: flex-start !important; flex-wrap: wrap !important; }
  .rtable td.rt-act .btn-row { flex-wrap: nowrap !important; }
  .rtable td.rt-act .btn-row > * { flex: 1 1 0; min-width: 0; }
  .rtable td.rt-act .btn-row .btn, .rtable td.rt-act .btn-row summary.btn { width: 100%; padding-left: 6px; padding-right: 6px; }
  .rtable .badges { justify-content: flex-start; }
  .rtable td br { display: none; }
  .rtable td > .muted, .rtable td > .centre { margin-left: 6px; }
  .table-wrap.flat .rtable tr { padding-left: 12px; padding-right: 12px; }
  .staff-table tr.off td { opacity: 1; }
  .staff-table tr.off { opacity: .6; }
  /* The remove confirmation opens as a sheet above the tab bar. */
  .remove-pop .remove-box { position: fixed; left: 12px; right: 12px; top: auto; width: auto; z-index: 70;
                            bottom: calc(84px + env(safe-area-inset-bottom)); }
}

@media (max-width: 380px) {
  .bottom-nav .bn-label { font-size: 10px; }
  .top-centre select, .top-centre .ui-select, .top-centre > * { width: 112px !important; }
}

/* Installed app: no browser chrome, so leave room for the status bar. */
html.standalone .topbar { padding-top: calc(10px + env(safe-area-inset-top)); }

@media print { .bottom-nav, .menu-btn { display: none !important; } }
@media (max-width: 900px) {
  .pri-group a { padding: 7px 12px !important; }
  .wa-preview { font-size: 16px; }
  .filter-sum svg { color: var(--blue); }
  .top-brand { justify-self: center; }
}
@media (max-width: 560px) { .mode-switch a small { display: none; } }

/* ------------------------------------------------------- settings: data */
.section-title { margin: 26px 2px 12px; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.data-split { margin-bottom: 14px; }
.data-actions { display: grid; gap: 10px; }
.data-btn { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
            color: var(--ink); background: #fff; transition: border-color .18s, box-shadow .2s var(--ease), transform .12s var(--ease); }
.data-btn:hover { text-decoration: none; border-color: #C9D2E0; box-shadow: 0 8px 20px -12px rgba(16,24,40,.3); }
.data-btn:active { transform: scale(.98); }
.data-btn b { display: block; font-size: 14.5px; }
.data-btn small { display: block; font-size: 12.5px; color: var(--muted); }
.data-ico { flex: 0 0 46px; height: 46px; border-radius: 10px; display: grid; place-items: center; font-size: 12px; font-weight: 800; letter-spacing: .03em; }
.data-btn.sql .data-ico { background: #EEF3FB; color: var(--blue); border: 1px solid #D5E1F5; }
.data-btn.xlsx .data-ico { background: #E8F6EF; color: #1E7A4D; border: 1px solid #C8EBD8; }
.card-sub { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.saved-list li { gap: 10px; }
.feed-box { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #FAFBFD; }
.feed-box + .feed-box { margin-top: 12px; }
.feed-box input[type=file] { font: inherit; font-size: 14px; padding: 10px; border: 1px dashed #C9D2E0; border-radius: 10px; background: #fff; width: 100%; }
.feed-box .seg { justify-self: start; }
.feed-box .btn { justify-self: start; }
.replace-confirm { display: none; color: var(--red); font-weight: 700; }
#restore-form.is-replace .replace-confirm { display: flex; }
#restore-form.is-replace { border-color: #F3C6CC; background: #FFF8F9; }
.data-report { margin-bottom: 14px; border-left: 4px solid var(--ok); }
.data-report.restore { border-left-color: var(--blue); }
.report-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.report-figs div { background: #F7F9FC; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.report-figs b { display: block; font-size: 22px; font-weight: 800; }
.report-figs span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.report-figs .warn { background: var(--warn-soft); border-color: #F2DDB0; }
.report-list { margin: 10px 0 0; padding-left: 18px; font-size: 13px; color: #475467; max-height: 220px; overflow: auto; }
@media (max-width: 560px) {
  .report-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feed-box .seg, .feed-box .btn { justify-self: stretch; }
  .feed-box .seg { display: flex; } .feed-box .seg-opt { flex: 1; text-align: center; }
}
