/* =======================================================================
   ANEXA Consultores · Sistema de agentes
   Paleta de marcador de posición (sustituir por la marca real de ANEXA
   cuando se facilite el manual/branding oficial). Un solo tono para
   magnitudes secuenciales (progreso), colores de estado reservados para
   hitos alcanzados, nunca reutilizados como "serie adicional".
   ======================================================================= */

:root {
    /* Marca real ANEXA Consultores: azul CMYK 98/87/46/12 (#041D79) como
       color principal, naranja CMYK 0/60/100/0 (#FF6600) como acento —
       misma pareja que ya usa la landing de anexaconsultores.es. */
    --anexa-primary-900: #031761;
    --anexa-primary-700: #041D79;
    --anexa-primary-500: #43569B;
    --anexa-primary-300: #8E99C3;
    --anexa-primary-100: #E1E4EF;

    --anexa-accent: #FF6600;
    --anexa-accent-ink: #CC5200;

    --anexa-ink: #23262b;
    --anexa-ink-muted: #5b6470;
    --anexa-surface: #ffffff;
    --anexa-surface-alt: #f7f5f4;
    --anexa-border: #e3dfdd;

    --anexa-status-good: #1f7a4d;
    --anexa-status-warning: #b6790a;
    --anexa-status-critical: #b3261e;

    --anexa-radius: 10px;
    --anexa-shadow: 0 1px 2px rgba(35, 38, 43, .06), 0 4px 16px rgba(35, 38, 43, .06);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --anexa-ink: #f2eeec;
        --anexa-ink-muted: #b7bcc2;
        --anexa-surface: #17181a;
        --anexa-surface-alt: #1f2124;
        --anexa-border: #33363a;
        --anexa-primary-100: #14204f;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--anexa-surface-alt);
    color: var(--anexa-ink);
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

a { color: var(--anexa-primary-700); }

.anexa-topbar {
    background: var(--anexa-primary-900);
    color: #fff;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.anexa-topbar .marca {
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    font-size: 14px;
}

.anexa-topbar .marca small {
    display: block;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--anexa-primary-300);
    font-size: 11px;
}

.anexa-topbar nav a {
    color: #fff;
    text-decoration: none;
    margin-left: 18px;
    font-size: 14px;
    opacity: .9;
}
.anexa-topbar nav a:hover { opacity: 1; text-decoration: underline; }

.anexa-contenedor {
    max-width: 1080px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}

.anexa-tarjeta {
    background: var(--anexa-surface);
    border: 1px solid var(--anexa-border);
    border-radius: var(--anexa-radius);
    box-shadow: var(--anexa-shadow);
    padding: 22px;
    margin-bottom: 20px;
}

.anexa-tarjeta h2 {
    margin-top: 0;
    font-size: 17px;
}

.anexa-login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--anexa-primary-900), var(--anexa-primary-700));
    padding: 20px;
}

.anexa-login-caja {
    background: var(--anexa-surface);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    padding: 36px 32px;
    width: 100%;
    max-width: 380px;
}

.anexa-login-caja h1 {
    font-size: 18px;
    text-align: center;
    margin-bottom: 4px;
}
.anexa-login-caja p.subtitulo {
    text-align: center;
    color: var(--anexa-ink-muted);
    font-size: 13px;
    margin-top: 0;
    margin-bottom: 24px;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--anexa-ink-muted);
}

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--anexa-border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--anexa-surface);
    color: var(--anexa-ink);
    margin-bottom: 16px;
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--anexa-primary-500);
    outline-offset: 1px;
}

.anexa-btn {
    display: inline-block;
    background: var(--anexa-accent);
    color: #fff;
    border: none;
    padding: 11px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}
.anexa-btn:hover { background: var(--anexa-accent-ink); }
.anexa-btn.secundario {
    background: transparent;
    color: var(--anexa-primary-700);
    border: 1px solid var(--anexa-primary-700);
}
.anexa-btn.ancho { width: 100%; }

.anexa-error {
    background: #fdecea;
    color: var(--anexa-status-critical);
    border: 1px solid #f5c2bd;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}
.anexa-ok {
    background: #e9f7ef;
    color: var(--anexa-status-good);
    border: 1px solid #bfe6cf;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

table.anexa-tabla {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 4px;
    font-size: 13px;
}
table.anexa-tabla th {
    text-align: left;
    color: var(--anexa-ink-muted);
    font-weight: 600;
    padding: 6px 10px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .03em;
}
table.anexa-tabla td {
    background: var(--anexa-surface-alt);
    padding: 10px 10px;
    vertical-align: middle;
}
table.anexa-tabla tr td:first-child { border-radius: 8px 0 0 8px; }
table.anexa-tabla tr td:last-child { border-radius: 0 8px 8px 0; }

.anexa-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.anexa-badge.tramo-1 { background: var(--anexa-primary-100); color: var(--anexa-primary-700); }
.anexa-badge.tramo-2 { background: #fbe8d3; color: var(--anexa-status-warning); }
.anexa-badge.tramo-3 { background: #dcf0e4; color: var(--anexa-status-good); }

/* ---- Línea de progreso (meter) de dos magnitudes ---- */
.anexa-progreso {
    position: relative;
    margin: 18px 0 8px;
    cursor: pointer;
}
.anexa-progreso .pista {
    position: relative;
    height: 14px;
    background: var(--anexa-surface-alt);
    border: 1px solid var(--anexa-border);
    border-radius: 999px;
    overflow: hidden;
}
.anexa-progreso .relleno-facturacion {
    position: absolute;
    inset: 0;
    width: 0%;
    background: var(--anexa-primary-300);
    border-radius: 999px;
}
.anexa-progreso .relleno-honorarios {
    position: absolute;
    inset: 0;
    width: 0%;
    background: var(--anexa-primary-700);
    border-radius: 999px;
    box-shadow: inset 0 0 0 2px var(--anexa-surface);
}
.anexa-progreso .meta {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 2px;
    background: var(--anexa-ink-muted);
    opacity: .5;
}
.anexa-progreso .meta-label {
    position: absolute;
    top: 18px;
    font-size: 11px;
    color: var(--anexa-ink-muted);
    transform: translateX(-50%);
    white-space: nowrap;
}
.anexa-leyenda-progreso {
    display: flex;
    gap: 18px;
    font-size: 12px;
    color: var(--anexa-ink-muted);
    margin-top: 26px;
}
.anexa-leyenda-progreso .punto {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 5px;
}
.punto.honorarios { background: var(--anexa-primary-700); }
.punto.facturacion { background: var(--anexa-primary-300); }
.punto.profit { background: var(--anexa-status-good); }

.anexa-progreso-simple .pista { height: 10px; }
.anexa-progreso-simple .relleno-profit {
    position: absolute;
    inset: 0;
    width: 0%;
    background: var(--anexa-status-good);
    border-radius: 999px;
}

.anexa-desglose {
    display: none;
    margin-top: 14px;
    border-top: 1px dashed var(--anexa-border);
    padding-top: 12px;
}
.anexa-desglose.abierto { display: block; }

.anexa-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 720px) { .anexa-grid-2 { grid-template-columns: 1fr; } }

.anexa-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}
.anexa-switch input { opacity: 0; width: 0; height: 0; }
.anexa-switch .slider {
    position: absolute; inset: 0;
    background: var(--anexa-border);
    border-radius: 999px;
    transition: .15s;
}
.anexa-switch .slider::before {
    content: "";
    position: absolute;
    height: 16px; width: 16px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: .15s;
}
.anexa-switch input:checked + .slider { background: var(--anexa-status-good); }
.anexa-switch input:checked + .slider::before { transform: translateX(18px); }

.anexa-muted { color: var(--anexa-ink-muted); font-size: 13px; }
.anexa-flex-entre { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.anexa-stack { display: flex; flex-direction: column; gap: 4px; }

/* ---- Alta de operación: bloques de agente con tareas marcables ---- */
.anexa-agente-bloque {
    background: var(--anexa-surface-alt);
    padding: 16px;
}

.anexa-tarea-grupo-titulo {
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--anexa-ink-muted);
    margin: 16px 0 4px;
}
.anexa-tarea-grupo-titulo:first-of-type { margin-top: 6px; }

.anexa-tarea-fila {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 14px;
    padding: 8px 0;
    border-bottom: 1px solid var(--anexa-border);
}
.anexa-tarea-fila:last-child { border-bottom: none; }

.anexa-check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 400;
    color: var(--anexa-ink);
    margin-bottom: 0;
    cursor: pointer;
    flex: 1 1 auto;
    min-width: 0;
}
.anexa-check span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.anexa-check input[type=checkbox] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--anexa-primary-700);
}

.anexa-tarea-detalle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
    white-space: nowrap;
    flex: 0 0 auto;
}
.anexa-tarea-detalle .pct-tarea { color: var(--anexa-ink-muted); }
.anexa-tarea-detalle .importe-tarea {
    font-weight: 700;
    min-width: 78px;
    text-align: right;
}
.anexa-link-ajuste {
    background: none;
    border: none;
    color: var(--anexa-primary-700);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.anexa-tarea-ajuste {
    display: flex;
    gap: 10px;
    width: 100%;
    margin: 2px 0 6px;
}
.anexa-tarea-ajuste input { flex: 1; min-width: 0; margin-bottom: 0; }
@media (max-width: 560px) { .anexa-tarea-ajuste { flex-direction: column; } }

.badge-tramo-agente { flex-shrink: 0; }

.anexa-col-nowrap { white-space: nowrap; }

/* ---- Mi red de agentes (diagrama de referidos, panel del agente) ---- */
.red-scroll {
    overflow-x: auto;
    padding-bottom: 4px;
}
.red-diagrama {
    position: relative;
    display: flex;
    align-items: center;
    gap: 108px;
    padding: 26px 14px;
    min-width: max-content;
}
.red-svg {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    overflow: visible;
    color: var(--anexa-primary-300);
}
.red-columna {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 40px;
    min-width: 132px;
    position: relative;
    z-index: 1;
}
.red-columna-raiz { min-width: 88px; }
.red-nodo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
}
.red-icono {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--anexa-primary-100);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.red-icono svg { stroke: var(--anexa-primary-700); }
.red-nodo-raiz .red-icono {
    width: 54px;
    height: 54px;
    background: var(--anexa-primary-700);
}
.red-nodo-raiz .red-icono svg { stroke: #fff; }
.red-nombre {
    font-size: 12.5px;
    font-weight: 600;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.red-nodo-raiz .red-nombre { font-weight: 700; }

.red-etiqueta {
    position: absolute;
    transform: translate(-50%, -50%);
    background: var(--anexa-surface);
    border: 1px solid var(--anexa-border);
    border-radius: 8px;
    padding: 3px 8px;
    font-size: 10.5px;
    line-height: 1.4;
    color: var(--anexa-ink-muted);
    white-space: nowrap;
    text-align: center;
    z-index: 2;
    pointer-events: none;
}
.red-etiqueta strong { color: var(--anexa-ink); font-weight: 700; }
