:root {
    --flex365-navy: #1B3A6B;
    --flex365-navy-dark: #14294f;
    --flex365-teal: #16b892;
    --flex365-teal-dark: #129c7d;
    --flex365-red: #dc3545;
    --flex365-orange: #f97316;
    --border: #e2e5ea;
    --text-muted: #6b7688;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: #f4f6f9;
    color: #1f2937;
}

a { color: var(--flex365-teal-dark); }

/* ── Login / Activar (páginas sin sesión) ───────────────────────── */
/* Referencia: pantalla de login de My Nutanix -- fondo gris claro con un
   corte diagonal blanco abajo, marca arriba de la tarjeta (no adentro),
   tarjeta blanca angosta y plana (sombra sutil, no la navy oscura que
   tenía antes). */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f4f5f7;
    padding: 24px;
    position: relative;
    overflow: hidden;
}
.auth-page::before {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 45%;
    background: #fff;
    clip-path: polygon(0 100%, 100% 55%, 100% 100%);
    z-index: 0;
}
.auth-brand-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    position: relative;
    z-index: 1;
}
.auth-brand-row .brand-mark {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: .5px;
    color: var(--flex365-navy);
}
.auth-brand-row .brand-sep {
    width: 1px;
    height: 18px;
    background: var(--border);
}
.auth-brand-row .brand-product {
    font-size: 18px;
    color: #374151;
}
.auth-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 4px 16px rgba(16,24,40,0.08);
    position: relative;
    z-index: 1;
}
.auth-title {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 24px;
}
.auth-link-row {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 20px;
}
.auth-footer {
    position: relative;
    z-index: 1;
    margin-top: 60px;
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}
.auth-footer-label { font-weight: 700; color: #374151; margin-right: 4px; }
.auth-footer-dot { color: var(--border); }
.auth-footer a { color: var(--text-muted); text-decoration: underline; }
.auth-footer a:hover { color: var(--flex365-teal-dark); }
.form-label { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; font-weight: 600; margin: 14px 0 6px; color: #374151; }
.form-label-hint { font-size: 11px; font-weight: 400; color: var(--text-muted); }
.form-control, textarea.form-control, select.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}
.form-control:focus, textarea.form-control:focus, select.form-control:focus {
    outline: none;
    border-color: var(--flex365-teal);
    box-shadow: 0 0 0 3px rgba(22, 184, 146, .18);
}
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-control-short { max-width: 220px; }

.dp-form-row { display: flex; gap: 16px; align-items: flex-start; }
.dp-form-row > div:first-child { flex: 0 0 220px; }
.dp-form-row > div:last-child { flex: 1; min-width: 0; }
@media (max-width: 640px) {
    .dp-form-row { flex-direction: column; }
    .dp-form-row > div:first-child { flex-basis: auto; width: 100%; }
}

.dp-form-row-4 > div { flex: 1; min-width: 0; }
@media (max-width: 900px) {
    .dp-form-row-4 { flex-wrap: wrap; }
    .dp-form-row-4 > div { flex: 1 1 45%; }
}
@media (max-width: 640px) {
    .dp-form-row-4 { flex-direction: column; }
    .dp-form-row-4 > div { width: 100%; }
}

.dp-search-results {
    position: relative;
    margin-top: 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .08);
}
.dp-search-result-item {
    padding: 9px 12px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}
.dp-search-result-item:last-child { border-bottom: none; }
.dp-search-result-item:hover { background: #f8f9fb; }
.dp-search-result-empty { color: var(--text-muted); cursor: default; }
.dp-search-result-empty:hover { background: none; }

.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}
.btn-primary { background: var(--flex365-teal); color: #fff; }
.btn-primary:hover { background: var(--flex365-teal-dark); }
.btn-secondary { background: #f1f3f5; color: #374151; }
.btn-block { width: 100%; text-align: center; margin-top: 20px; }
.btn:disabled { opacity: 0.7; cursor: not-allowed; }

/* Spinner inline para botones en estado "procesando" -- ver
   btn-loading-text/btn-loading-spinner, usado en formularios cuyo submit
   real (ej. crear cliente) puede tardar unos segundos (deploy automático). */
.btn-spinner {
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: -2px;
    animation: dp-spin 0.7s linear infinite;
}
@keyframes dp-spin { to { transform: rotate(360deg); } }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-error { background: #fdecea; color: #a1372c; }
.alert-success { background: #e6f7f1; color: #0f7a5f; }
.alert-warning { background: #fff3e0; color: #9a5b00; }
.alert-info { background: #eef1f5; color: var(--flex365-navy); }

/* ── Layout autenticado -- topbar oscura, referencia: My Nutanix ──── */
.dp-topbar {
    background: #14161a;
    color: #fff;
    padding: 0 28px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.dp-topbar-brand { font-weight: 800; font-size: 16px; letter-spacing: .3px; }
.dp-topbar-brand-sep { color: #4b5563; font-weight: 400; margin: 0 4px; }
.dp-topbar-right { display: flex; align-items: center; gap: 22px; }
.dp-topbar-link { color: #cbd5e1; font-size: 13px; text-decoration: none; }
.dp-topbar-link:hover { color: #fff; }

.dp-topbar-user-menu { position: relative; }
.dp-topbar-user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    color: #e5e7eb;
    font-size: 13px;
    cursor: pointer;
    padding: 6px 4px;
}
.dp-topbar-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--flex365-teal);
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dp-topbar-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: #1c1f26;
    border: 1px solid #2c313a;
    border-radius: 8px;
    min-width: 220px;
    padding: 8px 0;
    box-shadow: 0 12px 28px rgba(0,0,0,0.35);
    z-index: 20;
}
.dp-topbar-user-menu.is-open .dp-topbar-dropdown { display: block; }
.dp-topbar-dropdown-email {
    padding: 6px 16px 10px;
    font-size: 12px;
    color: #9aa1ab;
    word-break: break-all;
}
.dp-topbar-dropdown-divider { height: 1px; background: #2c313a; margin: 6px 0; }
.dp-topbar-dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 9px 16px;
    font-size: 13px;
    color: #e5e7eb;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
}
a.dp-topbar-dropdown-item:hover { background: #262b34; }
.dp-topbar-dropdown-item-disabled { color: #6b7280; cursor: default; }
.dp-topbar-dropdown-item-btn { font-family: inherit; }
.dp-topbar-dropdown-item-btn:hover { background: #262b34; }

.dp-content { max-width: 1100px; margin: 0 auto; padding: 28px 20px; }

.dp-cxp-banner {
    background: #fff3e0;
    color: #9a5b00;
    text-align: center;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
}
.dp-cxp-banner a { color: #9a5b00; text-decoration: underline; }

.dp-page-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.dp-page-subtitle { color: var(--text-muted); font-size: 14px; margin: 0 0 20px; }

.dp-panel {
    background: #fff;
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 1px 4px rgba(16,24,40,0.06);
    margin-bottom: 20px;
}

table.dp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.dp-table th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--text-muted);
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
}
table.dp-table td { padding: 10px; border-bottom: 1px solid #f0f1f3; }
table.dp-table tr:last-child td { border-bottom: none; }

.dp-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.dp-badge-demo { background: #fff3e0; color: #b45309; }
.dp-badge-active { background: #e6f7f1; color: #0f7a5f; }
.dp-badge-inactive { background: #fdecea; color: #a1372c; }

.dp-empty { text-align: center; padding: 40px 0; color: var(--text-muted); }

/* ── Filtros de /clientes: búsqueda + selects sobre la tabla ────────── */
.dp-filter-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 12px; align-items: end; }
.dp-filter-row label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.dp-filter-row .form-control { padding: 8px 10px; font-size: 13px; }
.dp-filter-clear { font-size: 13px; color: var(--text-muted); text-decoration: underline; white-space: nowrap; padding-bottom: 10px; }
@media (max-width: 900px) {
    .dp-filter-row { grid-template-columns: 1fr 1fr; }
    .dp-filter-clear { grid-column: 1 / -1; text-align: right; }
}

/* ── KPIs de /clientes: "de un vistazo" arriba de la tabla ─────────
   Color = estado (bueno/alerta/crítico), no identidad -- por eso un tile
   sin nada que reportar (0 por vencer, 0 sin actividad) se queda neutro en
   vez de pintarse de rojo/naranja por defecto. */
.dp-kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.dp-kpi-tile {
    background: #fff;
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: 0 1px 4px rgba(16,24,40,0.06);
    border-left: 3px solid var(--border);
}
.dp-kpi-value { font-size: 28px; font-weight: 600; line-height: 1.1; color: #1f2937; }
.dp-kpi-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.dp-kpi-tile-warning { border-left-color: var(--flex365-orange); }
.dp-kpi-tile-warning .dp-kpi-value { color: var(--flex365-orange); }
.dp-kpi-tile-critical { border-left-color: var(--flex365-red); }
.dp-kpi-tile-critical .dp-kpi-value { color: var(--flex365-red); }
.dp-kpi-tile-info { border-left-color: var(--flex365-teal); }
.dp-kpi-tile-info .dp-kpi-value { color: var(--flex365-teal-dark); }
@media (max-width: 720px) { .dp-kpi-row { grid-template-columns: repeat(2, 1fr); } }

/* ── Columna "Vence" de /clientes: fecha + nota de urgencia debajo ── */
.dp-venc-date-porvencer { color: var(--flex365-orange); font-weight: 600; }
.dp-venc-date-vencido { color: var(--flex365-red); font-weight: 600; }
.dp-venc-note { font-size: 12px; margin-top: 2px; }
.dp-venc-note-porvencer { color: var(--flex365-orange); }
.dp-venc-note-vencido { color: var(--flex365-red); }

.dp-checkbox-row { display: flex; align-items: center; gap: 8px; margin: 14px 0; }
.dp-checkbox-row label { font-size: 14px; font-weight: 600; margin: 0; }

.dp-metric-value { font-size: 32px; font-weight: 800; color: var(--flex365-navy); }
.dp-metric-label { font-size: 13px; color: var(--text-muted); }

/* ── Dashboard de tiles (Home) -- referencia visual: My Nutanix ───── */
.dp-dash-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--flex365-navy);
    text-transform: uppercase;
    letter-spacing: .4px;
    margin: 28px 0 14px;
}
.dp-dash-section-title:first-of-type { margin-top: 8px; }
.dp-dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
    margin-bottom: 8px;
}
.dp-dash-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 178px;
    transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
.dp-dash-card:not(.dp-dash-card-soon):hover {
    box-shadow: 0 8px 20px rgba(16,24,40,0.08);
    transform: translateY(-2px);
    border-color: #d7dbe2;
}
.dp-dash-card-soon { background: #fafbfc; }
.dp-dash-card-soon .dp-dash-card-icon { background: #eef0f3; color: #9aa1ab; }
.dp-dash-card-soon .dp-dash-card-title { color: #6b7280; }
.dp-dash-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 9px;
    background: rgba(22, 184, 146, 0.12);
    color: var(--flex365-teal-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}
.dp-dash-card-icon svg { width: 20px; height: 20px; }
.dp-dash-card-title { font-size: 15px; font-weight: 700; color: #111827; margin-bottom: 8px; }
.dp-dash-card-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; flex: 1; margin-bottom: 16px; }
.dp-dash-card-btn {
    display: block;
    text-align: center;
    padding: 9px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}
.dp-dash-card-btn-disabled {
    background: #eef0f3;
    color: #9aa1ab;
    cursor: default;
}

/* ── KPIs + charts (Deal Registration) -- todo calculado server-side,
   sin librería JS externa: donut con conic-gradient, barras con flex. ── */
.dp-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.dp-kpi-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
}
.dp-kpi-value { font-size: 26px; font-weight: 800; color: var(--flex365-navy); line-height: 1.2; }
.dp-kpi-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.dp-charts-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    margin-bottom: 20px;
}
@media (max-width: 720px) {
    .dp-charts-row { grid-template-columns: 1fr; }
}

.dp-donut-wrap { display: flex; align-items: center; gap: 20px; }
.dp-donut {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dp-donut-legend { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.dp-donut-legend-item { display: flex; align-items: center; gap: 8px; color: #374151; }
.dp-donut-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dp-donut-legend-count { color: var(--text-muted); margin-left: auto; padding-left: 12px; }

/* Embudo de la oportunidad -- mismo criterio que .sercop-funnel en
   F365.ClientApp: cono continuo hecho de bandas apiladas sin espacio, cada
   una recortada con clip-path para que el borde inferior de una calce con
   el superior de la siguiente. El texto vive aparte, en .dp-funnel-stages,
   para que nunca se corte dentro de una banda angosta (p.ej. "Ganada" con
   pocos casos); el cono solo comunica la proporción visualmente y, al
   pasar el mouse, el title nativo confirma el valor exacto. Los % de
   conversión entre etapas flotan en el pasillo entre el cono y el texto. */
.dp-funnel-subtitle { font-size: 13px; color: var(--text-muted); margin: 0 0 16px; }

.dp-funnel {
    display: flex;
    align-items: stretch;
    gap: 36px;
    margin-top: 4px;
}

.dp-funnel-col {
    position: relative;
    width: 220px;
    flex: none;
    display: flex;
    flex-direction: column;
    filter: drop-shadow(0 3px 6px rgba(16,24,40,0.12));
}

.dp-funnel-col::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 100%;
    margin-left: 18px;
    border-left: 1px dashed #e5e7eb;
}

.dp-funnel-band {
    height: 74px;
    box-shadow: inset 0 -2px 0 rgba(255,255,255,.55);
    transition: filter .15s ease;
}

.dp-funnel-band:last-child { box-shadow: none; }
.dp-funnel-band:hover { filter: brightness(1.06); }

.dp-funnel-empty-note {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 30px;
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,.15);
    pointer-events: none;
}

.dp-funnel-conversion {
    position: absolute;
    left: 100%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 11.5px;
    font-weight: 700;
    color: #4b5563;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 1px 3px rgba(16,24,40,0.08);
}

.dp-funnel-conversion-arrow { color: #9ca3af; }

.dp-funnel-stages {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.dp-funnel-stage {
    height: 74px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-bottom: 1px solid #f3f4f6;
}

.dp-funnel-stage:last-child { border-bottom: none; }

.dp-funnel-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; margin-top: 6px; }

.dp-funnel-stage-text { flex: 1; min-width: 0; }

.dp-funnel-stage-head { display: flex; align-items: baseline; gap: 8px; }

.dp-funnel-stage-label { font-size: 14px; font-weight: 700; color: #111827; }

.dp-funnel-stage-count {
    margin-left: auto;
    font-size: 19px;
    font-weight: 800;
    color: #111827;
    font-variant-numeric: tabular-nums;
}

.dp-funnel-stage-desc { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; line-height: 1.4; }

.dp-funnel-lost {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px dashed #e5e7eb;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
    font-size: 13px;
    color: var(--text-muted);
}

.dp-funnel-lost span { display: inline-flex; align-items: center; gap: 8px; }

@media (max-width: 720px) {
    .dp-funnel { flex-direction: column; gap: 28px; }
    .dp-funnel-col { width: 100%; filter: none; }
    .dp-funnel-col::after { display: none; }
    .dp-funnel-conversion { left: 50%; transform: translate(-50%, -50%); }
}

.dp-bars {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 130px;
    padding-top: 10px;
}
.dp-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.dp-bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.dp-bar {
    width: 60%;
    min-height: 3px;
    background: var(--flex365-teal);
    border-radius: 4px 4px 0 0;
}
.dp-bar-count { font-size: 11px; font-weight: 700; color: #374151; margin-bottom: 4px; }

/* ── Modal genérico (hoy solo lo usa la Calculadora de Precios) ────── */
.dp-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.dp-modal-overlay.is-open { display: flex; }
.dp-modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.dp-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.dp-modal-header h3 { margin: 0; font-size: 16px; color: var(--flex365-navy); }
.dp-modal-close {
    border: none;
    background: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
}
.dp-modal-tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 20px; }
.dp-modal-tab {
    border: none;
    background: none;
    padding: 12px 4px;
    margin-right: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}
.dp-modal-tab.is-active { color: var(--flex365-navy); border-bottom-color: var(--flex365-teal); }
.dp-modal-body { padding: 20px; }
.dp-modal-panel { display: none; }
.dp-modal-panel.is-active { display: block; }

.dp-calc-result { margin-top: 20px; padding: 16px; background: #f8f9fb; border-radius: 8px; }
.dp-calc-total { font-size: 24px; font-weight: 800; color: var(--flex365-navy); }
.dp-calc-total span { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.dp-calc-breakdown { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.dp-calc-empty { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.dp-bar-label { font-size: 11px; color: var(--text-muted); margin-top: 6px; text-transform: uppercase; }
