/* Zelio CRM: same look as the Zelio app ("clean workspace": neutral surfaces, one indigo accent, Inter). */
@font-face { font-family: "Inter Variable"; src: url("/fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --app-bg: #f6f7f9; --app-surface: #fff; --app-surface-2: #fafbfc; --app-border: #e7e9ee; --app-border-strong: #d8dbe2;
  --app-text: #111827; --app-muted: #5f6873; --app-faint: #636b75; --app-sidebar: #fbfbfd; --app-hover: #f2f4f7;
  --app-pos: #1d7a36; --app-neg: #b42318; --app-warn: #b63c0d;
  --indigo-0: #edf2ff; --indigo-1: #dbe4ff; --indigo-3: #91a7ff; --indigo-5: #5c7cfa; --indigo-7: #4263eb; --indigo-9: #364fc7;
  --accent: var(--indigo-7); --accent-soft: var(--indigo-0); --accent-ink: var(--indigo-9);
  --rail-bg: #262b45; --rail-fg: #aab1c7;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06); --shadow-md: 0 4px 12px rgba(16, 24, 40, .08);
  --radius: 12px; --topbar-h: 56px;
  --c-green: #2f9e44; --c-red: #e03131; --c-orange: #e8590c; --c-blue: #748ffc; --c-grey: #adb5bd; --c-violet: #7048e8;
  --chat-bg: #efeae2; --chat-in: #fff; --chat-out: #d9fdd3;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --app-bg: #0f1115; --app-surface: #171a21; --app-surface-2: #1b1f27; --app-border: #262b35; --app-border-strong: #313744;
  --app-text: #e5e7eb; --app-muted: #9aa3b2; --app-faint: #8b93a1; --app-sidebar: #13161c; --app-hover: #1f242d;
  --app-pos: #69db7c; --app-neg: #ff8787; --app-warn: #ffa94d;
  --accent-soft: rgba(92, 124, 250, .14); --accent-ink: #bac8ff; --rail-bg: #1c2036;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 6px 18px rgba(0, 0, 0, .45);
  --chat-bg: #0b141a; --chat-in: #202c33; --chat-out: #005c4b;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--app-bg); color: var(--app-text); -webkit-font-smoothing: antialiased; }
body { font: 14px/1.45 "Inter Variable", system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--app-muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
h2 { font-size: 15px; font-weight: 650; margin: 0 0 14px; }

/* ---------------- shell: icon rail + pages pane + top bar ---------------- */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar { display: flex; flex-shrink: 0; position: sticky; top: 0; height: 100vh; z-index: 50; }
.app-rail { width: 68px; background: var(--rail-bg); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 0; }
.rail-logo { width: 38px; height: 38px; margin-bottom: 12px; display: grid; place-items: center; }
.rail-logo img { width: 34px; height: 34px; }
.rail-item { width: 58px; padding: 7px 2px 6px; border-radius: 10px; display: grid; justify-items: center; gap: 3px; color: var(--rail-fg);
  font-size: 10.5px; font-weight: 500; line-height: 1.15; text-align: center; position: relative; transition: background .12s, color .12s; }
.rail-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.rail-item[data-current] { background: rgba(145, 167, 255, .18); color: #fff; }
.rail-item[data-current] svg { color: #b8c5ff; }
.rail-item .dotbadge { position: absolute; top: 3px; right: 8px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--c-red); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.rail-spacer { flex: 1; }
.rail-user { width: 36px; height: 36px; border-radius: 50%; background: var(--indigo-7); color: #fff; font-weight: 600; font-size: 13px; display: grid; place-items: center; margin-top: 6px; border: 0; cursor: pointer; }
.app-pane { width: 220px; background: var(--app-sidebar); border-right: 1px solid var(--app-border); padding: 16px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.app-sidebar[data-collapsed] .app-pane { display: none; }
.pane-head { padding: 0 8px 12px; }
.pane-title { font-size: 16px; font-weight: 650; }
.pane-sub { font-size: 12px; color: var(--app-muted); }
.pane-label { padding: 12px 8px 2px; font-size: 12px; color: var(--app-faint); }
.pane-link { display: flex; align-items: center; justify-content: space-between; min-height: 32px; padding: 5px 10px; border-radius: 7px; color: var(--app-text); opacity: .86; font-size: 13.5px; }
.pane-link:hover { background: var(--app-hover); opacity: 1; }
.pane-link[data-active] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; opacity: 1; }
.count { font-size: 11.5px; font-weight: 600; padding: 0 7px; border-radius: 99px; background: #ffe3e3; color: #c92a2a; }
:root[data-theme="dark"] .count { background: rgba(250, 82, 82, .18); color: #ffa8a8; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar { height: var(--topbar-h); position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: color-mix(in srgb, var(--app-bg) 85%, transparent); backdrop-filter: saturate(160%) blur(8px); border-bottom: 1px solid var(--app-border); }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; border: 0; background: none; color: var(--app-muted); cursor: pointer; }
.icon-btn:hover { background: var(--app-hover); color: var(--app-text); }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; white-space: nowrap; }
.crumb-parent { color: var(--app-muted); } .crumb-sep { color: var(--app-faint); } .crumb-current { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.top-spacer { flex: 1; }
.company { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px 0 5px; border: 1px solid var(--app-border); border-radius: 10px; background: var(--app-surface); font-weight: 600; font-size: 13.5px; }
.company i { width: 28px; height: 28px; border-radius: 7px; background: var(--indigo-7); color: #fff; font-style: normal; font-size: 11.5px; display: grid; place-items: center; }
.app-content { padding: 24px 28px 48px; max-width: 1440px; width: 100%; margin: 0 auto; animation: page-in .22s ease both; }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------- page header + controls ---------------- */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-title { margin: 0; font-size: 24px; font-weight: 650; letter-spacing: -.01em; line-height: 1.25; display: flex; align-items: center; gap: 10px; }
.page-title .tally { font-size: 13px; font-weight: 600; padding: 2px 9px; border-radius: 8px; background: var(--app-hover); color: var(--app-muted); }
.page-subtitle { color: var(--app-muted); font-size: 14px; margin-top: 2px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; border: 1px solid var(--app-border); background: var(--app-surface); padding: 0 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; font-weight: 500; font-size: 13.5px; }
.btn:hover { border-color: var(--app-border-strong); box-shadow: var(--shadow-sm); }
.btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
.btn.primary { background: var(--indigo-7); color: #fff; border-color: var(--indigo-7); }
.btn.primary:hover { background: var(--indigo-9); }
.btn.wa { background: #1f8f4e; border-color: #1f8f4e; color: #fff; }
.btn.danger { color: var(--app-neg); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--app-hover); border: 1px solid var(--app-border); }
.seg button { border: 0; background: none; padding: 0 12px; height: 28px; border-radius: 6px; cursor: pointer; color: var(--app-muted); font-size: 13px; font-weight: 500; }
.seg button.on { background: var(--app-surface); color: var(--app-text); box-shadow: var(--shadow-sm); }
select, input[type=text], input[type=number], input[type=password], input[type=search], textarea {
  height: 36px; border: 1px solid var(--app-border); border-radius: 8px; padding: 0 10px; background: var(--app-surface); min-width: 0; font-size: 13.5px; outline: none; }
select:focus, input:focus, textarea:focus { border-color: var(--indigo-5); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { width: 100%; height: auto; min-height: 70px; padding: 8px 10px; resize: vertical; }
input[type=color] { width: 40px; height: 32px; border: 1px solid var(--app-border); border-radius: 8px; padding: 2px; background: var(--app-surface); }
label.f { display: grid; gap: 6px; font-size: 13px; font-weight: 500; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 9px; width: 18px; height: 18px; color: var(--app-faint); }
.search input { padding-left: 34px; width: 280px; }

/* ---------------- cards ---------------- */
.card { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 18px 20px 4px; }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-bottom: 16px; }
.kpi { padding: 18px 20px; }
.kpi .l { font-size: 13.5px; font-weight: 600; }
.kpi .v { font-size: 26px; font-weight: 650; letter-spacing: -.01em; margin-top: 2px; }
.kpi .s { font-size: 12.5px; color: var(--app-muted); margin-top: 2px; }
.kpi.bad .v { color: var(--app-neg); } .kpi.warn .v { color: var(--app-warn); } .kpi.good .v { color: var(--app-pos); }
.cols2 { grid-template-columns: 1.5fr 1fr; } .cols2e { grid-template-columns: 1fr 1fr; }
.mt { margin-top: 16px; }
@media (max-width: 1100px) { .cols2, .cols2e { grid-template-columns: 1fr; } }

/* ---------------- tables (Zelio list) ---------------- */
.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { font-size: 12px; font-weight: 600; color: var(--app-muted); text-transform: uppercase; letter-spacing: .04em; background: var(--app-surface-2);
  border-bottom: 1px solid var(--app-border); white-space: nowrap; height: 40px; padding: 0 12px; text-align: left; }
tbody td { height: 52px; padding: 6px 12px; border-bottom: 1px solid var(--app-border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .1s; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--app-hover); }
td.r, th.r { text-align: right; }
td.num, td.r { white-space: nowrap; }
.strong { font-weight: 600; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .muted { white-space: nowrap; }
.who { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none;
  background: color-mix(in srgb, var(--c, var(--indigo-7)) 14%, var(--app-surface)); color: color-mix(in srgb, var(--c, var(--indigo-7)) 80%, var(--app-text)); }
.bar { height: 6px; border-radius: 4px; background: var(--app-hover); overflow: hidden; min-width: 56px; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--indigo-5); }
.cell-bar { display: flex; align-items: center; gap: 10px; } .cell-bar .bar { flex: 1; } .cell-bar span { white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--app-border); color: var(--app-muted); font-size: 13px; }
.tablebar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }

/* status pills (Zelio): tint + dot */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap;
  background: color-mix(in srgb, var(--p) 12%, var(--app-surface)); color: color-mix(in srgb, var(--p) 78%, var(--app-text)); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--p); }
.h-unanswered { --p: #e03131; } .h-waiting { --p: #e8590c; } .h-cold { --p: #4263eb; } .h-active { --p: #2f9e44; } .h-won { --p: #0c8599; } .h-lost { --p: #868e96; } .h-demo { --p: #868e96; } .h-qr { --p: #e8590c; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 32px; border: 1px solid var(--app-border); background: var(--app-surface); border-radius: 99px; padding: 0 13px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--app-muted); display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { color: var(--app-text); border-color: var(--app-border-strong); }
.chip.on { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); font-weight: 600; }

/* charts */
svg.chart { width: 100%; height: auto; display: block; }
svg.chart text { font-size: 11px; fill: var(--app-muted); font-family: inherit; }
svg.chart .gl { stroke: var(--app-border); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--app-muted); margin-top: 10px; }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--c); }
.hbars { display: grid; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(130px, 1.2fr) 2fr 56px; gap: 12px; align-items: center; font-size: 13.5px; }
.hbar .bar { height: 8px; }
.hbar b { text-align: right; font-weight: 600; }

/* drawer */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .25); backdrop-filter: blur(2px); z-index: 60; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--app-surface); z-index: 61; display: flex; flex-direction: column; box-shadow: var(--shadow-md); animation: slide .2s ease; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer header { padding: 16px 18px; border-bottom: 1px solid var(--app-border); display: flex; gap: 12px; align-items: flex-start; }
.drawer header .t { flex: 1; min-width: 0; }
.drawer header h3 { margin: 0 0 2px; font-size: 17px; font-weight: 650; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.drawer .body { flex: 1; overflow: auto; padding: 16px 18px; background: var(--chat-bg); }
.drawer footer { border-top: 1px solid var(--app-border); padding: 14px 18px; display: grid; gap: 10px; }
.msg { max-width: 80%; padding: 7px 10px 5px; border-radius: 9px; margin: 4px 0; box-shadow: 0 1px .5px rgba(0, 0, 0, .13); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.in { background: var(--chat-in); } .msg.out { background: var(--chat-out); margin-left: auto; }
.msg time { display: block; text-align: right; font-size: 10.5px; color: var(--app-muted); margin-top: 2px; }
.gap, .day { text-align: center; margin: 10px 0; }
.gap span { background: #fff3bf; color: #7a4a00; font-size: 11.5px; padding: 3px 9px; border-radius: 7px; }
.day span { background: var(--app-surface); color: var(--app-muted); font-size: 11.5px; padding: 3px 9px; border-radius: 7px; box-shadow: var(--shadow-sm); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* misc */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(380px, 100%); display: grid; gap: 14px; padding: 28px; }
.login .brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 650; margin-bottom: 6px; }
.login .brand img { width: 34px; height: 34px; }
.err { color: var(--app-neg); font-size: 13px; }
.empty { padding: 48px 20px; text-align: center; color: var(--app-muted); }
.qr { display: grid; place-items: center; gap: 8px; padding: 10px; }
.qr img { width: 260px; height: 260px; image-rendering: pixelated; border-radius: 8px; background: #fff; padding: 6px; }
.note { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); color: var(--accent-ink); padding: 12px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 16px; }
.note svg { margin-top: 1px; }

@media (max-width: 62em) {
  .app-sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-md); }
  .app-sidebar[data-open] { transform: none; }
  .app-sidebar[data-collapsed] .app-pane { display: flex; }
  .app-content { padding: 18px 16px 40px; }
  .app-topbar { padding: 0 12px; }
  .company span { display: none; }
  .search, .search input { width: 100%; }
  .hbar { grid-template-columns: 1fr 1fr 44px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .v { font-size: 22px; }
  .filters, .filters select { width: 100%; }
}
