/* ---------- Fonts (Lato + Roboto) ---------- */
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/lato-400.woff2') format('woff2'); }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/lato-700.woff2') format('woff2'); }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 800; font-display: swap; src: url('../fonts/lato-700.woff2') format('woff2'); }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 900; font-display: swap; src: url('../fonts/lato-900.woff2') format('woff2'); }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/roboto-400.woff2') format('woff2'); }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/roboto-500.woff2') format('woff2'); }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/roboto-500.woff2') format('woff2'); }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/roboto-700.woff2') format('woff2'); }

:root {
  --scarlet: #B91C1C;
  --scarlet-dark: #991B1B;
  --rose: #FEF2F2;
  --rose-medium: #FEE2E2;
  --teal: #0D9488;
  --teal-dark: #0F766E;
  --teal-light: #F0FDFA;
  --ink: #1a2733;
  --muted: #5f7384;
  --bg: #f8f5f5;
  --card: #ffffff;
  --line: #e8e0e0;
  --warn: #e8590c;
  --danger: #e03131;
  --ok: #2b8a3e;
  --gold: #f59f00;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20, 8, 8, .08), 0 4px 14px rgba(20, 8, 8, .06);
  --sidebar-w: 236px;
  --font: "Lato", "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--scarlet); text-decoration: none; }
a:hover { color: var(--scarlet-dark); }
img { max-width: 100%; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 22px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 1px solid transparent; border-radius: 10px; padding: 11px 18px;
  font-weight: 600; font-size: 14.5px; cursor: pointer; transition: .15s; font-family: var(--font); white-space: nowrap;
}
.btn-primary { background: var(--scarlet); color: #fff; }
.btn-primary:hover { background: var(--scarlet-dark); color: #fff; }
.btn-accent { background: var(--scarlet); color: #fff; }
.btn-accent:hover { background: var(--scarlet-dark); color: #fff; }
.btn-outline { background: #fff; border-color: var(--scarlet); color: var(--scarlet); }
.btn-outline:hover { background: var(--rose); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--rose); }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 14px 24px; font-size: 16px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-whatsapp { background: #25d366; color: #fff; }
.btn-whatsapp:hover { filter: brightness(.95); color: #fff; }

/* ---------- Public site ---------- */
.top-strip { background: var(--scarlet-dark); color: #fde8e8; font-size: 13px; padding: 7px 0; }
.top-strip .container { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.top-strip b { color: #fff; }

.site-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.site-header .container { display: flex; align-items: center; gap: 26px; padding: 13px 22px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; color: var(--ink); }
.brand .mark { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--scarlet), var(--scarlet-dark)); color: #fff; display: grid; place-items: center; font-size: 18px; font-weight: 800; }
.site-nav { display: flex; gap: 20px; margin-left: auto; font-size: 14.5px; font-weight: 600; }
.site-nav a { color: var(--ink); padding: 6px 2px; border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--scarlet); border-color: var(--scarlet); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.header-phone { font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 6px; }

.mobile-toggle { display: none; background: none; border: 0; font-size: 24px; cursor: pointer; }

.hero { background: linear-gradient(135deg, var(--scarlet-dark) 0%, var(--scarlet) 55%, #e03a3a 100%); color: #fff; padding: 66px 0 84px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -120px; top: -120px; width: 420px; height: 420px; border-radius: 50%; background: rgba(255,255,255,.08); }
.hero .container { position: relative; z-index: 2; }
.hero h1 { font-size: 46px; line-height: 1.12; letter-spacing: -.5px; max-width: 620px; margin-bottom: 16px; }
.hero h1 .hl { color: #fca5a5; }
.hero p { font-size: 18px; opacity: .92; max-width: 560px; margin-bottom: 28px; }
.hero-ctas { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 34px; }
.hero-stats { display: flex; gap: 44px; flex-wrap: wrap; border-top: 1px solid rgba(255,255,255,.22); padding-top: 26px; }
.hero-stats .stat b { font-size: 28px; display: block; }
.hero-stats .stat span { font-size: 13.5px; opacity: .82; }

.section { padding: 60px 0; }
.section-head { max-width: 720px; margin-bottom: 30px; }
.section-head.camp-head { max-width: 760px; margin: 0 auto 30px; }
.eyebrow { color: var(--scarlet); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }
.section-head h2 { font-size: 30px; letter-spacing: -.3px; margin: 6px 0 10px; }
.section-head p { color: var(--muted); font-size: 16px; }
.section.bg-white { background: #fff; }
.section.bg-tint { background: var(--rose); }

/* Symptom cards */
.symptom-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; }
.symptom { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; cursor: pointer; transition: .15s; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.symptom:hover { transform: translateY(-3px); border-color: var(--scarlet); }
.symptom .emoji { font-size: 26px; }
.symptom b { font-size: 15px; }
.symptom small { color: var(--muted); font-size: 13px; }
.symptom.selected { border-color: var(--scarlet); background: var(--rose); }

/* Treatment cards */
.treat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 16px; }
.treat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; transition: .15s; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; cursor: pointer; }
.treat:hover { transform: translateY(-3px); border-color: var(--scarlet); box-shadow: 0 6px 18px rgba(185,28,28,.14); }
.treat .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--rose); display: grid; place-items: center; font-size: 22px; }
.treat h3 { font-size: 16px; }
.treat p { color: var(--muted); font-size: 13.5px; flex: 1; }
.treat .price { font-weight: 700; color: var(--scarlet); font-size: 13.5px; }
.treat .price small { color: var(--muted); font-weight: 500; }
.treat.popular { border-color: var(--scarlet); }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; flex-shrink: 0; }
.chip-teal { background: var(--rose); color: var(--scarlet); }
.chip-green { background: #e6f7ec; color: var(--ok); }
.chip-red { background: #fdecec; color: var(--danger); }
.chip-amber { background: #fff3e0; color: var(--warn); }
.chip-blue { background: #e8f0fe; color: #1971c2; }
.chip-gray { background: #eef2f4; color: var(--muted); }

/* Clinic cards */
.clinic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.clinic { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.clinic h3 { font-size: 16px; }
.clinic .addr { color: var(--muted); font-size: 13.5px; }
.clinic .row { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.clinic .actions { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }

/* Reviews */
.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.review { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.review .stars { color: var(--gold); letter-spacing: 2px; }
.review p { margin: 10px 0; color: var(--ink); font-size: 14.5px; }
.review .who { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted); }
.review .av { width: 38px; height: 38px; border-radius: 50%; background: var(--rose); color: var(--scarlet); display: grid; place-items: center; font-weight: 700; }

/* Booking form */
.booking-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 26px; max-width: 760px; margin: 0 auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14.5px; font-family: var(--font); background: #fff; color: var(--ink);
}
.field input:not([type="checkbox"]):not([type="radio"]), .field select { height: 43px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--scarlet); border-color: transparent; }
.field textarea { resize: vertical; }
.req { color: var(--danger); }

/* Generic form controls (.inp used in modals & app forms) */
.inp {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14.5px; font-family: var(--font); background: #fff; color: var(--ink);
  transition: border-color .15s;
}
.inp:focus { outline: 2px solid var(--scarlet); border-color: transparent; }
.inp-sm { padding: 7px 10px; font-size: 13px; border-radius: 8px; }
input[type=checkbox] { accent-color: var(--scarlet); }

/* Footer */
.site-footer { background: #2a0b0b; color: #f0d6d6; padding: 52px 0 26px; margin-top: 10px; }
.site-footer .container { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 34px; }
.site-footer h4 { color: #fff; font-size: 14px; margin-bottom: 14px; }
.site-footer ul { list-style: none; display: flex; flex-direction: column; gap: 9px; font-size: 14px; }
.site-footer a { color: #e8b0b0; }
.site-footer a:hover { color: #fff; }
.footer-bottom { grid-column: 1 / -1; border-top: 1px solid rgba(255,255,255,.12); padding-top: 20px; font-size: 13px; color: #d4a0a0; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Floating buttons */
.float-btns { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 90; }
.float-btn { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; box-shadow: 0 4px 16px rgba(0,0,0,.22); border: 0; cursor: pointer; color: #fff; }
.float-call { background: var(--scarlet); }
.float-wa { background: #25d366; }

/* ================= Internal App ================= */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: #2a0b0b; color: #f0d6d6; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; }
.sidebar .brand { color: #fff; padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar .brand small { display: block; font-weight: 500; font-size: 12px; color: #d4a0a0; }
.side-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.side-nav .grp { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #d49a9a; padding: 14px 10px 6px; font-weight: 700; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; color: #f0d6d6; font-size: 14px; font-weight: 500; }
.side-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-nav a.active { background: var(--scarlet); color: #fff; }
.side-nav a .ic { width: 20px; text-align: center; }
.side-nav .submenu { margin: 2px 0; }
.side-nav .sub-toggle { cursor: pointer; user-select: none; }
.side-nav .sub-toggle .caret { margin-left: auto; font-size: 11px; color: #d49a9a; transition: transform .2s; }
.side-nav .submenu.open .sub-toggle .caret { transform: rotate(180deg); }
.side-nav .sub-toggle.parent-active { color: #fff; }
.side-nav .sub-items { display: none; margin-left: 14px; border-left: 1px solid rgba(255,255,255,.12); padding-left: 4px; }
.side-nav .submenu.open .sub-items { display: block; }
.side-nav a.sub { padding: 8px 12px; font-size: 13.5px; }
.side-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.1); font-size: 12px; color: #d4a0a0; }

/* ---------- Toggle Switch Component ---------- */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .25s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .25s; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
input:checked + .slider { background-color: #10b981; }
input:focus + .slider { box-shadow: 0 0 1px #10b981; }
input:checked + .slider:before { transform: translateX(20px); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 12px 24px; display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 40; }
.topbar .crumb { font-size: 15px; font-weight: 700; }
.topbar .spacer { flex: 1; }
.topbar .clinic-pick select { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; background: #fff; font-family: var(--font); }
.user-pill { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px 5px 6px; font-size: 13.5px; cursor: pointer; transition: all .15s ease; }
.user-pill:hover { border-color: var(--scarlet); background: #fff; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(185,28,28,.12); }
.user-pill .av { width: 32px; height: 32px; border-radius: 50%; background: var(--scarlet); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.user-pill .role { color: var(--muted); font-size: 11.5px; display: block; }

.content { padding: 24px; flex: 1; }
.page-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-title h1 { font-size: 24px; letter-spacing: -.3px; }
.page-title .sub { color: var(--muted); font-size: 14px; }
.page-title .spacer { flex: 1; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.kpi .val { font-size: 26px; font-weight: 800; margin-top: 6px; letter-spacing: -.3px; }
.kpi .delta { font-size: 12px; font-weight: 700; }
.kpi .delta.up { color: var(--ok); }
.kpi .delta.down { color: var(--danger); }

.grid { display: grid; gap: 16px; margin-bottom: 22px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card h3 { font-size: 15.5px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card h3 .ic { font-size: 17px; }
.card .muted { color: var(--muted); font-size: 13.5px; }

/* Patient detail — unified info card */
.patient-info { padding: 0; overflow: hidden; }
.pi-head { display: flex; align-items: center; gap: 18px; padding: 20px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pi-avatar { width: 64px; height: 64px; border-radius: 50%; background: linear-gradient(135deg, var(--scarlet), var(--scarlet-dark)); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 800; flex-shrink: 0; }
.pi-title { flex: 1; min-width: 200px; }
.pi-name { font-size: 24px; margin: 0; letter-spacing: -.4px; color: var(--ink); }
.pi-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.pi-edit { color: var(--scarlet); font-size: 13px; font-weight: 600; text-decoration: underline; white-space: nowrap; }
.pi-body { padding: 22px 24px; }
.pi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 0 24px; }
.pi-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.pi-item span { display: block; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px; }
.pi-item b { font-size: 14.5px; color: var(--ink); font-weight: 600; }
.pi-item b a { color: var(--scarlet); }
.pi-note { margin: 16px 0 0; padding-top: 14px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--muted); }
.pi-section { margin-top: 22px; }
.pi-section h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; margin-bottom: 6px; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13.8px; }
table.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 10px 12px; border-bottom: 2px solid var(--line); }
table.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:hover td { background: var(--rose); }
.tbl .actions { display: flex; gap: 6px; }
.tbl .actions button { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 5px 9px; font-size: 12px; cursor: pointer; font-family: var(--font); color: var(--ink); }
.tbl .actions button:hover { border-color: var(--scarlet); color: var(--scarlet); }

.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--rose); color: var(--scarlet); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }

/* Mini bar chart */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .bar .fill { width: 100%; max-width: 46px; background: linear-gradient(180deg, var(--scarlet), var(--scarlet-dark)); border-radius: 7px 7px 3px 3px; min-height: 6px; }
.bars .bar span { font-size: 11.5px; color: var(--muted); }

/* Pipeline / stepper */
.pipeline { display: flex; gap: 8px; flex-wrap: wrap; }
.stage { flex: 1; min-width: 130px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.stage b { display: block; font-size: 13px; margin-bottom: 6px; }
.stage .cnt { font-size: 20px; font-weight: 800; }

/* Check-in / wizard steps */
.steps { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.step { padding: 8px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.step.active { background: var(--scarlet); color: #fff; border-color: var(--scarlet); }
.step.done { background: var(--rose); color: var(--scarlet); border-color: var(--scarlet); }

/* Checklist */
.checklist { display: flex; flex-direction: column; gap: 10px; }
.check-row { display: flex; align-items: center; gap: 12px; background: var(--bg); border: 1px solid var(--line); padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.check-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--scarlet); }

/* Tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 6px; }
.tab { padding: 9px 16px; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer; background: transparent; border: 1px solid transparent; border-radius: 8px; transition: .15s; font-family: var(--font); }
.tab:hover { color: var(--ink); background: #fff; }
.tab.active { background: var(--scarlet); color: #fff; border-color: var(--scarlet); box-shadow: 0 4px 12px rgba(153,27,27,.28); }

/* Odontogram mini */
.odontogram { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.tooth { width: 30px; height: 34px; border: 2px solid var(--scarlet); border-radius: 7px; display: grid; place-items: center; font-size: 11px; color: var(--scarlet); font-weight: 700; background: #fff; cursor: pointer; }
.tooth.filled { background: var(--rose); }
.tooth.crown { background: var(--scarlet); color: #fff; border-color: var(--scarlet); }
.tooth.rot { background: var(--gold); color: #fff; border-color: var(--gold); }
.tooth.missing { background: #e9edf0; border-style: dashed; color: #9aa8b1; }

.btn:active, .btn.btn-processing {
  transform: scale(0.96);
  box-shadow: inset 0 3px 8px rgba(0,0,0,0.4);
  filter: brightness(0.85);
}
.btn-primary:active, .btn-primary.btn-processing {
  background: #520909 !important;
  border-color: #3a0606 !important;
  color: #fff !important;
}

/* Notifications / toast */
.toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%) translateY(-60px); background: var(--ink); color: #fff; padding: 14px 26px; border-radius: 12px; font-size: 14.5px; font-weight: 500; box-shadow: 0 8px 30px rgba(0,0,0,.3); opacity: 0; transition: transform .3s cubic-bezier(0.16, 1, 0.3, 1), opacity .3s ease; z-index: 9999; pointer-events: none; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Login page */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-hero { background: linear-gradient(150deg, #2a0b0b, var(--scarlet-dark) 60%, var(--scarlet)); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.login-hero::after { content: ""; position: absolute; right: -140px; top: -140px; width: 460px; height: 460px; border-radius: 50%; background: rgba(255,255,255,.07); }
.login-hero h1 { font-size: 40px; line-height: 1.1; margin: 18px 0 14px; max-width: 460px; }
.login-hero p { opacity: .92; max-width: 420px; }
.login-hero .stats { display: flex; gap: 34px; margin-top: 40px; }
.login-hero .stats b { font-size: 26px; display: block; }
.login-panel { background: var(--bg); padding: 44px; display: flex; flex-direction: column; justify-content: center; }
.login-panel h2 { font-size: 26px; margin-bottom: 6px; }
.login-panel > p { color: var(--muted); margin-bottom: 24px; }
.login-panel hr { border: 0; border-top: 1px solid var(--line); }
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.role-card { background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 15px; cursor: pointer; transition: .14s; text-align: left; font-family: var(--font); }
.role-card:hover { border-color: var(--scarlet); box-shadow: var(--shadow); transform: translateY(-2px); }
.role-card .emoji { font-size: 22px; }
.role-card b { display: block; margin: 6px 0 3px; font-size: 14.5px; }
.role-card small { color: var(--muted); font-size: 12.5px; line-height: 1.4; display: block; }
.role-card .creds { display: block; font-size: 11.5px; color: var(--scarlet); margin-top: 6px; font-weight: 600; }
@media (max-width: 860px) { .login-wrap { grid-template-columns: 1fr; } .login-hero { display: none; } }

/* Login form panel */
.login-form-panel { margin-bottom: 24px; }
.login-form-panel .field { margin-bottom: 12px; }

/* generic helpers */
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.b { font-weight: 700; }
.gap { gap: 12px; }
.text-right { text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 34px; font-size: 14px; }
.note-row { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 14px; margin-bottom: 10px; line-height: 1.6; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--scarlet), var(--scarlet-dark)); }

/* Breadcrumb */
.breadcrumb { background: var(--bg); padding: 12px 0; font-size: 13.5px; }
.breadcrumb .container { display: flex; align-items: center; gap: 8px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--scarlet); }
.breadcrumb .sep { color: var(--line); }

/* Hero meta details */
.meta-details { display: flex; gap: 20px; flex-wrap: wrap; font-size: 14.5px; margin-top: 12px; opacity: .9; }
.meta-details span { display: flex; align-items: center; gap: 6px; }

/* Steps list */
.steps-list { display: flex; flex-direction: column; gap: 14px; max-width: 800px; }
.step-card { display: flex; gap: 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.step-num { width: 40px; height: 40px; border-radius: 50%; background: var(--scarlet); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 17px; flex-shrink: 0; }
.step-body h3 { font-size: 16px; margin-bottom: 6px; }
.step-body p { color: var(--muted); font-size: 14px; line-height: 1.6; }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 10px; max-width: 800px; }
.faq-item { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; cursor: pointer; }
.faq-item summary { cursor: pointer; font-size: 15px; list-style: none; display: flex; align-items: center; justify-content: space-between; }
.faq-item summary::after { content: "+"; font-size: 18px; font-weight: 700; color: var(--scarlet); }
.faq-item[open] summary::after { content: "−"; }
.faq-item[open] { padding-bottom: 20px; }

/* CTA card */
.cta-card { background: linear-gradient(135deg, var(--scarlet-dark), var(--scarlet)); color: #fff; border-radius: 16px; padding: 40px; max-width: 700px; margin: 0 auto; }
.cta-card h2 { font-size: 28px; margin-bottom: 12px; }
.cta-card p { opacity: .9; font-size: 15.5px; }
.cta-card .btn-outline { border-color: rgba(255,255,255,.5); color: #fff; }
.cta-card .btn-outline:hover { background: rgba(255,255,255,.12); }

@media (max-width: 980px) {
  .sidebar { position: fixed; left: -100%; transition: .25s; z-index: 100; }
  .sidebar.open { left: 0; }
  .site-nav { display: none; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: #fff; padding: 16px; border-bottom: 1px solid var(--line); }
  .site-nav.open { display: flex; }
  .mobile-toggle { display: block; }
  .hero h1 { font-size: 34px; }
  .site-footer .container { grid-template-columns: 1fr 1fr; }
  .login-panel { padding: 28px; }
}

/* ================= Chunked Import Progress UI ================= */
.chunked-import-progress {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-top: 16px;
}

.import-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.import-header h3 {
  margin: 0;
  font-size: 15.5px;
}

.import-progress-bar {
  height: 10px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 16px;
}

.import-progress-bar .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--scarlet), var(--scarlet-dark));
  border-radius: 99px;
  transition: width 0.3s ease;
}

.import-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  font-size: 13.5px;
}

.import-stats .stat {
  display: flex;
  align-items: center;
  gap: 6px;
}

.import-details {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-bottom: 16px;
  font-size: 12.5px;
  color: var(--muted);
}

.import-details .detail-row {
  display: flex;
  gap: 12px;
  margin-bottom: 6px;
}

.import-details .detail-row span:first-child {
  font-weight: 600;
  min-width: 80px;
}

.import-details code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
}

.import-log {
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-size: 12.5px;
  font-family: monospace;
}

.import-log .log-entry {
  margin-bottom: 4px;
  padding: 2px 0;
}

.import-log .log-info { color: var(--ink); }
.import-log .log-success { color: var(--ok); }
.import-log .log-error { color: var(--danger); }
.import-log .log-warning { color: var(--warn); }

/* ================= Modal Overlay ================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
}

.modal-body {
  padding: 20px;
  max-height: calc(90vh - 60px);
  overflow-y: auto;
}

.modal-body .grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.modal-body .grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 768px) {
  .modal-body .grid {
    grid-template-columns: 1fr;
  }
  .modal-body .grid.cols-3 {
    grid-template-columns: 1fr;
  }
}

/* ---------- Doctors (list + per-doctor dashboard) ---------- */
.dd-doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.dd-doc-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; cursor: pointer; transition: .15s; display: flex; flex-direction: column; gap: 4px; }
.dd-doc-card:hover { border-color: var(--scarlet); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(153, 27, 27, .12); }
.dd-doc-card.disabled { cursor: default; opacity: .75; }
.dd-doc-card.disabled:hover { border-color: var(--line); transform: none; box-shadow: var(--shadow); }
.dd-doc-av { width: 46px; height: 46px; border-radius: 50%; background: var(--rose); color: var(--scarlet); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; margin-bottom: 6px; }
.dd-doc-name { font-weight: 800; font-size: 15.5px; }
.dd-doc-spec { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.dd-doc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 6px 0 10px; }
.dd-doc-stats div { display: flex; flex-direction: column; }
.dd-doc-stats b { font-size: 15px; }
.dd-doc-stats span { font-size: 11px; color: var(--muted); }
.dd-doc-link { margin-top: auto; font-size: 12.5px; font-weight: 700; color: var(--scarlet); }

.dd-doc-pill { background: var(--rose); color: var(--scarlet); border: 1px solid var(--rose-medium); border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 13.5px; }
.dd-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; background: linear-gradient(135deg, #991B1B, #B91C1C); color: #fff; border-radius: var(--radius); padding: 20px 22px; margin-bottom: 22px; box-shadow: var(--shadow); }
.dd-head h2 { font-size: 22px; margin: 0 0 5px; letter-spacing: -.3px; }
.dd-head .muted { color: rgba(255, 255, 255, .82); }
.dd-meta { display: flex; gap: 22px; background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .18); border-radius: 12px; padding: 10px 16px; white-space: nowrap; }
.dd-meta > div { display: flex; flex-direction: column; gap: 2px; }
.dd-meta span { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; opacity: .85; }
.dd-meta b { font-size: 13.5px; }
.dd-month-select { border: 0; background: transparent; color: #fff; font: inherit; font-size: 13.5px; font-weight: 700; padding: 0; }
.dd-month-select option { color: var(--ink); background: #fff; }
/* Branch scope picker + the chip that names the branch in scope. */
.dd-branch-select { border: 0; background: transparent; color: #fff; font: inherit; font-size: 13.5px; font-weight: 700; padding: 0; max-width: 170px; cursor: pointer; }
.dd-branch-select option { color: var(--ink); background: #fff; }
.dd-branch-badge { display: inline-block; background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; padding: 3px 12px; font-size: 12px; font-weight: 700; letter-spacing: .2px; }
/* Status / PRM pickers inside the red dashboard header — white text on a
   translucent chip so they read as editable, not as static meta text. */
.dd-head-select { border: 1px solid rgba(255, 255, 255, .35); border-radius: 7px; background: rgba(255, 255, 255, .14); color: #fff; font: inherit; font-size: 13px; font-weight: 700; padding: 4px 8px; min-width: 96px; max-width: 160px; cursor: pointer; }
.dd-head-select:hover, .dd-head-select:focus-visible { background: rgba(255, 255, 255, .24); outline: none; }
.dd-head-select:disabled { opacity: .7; cursor: default; }
.dd-head-select option { color: var(--ink); background: #fff; }

.dd-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 14px; margin-bottom: 22px; }
.dd-head > #drDashKpis { flex: 1 0 100%; }
.dd-head > #drDashKpis .dd-kpis { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; margin: 2px 0 0; }
.dd-head > #drDashKpis .dd-kpi { padding: 10px 12px; gap: 8px; box-shadow: none; color: var(--ink); }
.dd-head > #drDashKpis .dd-kpi .v { font-size: 20px; }
.dd-head > #drDashKpis .dd-kpi .t { font-size: 11.5px; }
.dd-head > #drDashKpis .dd-kpi .s { font-size: 10.5px; }
.dd-head > #campDetailKpis { flex: 1 0 100%; }
.dd-head > #campDetailKpis .dd-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 2px 0 0; }
.dd-head > #campDetailKpis .dd-kpi { padding: 10px 12px; gap: 8px; box-shadow: none; color: var(--ink); }
.dd-head > #campDetailKpis .dd-kpi .v { font-size: 20px; }
.dd-head > #campDetailKpis .dd-kpi .t { font-size: 11.5px; }
.dd-head > #campDetailKpis .dd-kpi .s { font-size: 10.5px; }
.dd-head > #campLeadsKpis { flex: 1 0 100%; }
.dd-head > #campLeadsKpis .dd-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 2px 0 0; }
.dd-head > #campLeadsKpis .dd-kpi { padding: 10px 12px; gap: 8px; box-shadow: none; color: var(--ink); }
.dd-head > #campLeadsKpis .dd-kpi .v { font-size: 20px; }
.dd-head > #campLeadsKpis .dd-kpi .t { font-size: 11.5px; }
.dd-head > #campLeadsKpis .dd-kpi .s { font-size: 10.5px; }
/* Camp-leads header: white KPI cards on the left, a mini funnel chart on the right. */
.cl-head { align-items: stretch; }
.cl-head-main { flex: 1 1 620px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.cl-head-main #campLeadsKpis .dd-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 0; }
.cl-head-main #campLeadsKpis .dd-kpi { padding: 10px 11px; gap: 7px; box-shadow: none; color: var(--ink); }
.cl-head-main #campLeadsKpis .dd-kpi .v { font-size: 20px; }
.cl-head-main #campLeadsKpis .dd-kpi .t { font-size: 11.5px; }
.cl-head-main #campLeadsKpis .dd-kpi .s { font-size: 10.5px; }
.cl-head-main #crmOpdKpis .dd-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.cl-head-main #crmOpdKpis .dd-kpi { padding: 10px 11px; gap: 7px; box-shadow: none; color: var(--ink); }
.cl-head-main #crmOpdKpis .dd-kpi .v { font-size: 20px; }
.cl-head-main #crmOpdKpis .dd-kpi .t { font-size: 11.5px; }
.cl-head-main #crmOpdKpis .dd-kpi .s { font-size: 10.5px; }
.cl-funnel { flex: 0 0 300px; align-self: stretch; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; color: var(--ink); display: flex; flex-direction: column; }
.cl-funnel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.cl-funnel-title { font-size: 12.5px; font-weight: 800; }
.cl-funnel-sub { font-size: 10.5px; color: var(--muted); }
.cl-funnel-bars { flex: 1; display: flex; align-items: flex-end; gap: 10px; min-height: 92px; }
.cl-bar { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; align-self: stretch; gap: 5px; }
.cl-bar-val { font-size: 11.5px; font-weight: 800; }
.cl-bar-track { position: relative; flex: 1; width: 100%; }
.cl-bar-fill { position: absolute; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 30px; border-radius: 4px 4px 0 0; }
.cl-bar-lbl { font-size: 10px; color: var(--muted); text-align: center; line-height: 1.1; }
.cl-funnel-foot { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 10.5px; font-weight: 700; color: var(--scarlet); }
@media (max-width: 980px) {
  .cl-funnel { flex: 1 0 100%; }
  .cl-funnel-bars { min-height: 84px; }
}
@media (max-width: 620px) {
  .cl-head-main #campLeadsKpis .dd-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cl-head-main #crmOpdKpis .dd-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.dd-head > #prmLeadsKpis { flex: 1 0 100%; }
.dd-head > #prmLeadsKpis .dd-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 2px 0 0; }
.dd-head > #prmLeadsKpis .dd-kpi { padding: 10px 12px; gap: 8px; box-shadow: none; color: var(--ink); }
.dd-head > #prmLeadsKpis .dd-kpi .v { font-size: 20px; }
.dd-head > #prmLeadsKpis .dd-kpi .t { font-size: 11.5px; }
.dd-head > #prmLeadsKpis .dd-kpi .s { font-size: 10.5px; }
.dd-head > #crmOpdKpis { flex: 1 0 100%; }
.dd-head > #crmOpdKpis .dd-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 2px 0 0; }
.dd-head > #crmOpdKpis .dd-kpi { padding: 10px 12px; gap: 8px; box-shadow: none; color: var(--ink); }
.dd-head > #crmOpdKpis .dd-kpi .v { font-size: 20px; }
.dd-head > #crmOpdKpis .dd-kpi .t { font-size: 11.5px; }
.dd-head > #crmOpdKpis .dd-kpi .s { font-size: 10.5px; }
.dd-head > #pipelineKpis { flex: 1 0 100%; }
.dd-head > #pipelineKpis .dd-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 2px 0 0; }
.dd-head > #pipelineKpis .dd-kpi { padding: 10px 12px; gap: 8px; box-shadow: none; color: var(--ink); }
.dd-head > #pipelineKpis .dd-kpi .v { font-size: 20px; }
.dd-head > #pipelineKpis .dd-kpi .t { font-size: 11.5px; }
.dd-head > #pipelineKpis .dd-kpi .s { font-size: 10.5px; }
.dd-head > #brDashKpis { flex: 1 0 100%; }
.dd-head > #brDashKpis .dd-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 2px 0 0; }
.dd-head > #brDashKpis .dd-kpi { padding: 10px 12px; gap: 8px; box-shadow: none; color: var(--ink); }
.dd-head > #brDashKpis .dd-kpi .v { font-size: 20px; }
.dd-head > #brDashKpis .dd-kpi .t { font-size: 11.5px; }
.dd-head > #brDashKpis .dd-kpi .s { font-size: 10.5px; }
.dd-nav button.active { background: rgba(255, 255, 255, .22); color: #fff; }

/* ---------- Appointments Calendar (Operations → Appointments Calendar) ----------
   A GitHub-style contribution grid: a CSS-grid block of equal squares, one per
   day, shaded by how full the branch's single seat was. No weekday labels and
   no day numbers, so each month's shape reads at a glance. */
.gh-cal { display: grid; gap: 3px; width: 100%; }
.gh-cal.gh-mini { gap: 2px; }
.gh-cal .gh-month { grid-row: 1; font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; overflow: hidden; white-space: nowrap; }
.gh-cal .gh-day, .gh-cal .gh-empty { aspect-ratio: 1 / 1; border-radius: 3px; min-width: 0; min-height: 6px; }
.gh-cal .gh-day { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.gh-cal .gh-day:hover { transform: scale(1.1); box-shadow: 0 1px 3px rgba(20, 60, 40, .28); z-index: 2; }
.gh-cal .gh-empty { cursor: default; background: transparent; }
.gh-cal .gh-day { background: #ebedf0; }
.gh-cal .gh-day.gh-today { outline: 1.5px solid var(--scarlet); outline-offset: -1.5px; }
.gh-cal .gh-day.gh-l1 { background: #9be9a8; }
.gh-cal .gh-day.gh-l2 { background: #40c463; }
.gh-cal .gh-day.gh-l3 { background: #30a14e; }
.gh-cal .gh-day.gh-l4 { background: #216e39; }
.gh-cal .gh-day.gh-l5 { background: #1a5b32; }

/* Appointments Calendar — every branch at a glance */
.gh-branch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(560px, 1fr)); gap: 16px; align-items: start; }
.gh-branch-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.gh-branch-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.gh-branch-head.cal-open-detail { cursor: pointer; padding: 4px 6px; margin: -4px -6px 8px; border-radius: 8px; transition: .15s; }
.gh-branch-head.cal-open-detail:hover { background: var(--bg); }
.gh-branch-head.cal-open-detail:hover .gh-branch-name::after { content: " →"; color: var(--scarlet); font-size: 13px; }
.gh-branch-name { font-size: 14.5px; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gh-branch-total { font-size: 12px; color: var(--muted); font-weight: 700; }

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

/* Per-branch overview cards (unused in the list layout — kept for older renders) */
.gh-mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; margin-top: 14px; }
.gh-mini-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; transition: .15s; box-shadow: var(--shadow); }
.gh-mini-card:hover { border-color: var(--scarlet); transform: translateY(-2px); }
.gh-mini-card.is-on { border-color: var(--scarlet); background: var(--rose); }
.gh-mini-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.gh-mini-total { font-size: 12px; color: var(--muted); font-weight: 700; }
.gh-mini-card .gh-cal th.gh-month { font-size: 9px; }

/* Legend under the main calendar head */
.gh-legend { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; margin-bottom: 8px; }
.gh-legend-cell { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }
.gh-legend .muted { font-size: 11px; }

@media (max-width: 820px) {
  .gh-cal td { min-width: 10px; }
  .gh-cal th.gh-dow { width: 24px; }
}

/* ---------- Metric ruleset (Operations → Metric Ruleset) ---------- */
.mr-intro h2 { font-size: 22px; letter-spacing: -.3px; }
.mr-toc { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mr-toc > b { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-right: 4px; }
.mr-toc-link { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 5px 13px; font-size: 12.5px; font-weight: 600; color: var(--scarlet); text-decoration: none; background: var(--rose); }
.mr-toc-link:hover { background: var(--rose-medium); border-color: var(--rose-medium); }
.mr-head { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; user-select: none; }
.mr-head:focus-visible { outline: 2px solid var(--scarlet); outline-offset: 3px; border-radius: 6px; }
.mr-caret { color: var(--scarlet); font-size: 15px; line-height: 1.5; flex: 0 0 auto; }
.mr-head-text { flex: 1; min-width: 0; }
.mr-head-text h3 { margin: 0 0 3px; }
.mr-head-text p { margin: 0; font-size: 12.5px; }
.mr-count { flex: 0 0 auto; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--rose); border-radius: 999px; padding: 3px 10px; }
.mr-section .ds-table td:first-child { min-width: 150px; }
.mr-section code, .mr-intro code, .card code { background: var(--rose); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.mr-section strong { color: var(--ink); }
.mr-bullet { color: var(--scarlet); font-weight: 800; margin-right: 4px; }

/* Strips whose tile count varies (4 tiles) — fit as many per row as will go
   instead of the fixed 3/6 column grids used by the boards. */
.ap-kpis-auto { grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); }
.ap-kpis-auto .ap-kpi { min-width: 0; }
.ap-kpis-auto .ap-kpi-val { font-size: 21px; }
.ap-kpis-auto .ap-kpi-sub { overflow-wrap: anywhere; }

/* Patient treatment modal — notes timeline */
.dr-note-list { list-style: none; margin: 0; padding: 0; }
.dr-note-list li {
  border-left: 2px solid var(--line, #e2e2e2); padding: 4px 0 4px 12px;
  margin-bottom: 6px; font-size: .86rem; color: #444;
}

/* Treatments tab — segmented bucket filter */
.br-seg {
  border: 1px solid var(--line, #e2e2e2); background: #fff; color: #444;
  border-radius: 16px; padding: 3px 12px; font-size: .82rem; cursor: pointer;
}
.br-seg:hover { border-color: #b9c6d2; }
.br-seg b { font-weight: 700; margin-left: 3px; }
.br-seg.is-on { background: #0f2f4a; border-color: #0f2f4a; color: #fff; }
.br-seg.is-on b { color: #fff; }

/* Money owed on work already delivered */
.ds-owed { color: #b3261e; }

/* Clinic registry CRUD — aliases and tags read as small chips */
.clinic-addr { font-size: .82rem; line-height: 1.35; max-width: 46ch; color: var(--ink-2, #555); }
.clinic-flags { display: flex; gap: 18px; align-items: center; margin: 4px 0 10px; }
.clinic-flags label { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; cursor: pointer; }
.ds-tag {
  display: inline-block; padding: 1px 7px; margin: 1px 3px 1px 0;
  border: 1px solid var(--line, #e2e2e2); border-radius: 10px;
  background: #f6f6f6; color: #444; font-size: .72rem; white-space: nowrap;
}
.ds-tag-alias { background: #eef4ff; border-color: #cfe0ff; color: #1c4f9c; }
.clinic-alias-note { font-size: .78rem; }
tr.ds-muted td { opacity: .55; }

/* Leads tab: search + filter tools, and booked-but-unplanned lead rows */
.br-lead-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.br-lead-noTx td { opacity: .72; }
.br-lead-noTx td:nth-child(3) { font-style: italic; }

/* Treatment-list modal (branch detail → Leads → TT Plan / TT Done) */
.br-tx-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 16px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.br-tx-meta > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.br-tx-meta span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.br-tx-meta b { font-size: 13px; overflow-wrap: anywhere; }
.br-tx-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px 14px; margin-bottom: 12px; }
.br-tx-facts > div { background: var(--rose); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.br-tx-facts span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.br-tx-facts b { font-size: 17px; font-weight: 800; letter-spacing: -.3px; overflow-wrap: anywhere; }
.br-tx-verdict { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.br-tx-verdict .ds-pill { font-size: 11.5px; }
.br-tx-statuses { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.br-tx-statuses:empty { display: none; }
.br-tx-statuses .ds-pill { font-size: 11.5px; }
.br-tx-mid { background: var(--rose); color: var(--muted); border: 1px dashed var(--line); }
/* Diagnostic rows: shown for context, visibly not part of the counts. */
.br-tx-dx td { opacity: .62; }
.br-tx-dx td:nth-child(2) { font-style: italic; }
.br-tx-dx-pill { background: var(--rose); color: var(--muted); border: 1px dashed var(--line); }
.modal-body .ds-table td:first-child { width: 34px; }
.dd-nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; background: #991B1B; border-radius: 10px; padding: 5px; margin: -8px 0 18px; box-shadow: var(--shadow); }
.dd-nav button { border: 0; background: transparent; color: rgba(255, 255, 255, .82); border-radius: 7px; padding: 9px 18px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.dd-nav button:hover, .dd-nav button:focus-visible { background: rgba(255, 255, 255, .16); color: #fff; outline: none; }
.dr-review-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.dr-review-field { display: flex; flex-direction: column; gap: 5px; }
.dr-review-field label { color: var(--muted); font-size: 12px; font-weight: 700; }
.dr-review-wide { grid-column: 1 / -1; }
.dr-stars { display: flex; gap: 3px; }
.dr-stars button { border: 0; background: transparent; color: #d7dce2; cursor: pointer; font-size: 27px; line-height: 1; padding: 0 2px; }
.dr-stars button.active, .dr-stars button:hover { color: #f59f00; }
.dr-review-stars-text { color: #f59f00; white-space: nowrap; letter-spacing: 1px; }
.dr-active-switch { width: 38px; height: 22px; border: 0; border-radius: 999px; background: #adb5bd; padding: 3px; cursor: pointer; vertical-align: middle; }
.dr-active-switch span { display: block; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .18s ease; }
.dr-active-switch.active { background: #2b8a3e; }
.dr-active-switch.active span { transform: translateX(16px); }
.dr-status-toggle { display: inline-flex; align-items: center; gap: 6px; }
.dr-status-toggle small { color: var(--muted); font-size: 11px; }
.dd-kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; }
.dd-kpi .ic { font-size: 20px; line-height: 1.2; }
.dd-kpi .t { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.dd-kpi .v { font-size: 24px; font-weight: 800; letter-spacing: -.4px; }
.dd-kpi .s { font-size: 11.5px; color: var(--muted); }

.dd-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.dd-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dd-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.dd-hbars { display: flex; flex-direction: column; gap: 9px; }
.dd-hbar { display: grid; grid-template-columns: 92px 1fr 78px; align-items: center; gap: 8px; font-size: 12.5px; }
.dd-hbar-lbl { color: var(--muted); }
.dd-hbar-track { background: var(--rose); border-radius: 6px; height: 16px; overflow: hidden; }
.dd-hbar-fill { background: linear-gradient(90deg, var(--scarlet), var(--scarlet-dark)); height: 100%; border-radius: 6px; }
.dd-hbar-val { text-align: right; font-weight: 700; }
.dd-summary { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.dd-summary b { font-size: 18px; color: var(--scarlet); }

.dd-funnel { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 6px; }
.dd-funnel-seg { border-radius: 6px; padding: 10px 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.dd-funnel-seg b { font-size: 17px; font-weight: 800; }
.dd-funnel-seg span { font-size: 11px; opacity: .92; }
.dd-fl { text-align: center; line-height: 1.2; }
.dd-fl b { display: block; font-size: 15px; font-weight: 800; }
.dd-fl span { font-size: 10px; opacity: .92; }

.dd-list { list-style: none; display: flex; flex-direction: column; gap: 11px; }
.dd-list li { display: flex; gap: 10px; font-size: 13.5px; line-height: 1.5; }
.dd-list .n { flex: 0 0 20px; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; background: var(--scarlet); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

@media (max-width: 760px) {
  .dd-meta { gap: 14px; padding: 8px 12px; }
  .dd-hbar { grid-template-columns: 70px 1fr 62px; }
  .dd-head > #drDashKpis .dd-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dd-head > #brDashKpis .dd-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dd-head > #prmLeadsKpis .dd-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mr-toc-link { padding: 4px 10px; font-size: 12px; }
  .dd-nav { overflow-x: auto; flex-wrap: nowrap; }
  .dd-nav button { white-space: nowrap; padding: 8px 14px; }
  .dr-review-form { grid-template-columns: 1fr; }
  .dr-review-wide { grid-column: auto; }
}

/* ---------- Ops dashboard: collapsible panels ---------- */
.opdash { --od-radius: 16px; }
.opdash-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: var(--od-radius);
  padding: 18px 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.opdash-bar-main { display: flex; align-items: center; gap: 15px; min-width: 0; }
.opdash-bar-ic { width: 50px; height: 50px; border-radius: 14px; flex: 0 0 50px;
  background: linear-gradient(135deg, #b91c1c, #991b1b); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 23px;
  box-shadow: 0 6px 16px rgba(153, 27, 27, .28); }
.opdash-bar-txt h1 { font-size: 22px; font-weight: 800; letter-spacing: -.4px; line-height: 1.2; margin: 0 0 3px; }
.opdash-bar-txt p { color: var(--muted); font-size: 13.5px; }
.opdash-bar-side { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.opdash-panels { display: flex; flex-direction: column; gap: 14px; }
.opdash-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--od-radius);
  box-shadow: var(--shadow); overflow: hidden; }
.opdash-head { display: flex; align-items: center; gap: 13px; padding: 15px 20px; cursor: pointer;
  user-select: none; transition: background .15s; }
.opdash-head:hover { background: var(--bg); }
.opdash-head:focus-visible { outline: 2px solid var(--scarlet); outline-offset: -2px; }
.opdash-caret { color: var(--scarlet); font-size: 13px; flex: 0 0 13px; transition: transform .2s; display: inline-block; }
.opdash-panel[data-open="0"] .opdash-caret { transform: rotate(-90deg); }
.opdash-ic { width: 38px; height: 38px; border-radius: 11px; flex: 0 0 38px; background: var(--rose);
  display: flex; align-items: center; justify-content: center; font-size: 18px; }
.opdash-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.opdash-txt b { font-size: 16px; font-weight: 800; letter-spacing: -.2px; }
.opdash-txt small { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opdash-state { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; flex: 0 0 auto; }
.opdash-panel[data-open="1"] .opdash-state { color: #fff; background: var(--scarlet); border-color: var(--scarlet); }
.opdash-panel[data-open="1"] .opdash-head { border-bottom: 1px solid var(--line); }
.opdash-body { padding: 18px 20px 4px; }
.opdash-body[hidden] { display: none; }
.opdash-body > .mt:first-child { margin-top: 0; }

@media (max-width: 620px) {
  .opdash-head { padding: 13px 15px; gap: 10px; }
  .opdash-body { padding: 15px 15px 2px; }
  .opdash-txt small { white-space: normal; }
  .opdash-state { display: none; }
}

/* ---------- Doctor performance (aggregate) dashboard ---------- */
.ap-page { --ap-radius: 16px; }
.ap-page .card { border-radius: var(--ap-radius); }

/* Header */
.ap-head { display: flex; align-items: center; justify-content: space-between; gap: 20px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--ap-radius);
  padding: 20px 24px; margin-bottom: 18px; box-shadow: var(--shadow); }
.ap-head-main { display: flex; align-items: center; gap: 16px; min-width: 0; }
.ap-head-ic { width: 52px; height: 52px; border-radius: 14px; flex: 0 0 52px;
  background: linear-gradient(135deg, #b91c1c, #991b1b); color: #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgba(153, 27, 27, .28); }
.ap-head-txt { min-width: 0; }
.ap-head-txt h1 { font-size: 24px; font-weight: 800; letter-spacing: -.4px; line-height: 1.2; margin: 0 0 3px; }
.ap-head-txt h1 .ap-dash { color: #c8cfd6; font-weight: 600; }
.ap-head-txt h1 .ap-month-name { color: var(--scarlet); }
.ap-head-txt p { color: var(--muted); font-size: 13.5px; }
.ap-head-side { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.ap-month { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 7px 10px 7px 12px; }
.ap-month > span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
.ap-month select { border: 0; background: transparent; font-family: var(--font); font-size: 13.5px; font-weight: 700;
  color: var(--ink); cursor: pointer; outline: none; }

.ap-meta { display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 9px 16px; white-space: nowrap; }
.ap-meta-ic { color: var(--scarlet); display: flex; }
.ap-meta > div { display: flex; flex-direction: column; gap: 1px; }
.ap-meta span:not(.ap-meta-ic) { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
.ap-meta b { font-size: 13px; }
.ap-meta-sep { width: 1px; align-self: stretch; background: var(--line); }

/* KPI cards */
.ap-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
/* Four-tile strip (Dental Camps funnel) — one clean row, and it must beat the
   min-width:1500 six-column rule via the extra class. */
.ap-kpis.ap-kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ap-kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--ap-radius); box-shadow: var(--shadow);
  padding: 16px; display: flex; gap: 12px; align-items: flex-start; min-height: 112px; position: relative; cursor: default; }
.ap-kpi:hover { border-color: #cbd5e1; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07); }
.ap-kpi-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #1e293b;
  color: #f8fafc;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  padding: 6px 11px;
  border-radius: 6px;
  white-space: normal;
  width: max-content;
  max-width: 220px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 999;
}
.ap-kpi-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: #1e293b transparent transparent transparent;
}
.ap-kpi:hover .ap-kpi-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.ap-kpi-ic { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex: 0 0 40px; }
.ap-kpi-body { min-width: 0; flex: 1; }
.ap-kpi-lbl { font-size: 12px; font-weight: 700; color: #47535c; line-height: 1.25; min-height: 30px; }
.ap-kpi-val { font-size: 25px; font-weight: 800; letter-spacing: -.6px; line-height: 1.15; margin: 2px 0 3px; }
.ap-kpi-sub { font-size: 11px; color: var(--muted); line-height: 1.3; }

/* Charts */
.ap-charts { display: grid; grid-template-columns: 1.75fr 1fr; gap: 16px; margin-bottom: 18px; align-items: start; }
.ap-chart-card { border-radius: var(--ap-radius); padding: 18px 18px 10px; }
.ap-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.ap-card-head h3 { font-size: 15px; font-weight: 800; margin: 0; display: flex; align-items: center; gap: 9px; }
.ap-card-head h3::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--scarlet); display: inline-block; }
.dr-chart { width: 100%; }

/* Summary table */
.ap-kpi.is-interactive {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.ap-kpi.is-interactive:hover {
  transform: translateY(-2px);
  border-color: #991B1B;
  box-shadow: 0 6px 16px rgba(153, 27, 27, 0.12);
}
.ap-table-card {
  border-radius: var(--ap-radius);
  scroll-margin-top: 80px;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
@keyframes tableFocusPulse {
  0% { box-shadow: 0 0 0 0 rgba(153, 27, 27, 0.45); border-color: #991B1B; }
  35% { box-shadow: 0 0 0 8px rgba(153, 27, 27, 0.20); border-color: #991B1B; }
  100% { box-shadow: 0 0 0 0 rgba(153, 27, 27, 0); border-color: var(--line, #e2e8f0); }
}
.table-autofocus-pulse {
  animation: tableFocusPulse 1.6s ease-out;
}
.ap-summary { overflow-x: auto; }
.ap-summary table.tbl { min-width: 1250px; }
.ap-summary table.tbl thead th { background: linear-gradient(90deg, #7f1d1d, #991B1B); color: #fff; border-bottom: 0; font-weight: 700; }
.ap-summary table.tbl thead th:first-child { border-top-left-radius: 10px; }
.ap-summary table.tbl thead th:last-child { border-top-right-radius: 10px; }
table.tbl tr.dd-active-row td { background: #eafaf0; }
table.tbl tr.dd-active-row:hover td { background: #ddf6e7; }
table.tbl tr.dd-total-row td { background: var(--rose-medium); font-weight: 800; }

@media (min-width: 1500px) {
  .ap-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 1200px) {
  .ap-charts { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .ap-head { flex-direction: column; align-items: stretch; }
  .ap-head-side { flex-wrap: wrap; }
  .ap-meta { flex: 1; }
}
@media (max-width: 620px) {
  .ap-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ap-kpis.ap-kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ap-head-txt h1 { font-size: 20px; }
}

/* ---------- Dashboard summary tables (Image style) ---------- */
.ds-card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.ds-card-title { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; color: var(--scarlet-dark); letter-spacing: -.2px; }
.ds-title-ic { color: var(--scarlet); display: flex; }
.ds-card-meta { display: flex; align-items: center; gap: 10px; padding-left: 16px; border-left: 1px solid var(--line); }
.ds-cal { color: var(--scarlet); display: flex; }
.ds-card-meta > div { display: flex; flex-direction: column; line-height: 1.2; }
.ds-card-meta b { font-size: 14px; color: var(--ink); }
.ds-card-meta span:not(.ds-cal) { font-size: 11px; color: var(--muted); }

.ds-table-wrap { overflow-x: auto; }
.ds-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; line-height: 1.3; }
.ds-table thead th { background: linear-gradient(180deg, #a81d1d, #8f1717); color: #fff; font-weight: 700; font-size: 12.5px;
  text-align: center; padding: 11px 14px; white-space: nowrap; line-height: 1.25; }
.ds-table thead th:first-child { border-top-left-radius: 12px; }
.ds-table thead th:last-child { border-top-right-radius: 12px; }
.ds-table tbody td { padding: 10px 14px; text-align: center; border-bottom: 1px solid #f4dede; color: var(--ink); }
.ds-table tbody td:first-child { color: var(--scarlet); font-weight: 800; text-align: center; padding-left: 12px; padding-right: 12px; width: 44px; background: #fdf6f6; }
.ds-table tbody td:nth-child(2) { text-align: left; font-weight: 600; }
.ds-table tbody tr:hover td { background: #fffafa; }
.ds-table tbody tr:hover td:first-child { background: #fdf0f0; }
.ds-table tr.ds-total td { background: #fcecec; font-weight: 800; border-bottom: 0; }
.ds-table tr.ds-total td:first-child { background: #fcecec; }
.ds-table tr.ds-total td:first-child { border-bottom-left-radius: 12px; }
.ds-table tr.ds-total td:last-child { border-bottom-right-radius: 12px; }
.ds-table tr.ds-active td { background: #effaf2; }
.ds-table tr.ds-active td:first-child { background: #e3f7e8; }

.ds-table.ds-plain tbody td:first-child { color: var(--ink); font-weight: 700; text-align: left; background: transparent; width: auto; }
.ds-table.ds-plain tbody td:nth-child(2) { text-align: center; }
.ds-table.ds-plain tbody tr:hover td { background: #fffafa; }

.ds-table.ds-detail thead th, .ds-table.ds-detail tbody td { text-align: left; white-space: nowrap; }
.ds-table.ds-detail tbody td:first-child { color: var(--scarlet); font-weight: 700; background: transparent; width: auto; text-align: left; }
.ds-table.ds-detail tbody tr:hover td { background: #fffafa; }

.ds-pill { display: inline-block; min-width: 46px; padding: 4px 10px; border-radius: 8px; font-weight: 800; font-size: 12.5px; line-height: 1.25; }
.ds-pill-low { background: #fdeaea; color: #c92a2a; }
.ds-pill-good { background: #e3f7e8; color: #2b8a3e; }
.ds-table a { font-weight: 700; }

.dr-rev-sum { display: flex; gap: 28px; flex-wrap: wrap; margin: 0 0 14px; padding: 12px 16px; background: var(--rose); border: 1px solid var(--rose-medium); border-radius: 12px; }
.dr-rev-sum > div { display: flex; flex-direction: column; }
.dr-rev-sum span { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; }
.dr-rev-sum b { font-size: 18px; color: var(--scarlet-dark); }



/* ---------- Leads (DB) Excel-like grid ---------- */
.db-grid-wrap { overflow: auto; max-height: 68vh; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.db-grid-wrap table.tbl { min-width: 3400px; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.db-grid-wrap table.tbl thead tr.head-row th { position: sticky; top: 0; background: #fff; z-index: 3; height: 40px; box-shadow: 0 1px 0 var(--line); white-space: nowrap; }
.db-grid-wrap table.tbl thead tr.filter-row th { position: sticky; top: 40px; background: #faf6f6; z-index: 2; padding: 5px 6px; box-shadow: 0 1px 0 var(--line); }
.db-grid-wrap table.tbl thead tr.filter-row input { width: 100%; min-width: 96px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; font-family: var(--font); box-sizing: border-box; background: #fff; }
.db-grid-wrap table.tbl thead tr.filter-row input:focus { outline: none; border-color: var(--scarlet); }
.db-grid-wrap table.tbl tbody td { white-space: nowrap; }
.db-grid-wrap table.tbl tbody td a.lead-name-link { font-weight: 600; }
.db-grid-wrap table.tbl tbody td a.lead-name-link:hover { text-decoration: underline; }
/* Aligners grid — same Excel-like style, wider to fit all detail columns. */
.db-grid-wrap.aligner-grid table.tbl { min-width: 1350px; }

/* ============================================================
   Treatment Mix board — share bars and category tags
   The category table has 14 columns and the mix is the point, so the
   share column carries a bar rather than a bare percentage: the
   ranking is readable before any number is parsed.
   ============================================================ */
.treat-share {
  position: relative; min-width: 118px; height: 16px; border-radius: 8px;
  background: #f1f3f5; overflow: hidden;
}
.treat-share-fill { position: absolute; inset: 0 auto 0 0; background: #991B1B; border-radius: 8px; }
.treat-share-val {
  position: relative; display: block; line-height: 16px; padding: 0 7px;
  font-size: 11px; font-weight: 700; color: #1a2733; mix-blend-mode: normal;
}
.treat-cat-tag {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  background: #eef2f6; color: #47535c; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}

/* ============================================================
   OPD Leads dashboard (CRM)
   ============================================================ */
/* Filter row inside the leads card (source / branch / search + actions). */
/* Filter tray shared by the lead boards (CRM · OPD, Camp Leads, PRM, Pipeline).
   A light rose tray groups the controls, and every control carries the scarlet
   border that used to appear on focus only — so the filters read as filters. */
.opd-filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; background: #fbf6f6; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.opd-filter-bar .spacer { flex: 1; }
/* ``min-width: 0`` is what keeps the row on one line: without it a control can
   never shrink below its placeholder text, so the bar wraps instead of
   compressing. Text now clips (ellipsis) rather than pushing siblings down. */
.opd-filter-bar .inp { max-width: 230px; min-width: 0; text-overflow: ellipsis; border-color: rgba(153, 27, 27, .32); }
.opd-filter-bar .inp:hover { border-color: rgba(153, 27, 27, .52); }
.opd-filter-bar .inp:focus { outline: none; border-color: var(--scarlet); box-shadow: 0 0 0 3px rgba(153, 27, 27, .13); }
/* Free-text search fills whatever the selects leave behind instead of sitting
   in a fixed 420px box that wraps onto its own line. */
.opd-filter-bar .filter-search { flex: 1 1 220px; max-width: 340px; }
/* Buttons travel together and stay pinned right, so a primary action never
   wraps on its own. */
.opd-filter-bar .filter-actions { display: flex; gap: 9px; flex: 0 0 auto; margin-left: auto; }
.opd-filter-bar .btn { flex: 0 0 auto; }
/* Pipeline has five controls plus its actions, so it is pinned to a single row:
   the filters take fixed widths, the search absorbs the slack, and if the
   window is genuinely narrow everything compresses (clipped) rather than
   dropping the actions onto a second line. */
.opd-filter-bar.pipeline-filters { flex-wrap: nowrap; gap: 8px; padding: 10px; }
.opd-filter-bar.pipeline-filters .filter-search { flex: 1 1 200px; }
@media (max-width: 760px) { .opd-filter-bar.pipeline-filters { flex-wrap: wrap; } }
.opd-pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.opd-kpi { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: flex; align-items: center; gap: 14px; background: #fff; box-shadow: var(--shadow); }
.opd-kpi .dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.opd-kpi .t { font-size: 13px; font-weight: 700; }
.opd-kpi .s { font-size: 12px; color: var(--muted); }
.opd-kpi .v { margin-left: auto; font-size: 30px; font-weight: 800; letter-spacing: -.5px; }

/* CRM funnel stages — the four clickable stage cards that drive the leads
   table. Each card carries its own accent (icon + tint + count + share bar);
   the active stage fills with its colour so the selected tab is obvious. */
.opd-stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin: 0 0 6px; }
.opd-stage {
  --sc: #1971c2; --sb: #e8f0fe;
  display: flex; align-items: stretch; gap: 9px; text-align: left;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px;
  background: #fff; color: var(--ink); font-family: var(--font); font-size: 13px;
  cursor: pointer; box-shadow: var(--shadow); transition: .15s; min-height: 92px;
}
.opd-stage:hover { border-color: var(--sc); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(20, 8, 8, .14); }
.opd-stage.is-on { background: var(--sb); border-color: var(--sc); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(153, 27, 27, .14); }
.opd-stage-ic {
  width: 36px; height: 36px; border-radius: 10px; align-self: center; flex: 0 0 36px;
  background: var(--sb); color: var(--sc); display: grid; place-items: center; font-size: 18px;
}
.opd-stage.is-on .opd-stage-ic { background: var(--sc); color: #fff; }
.opd-stage-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.opd-stage-label { font-size: 12px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.opd-stage-count { font-size: 22px; font-weight: 800; letter-spacing: -.4px; line-height: 1.1; }
.opd-stage.is-on .opd-stage-count { color: var(--sc); }
.opd-stage-sub { font-size: 11px; color: var(--muted); }
.opd-stage-bar { height: 5px; border-radius: 3px; background: var(--rose); overflow: hidden; }
.opd-stage-bar span { display: block; height: 100%; background: var(--sc); }
.opd-stage.is-on .opd-stage-bar span { background: var(--sc); }
/* ---- Lead cards (the OPD board list) --------------------------------
   One card per lead: identity + status chips on top, key facts as a
   labelled meta strip, and a fold-out 3-column editor when the card's
   ✏ Edit button is clicked. No horizontal scrolling — cards wrap. */
@keyframes opdFadeIn {
  from { opacity: 0.6; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
#crmOpdTable { transition: opacity .15s ease; }
.opd-cards {
  display: flex; flex-direction: column; gap: 10px;
  animation: opdFadeIn .18s cubic-bezier(0.16, 1, 0.3, 1);
}
.opd-card {
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  padding: 12px 16px;
  transition: background-color .28s ease, border-color .25s ease, box-shadow .25s ease, opacity .28s ease, transform .28s cubic-bezier(0.4, 0, 0.2, 1), max-height .32s cubic-bezier(0.4, 0, 0.2, 1), padding .32s ease, margin .32s ease;
}
.opd-card.opd-card-highlight {
  box-shadow: 0 4px 18px rgba(0, 0, 0, .09) !important;
}
.opd-card.opd-card-departing {
  opacity: 0 !important;
  transform: scale(0.96) translateY(-8px) !important;
  max-height: 0px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}
.opd-card:hover { border-color: #d9cccc; box-shadow: 0 1px 5px rgba(26, 39, 51, .06); }
.opd-card.opd-card-editing { border-color: #eeb4b4; background: #fffafa; }
.opd-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.opd-card-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.opd-card-name { min-width: 0; }
.opd-card-name b { font-size: 15.5px; }
/* Call / WhatsApp / Notes icons sit right beside the patient name. */
.opd-name-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.opd-mini-ic {
  width: 22px; height: 22px; border-radius: 6px; display: inline-grid; place-items: center;
  font-size: 11.5px; background: var(--bg); border: 1px solid var(--line); text-decoration: none;
  color: var(--ink); transition: .15s; flex-shrink: 0;
}
.opd-mini-ic:hover { border-color: var(--scarlet); background: var(--rose); }
/* Elapsed timer badge next to lead name & action icons */
.opd-timer-badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 8px; border-radius: 6px;
  font-size: 12.5px; font-weight: 700; font-family: var(--font);
  line-height: 1; letter-spacing: .15px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  transition: all .15s ease; user-select: none; white-space: nowrap; flex-shrink: 0;
}
.opd-timer-icon { flex-shrink: 0; display: block; opacity: .9; }
.opd-timer-txt { font-variant-numeric: tabular-nums; font-weight: 700; }
.opd-timer-hot { background: #ebfbee; color: #2b8a3e; border-color: #b2f2bb; }
.opd-timer-fresh { background: #e7f5ff; color: #1971c2; border-color: #a5d8ff; }
.opd-timer-day { background: #fff9db; color: #e67700; border-color: #ffec99; }
/* Overdue leads (> 1 day old) highlighted with bold red background */
.opd-timer-overdue { background: #ffe3e3; color: #c92a2a; border-color: #ffa8a8; }
.opd-timer-mute { background: #f8f9fa; color: #5f7384; border-color: #e9ecef; }
.opd-timer-pulse {
  width: 6.5px; height: 6.5px; border-radius: 50%; background: #2b8a3e;
  display: inline-block; flex-shrink: 0;
  animation: opdTimerPulse 1.6s ease-in-out infinite;
}
@keyframes opdTimerPulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}
.opd-card-sub {
  display: block; color: var(--muted); font-size: 13px; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.opd-card-tools { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.opd-tool {
  height: 28px; min-width: 28px; border-radius: 7px; display: inline-grid; place-items: center;
  font-size: 14px; background: var(--bg); border: 1px solid var(--line); text-decoration: none;
  color: var(--ink); cursor: pointer; padding: 0 6px; transition: .15s; font-family: var(--font);
}
.opd-tool:hover { border-color: var(--scarlet); background: var(--rose); }
.opd-edit-toggle { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; }
/* Stage / warmth quick dropdowns styled as the chips they replace — the card
   re-renders after save, so the pill recolours to the chosen value. */
.opd-chip-sel {
  appearance: none; -webkit-appearance: none; border: 0; cursor: pointer; font-family: var(--font);
  height: 26px; padding: 0 22px 0 10px; font-weight: 700;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%235f7384' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 7px center; background-size: 9px;
}
.opd-chip-sel:focus { outline: 2px solid var(--scarlet); }

/* Meta strip — labelled facts: avatars for people, a colour dot per branch,
   muted sub-times, and a light dash for blanks. */
.opd-card-meta { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 10px; }
.opd-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.opd-meta > span { font-size: 13.5px; text-transform: uppercase; letter-spacing: .5px; color: #33424f; font-weight: 700; }
.opd-meta b {
  display: inline-flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 700;
  max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.opd-meta b i { font-style: normal; font-weight: 700; font-size: 16px; }
/* Follow-up facts (next call, value) sit on the right end of the strip. */
.opd-meta-end { margin-left: auto; display: flex; gap: 8px 28px; flex-wrap: wrap; justify-content: flex-end; }
.opd-none { color: #c8d0d9; font-weight: 400; }
.opd-mini {
  width: 23px; height: 23px; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 10.5px; font-weight: 800; color: #47535c; flex-shrink: 0; letter-spacing: -.2px; background: var(--bg);
}
.opd-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.opd-overdue { color: #c92a2a; }
.opd-money { font-variant-numeric: tabular-nums; }

/* Chief-complaint tag words — multiple issues as removable pills; the
   editor's tag box doubles as the "＋ Add issue…" dropdown host. */
.opd-tags {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; width: 100%;
  min-height: 38px; padding: 6px 8px; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.opd-tag {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line);
  white-space: nowrap;
}
.opd-tag-x {
  border: 0; background: transparent; cursor: pointer; font-size: 14px; line-height: 1;
  padding: 0 1px; color: var(--muted); font-family: var(--font);
}
.opd-tag-x:hover { color: var(--scarlet); }
.opd-tag-add {
  border: 1px dashed #d9cccc; border-radius: 999px; background: #fff; font-family: var(--font);
  font-size: 12.5px; padding: 4px 10px; color: var(--muted); cursor: pointer; max-width: 200px;
}
.opd-tag-add:focus { outline: 2px solid var(--scarlet); border-color: transparent; }
.opd-meta .opd-cc-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; max-width: 300px; white-space: normal; overflow: visible; }

/* Fold-out editor — rich sectioned form: big caller header, tinted section
   cards (Contact / Provider / Call details / Next call / Notes) and a
   Save / Reset footer. Fields keep their collect classes; changes are purely
   local until "Save changes" fires one PATCH. */

/* Big caller header (editing only) */
.opd-x-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.opd-avatar-lg { width: 48px; height: 48px; font-size: 17px; background: #f3e8fd; }
.opd-x-call {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: #fdecec; border: 1px solid #f4c2c2; color: #c92a2a; font-size: 18px; text-decoration: none;
  transition: .15s;
}
.opd-x-call:hover { background: #fbd5d5; }
.opd-x-id { min-width: 0; }
.opd-x-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.opd-x-name { font-size: 20px; font-weight: 800; color: var(--ink); letter-spacing: .2px; line-height: 1.2; }
.opd-x-phone { font-size: 15px; font-weight: 700; color: var(--muted); letter-spacing: .2px; }
.opd-x-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.opd-x-headtools { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.opd-x-stage { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; color: #33424f; font-size: 13.5px; }
.opd-x-stage select {
  height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0 26px 0 9px;
  font-family: var(--font); font-weight: 700; font-size: 13.5px; color: var(--ink); background: #fff;
}
.opd-x-cancel { color: #c92a2a; border-color: #f4c2c2; height: 34px; display: inline-flex; align-items: center; }
.opd-x-cancel:hover { background: #fdecec; }
.opd-x-save { height: 34px; padding: 0 14px; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }

/* Section grid */
.opd-x-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 12px; }.opd-sec { border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.opd-sec-wide { grid-column: 1 / -1; }
/* Bottom section: 3 Tabs (Log History, Add Call & Note, Messages) */
.opd-x-bottom { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.opd-bottom-tabs {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 2px;
  background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 5px;
}
.opd-bottom-tabs .tab {
  padding: 8px 18px; font-weight: 700; font-size: 13.5px; color: var(--muted);
  cursor: pointer; background: transparent; border: 1px solid transparent; border-radius: 9px;
  transition: all .15s ease; font-family: var(--font); display: inline-flex; align-items: center; gap: 7px;
}
.opd-bottom-tabs .tab:hover { color: var(--ink); background: #ffffff; }
.opd-bottom-tabs .tab.active {
  background: #ffffff; color: var(--ink); border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}
.opd-bottom-tabs .tab[data-tab="history"].active { color: #c92a2a; border-bottom: 3px solid #c92a2a; }
.opd-bottom-tabs .tab[data-tab="note"].active { color: #d9480f; border-bottom: 3px solid #d9480f; }
.opd-bottom-tabs .tab[data-tab="messages"].active { color: #2b8a3e; border-bottom: 3px solid #2b8a3e; }
.opd-bottom-pane { width: 100%; box-sizing: border-box; }
.btn-wa { background: #25d366 !important; color: #fff !important; border: 1px solid #1ebe5d !important; font-weight: 700; }
.btn-wa:hover { background: #1ebe5d !important; box-shadow: 0 2px 8px rgba(37, 211, 102, .3); }
.opd-wa-recipient {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 10px; border-radius: 8px; background: #f4fcf6; border: 1px solid #c3fae8;
  font-size: 12.5px; color: #2b8a3e; font-weight: 700;
}
.opd-wa-chat {
  height: 155px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
  padding: 8px 10px; background: #f8fafc; border: 1px solid var(--line); border-radius: 9px;
  box-sizing: border-box;
}
.opd-wa-bubble {
  max-width: 86%; padding: 6px 10px; border-radius: 9px;
  font-size: 12.5px; line-height: 1.35; word-break: break-word; position: relative;
}
.opd-wa-bubble.out {
  align-self: flex-end; background: #dcf8c6; color: #111b21;
  border-bottom-right-radius: 2px; box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.opd-wa-bubble.in {
  align-self: flex-start; background: #ffffff; color: #111b21;
  border: 1px solid #e1e7ec; border-bottom-left-radius: 2px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.opd-wa-bubble-author { font-size: 10.5px; font-weight: 700; margin-bottom: 2px; color: #1b7a3e; }
.opd-wa-bubble.in .opd-wa-bubble-author { color: #1971c2; }
.opd-wa-bubble-time { display: block; font-size: 10px; color: #718096; margin-top: 2px; text-align: right; }
.opd-wa-input {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px;
  font-family: var(--font); font-size: 13.5px; line-height: 1.4; color: var(--ink);
  resize: vertical; outline: none; box-sizing: border-box; background: #fff;
}
.opd-wa-input:focus { border-color: #25d366; box-shadow: 0 0 0 2px rgba(37, 211, 102, .15); }
.opd-sec-head { display: flex; gap: 11px; align-items: center; padding: 10px 14px; }
.opd-sec-head h4 { margin: 0; font-size: 16.5px; line-height: 1.2; }
.opd-sec-head p { margin: 1px 0 0; font-size: 12.5px; color: var(--muted); }
.opd-sec-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; flex-shrink: 0; }
.opd-sec-blue .opd-sec-head { background: #e8f0fe; }   .opd-sec-blue .opd-sec-head h4 { color: #1971c2; }   .opd-sec-blue .opd-sec-ic { background: #d0e1fd; }
.opd-sec-green .opd-sec-head { background: #e7f8ee; }  .opd-sec-green .opd-sec-head h4 { color: #2b8a3e; }  .opd-sec-green .opd-sec-ic { background: #c8f2d8; }
.opd-sec-amber .opd-sec-head { background: #fff4e0; }  .opd-sec-amber .opd-sec-head h4 { color: #b35c00; }  .opd-sec-amber .opd-sec-ic { background: #ffe8c2; }
.opd-sec-purple .opd-sec-head { background: #f3e8fd; } .opd-sec-purple .opd-sec-head h4 { color: #7048e8; } .opd-sec-purple .opd-sec-ic { background: #e3d5fc; }
.opd-sec-rose .opd-sec-head { background: #fdecec; }   .opd-sec-rose .opd-sec-head h4 { color: #c92a2a; }   .opd-sec-rose .opd-sec-ic { background: #fbd5d5; }
.opd-sec-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.opd-sec-body.opd-x-cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }

/* Label + icon-chip field rows */
.opd-x-row { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 9px; }
.opd-x-row > label { font-size: 13.5px; font-weight: 700; color: #33424f; }
.opd-x-field { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.opd-x-field:focus-within { border-color: var(--scarlet); box-shadow: 0 0 0 2px rgba(168, 29, 29, .08); }
.opd-x-ic { width: 34px; display: grid; place-items: center; background: var(--bg); border-right: 1px solid var(--line); font-size: 13px; flex-shrink: 0; }
.opd-x-field input, .opd-x-field select {
  border: 0; outline: none; box-shadow: none; height: 37px; padding: 6px 10px;
  font-size: 15px; color: var(--ink); font-family: var(--font); flex: 1; min-width: 0; width: 100%; box-sizing: border-box; background: #fff;
}
.opd-x-field input::placeholder { color: #9aa5ad; }
.opd-x-inline { display: flex; gap: 9px; flex: 1; min-width: 0; }
.opd-x-inline .opd-x-field { flex: 1; min-width: 0; }
.opd-x-field.opd-x-tags { align-items: stretch; padding: 0; }
.opd-x-tags .opd-x-ic { align-self: stretch; height: auto; }
.opd-x-tags .opd-tags { border: 0; border-radius: 0; flex: 1; min-height: 37px; }
.opd-x-notebtn { display: flex; justify-content: flex-end; }
.opd-note-tools { display: flex; align-items: center; gap: 10px; }
.opd-mic {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer;
  font-family: var(--font); font-size: 13px; font-weight: 700; color: #33424f; transition: .15s;
}
.opd-mic:hover { border-color: var(--scarlet); background: var(--rose); }
.opd-mic.recording {
  border-color: #c92a2a; color: #c92a2a; background: #fdecec;
  animation: opd-mic-pulse 1.1s ease-in-out infinite;
}
.opd-mic:disabled { opacity: .62; cursor: default; animation: none; }
@keyframes opd-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 42, 42, .30); }
  50% { box-shadow: 0 0 0 7px rgba(201, 42, 42, 0); }
}

/* Call history timeline (LeadFollowUp rows + queued entries) */
.opd-call-list { max-height: 240px; overflow: auto; display: flex; flex-direction: column; gap: 7px; }
.opd-call-row { display: flex; gap: 9px; padding: 8px 9px; border-radius: 9px; background: var(--bg); align-items: flex-start; }
.opd-call-ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); font-size: 12px; flex-shrink: 0; }
.opd-call-main { flex: 1; min-width: 0; }
.opd-call-when { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.opd-call-meta { display: flex; align-items: center; gap: 6px; margin: 3px 0; flex-wrap: wrap; }
.opd-call-meta .chip { font-size: 11px; }
.opd-call-txt { margin: 0; font-size: 13.5px; color: var(--ink); overflow-wrap: anywhere; }
.opd-note-pending { background: #fff4e0; border: 1px dashed #f08c00; }

/* PRM Leads table — appointment highlight colours */
.prm-appt-today { color: #b35c00; font-weight: 800; }
.prm-appt-past { color: #c92a2a; font-weight: 700; }

/* Detail — week navigator (Monday to Friday) */
.cw-nav { display: flex; align-items: center; gap: 10px; }
.cw-nav-lbl { font-size: 13.5px; white-space: nowrap; }
.cw-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.cw-day {
  display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer;
  font: inherit; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 9px 6px; transition: .15s;
}
.cw-day:hover { border-color: var(--scarlet); transform: translateY(-2px); box-shadow: var(--shadow); }
.cw-day.is-today { border-color: var(--scarlet); box-shadow: 0 0 0 2px var(--rose); }
.cw-dow { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.cw-date { font-size: 18px; font-weight: 800; color: #1f2d3a; line-height: 1.1; }
.cw-n { font-size: 11px; font-weight: 800; color: var(--muted); background: var(--bg); border-radius: 999px; padding: 1px 8px; min-width: 22px; }
@media (max-width: 640px) { .cw-nav { flex-wrap: wrap; } .cw-nav-lbl { order: -1; width: 100%; } }

/* Footer actions */
.opd-editor-actions {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line);
}
.opd-editor-actions .btn { font-size: 14.5px; }
@media (max-width: 1100px) { .opd-x-grid { grid-template-columns: repeat(2, 1fr); } .opd-sec-body.opd-x-cols2 { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .opd-x-grid { grid-template-columns: 1fr; } .opd-x-row { grid-template-columns: 84px 1fr; } }
@media (max-width: 1100px) { .opd-card-editor { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .opd-card-editor { grid-template-columns: 1fr; } }

/* The PRM / next-call / value meta ✏ shortcuts (read-only card). */
.opd-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #47535c; flex-shrink: 0; }
.opd-empty { text-align: center; color: var(--muted); padding: 26px; }

/* ＋ New Lead modal — the card editor's sections, laid out two-up inside the
   modal so the same form reads the same on every leads board. */
.lead-new .modal-body { padding: 18px 20px 20px; }
.lead-new .opd-x-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 0; }
.lead-new .opd-editor-actions { margin-top: 16px; }
.lead-new .opd-tag-add { color: var(--muted); }
@media (max-width: 820px) { .lead-new .opd-x-grid { grid-template-columns: 1fr; } }

/* 📅 Confirm appointment modal — a who/what summary strip above the same
   branch/doctor/time fields the card editor uses. */
.lead-sched .ls-lead {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px; margin-bottom: 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
}
.lead-sched .ls-lead-id { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lead-sched .ls-lead-id b { font-size: 16px; }
.lead-sched .opd-x-row { grid-template-columns: 74px 1fr; }
.lead-sched .opd-x-inline .btn { flex-shrink: 0; }
.lead-sched .opd-sec-amber p.muted { margin: 2px 0 0; }

/* Warmth select — color the value like a chip */
.opd-warm option[value="hot"][selected] { color: #dc2626; }
.opd-warm option[value="warm"][selected] { color: #d97706; }
.opd-warm option[value="cold"][selected] { color: #0d9488; }

/* Stage select — color the chosen funnel stage */
.opd-stage-select option[value="new"][selected] { color: #1d4ed8; }
.opd-stage-select option[value="contacted"][selected] { color: #e8590c; }
.opd-stage-select option[value="scheduled"][selected] { color: #2b8a3e; }
.opd-stage-select option[value="op_completed"][selected] { color: #7048e8; }


/* ============================================================
   Lead card / follow-up modal (CRM)
   ============================================================ */
.ld-modal { max-width: 880px; }
.ld-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.ld-avatar { width: 52px; height: 52px; font-size: 18px; }
.ld-head-info .ld-name { font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.ld-head-info .ld-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.ld-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.ld-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.ld-card-lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.ld-card-val { font-size: 16px; font-weight: 700; margin-top: 4px; display: flex; align-items: center; gap: 8px; }
.ld-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px; }
.ld-fu { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.ld-fu-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ld-fu-head .ld-counts { display: flex; gap: 14px; }
.ld-timeline { max-height: 260px; overflow: auto; }
.ld-tl-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.ld-tl-item:last-child { border-bottom: 0; }
.ld-tl-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; flex-shrink: 0; background: var(--rose); }
.ld-tl-body { flex: 1; }
.ld-tl-kind { font-size: 13px; font-weight: 700; }
.ld-tl-meta { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 6px; }
.ld-tl-detail { font-size: 13px; margin-top: 2px; color: var(--ink); }
.ld-addfu { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }

/* ---- Dental Camps · Pipeline "New Lead" modal ---------------------------- */
/* Compact, high-contrast form: solid brand-red section bars, tight 40px
   controls, sticky header + footer so only the fields scroll. */
.pl-modal { display: flex; flex-direction: column; max-width: 1180px; max-height: 90vh; }
.pl-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 18px; border-bottom: 1px solid var(--line); background: #fff;
}
.pl-head-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pl-badge {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 11px; color: #fff;
  background: linear-gradient(135deg, var(--scarlet), var(--scarlet-dark));
  display: grid; place-items: center; box-shadow: 0 3px 10px rgba(185,28,28,.32);
}
.pl-title { margin: 0; font-size: 19px; font-weight: 800; color: var(--ink); line-height: 1.15; letter-spacing: -.2px; }
.pl-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.pl-close {
  width: 34px; height: 34px; flex: 0 0 34px; border: 1px solid var(--rose-medium); border-radius: 9px;
  background: #fff; color: var(--scarlet); display: grid; place-items: center; cursor: pointer;
}
.pl-close:hover { background: var(--scarlet); border-color: var(--scarlet); color: #fff; }
.pl-body { padding: 13px 18px; display: flex; flex-direction: column; gap: 11px; overflow-y: auto; flex: 1 1 auto; }
.pl-section { border: 1px solid #eed7d7; border-radius: 11px; overflow: hidden; box-shadow: 0 1px 2px rgba(20,8,8,.04); }
.pl-sec-head {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: linear-gradient(135deg, var(--scarlet) 0%, var(--scarlet-dark) 100%);
}
.pl-sec-head h4 { margin: 0; font-size: 13.5px; font-weight: 800; color: #fff; letter-spacing: .2px; }
.pl-sec-ic {
  width: 26px; height: 26px; flex: 0 0 26px; border-radius: 8px;
  background: rgba(255,255,255,.2); color: #fff; display: grid; place-items: center;
}
.pl-grid { display: grid; gap: 10px 14px; padding: 11px 12px; }
.pl-grid.pl-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pl-grid.pl-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pl-grid.pl-cols-4 { grid-template-columns: 1.25fr repeat(3, minmax(0, 1fr)); }
.pl-field { min-width: 0; }
.pl-field.pl-span { grid-column: 1 / -1; }
.pl-field > label { display: block; font-size: 12px; font-weight: 700; color: var(--ink); margin-bottom: 5px; }
.pl-input {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  border: 1px solid #e3d4d4; border-radius: 9px; background: #fff; padding: 0 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.pl-input:hover { border-color: var(--rose-medium); }
.pl-input:focus-within { border-color: var(--scarlet); box-shadow: 0 0 0 3px rgba(185,28,28,.13); }
.pl-input .pl-ic { flex: 0 0 auto; color: var(--scarlet); opacity: .55; display: grid; place-items: center; }
.pl-input:focus-within .pl-ic { opacity: 1; }
.pl-input input, .pl-input select, .pl-input textarea {
  flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 14px; color: var(--ink); padding: 9px 0; height: 40px;
}
.pl-input select { cursor: pointer; }
.pl-input input::placeholder, .pl-input textarea::placeholder { color: #a9b4bd; }
.pl-input textarea { resize: vertical; height: auto; min-height: 40px; line-height: 1.45; padding: 9px 0; }
.pl-input.pl-area { align-items: flex-start; padding-top: 1px; }
.pl-check {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px;
  border: 1px solid #e3d4d4; border-radius: 9px; background: #fff; font-size: 13.5px;
  font-weight: 600; color: var(--ink); cursor: pointer;
}
.pl-check:hover { border-color: var(--rose-medium); }
.pl-check input { width: 16px; height: 16px; accent-color: var(--scarlet); cursor: pointer; }
.pl-foot {
  display: flex; align-items: center; gap: 10px; padding: 11px 18px;
  border-top: 1px solid var(--line); background: var(--bg);
}
.pl-btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 22px; font-size: 14px; font-weight: 700; border-radius: 9px; }
.pl-btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.pl-btn-ghost:hover { background: var(--rose); border-color: var(--rose-medium); color: var(--scarlet); }
.pl-btn:disabled { opacity: .6; cursor: not-allowed; }
@media (max-width: 1000px) { .pl-grid.pl-cols-4, .pl-grid.pl-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .pl-grid.pl-cols-4, .pl-grid.pl-cols-3, .pl-grid.pl-cols-2 { grid-template-columns: minmax(0, 1fr); }
}

/* ============ Personal PRM Dashboard ============ */
.prm-dash-banner {
  background: linear-gradient(135deg, #ffffff 0%, #f8fbfd 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 22px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .03);
}
.prm-dash-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}
@media (max-width: 1080px) {
  .prm-dash-grid { grid-template-columns: 1fr; }
}

.prm-side-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
  position: sticky;
  top: 14px;
}
.prm-side-head {
  padding: 12px 16px;
  background: #fafbfc;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.prm-call-list {
  max-height: 580px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}
.prm-call-row {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all .15s ease;
}
.prm-call-row:hover {
  border-color: #cbd5e1;
  box-shadow: 0 3px 10px rgba(0,0,0,.05);
  transform: translateY(-1px);
}
.prm-call-row.is-overdue {
  border-left: 4px solid #e03131;
  background: #fffdfd;
}
.prm-call-row.is-today {
  border-left: 4px solid #f08c00;
  background: #fffdfa;
}
.prm-call-row.is-upcoming {
  border-left: 4px solid #0ca678;
}

.prm-alert {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.prm-alert-red {
  background: #fff5f5;
  border: 1px solid #ffc9c9;
  color: #c92a2a;
}
.prm-alert-amber {
  background: #fff9db;
  border: 1px solid #ffe066;
  color: #d9480f;
}
.prm-alert-green {
  background: #ebfbee;
  border: 1px solid #b2f2bb;
  color: #2b8a3e;
}

.prm-funnel-bar {
  display: flex;
  width: 100%;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: #f1f3f5;
  margin: 10px 0 14px;
}
.prm-funnel-seg {
  height: 100%;
  transition: width .3s ease;
}

.prm-feed-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f3f5;
  font-size: 13px;
}
.prm-feed-item:last-child {
  border-bottom: 0;
}
.prm-feed-ic {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  flex: 0 0 auto;
}
.btn-xs {
  padding: 3px 8px;
  font-size: 11.5px;
  border-radius: 6px;
  line-height: 1.3;
}
.prm-call-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  text-decoration: none;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #f8fafc;
  transition: all .15s ease;
}
.prm-call-action-btn:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}
.prm-call-action-btn.is-wa {
  background: #e6fcf5;
  border-color: #96f2d7;
  color: #0ca678;
}
.prm-call-action-btn.is-wa:hover {
  background: #c3fae8;
}
.prm-call-action-btn.is-call {
  background: #e7f5ff;
  border-color: #a5d8ff;
  color: #1971c2;
}
.prm-call-action-btn.is-call:hover {
  background: #d0ebff;
}

/* ============ Proper Funnel & Improved Stage Cards ============ */
.prm-funnel-card-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(300px, 1.25fr);
  gap: 20px;
  align-items: stretch;
}
@media (max-width: 900px) {
  .prm-funnel-card-layout {
    grid-template-columns: 1fr;
  }
}

.prm-funnel-box {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.prm-funnel-svg {
  width: 100%;
  max-width: 320px;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.04));
}
.prm-funnel-tier {
  cursor: pointer;
  transition: transform .2s ease, filter .2s ease, opacity .2s ease;
}
.prm-funnel-tier:hover {
  filter: brightness(1.08) drop-shadow(0 6px 12px rgba(0,0,0,.15));
  transform: scale(1.02);
  transform-origin: center;
}
.prm-funnel-tier text {
  pointer-events: none;
  font-family: inherit;
}

.prm-stage-cards-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: space-between;
}

.prm-stage-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all .18s ease;
  cursor: pointer;
}
.prm-stage-item:hover {
  border-color: #cbd5e1;
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
  background: #fafbfc;
}
.prm-stage-item.is-new {
  border-left: 4px solid #1971c2;
}
.prm-stage-item.is-contacted {
  border-left: 4px solid #f08c00;
}
.prm-stage-item.is-scheduled {
  border-left: 4px solid #7048e8;
}
.prm-stage-item.is-op_completed {
  border-left: 4px solid #2b8a3e;
}
.prm-stage-item.is-lost {
  border-left: 4px solid #868e96;
}

.prm-stage-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex: 0 0 auto;
}
.prm-stage-main-info {
  flex: 1;
  min-width: 0;
}
.prm-stage-item-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}
.prm-stage-item-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}
.prm-stage-item-stat {
  text-align: right;
  flex: 0 0 auto;
}
.prm-stage-item-count {
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}
.prm-stage-item-cta {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}
.prm-stage-item:hover .prm-stage-item-cta {
  color: var(--ink);
}

/* ============ Top KPI + Funnel Row Layout ============ */
.prm-kpi-funnel-row {
  display: grid;
  grid-template-columns: 1.12fr 1fr;
  gap: 16px;
  margin-top: 14px;
  margin-bottom: 16px;
  align-items: stretch;
}
@media (max-width: 1120px) {
  .prm-kpi-funnel-row {
    grid-template-columns: 1fr;
  }
}

.prm-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  height: 100%;
}
@media (max-width: 600px) {
  .prm-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.prm-kpi-tile {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all .18s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.03);
}
.prm-kpi-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
}
.prm-kpi-tile.is-clickable {
  cursor: pointer;
}

.prm-kpi-tile.is-overdue {
  border-left: 4px solid #e03131;
  background: linear-gradient(135deg, #fff5f5 0%, #ffffff 100%);
}
.prm-kpi-tile.is-today {
  border-left: 4px solid #f08c00;
  background: linear-gradient(135deg, #fff9db 0%, #ffffff 100%);
}
.prm-kpi-tile.is-assigned {
  border-left: 4px solid #1971c2;
  background: linear-gradient(135deg, #e7f5ff 0%, #ffffff 100%);
}
.prm-kpi-tile.is-value {
  border-left: 4px solid #2b8a3e;
  background: linear-gradient(135deg, #ebfbee 0%, #ffffff 100%);
}
.prm-kpi-tile.is-appts {
  border-left: 4px solid #7048e8;
  background: linear-gradient(135deg, #f3f0ff 0%, #ffffff 100%);
  grid-column: 1 / -1;
}

.prm-kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex: 0 0 42px;
}
.prm-kpi-content {
  flex: 1;
  min-width: 0;
}
.prm-kpi-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #495057;
  text-transform: uppercase;
  letter-spacing: .3px;
  line-height: 1.2;
}
.prm-kpi-num {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
  margin: 2px 0 1px;
}
.prm-kpi-detail {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Funnel stage chips under the funnel */
.prm-funnel-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 10px;
}
.prm-funnel-chip {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  background: #ffffff;
  cursor: pointer;
  transition: all .15s ease;
}
.prm-funnel-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
  border-color: #cbd5e1;
}
