:root {
  --bg: #f5f6f8; --panel: #ffffff; --ink: #14171f; --muted: #5d6474; --line: #e3e6ec; --line2: #eef0f4;
  --nav: #101828; --nav-ink: #c9d0dc; --nav-active: #ffffff;
  --brand: #1f5eff; --brand-soft: #e8efff;
  --hot: #d92d20; --hot-soft: #fdecea; --warm: #b54708; --warm-soft: #fef4e6; --cold: #475467; --cold-soft: #eef1f5;
  --good: #067647; --good-soft: #e7f6ee; --bad: #b42318;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* layout */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.side { background: var(--nav); color: var(--nav-ink); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { color: #fff; font-weight: 700; font-size: 16px; padding: 4px 10px 14px; letter-spacing: -.01em; }
.brand small { display: block; font-weight: 500; font-size: 11px; color: #8a93a6; letter-spacing: .04em; text-transform: uppercase; margin-top: 2px; }
.ws-switch { margin: 0 6px 14px; }
.ws-switch select { width: 100%; background: #1d2939; color: #fff; border: 1px solid #344054; border-radius: 8px; padding: 7px 8px; }
.nav a { display: flex; align-items: center; justify-content: space-between; color: var(--nav-ink); padding: 8px 10px; border-radius: 8px; font-weight: 500; }
.nav a:hover { background: #1d2939; text-decoration: none; color: #fff; }
.nav a.active { background: #1f2a3d; color: var(--nav-active); }
.nav .count { background: var(--hot); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; }
.side .foot { margin-top: auto; font-size: 12px; padding: 10px; color: #8a93a6; }
.side .foot button { background: none; border: 0; color: #c9d0dc; padding: 0; }
.main { padding: 24px 28px 48px; max-width: 1280px; width: 100%; min-width: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.015em; }
h2 { font-size: 15px; margin: 0 0 10px; }
.sub { color: var(--muted); margin-top: 4px; }

/* blocks */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 2fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.kpi b { display: block; font-size: 24px; letter-spacing: -.02em; }
.kpi span { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); padding: 18px 4px; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); background: #fafbfc; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line2); vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f8faff; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* chips */
.chip { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 600; background: var(--cold-soft); color: var(--cold); white-space: nowrap; }
.chip.hot { background: var(--hot-soft); color: var(--hot); }
.chip.warm { background: var(--warm-soft); color: var(--warm); }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.brand { background: var(--brand-soft); color: var(--brand); }
.chip.bad { background: var(--hot-soft); color: var(--bad); }
.tags .chip { margin: 0 4px 4px 0; }

/* forms */
.btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 12px; font-weight: 600; color: var(--ink); }
.btn:hover { background: #f8f9fb; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #1a4fd8; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=tel], select, textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; min-width: 0; }
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input[type=search] { width: 260px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.login h1 { margin-bottom: 4px; }
.login .btn { width: 100%; padding: 10px; margin-top: 6px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }

/* today */
.task { display: grid; grid-template-columns: 20px 1fr auto; gap: 10px; padding: 11px 4px; border-bottom: 1px solid var(--line2); align-items: start; }
.task:last-child { border-bottom: 0; }
.task input { margin-top: 3px; }
.task .t { font-weight: 600; }
.task .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.task.late .due { color: var(--bad); font-weight: 600; }
.due { font-size: 12px; color: var(--muted); white-space: nowrap; }
.p1 { border-left: 3px solid var(--hot); padding-left: 8px; }

/* contact */
.profile dl { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; margin: 0; }
.profile dt { color: var(--muted); font-size: 12px; }
.profile dd { margin: 0; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line2); }
.timeline .ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--cold-soft); color: var(--cold); }
.ic.email { background: #e8efff; color: #1f5eff; }
.ic.whatsapp { background: #e3f8ea; color: #087443; }
.ic.ad { background: #f4ebff; color: #6941c6; }
.ic.web { background: #fef4e6; color: #b54708; }
.ic.call, .ic.note { background: #fff1f3; color: #c01048; }
.timeline .s { font-weight: 500; }
.timeline .m { color: var(--muted); font-size: 12px; margin-top: 2px; }
.timeline .system .s { font-weight: 400; color: var(--muted); }
.stagebar { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0 4px; }
.stagebar button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 4px 9px; font-size: 12px; font-weight: 600; color: var(--muted); }
.stagebar button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.stagebar button.lost.on { background: var(--bad); border-color: var(--bad); }
.stagebar button.won.on { background: var(--good); border-color: var(--good); }

/* board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #eef0f4; border-radius: var(--radius); padding: 10px; min-height: 200px; }
.col h3 { margin: 2px 4px 10px; font-size: 13px; display: flex; justify-content: space-between; }
.col h3 span { color: var(--muted); font-weight: 500; }
.dcard { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; cursor: pointer; box-shadow: var(--shadow); }
.dcard:hover { border-color: #c7d3f5; }
.dcard .n { font-weight: 600; margin-bottom: 4px; }
.dcard .m { color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; gap: 6px; }

/* bars */
.bars .bar { display: grid; grid-template-columns: 120px 1fr 48px; gap: 10px; align-items: center; margin: 7px 0; }
.bars .track { background: #eef0f4; border-radius: 4px; height: 12px; overflow: hidden; }
.bars .fill { background: var(--brand); height: 100%; border-radius: 4px; }
.bars .v { text-align: right; font-variant-numeric: tabular-nums; }
.w0 { width: 0 } .w5 { width: 5% } .w10 { width: 10% } .w15 { width: 15% } .w20 { width: 20% } .w25 { width: 25% } .w30 { width: 30% } .w35 { width: 35% } .w40 { width: 40% } .w45 { width: 45% } .w50 { width: 50% } .w55 { width: 55% } .w60 { width: 60% } .w65 { width: 65% } .w70 { width: 70% } .w75 { width: 75% } .w80 { width: 80% } .w85 { width: 85% } .w90 { width: 90% } .w95 { width: 95% } .w100 { width: 100% }

/* switch */
.switch { position: relative; width: 36px; height: 20px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d0d5dd; border-radius: 20px; transition: .15s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::before { transform: translateX(16px); }

/* modal + toast */
.modal-bg { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); display: grid; place-items: center; z-index: 20; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 460px; padding: 20px; max-height: 90vh; overflow: auto; }
.modal h2 { font-size: 17px; margin-bottom: 14px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.secret { background: #101828; color: #e8efff; padding: 10px; border-radius: 8px; word-break: break-all; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #101828; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 30; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.toast.bad { background: var(--bad); }
pre.json { background: #f8f9fb; border: 1px solid var(--line); padding: 8px; border-radius: 6px; font-size: 11px; max-height: 160px; overflow: auto; margin: 6px 0 0; white-space: pre-wrap; }

@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .g2, .g3 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; }
  .brand { padding: 4px 8px; }
  .brand small, .side .foot { display: none; }
  .ws-switch { margin: 0; }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; width: 100%; }
  .main { padding: 16px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .filters input[type=search] { width: 100%; }
  table { display: block; overflow-x: auto; }
}
