:root {
  --red: #ff0000;
  --red-dark: #c60000;
  --ink: #000000;
  --muted: #667085;
  --line: #e1e4ea;
  --soft: #fafafa;
  --paper: #ffffff;
  --green: #18794e;
  --amber: #a15c00;
  --shadow: 0 18px 50px rgba(18, 24, 40, 0.12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--soft); color: var(--ink); font-family: Inter, Helvetica, Arial, sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; background: var(--ink); border: 1px solid var(--ink); border-radius: 7px; color: white; font-weight: 780; }
button:hover { background: var(--red); border-color: var(--red); color: white; }
button:focus-visible { outline: 3px solid rgba(255, 0, 0, .28); outline-offset: 2px; }
.topbar { height: 72px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; background: var(--paper); border-bottom: 3px solid var(--red); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { display: block; height: 34px; object-fit: contain; width: auto; }
.brand span { font-size: 18px; font-weight: 700; }
.user-context { display: flex; align-items: center; gap: 14px; }
.user-context > div { display: grid; text-align: right; }
.user-context strong { font-size: 13px; }
.user-context span { color: var(--muted); font-size: 11px; margin-top: 2px; }
.compact { padding: 7px 11px; font-size: 12px; }
.auth-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #fafafa 0%, #ffffff 55%, #f2f2f2 100%); }
.auth-card { width: min(440px, 100%); background: var(--paper); border: 1px solid var(--line); border-top: 5px solid var(--red); border-radius: 12px; padding: 34px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 36px; }
.auth-brand img { display: block; height: 38px; object-fit: contain; width: auto; }
.auth-brand span { font-size: 17px; font-weight: 800; }
.auth-card h1 { font-size: 30px; }
.auth-card p { color: var(--muted); line-height: 1.5; }
.auth-card footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; margin-top: 28px; padding-top: 16px; }
.auth-form { display: grid; gap: 14px; margin-top: 24px; }
.auth-form small { color: var(--muted); line-height: 1.4; }
.auth-form .primary { margin-top: 4px; }
.shell { min-height: calc(100vh - 72px); display: grid; grid-template-columns: 220px 1fr; }
.sidebar { background: var(--paper); border-right: 1px solid var(--line); padding: 22px 14px; }
.nav-button { width: 100%; background: var(--ink); border-color: var(--ink); color: white; text-align: left; padding: 12px 14px; border-radius: 8px; margin-bottom: 7px; font-weight: 750; }
.nav-button:hover { background: var(--red-dark); border-color: var(--red-dark); color: white; }
.nav-button.active { background: var(--red); border-color: var(--red); color: white; box-shadow: 0 4px 12px rgba(255, 0, 0, .18); }
.sidebar-note { margin: 26px 8px 0; padding: 16px 0 0; border-top: 1px solid var(--line); }
.sidebar-note strong { font-size: 12px; text-transform: uppercase; color: var(--red); }
.sidebar-note p { color: var(--muted); font-size: 13px; line-height: 1.5; }
main { padding: 34px; max-width: 1600px; width: 100%; }
.view { display: none; }
.view.active { display: block; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.eyebrow { color: var(--red); display: block; font-size: 11px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 7px; }
h1 { font-size: 34px; letter-spacing: -1.1px; margin: 0; }
h2 { font-size: 18px; margin: 0; }
h3 { font-size: 14px; margin: 24px 0 12px; }
.page-heading p, .panel p { color: var(--muted); margin: 7px 0 0; line-height: 1.5; }
.primary, .secondary { border-radius: 7px; padding: 10px 16px; font-weight: 780; }
.primary { background: var(--red); border: 1px solid var(--red); color: white; }
.primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.secondary { background: var(--ink); border: 1px solid var(--ink); color: white; }
.secondary:hover { background: var(--red); border-color: var(--red); color: white; }
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi-grid article { background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--ink); border-radius: 8px; padding: 16px; }
.kpi-grid article.attention { border-top-color: var(--red); }
.kpi-grid span { color: var(--muted); display: block; font-size: 12px; font-weight: 700; min-height: 30px; }
.kpi-grid strong { display: block; font-size: 24px; margin-top: 6px; }
.sales-funnel-section { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 6px 18px rgba(0, 0, 0, .055); margin-bottom: 20px; padding: 22px; }
.funnel-heading { align-items: flex-start; display: flex; gap: 18px; justify-content: space-between; margin-bottom: 20px; }
.funnel-heading h2 { font-size: 22px; letter-spacing: -.03em; }
.funnel-heading p { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 6px 0 0; }
.funnel-heading-actions { align-items: flex-end; display: grid; gap: 12px; justify-items: end; }
.funnel-legend { align-items: center; color: var(--muted); display: flex; flex-wrap: wrap; font-size: 11px; font-weight: 750; gap: 14px; }
.funnel-legend span { align-items: center; display: flex; gap: 6px; white-space: nowrap; }
.funnel-spectrum { display: flex; gap: 3px !important; }
.funnel-spectrum i { border-radius: 50%; display: inline-block; height: 8px; width: 8px; }
.funnel-spectrum i:nth-child(1) { background: #16213e; }
.funnel-spectrum i:nth-child(2) { background: #244c5a; }
.funnel-spectrum i:nth-child(3) { background: #2f7f88; }
.funnel-spectrum i:nth-child(4) { background: #cf4318; }
.funnel-spectrum i:nth-child(5) { background: #ef6419; }
.funnel-spectrum i:nth-child(6) { background: #f39a0a; }
.funnel-spectrum i:nth-child(7) { background: #ffc20a; }
.stage-help-button { align-items: center; background: var(--red); border-color: var(--red); display: inline-flex; gap: 8px; padding: 10px 14px; }
.stage-help-button span { align-items: center; background: white; border-radius: 50%; color: var(--red); display: inline-flex; font-size: 12px; height: 20px; justify-content: center; width: 20px; }
.stage-help-button:hover { background: var(--red-dark); border-color: var(--red-dark); }
.funnel-layout { display: grid; gap: clamp(22px, 4vw, 54px); grid-template-columns: minmax(420px, 1.3fr) minmax(330px, .7fr); }
.sales-funnel { align-items: center; display: flex; flex-direction: column; gap: 3px; min-height: 500px; padding: 4px 0 6px; width: 100%; }
.funnel-stage { align-items: center; background: var(--stage-color); border: 0; border-radius: 0; box-shadow: none; box-sizing: border-box; color: var(--stage-text); display: flex; flex-direction: column; gap: 2px; justify-content: center; min-height: clamp(62px, 6vw, 74px); padding: 8px clamp(22px, 4vw, 38px); text-align: center; width: 100%; }
.funnel-level-1 { clip-path: polygon(0 0, 100% 0, 96.5% 100%, 3.5% 100%); }
.funnel-level-2 { clip-path: polygon(3.5% 0, 96.5% 0, 93% 100%, 7% 100%); }
.funnel-level-3 { clip-path: polygon(7% 0, 93% 0, 89.5% 100%, 10.5% 100%); }
.funnel-level-4 { clip-path: polygon(10.5% 0, 89.5% 0, 86% 100%, 14% 100%); }
.funnel-level-5 { clip-path: polygon(14% 0, 86% 0, 82.5% 100%, 17.5% 100%); }
.funnel-level-6 { clip-path: polygon(17.5% 0, 82.5% 0, 79% 100%, 21% 100%); }
.funnel-level-7 { clip-path: polygon(21% 0, 79% 0, 75.5% 100%, 24.5% 100%); }
.funnel-stage:hover { box-shadow: 0 7px 16px rgba(0, 0, 0, .18); color: var(--stage-text); filter: brightness(.88); transform: translateY(-1px) scale(1.005); }
.funnel-stage.is-empty { background-image: linear-gradient(rgba(255, 255, 255, .10), rgba(255, 255, 255, .10)); }
.funnel-stage.is-empty .funnel-stage-count,
.funnel-stage.is-empty .funnel-stage-value { opacity: .82; }
.funnel-stage-name { font-size: clamp(11px, 1.05vw, 14px); font-weight: 900; letter-spacing: .05em; line-height: 1.15; text-transform: uppercase; }
.funnel-stage-count { font-size: clamp(10px, .92vw, 12px); font-weight: 700; line-height: 1.15; white-space: nowrap; }
.funnel-stage-count strong { font-size: clamp(12px, 1.18vw, 15px); }
.funnel-stage-value { font-size: clamp(12px, 1.25vw, 16px); font-variant-numeric: tabular-nums; font-weight: 900; line-height: 1.15; white-space: nowrap; }
.funnel-help { color: var(--muted); font-size: 11px; margin: 10px 0 0; text-align: center; }
.funnel-indicators { border-left: 1px solid var(--line); padding-left: clamp(22px, 3vw, 38px); }
.funnel-primary-metric { background: var(--ink); border-radius: 12px; color: white; padding: 18px; }
.funnel-primary-metric span, .funnel-metric-grid span { display: block; font-size: 11px; font-weight: 800; line-height: 1.3; text-transform: uppercase; }
.funnel-primary-metric strong { display: block; font-size: 30px; font-variant-numeric: tabular-nums; letter-spacing: -.04em; margin: 8px 0 4px; text-align: center; }
.funnel-primary-metric small { color: #d2d2d2; display: block; font-size: 10px; line-height: 1.35; text-align: center; }
.funnel-metric-grid { display: grid; gap: 1px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--line); }
.funnel-metric-grid article { background: white; min-height: 118px; padding: 14px; }
.funnel-metric-grid span { color: var(--muted); min-height: 29px; }
.funnel-metric-grid strong { display: block; font-size: 24px; font-variant-numeric: tabular-nums; letter-spacing: -.04em; margin: 8px 0 3px; text-align: center; }
.funnel-metric-grid small { color: var(--muted); display: block; font-size: 10px; line-height: 1.3; text-align: center; }
.funnel-secondary-status { display: flex; gap: 8px; justify-content: space-between; margin-top: 12px; }
.funnel-secondary-status span { background: var(--soft); border-radius: 8px; color: var(--muted); flex: 1; font-size: 11px; padding: 10px; text-align: center; }
.funnel-secondary-status strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.marketing-impact-section { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 6px 18px rgba(0, 0, 0, .055); margin-bottom: 20px; overflow: hidden; padding: 22px; }
.marketing-impact-heading { align-items: flex-start; display: flex; gap: 18px; justify-content: space-between; margin-bottom: 18px; }
.marketing-impact-heading h2 { font-size: 22px; letter-spacing: -.03em; }
.marketing-impact-heading p { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 6px 0 0; }
.marketing-impact-heading-actions { align-items: center; display: flex; flex: 0 0 auto; gap: 9px; }
.marketing-impact-help-button { align-items: center; background: var(--red); border-color: var(--red); color: white; display: inline-flex; gap: 7px; padding: 8px 12px; }
.marketing-impact-help-button span { align-items: center; border: 1px solid rgba(255, 255, 255, .72); border-radius: 50%; display: inline-flex; font-size: 10px; height: 18px; justify-content: center; width: 18px; }
.page-heading-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 9px; justify-content: flex-end; }
.context-help-button { align-items: center; background: var(--ink); border-color: var(--ink); color: white; display: inline-flex; gap: 7px; }
.context-help-button span { align-items: center; border: 1px solid rgba(255, 255, 255, .72); border-radius: 50%; display: inline-flex; font-size: 10px; height: 18px; justify-content: center; width: 18px; }
.marketing-impact-kpis { display: grid; gap: 10px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.marketing-impact-kpis article { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; min-height: 112px; padding: 15px; position: relative; }
.marketing-impact-kpis article::after { background: var(--ink); content: ""; height: 3px; inset: auto 0 0; position: absolute; }
.marketing-impact-kpis article:nth-child(2)::after { background: var(--red); }
.marketing-impact-kpis span { color: var(--muted); display: block; font-size: 10px; font-weight: 850; min-height: 27px; text-align: center; text-transform: uppercase; }
.marketing-impact-kpis strong { display: block; font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -.03em; margin: 7px 0 4px; text-align: center; }
.marketing-impact-kpis small { color: var(--muted); display: block; font-size: 9px; line-height: 1.35; text-align: center; }
.marketing-impact-table-wrap { border: 1px solid var(--line); border-radius: 10px; }
.marketing-impact-note { border-left: 3px solid var(--red); color: var(--muted); font-size: 11px; line-height: 1.45; margin: 15px 0 0; padding-left: 11px; }
.business-intelligence-section { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 6px 18px rgba(0, 0, 0, .055); margin-bottom: 20px; overflow: hidden; padding: 22px; }
.business-intelligence-heading { align-items: flex-start; display: flex; gap: 18px; justify-content: space-between; margin-bottom: 18px; }
.business-intelligence-heading h2 { font-size: 22px; letter-spacing: -.03em; }
.business-intelligence-heading p { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 6px 0 0; }
.business-intelligence-heading-actions { align-items: center; display: flex; flex: 0 0 auto; gap: 9px; }
.business-intelligence-help-button { align-items: center; background: var(--red); border-color: var(--red); color: white; display: inline-flex; gap: 7px; padding: 8px 12px; }
.business-intelligence-help-button span { align-items: center; border: 1px solid rgba(255, 255, 255, .72); border-radius: 50%; display: inline-flex; font-size: 10px; height: 18px; justify-content: center; width: 18px; }
.learning-badge { background: var(--ink); border-radius: 999px; color: white; flex: 0 0 auto; font-size: 10px; font-weight: 850; letter-spacing: .05em; padding: 8px 12px; text-transform: uppercase; }
.business-intelligence-kpis { display: grid; gap: 10px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.business-intelligence-kpis article { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; min-height: 112px; padding: 15px; position: relative; }
.business-intelligence-kpis article::after { background: var(--ink); content: ""; height: 3px; inset: auto 0 0; position: absolute; }
.business-intelligence-kpis article:nth-child(3)::after { background: var(--red); }
.business-intelligence-kpis span { color: var(--muted); display: block; font-size: 10px; font-weight: 850; min-height: 27px; text-align: center; text-transform: uppercase; }
.business-intelligence-kpis strong { display: block; font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -.03em; margin: 7px 0 4px; text-align: center; }
.business-intelligence-kpis small { color: var(--muted); display: block; font-size: 9px; line-height: 1.35; text-align: center; }
.business-intelligence-table-wrap { border: 1px solid var(--line); border-radius: 10px; }
.business-intelligence-table th { white-space: nowrap; }
.business-intelligence-table td { vertical-align: middle; }
.business-intelligence-table td small { color: var(--muted); display: block; font-size: 9px; line-height: 1.35; margin-top: 4px; }
.numeric-cell { font-variant-numeric: tabular-nums; text-align: center; }
.numeric-cell > small { text-align: center; }
.business-intelligence-attention-button { background: var(--red); border-color: var(--red); border-radius: 999px; min-width: 34px; padding: 6px 10px; }
.business-intelligence-ok { display: inline-block; font-weight: 850; min-width: 34px; text-align: center; }
.business-intelligence-note { border-left: 3px solid var(--red); color: var(--muted); font-size: 11px; line-height: 1.45; margin: 15px 0 0; padding-left: 11px; }
.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 18px; margin-bottom: 16px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.work-list { display: grid; gap: 9px; }
.work-item { border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: 6px; padding: 12px; display: flex; justify-content: space-between; gap: 14px; }
.work-item button { background: var(--ink); border: 1px solid var(--ink); border-radius: 6px; color: white; font-weight: 780; padding: 7px 9px; text-align: left; }
.work-item button:hover { background: var(--red); border-color: var(--red); }
.work-item p { font-size: 13px; margin-top: 5px; }
.work-item time { white-space: nowrap; color: var(--red-dark); font-size: 12px; font-weight: 800; }
.empty { border: 1px dashed var(--line); color: var(--muted); padding: 18px; border-radius: 7px; text-align: center; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 10px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover { background: var(--soft); }
.link-button { background: var(--ink); border: 1px solid var(--ink); border-radius: 6px; color: white; font-weight: 780; padding: 7px 9px; text-align: left; }
.link-button:hover { background: var(--red); border-color: var(--red); }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: 14px; }
.account-card { background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 18px; }
.account-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.account-card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.account-card h2 { font-size: 20px; }
.account-meta { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.badge { border: 1px solid var(--line); background: var(--soft); border-radius: 999px; padding: 5px 9px; font-size: 11px; font-weight: 750; }
.badge.red { background: #fff0f1; border-color: #ffc8cd; color: var(--red-dark); }
.account-card dl { display: grid; grid-template-columns: 100px 1fr; gap: 7px; font-size: 13px; margin: 14px 0 0; }
.account-card dt { color: var(--muted); }
.account-card dd { margin: 0; }
.classification-guide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; margin-bottom: 16px; }
.classification-guide div { background: var(--paper); padding: 14px 16px; }
.classification-guide strong { display: block; color: var(--red-dark); font-size: 13px; margin-bottom: 4px; }
.classification-guide span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.filters { display: grid; grid-template-columns: repeat(5, minmax(140px, 1fr)); gap: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 14px; margin-bottom: 16px; }
label { color: var(--muted); display: grid; gap: 6px; font-size: 12px; font-weight: 750; }
input, select, textarea { width: 100%; border: 1px solid #cfd4dc; border-radius: 6px; padding: 10px; color: var(--ink); background: white; }
input[type="number"] { text-align: center; font-variant-numeric: tabular-nums; font-weight: 750; }
.form-section-title { align-items: end; border-bottom: 1px solid var(--line); display: flex; gap: 10px; justify-content: space-between; margin-top: 5px; padding: 8px 0; }
.form-section-title strong { color: var(--ink); font-size: 12px; letter-spacing: .03em; text-transform: uppercase; }
.form-section-title span { color: var(--muted); font-size: 10px; font-weight: 650; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(227, 6, 19, .15); border-color: var(--red); }
.pipeline { display: grid; gap: 9px; }
.opportunity-row { background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 15px; display: grid; grid-template-columns: minmax(220px, 1.6fr) 140px 150px 150px 120px; align-items: center; gap: 14px; }
.opportunity-row:hover { border-color: #b8bec8; box-shadow: 0 5px 18px rgba(18, 24, 40, .06); }
.opportunity-row h3 { margin: 0; font-size: 15px; }
.opportunity-row p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.cell-label { display: block; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; margin-bottom: 4px; }
.overdue { color: var(--red-dark); font-weight: 800; }
.review-grid { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 14px; }
.review-grid .panel { min-height: 175px; }
.review-grid strong { font-size: 34px; display: block; margin-top: 15px; }
.step { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: white; background: var(--ink); font-size: 12px; font-weight: 850; margin-bottom: 13px; }
.checklist { display: grid; gap: 11px; }
.checklist label { display: flex; align-items: center; color: var(--ink); font-size: 14px; }
.checklist input { width: 18px; height: 18px; }
.security-note { background: #fff5f5; border: 1px solid #ffcaca; border-left: 4px solid var(--red); border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; }
.security-note p { color: var(--muted); margin: 4px 0 0; font-size: 13px; }
.status-active { color: var(--green); font-weight: 800; }
.status-inactive { color: var(--red-dark); font-weight: 800; }
dialog { width: min(820px, calc(100vw - 30px)); max-height: 90vh; border: 0; border-radius: 12px; padding: 0; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(15, 18, 24, .52); }
dialog form, .detail-dialog > div { padding: 24px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.dialog-heading h2 { font-size: 24px; }
.icon-button { align-items: center; background: var(--ink); border: 1px solid var(--ink); border-radius: 50%; color: white; display: inline-flex; font-size: 23px; height: 36px; justify-content: center; line-height: 1; padding: 0; width: 36px; }
.icon-button:hover { background: var(--red); border-color: var(--red); color: white; }
.stage-guide-dialog { overflow-y: auto; width: min(1080px, calc(100vw - 30px)); }
.stage-guide-dialog > div { padding: 28px; }
.stage-guide-tabs { display: flex; gap: 7px; margin: -2px 0 18px; overflow-x: auto; padding: 2px 2px 8px; }
.stage-guide-tab { background: var(--stage-color); border-color: var(--stage-color); color: var(--stage-text); flex: 0 0 auto; font-size: 10px; letter-spacing: .03em; opacity: .74; padding: 8px 11px; text-transform: uppercase; }
.stage-guide-tab:hover, .stage-guide-tab.active { background: var(--stage-color); border-color: var(--stage-color); color: var(--stage-text); opacity: 1; }
.stage-guide-tab.active { box-shadow: 0 0 0 3px rgba(0, 0, 0, .13); transform: translateY(-1px); }
.stage-guide-content { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.stage-guide-banner { align-items: center; background: var(--stage-color); color: var(--stage-text); display: flex; gap: 24px; justify-content: space-between; padding: 22px 24px; }
.stage-guide-banner h3 { font-size: 24px; letter-spacing: .04em; margin: 0 0 6px; text-transform: uppercase; }
.stage-guide-banner p { color: inherit; line-height: 1.45; margin: 0; max-width: 690px; opacity: .9; }
.stage-guide-summary { display: grid; flex: 0 0 auto; grid-template-columns: auto auto; line-height: 1.1; min-width: 160px; }
.stage-guide-summary strong { font-size: 21px; font-variant-numeric: tabular-nums; text-align: right; }
.stage-guide-summary span { font-size: 10px; font-weight: 800; margin-left: 7px; opacity: .82; text-transform: uppercase; }
.stage-guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stage-guide-grid article { border-bottom: 1px solid var(--line); min-height: 190px; padding: 20px 22px; }
.stage-guide-grid article:nth-child(odd) { border-right: 1px solid var(--line); }
.stage-guide-grid h4 { font-size: 12px; letter-spacing: .05em; margin: 0 0 12px; text-transform: uppercase; }
.stage-guide-grid ul { color: var(--muted); display: grid; gap: 8px; line-height: 1.4; margin: 0; padding-left: 18px; }
.stage-guide-grid li::marker { color: var(--red); }
.stage-guide-grid p { color: var(--muted); line-height: 1.55; margin: 0; }
.stage-guide-grid .guide-positive { background: #f3faf6; }
.stage-guide-grid .guide-positive h4 { color: var(--green); }
.stage-guide-grid .guide-warning { background: #fff8f2; }
.stage-guide-grid .guide-warning h4 { color: #a74200; }
.stage-guide-footer { align-items: center; background: var(--ink); color: white; display: grid; gap: 22px; grid-template-columns: 180px 1fr; padding: 17px 22px; }
.stage-guide-footer div { display: grid; }
.stage-guide-footer span { color: #bdbdbd; font-size: 9px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.stage-guide-footer strong { font-size: 17px; margin-top: 3px; }
.stage-guide-footer p { color: #ededed; line-height: 1.45; margin: 0; }
.record-reuse-help-dialog { overflow-y: auto; width: min(980px, calc(100vw - 30px)); }
.record-reuse-help-dialog > div { padding: 28px; }
.record-reuse-help-dialog section + section { margin-top: 22px; }
.record-reuse-intro { background: var(--ink); border-left: 5px solid var(--red); border-radius: 10px; color: white; padding: 19px 21px; }
.record-reuse-intro strong { display: block; font-size: 16px; margin-bottom: 6px; }
.record-reuse-intro p { color: #d8d8d8; line-height: 1.5; margin: 0; }
.record-reuse-grid { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.record-reuse-grid article { background: var(--soft); border: 1px solid var(--line); border-radius: 9px; min-height: 150px; padding: 17px; }
.record-reuse-grid span { color: var(--red); font-size: 9px; font-weight: 900; letter-spacing: .06em; }
.record-reuse-grid h3, .record-reuse-scope h3 { font-size: 14px; margin: 9px 0 7px; }
.record-reuse-grid p, .record-reuse-scope p { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 0; }
.record-reuse-scope { border: 1px solid #ffd6d9; border-radius: 10px; padding: 18px; }
.record-reuse-scope > div { display: grid; gap: 1px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 13px 0; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 8px; }
.record-reuse-scope article { background: white; min-height: 118px; padding: 14px; }
.record-reuse-scope article strong { display: block; font-size: 12px; margin-bottom: 6px; }
.marketing-impact-help-dialog { overflow-y: auto; width: min(1120px, calc(100vw - 30px)); }
.marketing-impact-help-dialog > div { padding: 28px; }
.marketing-impact-help-dialog section + section { margin-top: 26px; }
.marketing-help-intro { background: var(--ink); border-left: 5px solid var(--red); border-radius: 10px; color: white; padding: 19px 21px; }
.marketing-help-intro strong { display: block; font-size: 16px; margin-bottom: 6px; }
.marketing-help-intro p { color: #d8d8d8; line-height: 1.5; margin: 0; }
.marketing-help-section-heading { align-items: end; display: flex; gap: 18px; justify-content: space-between; margin-bottom: 12px; }
.marketing-help-section-heading h3 { font-size: 16px; margin: 0; }
.marketing-help-section-heading span { color: var(--red-dark); font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.marketing-help-flow { display: grid; gap: 8px; grid-template-columns: repeat(6, minmax(0, 1fr)); list-style: none; margin: 0; padding: 0; }
.marketing-help-flow li { background: var(--soft); border: 1px solid var(--line); border-radius: 9px; min-height: 112px; padding: 15px 12px; position: relative; }
.marketing-help-flow li:not(:last-child)::after { color: var(--red); content: "→"; font-weight: 900; position: absolute; right: -8px; top: 48px; z-index: 1; }
.marketing-help-flow li > span { color: var(--red); display: block; font-size: 9px; font-weight: 900; letter-spacing: .06em; }
.marketing-help-flow strong, .marketing-help-flow small { display: block; }
.marketing-help-flow strong { font-size: 11px; margin: 10px 0 5px; text-transform: uppercase; }
.marketing-help-flow small { color: var(--muted); font-size: 10px; line-height: 1.35; }
.marketing-help-decision-grid, .marketing-help-field-grid, .marketing-help-examples { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.marketing-help-decision-grid article, .marketing-help-field-grid article, .marketing-help-examples article { border: 1px solid var(--line); border-radius: 9px; min-height: 155px; padding: 17px; }
.marketing-help-decision-grid h4, .marketing-help-examples h4 { font-size: 13px; margin: 12px 0 7px; }
.marketing-help-decision-grid p, .marketing-help-field-grid p, .marketing-help-examples p { color: var(--muted); font-size: 11px; line-height: 1.45; margin: 0 0 10px; }
.marketing-help-decision-grid strong { font-size: 11px; }
.marketing-help-level { border-radius: 999px; display: inline-block; font-size: 9px; font-weight: 900; padding: 5px 8px; text-transform: uppercase; }
.marketing-help-level.platform { background: #e3e5e8; color: #4d535c; }
.marketing-help-level.contact { background: #e7f6eb; color: #176b33; }
.marketing-help-level.opportunity { background: var(--red); color: white; }
.marketing-help-field-grid article { background: var(--soft); min-height: 138px; }
.marketing-help-field-grid b { display: block; font-size: 13px; margin-bottom: 7px; }
.marketing-help-field-grid code { background: white; border: 1px solid var(--line); border-radius: 5px; display: inline-block; font-size: 10px; margin: 0 4px 4px 0; padding: 5px 7px; }
.marketing-help-rule { background: #fff5f5; border-left: 4px solid var(--red); color: var(--muted); font-size: 11px; line-height: 1.5; margin: 12px 0 0; padding: 12px 14px; }
.marketing-help-kpi-list { border: 1px solid var(--line); border-radius: 10px; margin: 0; overflow: hidden; }
.marketing-help-kpi-list div { display: grid; gap: 16px; grid-template-columns: 190px 1fr; padding: 13px 16px; }
.marketing-help-kpi-list div + div { border-top: 1px solid var(--line); }
.marketing-help-kpi-list dt { font-size: 11px; font-weight: 850; text-transform: uppercase; }
.marketing-help-kpi-list dd { color: var(--muted); font-size: 11px; line-height: 1.45; margin: 0; }
.marketing-help-examples article { background: var(--soft); min-height: 150px; }
.marketing-help-routine { background: #fff5f5; border: 1px solid #ffd6d9; border-radius: 11px; padding: 20px; }
.marketing-help-routine h3 { font-size: 17px; margin: 5px 0 0; }
.marketing-help-routine ol { display: grid; gap: 8px; grid-template-columns: repeat(4, minmax(0, 1fr)); list-style: none; margin: 18px 0; padding: 0; }
.marketing-help-routine li { background: white; border: 1px solid #ffd6d9; border-radius: 8px; display: grid; gap: 3px; padding: 11px; }
.marketing-help-routine li strong { font-size: 11px; text-transform: uppercase; }
.marketing-help-routine li span { color: var(--muted); font-size: 10px; }
.marketing-help-routine > p { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 0; }
.business-intelligence-help-dialog { overflow-y: auto; width: min(1120px, calc(100vw - 30px)); }
.business-intelligence-help-dialog > div { padding: 28px; }
.business-intelligence-help-dialog section + section { margin-top: 26px; }
.business-intelligence-help-intro { background: var(--ink); border-left: 5px solid var(--red); border-radius: 10px; color: white; padding: 19px 21px; }
.business-intelligence-help-intro strong { display: block; font-size: 16px; margin-bottom: 6px; }
.business-intelligence-help-intro p { color: #d8d8d8; line-height: 1.5; margin: 0; }
.business-intelligence-help-section-heading { align-items: end; display: flex; gap: 18px; justify-content: space-between; margin-bottom: 12px; }
.business-intelligence-help-section-heading h3 { font-size: 16px; margin: 0; }
.business-intelligence-help-section-heading span { color: var(--red-dark); font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.business-intelligence-flow { align-items: center; display: flex; gap: 6px; min-width: 880px; }
.business-intelligence-flow-stage { background: var(--stage-color); border-radius: 7px; color: var(--stage-text); display: grid; flex: 1 0 104px; min-height: 72px; padding: 12px 9px; place-content: center; text-align: center; }
.business-intelligence-flow-stage strong { font-size: 10px; letter-spacing: .025em; text-transform: uppercase; }
.business-intelligence-flow-stage small { font-size: 10px; margin-top: 5px; opacity: .85; }
.business-intelligence-flow > b { color: var(--muted); font-size: 15px; }
section:has(> .business-intelligence-flow) { overflow-x: auto; padding-bottom: 4px; }
.business-intelligence-concepts { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.business-intelligence-concept-card { border: 1px solid var(--line); border-radius: 11px; min-height: 220px; padding: 20px; position: relative; }
.business-intelligence-card-number { color: var(--red); font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.business-intelligence-concept-card h3 { font-size: 15px; margin: 5px 0 16px; }
.business-intelligence-concept-card p { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 17px 0 0; }
.business-intelligence-mini-timeline { align-items: center; display: grid; gap: 9px; grid-template-columns: auto 1fr auto 1fr auto; }
.business-intelligence-mini-timeline span { font-size: 10px; font-weight: 800; text-transform: uppercase; }
.business-intelligence-mini-timeline i { background: var(--red); height: 2px; position: relative; }
.business-intelligence-mini-timeline i::after { background: var(--red); border-radius: 50%; content: ""; height: 7px; position: absolute; right: 0; top: -2px; width: 7px; }
.business-intelligence-mini-timeline strong { color: var(--red-dark); font-size: 18px; white-space: nowrap; }
.business-intelligence-bars { display: grid; gap: 8px; }
.business-intelligence-bars span { align-items: center; display: grid; font-size: 10px; font-weight: 750; gap: 8px; grid-template-columns: 92px 1fr 30px; }
.business-intelligence-bars i { background: linear-gradient(90deg, var(--red) 0 var(--bar), var(--line) var(--bar) 100%); border-radius: 999px; height: 9px; }
.business-intelligence-bars i.bar-34 { --bar: 34%; }
.business-intelligence-bars i.bar-78 { --bar: 78%; }
.business-intelligence-bars i.bar-100 { --bar: 100%; }
.business-intelligence-bars b { font-variant-numeric: tabular-nums; text-align: right; }
.business-intelligence-dot-example { align-items: center; display: flex; gap: 18px; }
.business-intelligence-dot-grid { display: grid; gap: 6px; grid-template-columns: repeat(5, 13px); }
.business-intelligence-dot-grid i { background: var(--red); border-radius: 50%; height: 13px; width: 13px; }
.business-intelligence-dot-grid i.off { background: #d9d9d9; }
.business-intelligence-dot-example > strong { font-size: 28px; }
.business-intelligence-equation { align-items: center; display: flex; flex-wrap: wrap; gap: 7px; }
.business-intelligence-equation span, .business-intelligence-equation strong { background: var(--soft); border: 1px solid var(--line); border-radius: 7px; font-size: 10px; padding: 10px; text-align: center; }
.business-intelligence-equation strong { background: var(--red); border-color: var(--red); color: white; }
.business-intelligence-equation b { color: var(--muted); }
.business-intelligence-status-grid { display: grid; gap: 1px; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 10px; }
.business-intelligence-status-grid article { background: white; min-height: 132px; padding: 17px; }
.business-intelligence-status-grid article.attention { border-top: 4px solid var(--red); padding-top: 13px; }
.business-intelligence-status-grid strong, .business-intelligence-status-grid span { display: block; }
.business-intelligence-status-grid strong { font-size: 13px; }
.business-intelligence-status-grid span { color: var(--red-dark); font-size: 10px; font-weight: 850; margin: 5px 0 10px; text-transform: uppercase; }
.business-intelligence-status-grid p { color: var(--muted); font-size: 11px; line-height: 1.4; margin: 0; }
.business-intelligence-examples { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.business-intelligence-examples article { background: var(--soft); border-radius: 9px; min-height: 142px; padding: 17px; }
.business-intelligence-examples h4 { font-size: 13px; margin: 12px 0 6px; }
.business-intelligence-examples p { color: var(--muted); font-size: 11px; line-height: 1.45; margin: 0; }
.example-result { border-radius: 999px; display: inline-block; font-size: 9px; font-weight: 900; padding: 5px 8px; text-transform: uppercase; }
.example-result.ok { background: #e7f6eb; color: #176b33; }
.example-result.warning { background: var(--red); color: white; }
.example-result.neutral { background: #e3e5e8; color: #4d535c; }
.business-intelligence-review { background: #fff5f5; border: 1px solid #ffd6d9; border-radius: 11px; padding: 20px; }
.business-intelligence-review h3 { font-size: 17px; margin: 5px 0 0; }
.business-intelligence-review-flow { display: grid; gap: 8px; grid-template-columns: repeat(4, minmax(0, 1fr)); list-style: none; margin: 18px 0; padding: 0; }
.business-intelligence-review-flow li { background: white; border: 1px solid #ffd6d9; border-radius: 8px; display: grid; gap: 3px; padding: 11px; position: relative; }
.business-intelligence-review-flow li:not(:last-child)::after { color: var(--red); content: "→"; font-weight: 900; position: absolute; right: -8px; top: 18px; z-index: 1; }
.business-intelligence-review-flow strong { font-size: 11px; text-transform: uppercase; }
.business-intelligence-review-flow span { color: var(--muted); font-size: 10px; }
.business-intelligence-review > p { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-grid .wide { grid-column: 1 / -1; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 22px; margin-top: 22px; border-top: 1px solid var(--line); }
.detail-dialog { width: min(980px, calc(100vw - 30px)); }
.contacts-dialog { width: min(1100px, calc(100vw - 30px)); }
.contacts-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr); gap: 20px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-heading p, #contacts-dialog-summary { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.contacts-list { display: grid; gap: 10px; max-height: 58vh; overflow-y: auto; padding-right: 4px; }
.contact-row { border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: 8px; padding: 13px; background: var(--paper); }
.contact-row.inactive { border-left-color: #aeb4be; background: var(--soft); opacity: .78; }
.contact-row-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.contact-row-heading strong { display: block; font-size: 15px; }
.contact-row-heading span { display: block; font-size: 10px; margin-top: 3px; }
.record-actions, .detail-header-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 7px; }
.copy-origin { color: var(--red-dark); display: block; font-size: 10px; font-weight: 800; line-height: 1.35; margin: 6px 0 0; }
.form-context { color: var(--muted); font-size: 11px; line-height: 1.45; margin: -6px 0 13px; }
.contact-row p { color: var(--muted); font-size: 12px; margin: 5px 0 9px; }
.contact-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
.contact-row dl { display: grid; grid-template-columns: 70px 1fr; gap: 5px; font-size: 12px; margin: 0; }
.contact-row dt { color: var(--muted); }
.contact-row dd { margin: 0; overflow-wrap: anywhere; }
.contact-editor { border-left: 1px solid var(--line); padding-left: 20px; }
.contact-editor h3 { margin-bottom: 13px; }
.detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.detail-header-actions { flex: 0 0 auto; justify-content: flex-end; }
.detail-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 18px; padding-top: 18px; }
.fact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.fact { background: var(--soft); border-radius: 6px; padding: 11px; }
.fact span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; margin-bottom: 4px; }
.detail-section { margin-top: 20px; }
.timeline { display: grid; gap: 9px; }
.timeline-item { border-left: 2px solid var(--line); padding-left: 12px; }
.timeline-item strong { font-size: 12px; }
.timeline-item p { color: var(--muted); font-size: 13px; margin: 4px 0; }
.compact-form { display: grid; gap: 10px; background: var(--soft); padding: 14px; border-radius: 8px; }
#toast { position: fixed; right: 24px; bottom: 24px; opacity: 0; transform: translateY(10px); transition: .2s; background: var(--ink); color: white; border-radius: 7px; padding: 12px 16px; pointer-events: none; box-shadow: var(--shadow); }
#toast.show { opacity: 1; transform: translateY(0); }
#toast.error { background: var(--red-dark); }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .funnel-layout { grid-template-columns: 1fr; }
  .funnel-indicators { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 22px; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .opportunity-row { grid-template-columns: minmax(220px, 1fr) repeat(2, 130px); }
  .opportunity-row > :nth-child(4), .opportunity-row > :nth-child(5) { display: none; }
}
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { display: flex; overflow-x: auto; position: sticky; top: 0; z-index: 5; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .nav-button { width: auto; white-space: nowrap; margin: 0; }
  .sidebar-note { display: none; }
  main { padding: 20px 14px; }
  .topbar { padding: 0 16px; }
  .brand span, .user-context > div { display: none; }
  .page-heading, .two-column, .detail-grid, .contacts-layout { display: grid; grid-template-columns: 1fr; }
  .kpi-grid, .card-grid, .review-grid, .filters, .form-grid, .classification-guide { grid-template-columns: 1fr; }
  .sales-funnel-section { padding: 18px 14px; }
  .marketing-impact-section { padding: 18px 14px; }
  .marketing-impact-heading { display: grid; }
  .marketing-impact-heading-actions { align-items: stretch; display: grid; }
  .marketing-impact-help-button { justify-content: center; width: 100%; }
  .marketing-impact-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .funnel-heading { display: grid; }
  .funnel-heading-actions { align-items: stretch; justify-items: stretch; }
  .stage-help-button { justify-content: center; width: 100%; }
  .funnel-layout { grid-template-columns: minmax(0, 1fr); }
  .sales-funnel { min-height: 0; }
  .funnel-stage { min-height: clamp(60px, 17vw, 72px); padding: 7px clamp(14px, 4vw, 24px); }
  .business-intelligence-section { padding: 18px 14px; }
  .business-intelligence-heading { display: grid; }
  .business-intelligence-heading-actions { align-items: stretch; display: grid; }
  .business-intelligence-help-button { justify-content: center; width: 100%; }
  .learning-badge { justify-self: start; }
  .business-intelligence-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .wide { grid-column: auto; }
  .opportunity-row { grid-template-columns: 1fr 110px; }
  .opportunity-row > :nth-child(3), .opportunity-row > :nth-child(4), .opportunity-row > :nth-child(5) { display: none; }
  .account-card-heading { display: grid; }
  .account-card-actions { justify-content: flex-start; }
  .contact-row-heading, .detail-header { display: grid; }
  .record-actions, .detail-header-actions { justify-content: flex-start; }
  .contact-editor { border-left: 0; border-top: 1px solid var(--line); padding: 18px 0 0; }
  .contacts-list { max-height: none; }
}

/* Rediseño DAMF: superficie de trabajo limpia, industrial y contemporánea. */
:root {
  --muted: #686868;
  --line: #e6e6e6;
  --soft: #f6f6f6;
  --shadow: 0 20px 60px rgba(0, 0, 0, .16);
}

html { background: var(--soft); }
body { -webkit-font-smoothing: antialiased; }
button { transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
button:hover { transform: translateY(-1px); box-shadow: 0 7px 16px rgba(255, 0, 0, .16); }
button:active { transform: translateY(0); }

.topbar {
  height: 82px;
  padding: 0 34px;
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .035);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { gap: 12px; }
.brand img { height: 37px; }
.brand span {
  border-left: 1px solid #d4d4d4;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .01em;
  padding-left: 12px;
  text-transform: uppercase;
}
.user-context { gap: 16px; }

.auth-gate {
  background: radial-gradient(circle at 15% 12%, rgba(255, 0, 0, .07), transparent 26%), linear-gradient(145deg, #fff 0%, #f3f3f3 100%);
}
.auth-card {
  width: min(460px, 100%);
  border-radius: 20px;
  border-top: 1px solid var(--line);
  padding: 38px;
  position: relative;
  overflow: hidden;
}
.auth-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--red); }
.auth-brand { align-items: center; gap: 12px; margin-bottom: 40px; }
.auth-brand img { height: 42px; }
.auth-brand span {
  border-left: 1px solid #d4d4d4;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .01em;
  padding-left: 12px;
  text-transform: uppercase;
}
.auth-card h1 { font-size: 32px; letter-spacing: -.04em; }

.shell { min-height: calc(100vh - 82px); grid-template-columns: 232px minmax(0, 1fr); }
.sidebar { background: var(--ink); border-right-color: var(--ink); padding: 24px 16px; }
.nav-button {
  background: white;
  border-color: white;
  color: var(--ink);
  border-radius: 10px;
  margin-bottom: 8px;
  padding: 11px 14px;
  box-shadow: none;
}
.nav-button:hover { background: #e9e9e9; border-color: #e9e9e9; color: var(--ink); box-shadow: none; }
.nav-button.active { background: var(--red); border-color: var(--red); color: white; box-shadow: 0 8px 20px rgba(255, 0, 0, .23); }
.nav-count { background: var(--ink); border-radius: 999px; color: white; float: right; font-size: 10px; min-width: 20px; padding: 2px 6px; text-align: center; }
.nav-button.active .nav-count { background: white; color: var(--red); }
.sidebar-note { border-top-color: #343434; }
.sidebar-note p { color: #d0d0d0; }

main { padding: 40px clamp(22px, 3.5vw, 56px); max-width: 1700px; }
.view.active { animation: damf-view-in .22s ease both; }
@keyframes damf-view-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.page-heading { align-items: flex-end; margin-bottom: 28px; }
h1 { font-size: clamp(30px, 3vw, 42px); letter-spacing: -.05em; line-height: 1.02; }
.eyebrow { font-size: 10px; letter-spacing: .12em; }

.kpi-grid { gap: 14px; margin-bottom: 20px; }
.kpi-grid article {
  min-height: 126px;
  border: 1px solid var(--line);
  border-top: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .055);
  position: relative;
  overflow: hidden;
}
.kpi-grid article::after { content: ""; position: absolute; inset: auto 0 0 0; height: 3px; background: var(--ink); }
.kpi-grid article.attention { border-top-color: var(--line); }
.kpi-grid article.attention::after { background: var(--red); height: 4px; }
.kpi-grid span { font-size: 11px; line-height: 1.3; text-align: center; }
.kpi-grid strong { font-size: 28px; letter-spacing: -.04em; margin-top: 12px; text-align: center; font-variant-numeric: tabular-nums; }

.panel, .account-card, .filters, .opportunity-row, .classification-guide {
  border-color: var(--line);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .055);
}
.panel { padding: 21px; }
.two-column { gap: 18px; }
.work-item { background: var(--soft); border-radius: 10px; }
.empty { background: var(--soft); border-color: #d4d4d4; border-radius: 10px; padding: 22px; }

th { background: var(--soft); font-size: 10px; letter-spacing: .07em; }
th, td { padding: 13px 11px; }
.account-card { padding: 20px; position: relative; overflow: hidden; }
.account-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--red) 0 28%, var(--ink) 28% 100%); }
.account-card h2 { font-size: 21px; line-height: 1.15; }
.badge { font-size: 10px; }
.classification-guide div { padding: 17px 18px; }
.filters { padding: 17px; }
.account-filters { grid-template-columns: minmax(240px, 1.5fr) repeat(3, minmax(145px, 1fr)) auto; }
.user-filters { grid-template-columns: minmax(240px, 1.5fr) minmax(170px, 1fr) minmax(150px, 1fr) auto; }
.filter-count { align-items: center; align-self: end; background: var(--ink); border-radius: 9px; color: white; display: flex; gap: 10px; justify-content: space-between; min-height: 39px; padding: 9px 13px; white-space: nowrap; }
.filter-count span { color: #d1d1d1; font-size: 9px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.filter-count strong { font-size: 13px; font-variant-numeric: tabular-nums; }

input, select, textarea { border-color: #d4d4d4; border-radius: 9px; padding: 11px 12px; transition: border-color .16s ease, box-shadow .16s ease; }
input:hover, select:hover, textarea:hover { border-color: #a8a8a8; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--red); box-shadow: 0 0 0 3px rgba(255, 0, 0, .1); }
.opportunity-row { padding: 16px 18px; transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease; }
.opportunity-row:hover { transform: translateY(-1px); box-shadow: 0 9px 24px rgba(0, 0, 0, .075); }
.web-safety-note { background: var(--ink); border-left: 4px solid var(--red); border-radius: 14px; color: white; margin-bottom: 16px; padding: 16px 18px; }
.web-safety-note p { color: #d3d3d3; font-size: 12px; margin: 5px 0 0; }
.web-filters { grid-template-columns: minmax(280px, 1.8fr) minmax(170px, 1fr) minmax(190px, 1fr) auto; }
.web-submissions { display: grid; gap: 10px; }
.web-submission-row { align-items: center; background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 6px 18px rgba(0, 0, 0, .055); cursor: pointer; display: grid; gap: 14px; grid-template-columns: minmax(240px, 1.45fr) 140px 190px minmax(220px, 1.2fr) 170px; padding: 17px 19px; }
.web-submission-row:hover { border-color: #b8bec8; transform: translateY(-1px); }
.web-submission-row h3 { font-size: 16px; margin: 0; }
.web-submission-row p { color: var(--muted); font-size: 11px; margin: 5px 0 0; }
.web-status { border-radius: 999px; display: inline-block; font-size: 10px; font-weight: 850; padding: 6px 9px; }
.web-status.new { background: var(--red); color: white; }
.web-status.working { background: #ffdda0; color: #442d00; }
.web-status.converted { background: #d8f0e2; color: #176b3a; }
.web-status.closed { background: #e7e7e7; color: #4c4c4c; }
.web-need { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); font-size: 12px; line-height: 1.55; padding: 16px; }
.web-detail-grid a { color: var(--red-dark); }
.review-grid strong { text-align: center; font-variant-numeric: tabular-nums; }
.security-note { background: var(--ink); border-color: var(--ink); color: white; border-radius: 14px; }
.security-note p { color: #d3d3d3; }

dialog { border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 0, 0, .62); backdrop-filter: blur(4px); }
dialog form, .detail-dialog > div { padding: 28px; }
.dialog-heading h2 { letter-spacing: -.04em; }
.primary:not(.compact),
.secondary:not(.compact),
.context-help-button:not(.compact),
.stage-help-button,
.marketing-impact-help-button,
.business-intelligence-help-button {
  font-size: 13px;
  line-height: 1.1;
  min-height: 40px;
  padding: 10px 14px;
}
.page-heading-actions > button:not(.compact) { height: 40px; min-height: 40px; padding: 9px 14px; }
.context-help-button span,
.stage-help-button span,
.marketing-impact-help-button span,
.business-intelligence-help-button span,
.dialog-help-button span {
  flex: 0 0 auto;
  height: 20px;
  width: 20px;
}
.dialog-heading-actions { align-items: center; display: flex; flex: 0 0 auto; gap: 8px; }
.dialog-help-button { align-items: center; background: var(--ink); border-color: var(--ink); color: white; display: inline-flex; gap: 7px; min-height: 36px; }
.dialog-help-button span { align-items: center; border: 1px solid rgba(255, 255, 255, .72); border-radius: 50%; display: inline-flex; font-size: 10px; justify-content: center; }
.dialog-help-button:hover { background: var(--red); border-color: var(--red); }
.dialog-context-help { background: var(--soft); border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: 12px; display: grid; gap: 1px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: -4px 0 22px; overflow: hidden; }
.dialog-context-help > div { background: white; padding: 14px 16px; }
.dialog-context-help strong { display: block; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
.dialog-context-help p { color: var(--muted); font-size: 11px; line-height: 1.45; margin: 6px 0 0; }
.stage-help-button,
.marketing-impact-help-button,
.business-intelligence-help-button { background: var(--ink); border-color: var(--ink); }
.stage-help-button span { background: transparent; border: 1px solid rgba(255, 255, 255, .72); color: white; }
.screen-help-dialog { overflow-y: auto; width: min(1040px, calc(100vw - 30px)); }
.screen-help-dialog > div { padding: 28px; }
.screen-help-dialog section + section { margin-top: 22px; }
.screen-help-intro { background: var(--ink); border-left: 4px solid var(--red); border-radius: 12px; color: white; padding: 18px 20px; }
.screen-help-intro strong { display: block; font-size: 16px; line-height: 1.4; }
.screen-help-intro p { color: #d2d2d2; font-size: 12px; line-height: 1.5; margin: 8px 0 0; }
.screen-help-grid { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.screen-help-grid article { background: var(--soft); border: 1px solid var(--line); border-radius: 12px; min-height: 180px; padding: 18px; }
.screen-help-grid article > span { color: var(--red); font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.screen-help-grid h3 { font-size: 16px; margin: 12px 0 8px; }
.screen-help-grid p, .screen-help-decision p, .screen-help-examples p { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0; }
.screen-help-grid article > strong { display: block; font-size: 11px; margin-top: 12px; }
.screen-help-decision > h3, .screen-help-examples > h3 { font-size: 15px; margin: 0 0 12px; }
.screen-help-decision > div, .screen-help-examples > div { border: 1px solid var(--line); border-radius: 12px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: hidden; }
.screen-help-decision article, .screen-help-examples article { background: white; padding: 16px 18px; }
.screen-help-decision article + article, .screen-help-examples article + article { border-left: 1px solid var(--line); }
.screen-help-decision b, .screen-help-examples strong { display: block; font-size: 12px; margin-bottom: 7px; }
.screen-help-examples > p { border-left: 3px solid var(--red); margin-top: 12px; padding-left: 11px; }
.screen-help-document { border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; margin: 24px 0 0; padding-top: 16px; }
.fact, .compact-form, .contact-row { border: 1px solid var(--line); border-radius: 10px; }
#toast { border-radius: 10px; z-index: 50; }

@media (max-width: 1280px) and (min-width: 761px) {
  .account-filters, .user-filters, .web-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-filters label:first-child, .user-filters label:first-child, .web-filters label:first-child { grid-column: 1 / -1; }
  .filter-count { justify-content: center; }
  .web-submission-row { grid-template-columns: 1fr 150px; }
  .web-submission-row > :nth-child(3), .web-submission-row > :nth-child(4), .web-submission-row > :nth-child(5) { display: none; }
}

@media (max-width: 760px) {
  .topbar { height: 70px; padding: 0 16px; }
  .brand img { height: 31px; }
  .brand span { font-size: 9px; padding-left: 9px; }
  .shell { min-height: calc(100vh - 70px); }
  .sidebar { top: 70px; gap: 7px; padding: 9px; border-bottom: 1px solid #282828; }
  .nav-button { padding: 9px 12px; }
  main { padding: 24px 14px; }
  .page-heading { align-items: stretch; }
  .page-heading > button { width: 100%; }
  .page-heading-actions { display: grid; justify-content: stretch; width: 100%; }
  .page-heading-actions button { justify-content: center; width: 100%; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .account-filters, .user-filters, .web-filters { grid-template-columns: 1fr; }
  .web-submission-row { grid-template-columns: 1fr; }
  .web-submission-row > :nth-child(3), .web-submission-row > :nth-child(4), .web-submission-row > :nth-child(5) { display: none; }
  .kpi-grid article { min-height: 112px; }
  dialog form, .detail-dialog > div { padding: 21px; }
  .stage-guide-dialog > div { padding: 21px; }
  .record-reuse-help-dialog > div { padding: 21px; }
  .record-reuse-grid, .record-reuse-scope > div { grid-template-columns: 1fr; }
  .screen-help-dialog > div { padding: 21px; }
  .screen-help-grid, .screen-help-decision > div, .screen-help-examples > div { grid-template-columns: 1fr; }
  .screen-help-grid article { min-height: 0; }
  .screen-help-decision article + article, .screen-help-examples article + article { border-left: 0; border-top: 1px solid var(--line); }
  .marketing-impact-help-dialog > div { padding: 21px; }
  .marketing-help-section-heading { align-items: flex-start; display: grid; gap: 6px; }
  .marketing-help-flow, .marketing-help-decision-grid, .marketing-help-field-grid, .marketing-help-examples, .marketing-help-routine ol { grid-template-columns: 1fr; }
  .marketing-help-flow li { min-height: 0; }
  .marketing-help-flow li:not(:last-child)::after { content: "↓"; left: 50%; right: auto; top: calc(100% - 3px); }
  .marketing-help-kpi-list div { gap: 5px; grid-template-columns: 1fr; }
  .business-intelligence-help-dialog > div { padding: 21px; }
  .business-intelligence-help-section-heading { align-items: flex-start; display: grid; gap: 6px; }
  .business-intelligence-concepts, .business-intelligence-status-grid, .business-intelligence-examples, .business-intelligence-review-flow { grid-template-columns: 1fr; }
  .business-intelligence-review-flow li:not(:last-child)::after { content: "↓"; left: 50%; right: auto; top: calc(100% - 3px); }
  .dialog-heading { gap: 12px; }
  .dialog-heading-actions { align-items: flex-end; flex-direction: column-reverse; }
  .dialog-context-help { grid-template-columns: 1fr; }
  .dialog-context-help > div { padding: 13px 14px; }
  .stage-guide-banner { align-items: flex-start; display: grid; gap: 18px; padding: 19px; }
  .stage-guide-summary { min-width: 0; }
  .stage-guide-grid { grid-template-columns: 1fr; }
  .stage-guide-grid article { min-height: 0; padding: 18px 19px; }
  .stage-guide-grid article:nth-child(odd) { border-right: 0; }
  .stage-guide-footer { grid-template-columns: 1fr; }
  .dialog-actions { align-items: stretch; flex-direction: column-reverse; }
  .dialog-actions button { width: 100%; }
}

@media (max-width: 430px) {
  .auth-card { padding: 30px 24px; }
  .auth-brand img { height: 36px; }
  .auth-brand span { font-size: 9px; padding-left: 9px; }
  .kpi-grid strong { font-size: 24px; }
  .work-item { display: grid; }
  .funnel-stage-name { font-size: 10px; letter-spacing: .02em; }
  .funnel-stage-count { font-size: 9px; }
  .funnel-stage-value { font-size: 12px; }
  .marketing-impact-kpis { grid-template-columns: 1fr; }
  .business-intelligence-kpis { grid-template-columns: 1fr; }
}

/* Código visual compartido para cada estado del proceso comercial. */
.stage-tone-navy { --stage-color: #16213e; --stage-text: #ffffff; }
.stage-tone-petrol { --stage-color: #244c5a; --stage-text: #ffffff; }
.stage-tone-teal { --stage-color: #2f7f88; --stage-text: #ffffff; }
.stage-tone-vermilion { --stage-color: #cf4318; --stage-text: #ffffff; }
.stage-tone-orange { --stage-color: #ef6419; --stage-text: #1a1a1a; }
.stage-tone-amber { --stage-color: #f39a0a; --stage-text: #1a1a1a; }
.stage-tone-yellow { --stage-color: #ffc20a; --stage-text: #1a1a1a; }
.stage-tone-lost { --stage-color: #c81e2a; --stage-text: #ffffff; }
.stage-tone-paused { --stage-color: #6b7280; --stage-text: #ffffff; }
.stage-tone-neutral { --stage-color: #eeeeee; --stage-text: #1a1a1a; }
.badge.stage-badge {
  background: var(--stage-color);
  border-color: var(--stage-color);
  color: var(--stage-text);
  font-weight: 850;
}
select.stage-status-control {
  background-color: var(--stage-color);
  border-color: var(--stage-color);
  color: var(--stage-text);
  font-weight: 850;
}
select.stage-status-control option { background: white; color: var(--ink); }
