/* FZ Radar — estilos */
:root {
  --ink: #12161F;
  --ink-2: #3A3F4B;
  --muted: #4A5060;
  --bg: #F3F4F1;
  --bg-2: #E9EBE5;
  --card: #FFFFFF;
  --line: #E3E5E0;
  --line-2: #EEF0EB;
  --line-3: #CDD0C8;
  --accent: #2448D8;
  --accent-ink: #1A35A3;
  --accent-soft: #E4E9FB;
  --accent-faint: #F5F7FE;
  --f1: #B9C6F2; --f2: #8EA3EA; --f3: #5B78E0;
  --warn: #A44A0C;
  --warn-ink: #8A3A06;
  --warn-soft: #FBE7D6;
  --warn-deep: #3D1A03;
  --teal-ink: #0F5F59; --teal-soft: #DDF1EE;
  --side: #12161F; --side-2: #1B202B; --side-3: #232937; --side-line: #2E3442; --side-txt: #C9CDD6;
  --wa: #128C4B;
  --radius: 14px;
  --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Space Grotesk', var(--font);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; }
a { color: var(--accent); }
a:hover { color: var(--accent-ink); }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 30px; line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
code { background: var(--line-2); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }
.ic { flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.txt-bad { color: var(--warn); font-weight: 600; }
.txt-good { color: var(--accent-ink); font-weight: 600; }
.txt-neutral { color: var(--muted); }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.side { width: 240px; flex: none; background: var(--side); color: #E8EAF0; padding: 24px 16px; display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 20px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-dark { color: var(--ink); }
.logo { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.tenant-switch { display: flex; flex-direction: column; gap: 6px; }
.tenant-switch label, .tenant-name span { font-size: 12px; color: #A9AEBB; text-transform: uppercase; letter-spacing: 0.08em; }
.tenant-switch select { font: inherit; padding: 10px; min-height: 44px; border-radius: 8px; border: 1px solid var(--side-line); background: var(--side-2); color: #fff; }
.tenant-name { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.navlist { display: flex; flex-direction: column; gap: 2px; }
.navlist a, .side-foot a, .linkbtn { display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 44px; border-radius: 8px; color: var(--side-txt); text-decoration: none; font: inherit; }
.navlist a:hover, .side-foot a:hover, .linkbtn:hover { background: var(--side-2); color: #fff; }
.navlist a[aria-current="page"], .side-foot a[aria-current="page"] { background: var(--side-3); color: #fff; font-weight: 600; }
.badge-count { margin-left: auto; background: #E07A1F; color: var(--ink); font-weight: 700; font-size: 12px; padding: 1px 8px; border-radius: 999px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--side-line); padding-top: 14px; display: flex; flex-direction: column; gap: 2px; }
.side-foot form { margin: 0; }
.linkbtn { background: none; border: 0; width: 100%; cursor: pointer; text-align: left; }
.main { flex: 1; min-width: 0; padding: 28px 36px 64px; display: flex; flex-direction: column; gap: 20px; }
.topbar, .navtoggle { display: none; }

/* ---------- Encabezados ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head p { margin: 6px 0 0; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.eyebrow.light { color: #A9B9F5; }
.h1-sub { font-size: 0.6em; font-weight: 500; letter-spacing: 0; }
.head-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; text-decoration: none; margin-bottom: 4px; }

/* ---------- Botones y campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); color: #fff; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line-3); }
.btn-ghost:hover { background: var(--line-2); color: var(--ink); }
.btn-light { background: #fff; color: var(--ink); }
.btn-light:hover { background: var(--accent-soft); color: var(--ink); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-wa:hover { background: #0D6E3A; color: #fff; }
.btn-danger-ghost { background: #fff; color: var(--warn); border-color: #E9C3A7; }
.btn-danger-ghost:hover { background: var(--warn-soft); color: var(--warn-ink); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], input[type=datetime-local], input:not([type]), select, textarea {
  font: inherit; font-size: 15px; min-height: 44px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line-3); background: #fff; color: var(--ink); width: 100%;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid rgba(36, 72, 216, 0.35); outline-offset: 1px; }
input[readonly] { background: var(--line-2); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.checks { justify-content: flex-end; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-content: start; }
.form-grid.one { grid-template-columns: minmax(0, 1fr); }
.form-grid h3 { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.span2 { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters .field { flex: 1 1 170px; }
.filters .grow2 { flex: 2 1 260px; }
.field-btn { flex: 0 0 auto !important; flex-direction: row !important; gap: 8px !important; }
.period { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0; }
.period select { width: auto; }
.period .custom-dates { display: none; gap: 8px; }
.period.is-custom .custom-dates { display: flex; }
.period input[type=date] { width: 150px; }

/* ---------- Tarjetas ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card.narrow { max-width: 560px; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 20px; align-items: stretch; }
.grow1 { flex: 1 1 300px; }
.grow2 { flex: 2 1 340px; }
.grow3 { flex: 3 1 460px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.flash { padding: 12px 16px; border-radius: 10px; font-weight: 500; }
.flash-ok { background: var(--accent-soft); color: var(--accent-ink); }
.flash-warn { background: var(--warn-soft); color: var(--warn-deep); }
.flash-error { background: #FBE1DA; color: #7A1D06; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { padding: 18px; gap: 6px; }
.kpi-label { font-size: 14px; color: var(--muted); }
.kpi-value { white-space: nowrap; font-family: var(--display); font-size: clamp(20px, 1.65vw, 26px); font-weight: 600; letter-spacing: -0.02em; }
.kpi-delta { font-size: 13px; font-weight: 600; }
.kpi-delta.good { color: var(--accent-ink); }
.kpi-delta.bad { color: var(--warn); }
.kpi-delta.neutral { color: var(--muted); }

/* Embudo */
.funnel { display: flex; flex-direction: column; gap: 14px; }
.funnel-top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; gap: 10px; }
.bar { height: 28px; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; }
.f1 { background: var(--f1); } .f2 { background: var(--f2); } .f3 { background: var(--f3); } .f4 { background: var(--accent); }
.callout { display: flex; gap: 12px; align-items: flex-start; border-radius: 10px; padding: 14px 16px; }
.callout.warn { background: var(--warn-soft); color: var(--warn-deep); }
.callout.warn .ic { color: var(--warn-ink); }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; }
.mini-stats div { display: flex; flex-direction: column; gap: 2px; }
.mini-stats strong { font-family: var(--display); font-size: 20px; }

/* Alertas */
.alert-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 8px; border-radius: 999px; }
.tag-urgent { color: var(--warn-ink); background: var(--warn-soft); }
.tag-warn, .tag-info { color: var(--accent-ink); background: var(--accent-soft); }

/* Gráfico */
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw-leads, .cb-leads { background: var(--f1); }
.sw-sales, .cb-sales { background: var(--accent); }
.chart { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 6px; height: 200px; align-items: end; border-bottom: 1px solid #D5D8D0; }
.chart-col { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.chart-num { font-size: 11px; color: var(--muted); }
.chart-bars { height: 160px; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.cb { width: 42%; max-width: 28px; border-radius: 4px 4px 0 0; min-height: 0; }
.chart-labels { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 6px; font-size: 12px; color: var(--muted); text-align: center; margin-top: -8px; }

/* Tablas */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 640px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; padding: 0 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table .r { text-align: right; white-space: nowrap; }
.table .sub { display: block; font-size: 13px; color: var(--muted); }
.table a { text-decoration: none; color: var(--ink); }
.table a:hover strong { color: var(--accent); }
.row-good td { background: var(--accent-faint); }
.row-bad td { background: #FFF8F2; }
.row-off td { opacity: 0.55; }
.person { display: inline-flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.meter { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.meter-track { flex: 1; height: 8px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.meter-fill { display: block; height: 100%; background: var(--accent); }
.stage-pill { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; background: var(--line-2); }
.st-new { background: var(--warn-soft); color: var(--warn-ink); }
.st-contacted, .st-proposal { background: var(--accent-soft); color: var(--accent-ink); }
.st-won { background: #DCEBDF; color: #1E5B2E; }
.st-lost { background: var(--line-2); color: var(--muted); }

/* Prioridad */
.priority, .rep-goal { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 26px; display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; }
.priority > div { flex: 1 1 420px; }
.priority p, .rep-goal p { color: var(--side-txt); margin: 8px 0 0; }
.priority-title { font-family: var(--display); font-size: 23px; font-weight: 600; line-height: 1.3; }

/* ---------- Pipeline ---------- */
.pending-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 8px; background: var(--warn-soft); color: var(--warn-deep); text-decoration: none; }
.pending-chip .ic { color: var(--warn-ink); }
.board-wrap { overflow-x: auto; padding-bottom: 8px; margin: 0 -4px; }
.board { display: grid; grid-template-columns: repeat(5, minmax(260px, 1fr)); gap: 14px; min-width: 1360px; padding: 0 4px; }
.col { background: var(--bg-2); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 10px; min-height: 300px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 2px; }
.col-head h2 { font-family: var(--font); font-size: 15px; font-weight: 600; flex: 1; }
.count { font-size: 13px; font-weight: 600; color: var(--muted); background: #fff; padding: 1px 9px; border-radius: 999px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-new { background: #E07A1F; } .dot-contacted { background: var(--f2); } .dot-proposal { background: var(--f3); } .dot-won { background: var(--accent); } .dot-lost { background: #8A8F99; }
.col-body { display: flex; flex-direction: column; gap: 10px; flex: 1; border-radius: 8px; transition: background 0.15s; }
.col-body.drag-over { background: rgba(36, 72, 216, 0.08); outline: 2px dashed var(--f2); }
.lead-card { background: #fff; border: 1px solid #DDE0D8; border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; cursor: grab; }
.lead-card.dragging { opacity: 0.5; }
.lead-card.saving { opacity: 0.6; pointer-events: none; }
.lc-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.lc-name { font-weight: 600; color: var(--ink); text-decoration: none; }
.lc-sub { font-size: 13px; color: var(--muted); margin-top: -4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--line-2); }
.chip-meta { color: var(--accent-ink); background: var(--accent-soft); }
.chip-google { color: var(--warn-ink); background: var(--warn-soft); }
.chip-organic, .chip-referral { color: var(--teal-ink); background: var(--teal-soft); }
.lc-time { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.lc-time.late { color: var(--warn); font-weight: 600; }
.lc-actions { display: flex; gap: 6px; align-items: center; }
.move-sel { min-height: 36px !important; padding: 4px 8px !important; font-size: 13px !important; flex: 1; }
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 16px 0; margin: 0; }
.more { text-align: center; font-size: 14px; padding: 8px; }
.dlg { border: 0; border-radius: var(--radius); padding: 24px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(18, 22, 31, 0.25); }
.dlg::backdrop { background: rgba(18, 22, 31, 0.45); }
.dlg form { display: flex; flex-direction: column; gap: 16px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* Ficha de lead */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { padding: 12px 0 12px 18px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 17px; width: 10px; height: 10px; border-radius: 50%; background: var(--f2); }
.tl-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tl-note { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.note-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.utm summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.utm dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; margin: 8px 0 0; }
.utm dt { color: var(--muted); }
.utm dd { margin: 0; word-break: break-all; }

/* Clientes */
.conn { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.conn:first-of-type { border-top: 0; padding-top: 0; }
.conn p { margin: 0; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-size: 13px; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.share-box { background: var(--accent-faint); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.share-box label { font-weight: 600; font-size: 14px; }

/* ---------- Informe ---------- */
.report-wrap { display: flex; justify-content: center; }
.report { width: 100%; max-width: 860px; background: #fff; border-radius: var(--radius); border: 1px solid var(--line); padding: 44px 52px; display: flex; flex-direction: column; gap: 32px; }
.rep-head { border-bottom: 2px solid var(--ink); padding-bottom: 24px; display: flex; flex-direction: column; gap: 4px; }
.rep-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.rep-brand .brand { font-size: 18px; }
.rep-brand .logo { width: 30px; height: 30px; }
.report h1 { font-size: 34px; }
.report section { display: flex; flex-direction: column; gap: 12px; }
.report h2 { font-size: 21px; }
.rep-summary { background: var(--accent-faint); border-radius: 10px; padding: 18px 22px 18px 40px; margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: 16px; }
.rep-summary li::marker { color: var(--accent-ink); font-weight: 700; }
.rep-table { min-width: 520px; }
.finding { display: flex; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.finding .num { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; }
.finding p { margin: 4px 0 0; color: var(--ink-2); }
.action-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; }
.rep-goal { flex-direction: column; align-items: flex-start; gap: 6px; }
.rep-foot { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; border-top: 1px solid var(--line); padding-top: 16px; }
.share-page { padding: 24px 16px 64px; background: var(--bg-2); min-height: 100vh; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.share-bar { width: 100%; max-width: 860px; display: flex; justify-content: flex-end; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login { width: min(400px, 100%); padding: 32px; }
.login h1 { font-size: 24px; }
.login p { margin: 0; }

/* ---------- Móvil ---------- */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .topbar { display: flex; align-items: center; gap: 12px; background: var(--side); color: #fff; padding: 8px 12px; position: sticky; top: 0; z-index: 20; }
  .brand-sm { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 700; }
  .iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 8px; cursor: pointer; }
  .side { display: none; position: fixed; inset: 60px 0 0 0; width: auto; height: auto; z-index: 30; }
  .navtoggle:checked ~ .side { display: flex; }
  .main { padding: 18px 16px 48px; }
  h1 { font-size: 25px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .report { padding: 26px 18px; }
  .report h1 { font-size: 27px; }
  .board { min-width: 0; grid-template-columns: minmax(0, 1fr); }
  .period input[type=date] { width: 100%; }
  .copy-row { flex-wrap: wrap; }
}

/* ---------- Impresión (PDF del informe) ---------- */
@media print {
  body { background: #fff; }
  .side, .topbar, .no-print, .flash { display: none !important; }
  .main, .share-page { padding: 0; background: #fff; }
  .report { border: 0; padding: 0; max-width: none; }
  .rep-goal, .finding .num, .rep-summary { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .report section { break-inside: avoid; }
  .table-wrap { overflow: visible; }
}

.card.form-grid { display: grid; }
@media (max-width: 900px) { .card.form-grid { grid-template-columns: minmax(0, 1fr); } }
