/* Indotech Hydraulics CRM — styles */
:root {
  --navy-900: #0b1f33;
  --navy-800: #0f2a44;
  --navy-700: #16395c;
  --navy-600: #1d4a76;
  --blue: #1f5fbf;
  --blue-600: #1a52a6;
  --blue-50: #eaf1fb;
  --orange: #c08f1c;
  --orange-50: #fbf4e1;
  --green: #15803d;
  --green-50: #e8f5ec;
  --red: #c62828;
  --red-50: #fdecec;
  --amber: #b45309;
  --amber-50: #fef5e6;
  --wa: #128c4b;

  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e3e8ef;
  --line-2: #d3dae4;
  --text: #17212e;
  --text-2: #4a5768;
  --muted: #6b7889;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 32, 56, .06), 0 1px 3px rgba(16, 32, 56, .04);
  --shadow-lg: 0 10px 30px rgba(16, 32, 56, .16);
  --sidebar-w: 236px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--text); }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 600; }
h4 { font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
code { font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; word-break: break-all; }
pre.code { font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--navy-900); color: #dbe7f5; border-radius: var(--radius-sm); padding: 12px 14px; overflow: auto; max-height: 360px; white-space: pre-wrap; word-break: break-word; }
.ic { flex: none; vertical-align: middle; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.clip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pad { padding: 16px; }
.pad-x { padding-left: 18px; padding-right: 18px; }
.mt { margin-top: 16px; }
.text-danger { color: var(--red); font-weight: 600; }
.text-ok { color: var(--green); }
.inline { display: inline; }
.link { background: none; border: 0; padding: 0; color: var(--blue); cursor: pointer; font: inherit; }
.link:hover { text-decoration: underline; }
.hint-line { margin: -6px 0 12px; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--navy-800); color: #c9d6e6;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; color: #fff; text-decoration: none !important; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand img { max-height: 36px; max-width: 120px; background: #fff; border-radius: 6px; padding: 3px; }
.brand .brand-logo { max-height: 46px; max-width: 190px; padding: 5px 8px; }
.brand-mark { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--orange); color: #fff; font-weight: 800; font-size: 14px; letter-spacing: .02em; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: #8fa6c2; font-size: 11.5px; }
.nav { padding: 10px 8px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px; color: #c9d6e6; font-weight: 500; text-decoration: none; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--navy-600); color: #fff; box-shadow: inset 3px 0 0 #d4a02a; }
.nav a span { flex: 1; }
.nav a.soon { opacity: .5; cursor: default; }
.nav a.soon:hover { background: none; }
.nav a em { font-style: normal; font-size: 10px; font-weight: 700; background: rgba(255,255,255,.1); border-radius: 4px; padding: 1px 5px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #6f88a8; padding: 14px 12px 4px; font-weight: 600; }
.pill { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--orange); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.07); }
.side-user div { flex: 1; min-width: 0; line-height: 1.25; }
.side-user strong { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user small { color: #8fa6c2; font-size: 11.5px; }
.side-user a { color: #8fa6c2; padding: 6px; border-radius: 6px; display: inline-flex; }
.side-user a:hover { color: #fff; background: rgba(255,255,255,.08); }
.scrim { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: rgba(243,245,248,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.search { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 9px; padding: 0 12px; color: var(--muted); }
.search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-50); }
.search input { border: 0 !important; outline: 0; box-shadow: none !important; padding: 9px 0 !important; background: transparent; flex: 1; min-width: 0; }
.btn-add { margin-left: auto; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface); border-color: var(--line); color: var(--text); text-decoration: none; }
.icon-btn .dot { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10.5px; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--bg); }
.menu-btn { display: none; }
.content { padding: 22px 24px 60px; max-width: 1440px; width: 100%; }

/* notifications */
.notif { position: relative; }
.notif-panel { position: absolute; right: 0; top: 46px; width: 360px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif-item { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none !important; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--blue-50); }
.notif-item strong { display: block; font-size: 13px; font-weight: 600; }
.notif-item span { display: block; font-size: 12.5px; color: var(--text-2); }
.notif-item small { color: var(--muted); font-size: 11.5px; }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: 500 13.5px var(--font); cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: var(--surface-2); border-color: #c0c9d6; }
.btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--blue-50); border-color: var(--blue); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-600); border-color: var(--blue-600); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #a82020; }
.btn-ghost-danger { color: var(--red); }
.btn-call { background: var(--navy-700); border-color: var(--navy-700); color: #fff; }
.btn-call:hover { background: var(--navy-800); }
.btn-wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn-wa:hover { background: #0e7a40; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

input, select, textarea {
  font: 14px var(--font); color: var(--text); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 11px; width: 100%; min-width: 0;
  transition: border-color .12s, box-shadow .12s;
}
select { padding-right: 28px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7889' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
textarea { resize: vertical; min-height: 60px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-50); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--blue); }
input:disabled { background: var(--surface-2); color: var(--muted); }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; color: var(--text-2); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; color: var(--text); }
.inline-label { flex-direction: row; align-items: center; gap: 8px; white-space: nowrap; }
.inline-label input { width: auto; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 9px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid h3 { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.form-grid h3:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.span2 { grid-column: 1 / -1; }
.form-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; gap: 10px; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-actions select { width: auto; }
.row-wrap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-wrap > input { flex: 1; min-width: 200px; }
.hint { margin-top: 16px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 13px; color: var(--text-2); }

/* ---------- page bits ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 small { font-size: 15px; font-weight: 500; margin-left: 4px; }
.page-head p { margin: 2px 0 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 680px; }
.form-card { max-width: 920px; }
.card h3 { margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.card-head h3 { margin: 0; }
.card.flush .card-head { padding-top: 14px; margin-bottom: 4px; }

.flash { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13.5px; border: 1px solid; }
.flash-success { background: var(--green-50); border-color: #bfe3cb; color: #0f5a2b; }
.flash-error { background: var(--red-50); border-color: #f3c3c3; color: #8c1c1c; }
.flash-info { background: var(--blue-50); border-color: #c5d8f3; color: #173f7a; }
.flash-x { margin-left: auto; background: none; border: 0; font-size: 18px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }

/* badges & tags */
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--bc); background: color-mix(in srgb, var(--bc) 12%, white); }
.src { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.src i { width: 8px; height: 8px; border-radius: 50%; background: var(--sc); flex: none; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); }
.tag-ok { background: var(--green-50); border-color: #c4e5cf; color: var(--green); }
.tag-off { background: #f1f3f6; color: var(--muted); }
.tag-err { background: var(--red-50); border-color: #f3c3c3; color: var(--red); }
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none; font-size: 11.5px; font-weight: 700; color: hsl(var(--ah) 55% 30%); background: hsl(var(--ah) 60% 90%); }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-empty { background: #eef1f5; color: var(--muted); border: 1px dashed var(--line-2); }
.who { display: flex; align-items: center; gap: 10px; }
.who div { line-height: 1.3; }
.who small { display: block; color: var(--muted); font-size: 12px; }

.due { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 5px; white-space: nowrap; }
.due-over { background: var(--red-50); color: var(--red); }
.due-today { background: var(--amber-50); color: var(--amber); }
.due-soon { background: var(--blue-50); color: var(--blue); }
.due-later { background: var(--surface-2); color: var(--text-2); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line-2); color: var(--text-2); font: 500 13px var(--font); cursor: pointer; text-decoration: none !important; }
.chip:hover { border-color: #b7c2d1; color: var(--text); }
.chip.on { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.chip b { font-weight: 700; opacity: .8; }
.chip-danger:not(.on) { border-color: #f0b9b9; color: var(--red); }
.chips-sm .chip { height: 28px; padding: 0 10px; font-size: 12.5px; }

/* tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr:hover td { background: #fafbfd; }
.table .chk { width: 36px; padding-right: 0; }
.row-muted td { opacity: .55; }
.lead-cell { min-width: 200px; }
.lead-cell small { display: block; color: var(--muted); font-size: 12.5px; }
.lead-name { color: var(--text); font-weight: 500; }
tr.unread .lead-name { font-weight: 700; }
tr.unread td:first-child { box-shadow: inset 3px 0 0 var(--orange); }
.log-table pre { margin: 6px 0 0; }

.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; }
.filters summary { cursor: pointer; padding: 10px 14px; font-weight: 500; color: var(--text-2); display: flex; align-items: center; gap: 8px; list-style: none; }
.filters summary::-webkit-details-marker { display: none; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; padding: 4px 14px 14px; align-items: center; }
.bulkbar { position: sticky; top: 60px; z-index: 20; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 10px; background: var(--navy-800); color: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.bulkbar select { width: auto; height: 30px; padding-top: 4px; padding-bottom: 4px; font-size: 13px; }
.bulkbar span { margin-right: 6px; }
.pager { display: flex; gap: 4px; align-items: center; justify-content: center; margin: 16px 0; flex-wrap: wrap; }
.pager a, .pager .cur { min-width: 34px; height: 34px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 500; }
.pager .cur { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.pager .muted { margin-left: 10px; font-size: 12.5px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty h3 { margin: 10px 0 6px; }
.empty .ic { color: #a8b4c4; }
.empty .btn { margin-top: 10px; }

/* ---------- dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; color: var(--text); text-decoration: none !important; transition: border-color .12s, transform .12s; }
.kpi:hover { border-color: #b9c6d8; transform: translateY(-1px); }
.kpi span { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi strong { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin: 2px 0; }
.kpi small { font-size: 12px; }
.kpi-warn { border-left: 3px solid var(--orange); }
.kpi-warn strong { color: var(--orange); }
.kpi-danger { border-left: 3px solid var(--red); }
.kpi-danger strong { color: var(--red); }
.kpi-ok strong { color: var(--green); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dash-grid .card + .card { margin-top: 0; }
.vbars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 16px; }
.vbar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; }
.vbar i { display: block; width: 100%; max-width: 28px; background: linear-gradient(180deg, var(--blue), var(--navy-600)); border-radius: 4px 4px 2px 2px; min-height: 2px; }
.vbar small { font-size: 11px; color: var(--muted); }
.vbar-n { font-size: 11px; font-weight: 600; color: var(--text-2); min-height: 14px; }
.hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hbars li { display: grid; grid-template-columns: 120px 1fr auto; gap: 10px; align-items: center; }
.hbar-label { color: var(--text); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.hbar i { display: block; height: 100%; border-radius: 5px; }
.hbar-n { font-weight: 600; font-size: 13px; white-space: nowrap; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.mini-list li:last-child { border-bottom: 0; }
.mini-list a { color: var(--text); min-width: 0; text-decoration: none; }
.mini-list a:hover strong { color: var(--blue); }
.mini-list strong { display: block; font-weight: 600; font-size: 13.5px; }
.mini-list small { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- lead detail ---------- */
.lead-head { display: flex; gap: 20px; justify-content: space-between; margin-bottom: 16px; }
.lead-head-main { min-width: 0; flex: 1; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.lead-head h1 { font-size: 24px; }
.lead-head h1 small { font-size: 14px; font-weight: 500; }
.lead-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0 14px; font-size: 13.5px; }
.contact-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lead-head-side { width: 280px; flex: none; display: flex; flex-direction: column; gap: 10px; padding-left: 20px; border-left: 1px solid var(--line); }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
.kv span { color: var(--text-2); font-weight: 500; }
.lost-box { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; padding: 10px; border-radius: 8px; background: var(--red-50); }
.lead-grid { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.lead-left .card + .card { margin-top: 16px; }
.details { display: grid; grid-template-columns: 96px 1fr; gap: 7px 10px; margin: 0; font-size: 13.5px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; min-width: 0; word-break: break-word; }
.req-text { margin-top: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; font-size: 13.5px; white-space: normal; word-break: break-word; }
.enq-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.lead-right { padding: 0; overflow: hidden; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 12px; background: var(--surface-2); }
.tabs a { padding: 12px 14px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--navy-800); border-bottom-color: var(--orange); font-weight: 600; }
.lead-right > .action-forms, .lead-right > .timeline, .lead-right > .fu-list, .lead-right > h4, .lead-right > p, .lead-right > .empty { margin-left: 18px; margin-right: 18px; }
.lead-right > h4 { margin-top: 18px; }
.action-forms { display: flex; flex-direction: column; gap: 10px; padding: 16px 0 6px; }
.act-box { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0; background: var(--surface); }
.act-box > summary { padding: 10px 14px; cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; list-style: none; }
.act-box > summary::-webkit-details-marker { display: none; }
.act-box > form, .act-box.open > form { padding: 0 14px 14px; }
.act-box.open > form { padding-top: 14px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { flex-direction: row; font-weight: 500; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 5px 11px; border: 1px solid var(--line-2); border-radius: 15px; font-size: 12.5px; cursor: pointer; color: var(--text-2); }
.seg input:checked + span { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.seg input:focus-visible + span { box-shadow: 0 0 0 3px var(--blue-50); }
.presets { display: flex; gap: 5px; flex-wrap: wrap; }
.presets button { border: 1px dashed var(--line-2); background: var(--surface); border-radius: 6px; font: 500 12px var(--font); padding: 5px 8px; cursor: pointer; color: var(--text-2); }
.presets button:hover { border-color: var(--blue); color: var(--blue); }
.dt-input { width: auto; }
.timeline { list-style: none; padding: 8px 0 18px; margin-top: 0; margin-bottom: 0; position: relative; }
.timeline li { display: flex; gap: 12px; padding: 10px 0; position: relative; }
.timeline li::before { content: ''; position: absolute; left: 13px; top: 36px; bottom: -6px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.tl-ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); z-index: 1; }
.tl-created .tl-ic, .tl-enquiry .tl-ic { background: var(--orange-50); color: var(--orange); border-color: #f6d3b2; }
.tl-call .tl-ic { background: var(--blue-50); color: var(--blue); border-color: #c5d8f3; }
.tl-status .tl-ic { background: #f1ecfd; color: #6d28d9; border-color: #ddd1fa; }
.tl-followup_done .tl-ic { background: var(--green-50); color: var(--green); border-color: #c4e5cf; }
.tl-body { font-size: 13.5px; word-break: break-word; }
.fu-list { list-style: none; padding: 0; margin-top: 8px; margin-bottom: 18px; display: flex; flex-direction: column; gap: 8px; }
.fu-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.fu-main { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.fu-done { margin-top: 8px; }
.fu-done > summary { list-style: none; display: inline-flex; }
.fu-done > summary::-webkit-details-marker { display: none; }
.fu-done form { margin-top: 8px; }
.history .fu-item { background: var(--surface-2); }
.fu-board { list-style: none; margin: 0; padding: 0; }
.fu-row { display: grid; grid-template-columns: 170px 1fr 40px auto; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.fu-row:last-child { border-bottom: 0; }
.fu-when { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.fu-what { min-width: 0; }
.fu-what small { display: block; }
.fu-acts { display: flex; gap: 6px; align-items: flex-start; justify-content: flex-end; }
.fu-acts .fu-done { margin: 0; position: relative; }
.right-pop .pop { position: absolute; right: 0; top: 36px; z-index: 15; width: 280px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 12px; margin: 0; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; height: max(420px, calc(100vh - 230px)); max-height: 760px; }
.chat-channels { display: flex; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.chat-channels .chip { height: 28px; }
.chat-window-note { padding: 8px 14px; font-size: 12.5px; background: var(--amber-50); color: var(--amber); border-bottom: 1px solid #f5dfba; }
.chat-window-note.ok { background: var(--green-50); color: var(--green); border-color: #c4e5cf; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; background: #eef1f4 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Ccircle cx='2' cy='2' r='1' fill='%23dde3ea'/%3E%3C/svg%3E"); }
.msg { max-width: min(78%, 520px); padding: 7px 11px 5px; border-radius: 10px; font-size: 14px; line-height: 1.45; box-shadow: 0 1px 1px rgba(0,0,0,.06); word-wrap: break-word; white-space: pre-wrap; }
.msg.in { align-self: flex-start; background: #fff; border-top-left-radius: 3px; }
.msg.out { align-self: flex-end; background: #d8f3e1; border-top-right-radius: 3px; }
.msg.out.failed { background: var(--red-50); }
.msg-meta { display: flex; justify-content: flex-end; gap: 6px; font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
.msg-err { font-size: 11.5px; color: var(--red); margin-top: 3px; white-space: normal; }
.msg-day { align-self: center; font-size: 11.5px; color: var(--text-2); background: rgba(255,255,255,.85); border-radius: 6px; padding: 3px 10px; margin: 8px 0 4px; }
.chat-compose { border-top: 1px solid var(--line); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.qr-row { display: flex; gap: 8px; align-items: center; }
.qr-row select { flex: 1; height: 32px; padding-top: 4px; padding-bottom: 4px; font-size: 13px; }
.compose-row { display: flex; gap: 8px; align-items: flex-end; }
.compose-row textarea { min-height: 44px; max-height: 160px; }
.btn-send { width: 44px; height: 44px; padding: 0; border-radius: 50%; flex: none; }

/* inbox */
.inbox { display: grid; grid-template-columns: 340px 1fr; gap: 16px; height: calc(100vh - 120px); min-height: 520px; }
.inbox .card + .card { margin-top: 0; }
.inbox-list { display: flex; flex-direction: column; min-height: 0; }
.inbox-head { padding: 14px 14px 6px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.inbox-head .chips { margin-bottom: 8px; }
.conv-list { overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none !important; align-items: center; }
.conv:hover { background: var(--surface-2); }
.conv.active { background: var(--blue-50); box-shadow: inset 3px 0 0 var(--blue); }
.conv .avatar { width: 38px; height: 38px; font-size: 13px; }
.conv-main { flex: 1; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; }
.conv-top strong { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.has-unread .conv-top strong { font-weight: 700; }
.conv-top small { color: var(--muted); font-size: 11.5px; flex: none; }
.conv-bot { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.conv-prev { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-prev em { font-style: normal; color: var(--text-2); }
.conv.has-unread .conv-prev { color: var(--text); }
.ch { font-size: 9.5px; font-weight: 800; padding: 1px 4px; border-radius: 4px; color: #fff; flex: none; }
.ch-whatsapp { background: var(--wa); }
.ch-messenger { background: #0a7cff; }
.ch-instagram { background: #c13584; }
.inbox-thread { display: flex; flex-direction: column; min-height: 0; }
.inbox-thread .chat { height: auto; flex: 1; min-height: 0; }
.thread-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.thread-who { flex: 1; min-width: 0; line-height: 1.3; }
.thread-who a { color: var(--text); }
.thread-who small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-meta { display: flex; gap: 8px; align-items: center; }
.thread-back { display: none; }
.thread-empty { margin: auto; max-width: 380px; }

/* pipeline */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.col { flex: 0 0 248px; background: #e9edf2; border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 210px); border-top: 3px solid var(--cc); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.col-head small { margin-left: auto; font-size: 11.5px; }
.col-count { background: rgba(255,255,255,.8); border-radius: 10px; padding: 0 8px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.col-body { padding: 0 8px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 60px; flex: 1; }
.col-body.drag-over { background: rgba(31,95,191,.08); border-radius: 8px; outline: 2px dashed var(--blue); outline-offset: -4px; }
.kcard { display: block; background: var(--surface); border-radius: 8px; padding: 10px 11px; box-shadow: var(--shadow); color: var(--text); text-decoration: none !important; border: 1px solid transparent; cursor: grab; }
.kcard:hover { border-color: var(--line-2); }
.kcard.dragging { opacity: .45; }
.kcard.unread { box-shadow: inset 3px 0 0 var(--orange), var(--shadow); }
.kcard-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.kcard-top strong { font-size: 13.5px; font-weight: 600; }
.kcard small { display: block; margin-top: 2px; max-width: 100%; }
.kcard-bot { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.dialog { border: 0; border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 20px; width: min(400px, 92vw); }
.dialog::backdrop { background: rgba(11, 31, 51, .45); }

/* settings */
.copy-grid { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; align-items: center; margin-bottom: 10px; font-size: 13px; }
.copy-grid span { color: var(--muted); font-weight: 500; }
.copy { cursor: copy; position: relative; }
.copy:hover { border-color: var(--blue); }
code.block { display: block; padding: 8px 10px; }
.logo-prev { max-height: 40px; border: 1px solid var(--line); border-radius: 6px; padding: 3px; background: #fff; }

/* auth */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: radial-gradient(1200px 600px at 10% -10%, #1d4a76 0%, transparent 60%), linear-gradient(160deg, var(--navy-900), var(--navy-800)); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 14px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.auth-card.wide { max-width: 640px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand img { max-height: 44px; max-width: 160px; }
.auth-brand strong { display: block; font-size: 17px; }
.auth-brand small { color: var(--muted); }
.auth-card .center { margin: 16px 0 0; }

/* toast */
.toast-wrap { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast { background: var(--navy-800); color: #fff; padding: 12px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); width: 340px; max-width: 100%; font-size: 13.5px; animation: toastIn .22s ease; }
.toast a { color: #ffd2a6; }
.toast.error { background: var(--red); }
.toast strong { display: block; }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1050px) {
  .lead-grid { grid-template-columns: 1fr; }
  .lead-head { flex-direction: column; }
  .lead-head-side { width: auto; padding-left: 0; border-left: 0; border-top: 1px solid var(--line); padding-top: 14px; display: grid; grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 290px 1fr; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(11,31,51,.45); z-index: 35; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .btn-add span { display: none; }
  .btn-add { width: 38px; padding: 0; }
  .content { padding: 16px 12px 70px; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi strong { font-size: 24px; }
  .form-grid { grid-template-columns: 1fr; }
  .lead-head-side { grid-template-columns: 1fr; }
  .bulkbar { top: 56px; }

  /* tables → cards */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 10px 14px; border-bottom: 1px solid var(--line); position: relative; }
  .table td { border: 0; padding: 3px 0; }
  .table td[data-label] { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
  .table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; }
  .table .chk { position: absolute; right: 14px; top: 12px; width: auto; }
  .table td.right { text-align: left; }
  .clip { max-width: 60vw; }
  .table td.clip { max-width: none; text-align: right; }
  tr.unread td:first-child { box-shadow: none; }
  tr.unread { box-shadow: inset 3px 0 0 var(--orange); }

  .fu-row { grid-template-columns: 1fr auto; grid-template-areas: "when owner" "what what" "acts acts"; gap: 8px; }
  .fu-when { grid-area: when; flex-direction: row; align-items: center; }
  .fu-what { grid-area: what; }
  .fu-owner { grid-area: owner; }
  .fu-acts { grid-area: acts; justify-content: flex-start; }
  .right-pop .pop { left: 0; right: auto; }

  .inbox { grid-template-columns: 1fr; height: calc(100vh - 100px); }
  .inbox.has-active .inbox-list { display: none; }
  .inbox:not(.has-active) .inbox-thread { display: none; }
  .thread-back { display: inline-grid; }
  .thread-meta .badge, .thread-meta .avatar { display: none; }
  .chat { height: calc(100vh - 200px); }
  .msg { max-width: 88%; }
  .col { flex-basis: 82vw; }
  .hbars li { grid-template-columns: 100px 1fr auto; }
}
@media (max-width: 480px) {
  .search { padding: 0 9px; }
  .contact-actions .btn { flex: 1; }
  .copy-grid { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .topbar { display: none; }
}

/* ---------- Phase 2: quotations, customers, media ---------- */
.form-grid.g3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.g4 { grid-template-columns: repeat(4, 1fr); }
.span3 { grid-column: span 3; }
.span4 { grid-column: 1 / -1; }
.kpis-5 { grid-template-columns: repeat(5, 1fr); }
.kpi-on { border-color: var(--navy-800); box-shadow: inset 0 -3px 0 var(--navy-800); }
.filters-inline { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters-inline input, .filters-inline select { width: auto; flex: 0 1 200px; }
.filters-inline input[type=search] { flex: 1 1 240px; }
.btn-block { width: 100%; }
.w-auto { width: auto; }
.text-strong { color: var(--text); }
.text-danger-link { color: var(--red); }
.share-link code { margin-top: 4px; font-size: 11.5px; }
.timeline.compact li { padding: 6px 0; }

.quote-form .card + .card { margin-top: 14px; }
.qitems-wrap { overflow-x: auto; }
.qitems { width: 100%; border-collapse: collapse; min-width: 860px; }
.qitems th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 8px 6px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.qitems td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.qitems input, .qitems select, .qitems textarea { padding: 6px 8px; font-size: 13px; }
.qitems textarea { margin-top: 5px; min-height: 40px; font-size: 12.5px; }
.qitems .c-prod { width: 34%; padding-left: 16px; }
.qitems .c-hsn { width: 9%; } .qitems .c-qty { width: 7%; } .qitems .c-unit { width: 7%; }
.qitems .c-rate { width: 11%; } .qitems .c-disc { width: 7%; } .qitems .c-gst { width: 9%; }
.qitems .c-amt { width: 11%; text-align: right; font-weight: 600; padding-top: 14px; white-space: nowrap; }
.qitems th.c-amt { text-align: right; }
.qitems-foot { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; flex-wrap: wrap; }
.qitems-foot > a { margin-top: 9px; }
.qtotals { margin-left: auto; min-width: 300px; border-collapse: collapse; font-size: 13.5px; }
.qtotals td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.qtotals td:last-child { text-align: right; white-space: nowrap; }
.qtotals .grand td { font-size: 16px; font-weight: 700; color: var(--navy-800); border-bottom: 0; padding-top: 10px; }

.quote-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.quote-side .card + .card { margin-top: 14px; }
.quote-side form + form { margin-top: 8px; }
.quote-side details > summary { list-style: none; }
.quote-side details > summary::-webkit-details-marker { display: none; }
.quote-preview { padding: 28px; overflow: hidden; }
.qdoc { font-size: 13.5px; color: var(--text); }
.qdoc h4 { margin-bottom: 4px; color: var(--orange); }
.qdoc-head { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 14px; border-bottom: 3px solid var(--orange); margin-bottom: 16px; }
.qdoc-co { display: flex; gap: 14px; align-items: flex-start; }
.qdoc-co img { max-height: 56px; max-width: 140px; }
.qdoc-co strong { display: block; font-size: 18px; color: var(--navy-800); }
.qdoc-co small, .qdoc-title small { display: block; color: var(--text-2); font-size: 12.5px; line-height: 1.5; }
.qdoc-title { text-align: right; flex: none; }
.qdoc-title h2 { color: var(--orange); font-size: 22px; letter-spacing: .04em; margin-bottom: 4px; }
.qdoc-bill { margin-bottom: 12px; line-height: 1.55; }
.qdoc-bill strong { font-size: 15px; }
.qdoc-subj { margin: 0 0 12px; }
.qdoc-tablewrap { overflow-x: auto; }
.qdoc-items { width: 100%; border-collapse: collapse; margin-bottom: 14px; min-width: 560px; }
.qdoc-items th { background: var(--navy-800); color: #fff; font-size: 12px; text-align: left; padding: 8px; font-weight: 600; }
.qdoc-items td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.qdoc-items .r { text-align: right; }
.qdoc-foot { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.qdoc-words { max-width: 360px; font-size: 13px; }
.qdoc-totals { border-collapse: collapse; min-width: 280px; margin-left: auto; }
.qdoc-totals td { padding: 5px 8px; border-bottom: 1px solid var(--line); }
.qdoc-totals td:last-child { text-align: right; white-space: nowrap; }
.qdoc-totals .grand td { background: var(--navy-800); color: #fff; font-weight: 700; font-size: 15px; border: 0; }
.qdoc-sec { margin-top: 16px; font-size: 13px; color: var(--text-2); }
.qdoc-sec ol { margin: 4px 0 0; padding-left: 20px; }

.public-body { background: var(--bg); }
.public-wrap { max-width: 920px; margin: 0 auto; padding: 20px 14px 40px; }
.public-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.public-respond { margin-top: 16px; }

.attach-btn { cursor: pointer; flex: none; width: 44px; height: 44px; }
.msg-img { display: block; margin: -3px -7px 6px; }
.msg-img img { display: block; max-width: 260px; max-height: 260px; border-radius: 8px; }
.msg-file { display: inline-block; padding: 6px 10px; margin-bottom: 5px; background: rgba(15,42,68,.06); border-radius: 6px; font-size: 13px; }

@media (max-width: 1050px) {
  .quote-grid { grid-template-columns: 1fr; }
  .kpis-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .form-grid.g3, .form-grid.g4 { grid-template-columns: 1fr; }
  .span3, .span4 { grid-column: 1 / -1; }
  .kpis-5 { grid-template-columns: repeat(2, 1fr); }
  .qitems { min-width: 0; }
  .qitems thead { display: none; }
  .qitems, .qitems tbody, .qitems tr, .qitems td { display: block; width: 100% !important; }
  .qitems tr { padding: 10px 12px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .qitems td { border: 0; padding: 0; }
  .qitems td.c-prod { grid-column: 1 / -1; padding-left: 0; }
  .qitems td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); }
  .qitems .c-amt { text-align: left; padding-top: 0; }
  .qtotals { min-width: 0; width: 100%; }
  .quote-preview { padding: 14px; }
  .qdoc-head { flex-direction: column; }
  .qdoc-title { text-align: left; }
}

/* ---------- Phase 3: reports & YouTube ---------- */
.report-filters { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.report-filters .chips { margin-bottom: 0; }
.report-table td, .report-table th { white-space: nowrap; }
.report-table td:first-child { white-space: normal; }
.table.compact td { padding: 8px 12px; }
.funnel { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.funnel li { display: grid; grid-template-columns: 130px 1fr 80px; gap: 10px; align-items: center; font-size: 13px; }
.f-bar { height: 22px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.f-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--navy-600), var(--blue)); border-radius: 5px; }
.funnel li:last-child .f-bar i { background: linear-gradient(90deg, #15803d, #22a35a); }
.f-n { text-align: right; white-space: nowrap; }
.sbars { display: flex; align-items: flex-end; gap: 5px; height: 190px; padding-top: 14px; }
.sbar { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; }
.sbar-stack { width: 100%; max-width: 30px; display: flex; flex-direction: column-reverse; border-radius: 4px 4px 2px 2px; overflow: hidden; min-height: 2px; background: var(--line); }
.sbar-stack i { display: block; min-height: 2px; }
.sbar small { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; max-width: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }
.cost-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cost-form select, .cost-form input { width: auto; }
.cost-form input[name=note] { flex: 1 1 200px; }
.steps { padding-left: 20px; line-height: 1.7; }
.details.wide { grid-template-columns: 110px 1fr; }
.vbars-dense { gap: 3px; }
.vbars-dense .vbar i { max-width: 18px; }
.vbars-dense .vbar small { font-size: 9.5px; }

.yt-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.yt-avatar { width: 56px; height: 56px; border-radius: 50%; }
.yt-head h2 { margin-bottom: 2px; }
.yt-stats { display: flex; gap: 28px; margin-left: auto; }
.yt-stats div { text-align: center; }
.yt-stats strong { display: block; font-size: 22px; font-weight: 700; }
.yt-stats span { font-size: 12px; color: var(--muted); }
.yt-tools { flex-wrap: wrap; align-items: center; }
.yt-tools .filters-inline { margin: 0; }
.yt-vid { display: flex; gap: 12px; align-items: center; min-width: 300px; }
.yt-thumb { position: relative; flex: none; width: 120px; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: #0b1f33; display: block; }
.yt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yt-thumb span { position: absolute; right: 4px; bottom: 4px; background: rgba(0,0,0,.78); color: #fff; font-size: 10.5px; padding: 1px 5px; border-radius: 3px; }
.yt-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; font-size: 13.5px; line-height: 1.35; }
.yt-table td { vertical-align: middle; }

@media (max-width: 900px) {
  .yt-stats { margin-left: 0; width: 100%; justify-content: space-around; }
  .funnel li { grid-template-columns: 105px 1fr 64px; }
  .report-table td, .report-table th { white-space: normal; }
  .yt-vid { min-width: 0; }
  .yt-thumb { width: 96px; }
}
@media print {
  .report-filters, .btn, .cost-form, .toast-wrap { display: none !important; }
  .main, .content { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}
.dash-grid > *, .quote-grid > *, .lead-grid > * { min-width: 0; }
.sbars, .vbars { overflow: hidden; }
@media (max-width: 900px) {
  .sbar small, .vbars-dense .vbar small { display: none; }
  .sbar:nth-child(5n+1) small, .vbars-dense .vbar:nth-child(5n+1) small { display: block; }
}

/* ---------- brand: gold logo ---------- */
.brand-mark-img { width: 42px; height: 42px; flex: none; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
.brand .brand-mark-img { background: none; padding: 0; max-height: none; max-width: none; }
.auth-logo { width: 64px; height: 64px; object-fit: contain; }
.auth-brand img.auth-logo { max-height: 64px; max-width: 64px; }
.pill { background: #c08f1c; }
.tag-gold { background: #fbf4e1; border-color: #ecd59a; color: #8a6510; }
.qdoc-co img { max-height: 64px; }
.access-box { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; background: var(--surface-2); }
.access-box h3 { margin: 0 0 10px; padding: 0; border: 0; }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin: 12px 0 6px; }
.perm-grid input:disabled + * , .perm-grid label:has(input:disabled) { opacity: .65; }
@media (max-width: 700px) { .perm-grid { grid-template-columns: 1fr; } }

/* ---------- WhatsApp one-click templates ---------- */
.chat { position: relative; }
.compose-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.compose-tools .btn { height: 30px; }
.attach-lbl { cursor: pointer; flex-direction: row; font-weight: 500; color: var(--text); }
.tpl-panel { position: absolute; left: 10px; right: 10px; bottom: 112px; max-height: min(62%, 460px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; z-index: 5; overflow: hidden; }
.tpl-tabs { display: flex; gap: 2px; padding: 6px 6px 0; border-bottom: 1px solid var(--line); background: var(--surface-2); overflow-x: auto; }
.tpl-tabs button { border: 0; background: none; padding: 8px 10px; font: 500 13px var(--font); color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tpl-tabs button.on { color: var(--navy-800); border-bottom-color: #d4a02a; font-weight: 600; }
.tpl-tabs button small { background: var(--line); border-radius: 8px; padding: 0 6px; font-size: 11px; }
.tpl-tabs .tpl-close { margin-left: auto; font-size: 20px; line-height: 1; }
.tpl-search { padding: 8px 10px 4px; }
.tpl-search input { height: 32px; padding: 4px 10px; font-size: 13px; }
.tpl-body { overflow-y: auto; padding: 4px 10px 10px; }
.tpl-body h5 { margin: 10px 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tpl-item { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; }
.tpl-item:hover { border-color: #c9d3e0; background: var(--surface-2); }
.tpl-text { flex: 1; min-width: 0; }
.tpl-text strong { display: block; font-size: 13px; }
.tpl-text span { display: block; font-size: 12px; color: var(--muted); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tpl-acts { display: flex; gap: 4px; flex: none; }
.tpl-video img { width: 72px; aspect-ratio: 16/9; object-fit: cover; border-radius: 5px; flex: none; background: var(--navy-900); }
.tpl-warn { background: var(--amber-50); color: var(--amber); border-radius: 6px; padding: 8px 10px; font-size: 12.5px; margin: 6px 0; }
.snip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; padding: 4px 18px 18px; }
.snip-grid.flush-grid { padding: 0; }
.snip-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.snip-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.snip-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }
.wa-bubble { background: #e7f8ee; border-radius: 8px 8px 8px 2px; padding: 8px 10px; font-size: 13px; line-height: 1.45; white-space: normal; max-height: 160px; overflow: auto; }
.tpl-pick { cursor: pointer; font-weight: 400; color: var(--text); }
.ph-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 6px; font-weight: 400; }
.chip-xs { height: 22px; padding: 0 8px; font-size: 11.5px; }
.wa-steps { padding-left: 20px; line-height: 1.7; font-size: 13.5px; }
.wa-steps li { margin-bottom: 4px; }
.wa-steps .btn { margin-left: 6px; }
@media (max-width: 700px) {
  .tpl-panel { left: 4px; right: 4px; bottom: 116px; max-height: 70%; }
  .tpl-item { flex-wrap: wrap; }
  .tpl-acts { width: 100%; justify-content: flex-end; }
}
.tpl-tabs, .tpl-search { flex: none; }
.tpl-body { flex: 1 1 auto; min-height: 0; }

/* WhatsApp QR page */
.qr-grid { display: grid; grid-template-columns: minmax(320px, 440px) 1fr; gap: 16px; align-items: start; }
.qr-grid > div > .card + .card { margin-top: 16px; }
.qr-card { min-height: 460px; display: flex; align-items: center; justify-content: center; text-align: center; }
.qr-state { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qr-state img[data-qr] { width: 300px; height: 300px; image-rendering: pixelated; border: 8px solid #fff; box-shadow: 0 0 0 1px var(--line); border-radius: 8px; }
.qr-steps { text-align: left; font-size: 13.5px; line-height: 1.7; margin: 0; padding-left: 20px; }
.qr-ok { width: 72px; height: 72px; border-radius: 50%; background: var(--green-50); color: var(--green); font-size: 38px; display: grid; place-items: center; }
.center-row { justify-content: center; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
ul.tight { padding-left: 18px; margin: 0; line-height: 1.7; }
@media (max-width: 900px) { .qr-grid { grid-template-columns: 1fr; } .qr-state img[data-qr] { width: 260px; height: 260px; } }
