/* =================== v6: compact, calm "SaaS" density. Loaded last. =================== */
:root { --radius: 14px; }
body { font-size: 13.5px; line-height: 1.45; }

/* layout */
.layout { grid-template-columns: 228px 1fr; }
.sidebar { padding: 14px 10px; }
.brand { padding: 2px 6px 14px; }
.brand img { width: 34px; height: 34px; }
.brand-name { font-size: 19px; }
.nav a, .nav-toggle { padding: 8px 10px; gap: 10px; font-size: 13.5px; border-radius: 10px; }
.nav a svg, .nav-toggle svg { width: 17px; height: 17px; }
.nav a.sub { padding: 6px 10px 6px 14px; font-size: 13px; }
.plan { padding: 11px; font-size: 12.5px; }
.topbar { padding: 9px 22px; gap: 12px; min-height: 56px; }
.search input { padding: 8px 12px 8px 34px; font-size: 13px; }
.content { padding: 18px 22px 96px; max-width: 1560px; margin: 0 auto; width: 100%; box-sizing: border-box; }
.footer { padding: 9px 22px; font-size: 11.5px; }

/* headings + spacing */
.page-head { margin-bottom: 14px; gap: 12px; align-items: center; }
.page-head h1 { font-size: 20px; letter-spacing: -.02em; }
.page-head p { font-size: 13px; margin-top: 2px; max-width: 760px; }
.grid { gap: 14px; }
.mb { margin-bottom: 14px; }
.card { padding: 16px; border-radius: var(--radius); }
.card-head { margin-bottom: 10px; }
.card-head h3 { font-size: 14.5px; }
.section-title { font-size: 11.5px; letter-spacing: .06em; margin: 2px 0 10px; }
.kv { gap: 7px 16px; font-size: 13px; }

/* stat cards: smaller, cleaner */
.card.stat { padding: 14px 16px; gap: 12px; }
.stat .ic { width: 40px; height: 40px; border-radius: 12px; }
.stat .ic svg { width: 19px; height: 19px; }
.stat .val { font-size: 22px; margin: 1px 0; }
.stat .val small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.stat .label { font-size: 12px; }
.stat .sub { font-size: 11.5px; }
.mini-stat .ic { width: 36px; height: 36px; border-radius: 11px; }
.mini-stat .val { font-size: 19px; }

/* controls */
.btn { padding: 7px 13px; font-size: 13px; border-radius: 10px; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 9px; }
.btn svg { width: 15px; height: 15px; }
input, select, textarea { padding: 7px 11px; font-size: 13.5px; border-radius: 10px; }
.form-grid { gap: 12px 14px; }
.form-grid label { font-size: 12.5px; gap: 5px; }
.pill { padding: 2px 9px; font-size: 11px; }
.range button { padding: 6px 11px; font-size: 12.5px; }
.status-tabs { padding: 6px; gap: 4px; }
.status-tabs button { padding: 6px 11px; font-size: 12.5px; }
.status-tabs button span { font-size: 11px; padding: 1px 7px; }
.lead-filters { padding: 10px 12px; gap: 8px; }
.lf-row select, .lf-row input { padding: 6px 9px; font-size: 12.5px; }

/* tables: denser, easier to scan */
table { font-size: 13px; }
th { padding: 8px 10px; font-size: 11px; }
td { padding: 8px 10px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.table-wrap { border: 1px solid var(--border); border-radius: 12px; }
.card > .table-wrap:only-child, .card .table-wrap { border: 0; }

/* modals + drawers */
.modal { border-radius: 18px; }
.modal-head { padding: 14px 18px; }
.modal-body { padding: 16px 18px; }
.modal-foot { padding: 12px 18px; }

/* dashboard */
.g-dash { grid-template-columns: minmax(0, 1fr) 300px; }
.head-date { padding: 8px 12px; }
.qa-btn { padding: 10px; font-size: 12.5px; }
.donut-wrap svg { max-width: 120px; }

/* banners with a button */
.banner-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; }
.notice-inline { background: #fff7e6; border: 1px solid #fde3a7; color: #92400e; border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; }

/* ---- payments */
.pay-wrap { display: flex; flex-direction: column; gap: 12px; }
.pay-step { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 4px; }
.pay-n { width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.pay-amount { display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 14px; padding: 6px 14px; background: var(--panel); }
.pay-amount span { font-size: 24px; font-weight: 700; color: var(--muted); }
.pay-amount input { border: 0; font-size: 26px; font-weight: 700; padding: 4px; width: 100%; background: transparent; box-shadow: none !important; }
.pay-methods { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pay-method { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--panel); cursor: pointer; font: inherit; color: inherit; text-align: left; transition: border-color .15s, box-shadow .15s; }
.pay-method:hover:not(:disabled) { border-color: #9dbcff; }
.pay-method.on { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29, 91, 240, .14); }
.pay-method:disabled { opacity: .55; cursor: not-allowed; }
.pay-method .pm-ic { font-size: 22px; }
.pay-method b { font-size: 13px; }
.pay-method .soon { position: absolute; top: 8px; right: 8px; background: #eef2f7; color: #64748b; border-radius: 999px; padding: 1px 7px; font-size: 10.5px; font-weight: 700; }
.pay-box { border: 1px dashed #b9cdf8; background: #f5f8ff; border-radius: 14px; padding: 12px 14px; }
.pay-box-head { font-size: 14px; margin-bottom: 6px; }
.pay-fields { display: flex; flex-direction: column; gap: 6px; }
.pf { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 10px; padding: 7px 10px; background: var(--panel); border-radius: 10px; border: 1px solid var(--border); }
.pf span { color: var(--muted); font-size: 12px; }
.pf b { word-break: break-all; font-size: 13px; }
.pay-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px; border: 2px dashed #c7d2e3; border-radius: 14px; cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.pay-drop:hover, .pay-drop.over { border-color: var(--primary); background: #f5f8ff; }
.pay-drop.has { border-style: solid; border-color: #86efac; background: #f0fdf4; }
.pay-drop .pd-ic { font-size: 24px; }
.pay-drop small { color: var(--muted); }
.pd-preview img { max-height: 140px; max-width: 100%; border-radius: 10px; margin-top: 8px; box-shadow: var(--shadow); }
.proof-img { max-width: 100%; max-height: 70vh; border-radius: 12px; display: block; margin: 0 auto; }
.proof-frame { width: 100%; height: 70vh; border: 0; border-radius: 12px; }
.pm-edit { border: 1px solid var(--border); border-radius: 14px; padding: 12px; margin-top: 10px; }
@media (max-width: 600px) { .pf { grid-template-columns: 1fr auto; } .pf span { grid-column: 1 / -1; } }

/* dark mode for the new parts */
[data-theme=dark] .pay-box, [data-theme=dark] .pay-drop:hover, [data-theme=dark] .pay-drop.over { background: #13213f; border-color: #26407a; }
[data-theme=dark] .pay-drop.has { background: #0f2a1e; border-color: #1f5c3a; }
[data-theme=dark] .pay-method .soon { background: #1b2742; color: #8ea0c0; }
[data-theme=dark] .notice-inline { background: #2a2010; border-color: #5c4516; color: #fcd58a; }
[data-theme=dark] .pay-amount { background: #0d1527; }

@media (max-width: 1100px) { .g-dash { grid-template-columns: 1fr; } }

/* dashboard period picker */
.dash-range .range { flex-wrap: wrap; justify-content: flex-end; }
.dash-range .range input[type=date] { padding: 5px 8px; font-size: 12.5px; }
@media (max-width: 900px) { .dash-range { width: 100%; } .dash-range .range { justify-content: flex-start; } }

/* ---- leads: one compact, responsive control bar */
.lead-bar { padding: 12px 14px 8px; }
.lb-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lb-search { position: relative; flex: 1 1 260px; min-width: 200px; }
.lb-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: #94a3b8; pointer-events: none; }
.lb-search input { width: 100%; padding-left: 34px; height: 36px; }
.lb-field { display: inline-flex; flex-direction: row; align-items: center; gap: 0; margin: 0; font-weight: 400; border: 1px solid #dfe5ef; border-radius: 10px; background: var(--panel); height: 36px; overflow: hidden; }
.lb-field span { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 0 4px 0 10px; white-space: nowrap; }
.lb-field select { border: 0; height: 34px; padding: 0 26px 0 4px; background-color: transparent; box-shadow: none !important; font-weight: 600; font-size: 13px; }
.lb-custom { display: inline-flex; align-items: center; gap: 6px; }
.lb-custom input { height: 36px; padding: 0 8px; }
.lb-ftoggle { height: 36px; position: relative; }
.lb-ftoggle.on { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }
.lb-count { background: var(--primary); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; line-height: 18px; margin-left: 2px; }
.lb-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 10px; padding: 10px; border-radius: 12px; background: #f7f9fc; border: 1px solid var(--border); }
.lb-filters select, .lb-filters input { width: 100%; height: 34px; padding: 0 10px; font-size: 13px; }
.lb-filters .lb-clear { height: 34px; }
.lb-tabs { display: flex; gap: 4px; overflow-x: auto; margin: 10px -14px 0; padding: 8px 14px 2px; border-top: 1px solid var(--border); scrollbar-width: thin; }
.lb-tabs button { flex: none; border: 0; background: none; padding: 6px 10px; border-radius: 999px; font: inherit; font-size: 12.5px; font-weight: 600; color: #475569; cursor: pointer; white-space: nowrap; }
.lb-tabs button:hover { background: #f1f5fb; }
.lb-tabs button span { background: #eef2f7; color: #64748b; border-radius: 999px; padding: 1px 7px; font-size: 11px; margin-left: 4px; }
.lb-tabs button.on { background: var(--primary); color: #fff; }
.lb-tabs button.on span { background: rgba(255, 255, 255, .25); color: #fff; }
@media (max-width: 700px) {
  .lb-search { flex-basis: 100%; }
  .lb-field { flex: 1 1 calc(50% - 4px); }
  .lb-field select { flex: 1; min-width: 0; }
  .lb-ftoggle { flex: 1 1 calc(50% - 4px); }
  .lb-custom { flex-basis: 100%; } .lb-custom input { flex: 1; }
}
[data-theme=dark] .lb-field { background: #0d1527; border-color: #26344f; }
[data-theme=dark] .lb-filters { background: #0e1729; }
[data-theme=dark] .lb-tabs button { color: #a9b8d4; }
[data-theme=dark] .lb-tabs button:hover { background: #16213a; }
[data-theme=dark] .lb-tabs button span { background: #1f2b45; color: #c7d3ea; }

/* phones / small tablets: the sidebar slides in, so the page uses the full width */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .content { padding: 14px 12px 96px; }
  .lb-search { min-width: 0; }
  .lb-field select { min-width: 0; width: 100%; }
}

/* ---- floating team chat (every page) */
.cdock { position: fixed; left: 248px; bottom: 54px; z-index: 70; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; pointer-events: none; }
.cdock > * { pointer-events: auto; }
.cd-bubble { position: relative; width: 50px; height: 50px; border-radius: 50%; border: 0; cursor: pointer; font-size: 22px; color: #fff; background: linear-gradient(135deg, #6ea8ff, #7c3aed); box-shadow: 0 10px 24px -6px rgba(124, 58, 237, .6); transition: transform .15s; }
.cd-bubble:hover { transform: translateY(-2px); }
.cdock.open .cd-bubble { transform: scale(.9); opacity: .85; }
.cd-badge { position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; border-radius: 999px; background: #ff3b5c; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 5px; border: 2px solid var(--panel); }
.cd-panel { width: 340px; height: min(480px, calc(100vh - 140px)); background: var(--panel); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 30px 60px -16px rgba(9, 16, 33, .4); display: flex; flex-direction: column; overflow: hidden; }
.cd-panel[hidden] { display: none !important; }
.cd-head { display: flex; align-items: center; gap: 8px; padding: 11px 12px; color: #fff; background: linear-gradient(135deg, #0b1b46, #1d5bf0); }
.cd-head b { font-size: 14px; }
.cd-sub { font-size: 11.5px; opacity: .85; display: inline-flex; align-items: center; gap: 4px; margin-right: auto; }
.cd-head button, .cd-head a { background: rgba(255, 255, 255, .14); border: 0; color: #fff; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; font-size: 17px; text-decoration: none; }
.cd-body { flex: 1; overflow-y: auto; min-height: 0; }
.cd-threads { padding: 6px; }
.cd-th { display: flex; gap: 10px; align-items: center; width: 100%; border: 0; background: none; text-align: left; padding: 9px; border-radius: 12px; cursor: pointer; font: inherit; color: inherit; }
.cd-th:hover { background: #f5f8fd; }
.cd-th > div { flex: 1; min-width: 0; } .cd-th small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd-th .avatar { position: relative; } .cd-th .badge { position: static; }
.cd-msgs { padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 100%; background: #f8fafd; box-sizing: border-box; }
.cd-msgs .cm { max-width: 85%; }
.cd-form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--border); }
.cd-form[hidden] { display: none !important; }
.cd-form textarea { flex: 1; resize: none; font-size: 13px; }
.cd-previews { display: flex; flex-direction: column; gap: 6px; }
.cd-preview { display: flex; gap: 9px; align-items: flex-start; width: 290px; background: var(--panel); border: 1px solid var(--border); border-left: 4px solid #7c3aed; border-radius: 14px; padding: 9px 10px; box-shadow: 0 16px 30px -12px rgba(9, 16, 33, .35); cursor: pointer; animation: cdIn .2s ease-out; font-size: 13px; }
.cd-preview > div { flex: 1; min-width: 0; } .cd-preview > div > div { color: #334155; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cd-preview button { border: 0; background: none; color: var(--muted); font-size: 18px; cursor: pointer; line-height: 1; }
@keyframes cdIn { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 860px) { .cdock { left: 12px; bottom: 16px; } .cd-panel { width: calc(100vw - 24px); height: min(70vh, 520px); } .cd-preview { width: calc(100vw - 90px); } }
[data-theme=dark] .cd-th:hover { background: #16213a; }
[data-theme=dark] .cd-msgs { background: #0e1729; }
[data-theme=dark] .cd-preview > div > div { color: #c7d3ea; }
.cd-form { align-items: flex-end; } .cd-form .btn { height: 34px; }

/* ---- Team Chat page (enterprise) */
.tc { display: grid; grid-template-columns: 290px minmax(0, 1fr) 250px; padding: 0; overflow: hidden; height: calc(100dvh - 200px); min-height: 520px; }
.tc-side { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; background: #fbfcfe; }
.tc-search { padding: 12px; border-bottom: 1px solid var(--border); }
.tc-search input { width: 100%; }
.tc-list { flex: 1; overflow-y: auto; padding: 6px 8px 12px; }
.tc-group { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 8px 6px; }
.tc-th { display: flex; gap: 10px; align-items: center; width: 100%; border: 0; background: none; text-align: left; padding: 8px; border-radius: 12px; cursor: pointer; font: inherit; color: inherit; }
.tc-th:hover { background: #f1f5fb; } .tc-th.on { background: var(--primary-50); box-shadow: inset 3px 0 0 var(--primary); }
.tc-th-main { flex: 1; min-width: 0; }
.tc-th-top { display: flex; justify-content: space-between; gap: 6px; } .tc-th-top b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .tc-th-top small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.tc-prev { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-th .badge { position: static; }
.avatar { position: relative; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.st-dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--panel); background: #94a3b8; }
.st-dot.available { background: #22c55e; } .st-dot.on-call { background: #ef4444; } .st-dot.away, .st-dot.break { background: #f59e0b; } .st-dot.wrapup { background: #06b6d4; }
.tc-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tc-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.tc-head b { font-size: 15px; }
.tc-msgs { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 6px; background: #f8fafd; }
.tc-msgs .cm { max-width: 72%; }
.tc-msgs .cm.grouped { margin-top: -2px; }
.tc-msgs .cm.grouped .avatar { visibility: hidden; }
.cm-name { font-size: 11.5px; font-weight: 700; color: #475569; margin: 0 0 2px 2px; }
.tc-empty { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-size: 28px; }
.tc-empty b { font-size: 15px; color: var(--text); } .tc-empty span { font-size: 13px; }
.tc-compose { border-top: 1px solid var(--border); padding: 10px 14px; background: var(--panel); }
.tc-compose textarea { width: 100%; resize: none; border-radius: 12px; min-height: 42px; }
.tc-compose-row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.tc-info { border-left: 1px solid var(--border); padding: 16px; overflow-y: auto; background: #fbfcfe; }
.tc-member { display: flex; gap: 10px; align-items: center; padding: 6px 0; } .tc-member b { display: block; font-size: 13px; } .tc-member small { color: var(--muted); font-size: 11.5px; }
.tc-profile { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding-top: 12px; } .tc-profile small { color: var(--muted); }
@media (max-width: 1200px) { .tc { grid-template-columns: 260px minmax(0, 1fr); } .tc-info { display: none; } }
@media (max-width: 760px) { .tc { grid-template-columns: 1fr; height: auto; } .tc-side { max-height: 240px; border-right: 0; border-bottom: 1px solid var(--border); } .tc-msgs { height: 55vh; } }
[data-theme=dark] .tc-side, [data-theme=dark] .tc-info { background: #0e1729; }
[data-theme=dark] .tc-msgs { background: #0b1324; }
[data-theme=dark] .tc-th:hover { background: #16213a; }
[data-theme=dark] .cm-name { color: #a9b8d4; }

/* ---- client balance in the top bar */
.bal-chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid #bbf7d0; background: #f0fdf4; color: #166534; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.bal-chip .bal-l { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; opacity: .75; }
.bal-chip b { font-size: 14px; }
.bal-chip.low { border-color: #fde3a7; background: #fff8e6; color: #92400e; }
.bal-chip.bad { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }
.bal-add { margin-left: 4px; background: var(--primary); color: #fff; border-radius: 999px; padding: 2px 8px; font-size: 11.5px; font-weight: 700; }
@media (max-width: 700px) { .bal-chip .bal-l { display: none; } .bal-add { display: none; } }
[data-theme=dark] .bal-chip { background: #0f2a1e; border-color: #1f5c3a; color: #86efac; }
[data-theme=dark] .bal-chip.low { background: #2a2010; border-color: #5c4516; color: #fcd58a; }
[data-theme=dark] .bal-chip.bad { background: #2e1418; border-color: #5b2329; color: #fca5a5; }

.mk-feat { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; } .mk-feat b { font-size: 13.5px; } .mk-feat span { color: var(--muted); font-size: 12.5px; }

/* Voice Routing */
.vr-node { display: flex; flex-direction: column; gap: 4px; }
.vr-node-head { display: flex; align-items: center; gap: 8px; }
.vr-stats { display: flex; gap: 14px; margin-top: 6px; font-size: 12.5px; color: var(--muted, #6b7280); }
.vr-stats b { color: var(--text, inherit); font-size: 15px; }
.vr-st { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; background: rgba(127,127,127,.14); }
.vr-st.ok { background: rgba(16,185,129,.15); color: #059669; }
.vr-st.bad { background: rgba(239,68,68,.13); color: #dc2626; }
.vr-chip { display: inline-block; padding: 2px 8px; margin: 1px 0; border-radius: 6px; background: rgba(99,102,241,.1); font-size: 12.5px; }
.vr-cfg { max-height: 60vh; overflow: auto; font-size: 12px; background: rgba(127,127,127,.08); padding: 12px; border-radius: 8px; white-space: pre; }
.bad-text { color: #dc2626; }
#rcCl { min-width: 130px; flex: 0 0 auto; }

/* phone numbers: routing state */
.route-bad { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; max-width: 280px; }
.route-bad small { color: #b45309; font-size: 11.5px; line-height: 1.3; }
.num-filter { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px; }
.num-filter input { flex: 1 1 260px; }
.num-filter select { flex: 0 0 auto; min-width: 180px; }
.card.mini.warn-card b { color: #d97706; }
.route-fix { display: flex; gap: 6px; flex-wrap: wrap; }

.cy-table input { width: 100%; min-width: 70px; max-width: 120px; }
.cy-table input[type=checkbox] { width: auto; min-width: 0; }
