/*
 * Gestor de Leads: hoja de estilos única (sin build).
 *
 * Orden: 1) tokens  2) base  3) layout  4) componentes  5) pantallas  6) utilidades.
 * Toda la identidad visual (colores, tipografía, radios) vive en los tokens de :root.
 * Marca: Agencia Canoa (azul #104285 / #193D70, naranja #F08013, Plus Jakarta Sans en títulos,
 * marca y botones; fuente del sistema en cuerpo y formularios, por densidad).
 * El modo oscuro se define dos veces con los mismos valores: por preferencia del sistema
 * y forzado con <html data-theme="dark">. <html data-theme="light"> fuerza el claro.
 */

/* 1) Tokens ------------------------------------------------------------ */
/* Font de marca (Agencia Canoa): Plus Jakarta Sans, self-host, variable 400–700 (OFL). */
@font-face {
    font-family: "Plus Jakarta Sans";
    src: url("../fonts/plus-jakarta-sans-latin.woff2") format("woff2");
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Plus Jakarta Sans";
    src: url("../fonts/plus-jakarta-sans-latin-ext.woff2") format("woff2");
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/*
 * Paleta Agencia Canoa (guía de marca: logo y sitio agenciacanoa.com.ar).
 * Azul (#104285 logo / #193D70 sitio) = interacción y estructura (sidebar, botones, links).
 * Naranja (#F08013 logo) = segundo color: CTA del agente, resultado elegido, altas, progreso.
 * Sobre naranja el texto es siempre marino (--on-accent-2), nunca blanco (2.69:1).
 * En claro el naranja de relleno es #E06F00 (logo -6 %) para llegar a 3:1 contra blanco.
 */
:root {
    --bg: #f4f5f8;
    --surface: #ffffff;
    --surface-2: #f7f8fb;
    --border: #dfe3ea;
    --border-strong: #7f889c;
    --text: #1a2233;
    --muted: #5e6778;
    --accent: #104285;
    --accent-strong: #193d70;
    --accent-soft: #e6edf7;
    --on-accent: #ffffff;
    --accent-fill: #104285;
    --accent-fill-hover: #193d70;
    --accent-2: #e06f00;
    --accent-2-hover: #f08013;
    --accent-2-strong: #a34f00;
    --accent-2-soft: #fdeedd;
    --on-accent-2: #0b1426;
    --brand-orange: #f08013;
    --danger: #b3261e;
    --danger-soft: #fbe9e7;
    --warn: #7a5c00;
    --warn-soft: #fff6d1;
    --info: #5a3e8e;
    --info-soft: #eeeaf7;
    --upgrade: #6a2fb8;
    --upgrade-soft: #f1e9fc;
    --focus: #104285;
    --overlay: rgba(10, 16, 32, .45);

    /* Sidebar (y barra móvil): azul marino de Canoa con texto claro */
    --sb-bg: #193d70;
    --sb-surface: #12305a;
    --sb-hover: #1f4779;
    --sb-active: #24528f;
    --sb-text: #eef2f9;
    --sb-active-text: #ffffff;
    --sb-muted: #afc0dc;
    --sb-border: #2a5086;
    --sb-border-strong: #7f97c0;
    --sb-link: #bfd3f5;
    --sb-focus: #ffb066;

    --logo-on-light: block;
    --logo-on-dark: none;

    /* Vidrio: fondo de página con degradé de marca y superficies translúcidas */
    --page-bg: radial-gradient(900px 520px at 100% 0%, rgba(240, 128, 19, .08), transparent 70%), radial-gradient(900px 600px at 0% 100%, rgba(16, 66, 133, .06), transparent 70%), #f1f3f8;
    --glass-card: rgba(255, 255, 255, .82);
    --glass-bar: rgba(255, 255, 255, .92);
    --glass-sb: rgba(25, 61, 112, .94);
    --glass-border: rgba(16, 34, 66, .10);
    --glass-sheen: inset 0 1px 0 rgba(255, 255, 255, .75);
    --glass-blur: 14px;
    --cta-glow: 0 4px 14px rgba(224, 111, 0, .28);

    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-brand: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
    --text-xs: 12px;
    --text-sm: 13px;
    --text-base: 14px;
    --text-lg: 16px;
    --text-xl: 20px;
    --text-2xl: 22px;
    --text-stat: 26px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;

    --radius: 6px;
    --radius-sm: 5px;
    --shadow: 0 1px 2px rgba(16, 34, 66, .06), 0 1px 1px rgba(16, 34, 66, .04);
    --shadow-raised: 0 -6px 16px rgba(16, 34, 66, .08);
    --sidebar-w: 216px;
    color-scheme: light;
}

/* Oscuro: azul marino profundo (no gris neutro). Mismo bloque dos veces: sistema y forzado. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0a1122;
        --surface: #111c33;
        --surface-2: #16233f;
        --border: #22345a;
        --border-strong: #5a6e96;
        --text: #e7ecf5;
        --muted: #9daac4;
        --accent: #86abea;
        --accent-strong: #aec6f2;
        --accent-soft: #1a2e55;
        --on-accent: #ffffff;
        /* Botón primario en oscuro: azul saturado con texto blanco (antes celeste lavado) */
        --accent-fill: #2f66c8;
        --accent-fill-hover: #3a6fd0;
        --accent-2: #f08013;
        --accent-2-hover: #ffa24d;
        --accent-2-strong: #ffa24d;
        --accent-2-soft: #3a2412;
        --on-accent-2: #0b1426;
        --brand-orange: #f08013;
        --danger: #f08a80;
        --danger-soft: #3d1f1c;
        --warn: #e8b85a;
        --warn-soft: #3a2f16;
        --info: #c3aef0;
        --info-soft: #2a2342;
        --upgrade: #c7a6f5;
        --upgrade-soft: #2e2150;
        --focus: #86abea;
        --overlay: rgba(0, 0, 0, .6);
        --shadow: 0 8px 24px rgba(0, 0, 0, .28);
        --shadow-raised: 0 -6px 16px rgba(0, 0, 0, .4);

        --sb-bg: #070d1b;
        --sb-surface: #0d1628;
        --sb-hover: #111c33;
        --sb-active: #16284a;
        --sb-text: #e7ecf5;
        --sb-active-text: #ffffff;
        --sb-muted: #9daac4;
        --sb-border: #1a2848;
        --sb-border-strong: #5a6e96;
        --sb-link: #aec6f2;
        --sb-focus: #ffa24d;

        --logo-on-light: none;
        --logo-on-dark: block;

        --page-bg: radial-gradient(1000px 560px at 100% 0%, rgba(240, 128, 19, .14), transparent 70%), radial-gradient(1000px 700px at 0% 100%, rgba(122, 79, 196, .22), transparent 70%), #0a1122;
        --glass-card: rgba(17, 28, 51, .80);
        --glass-bar: rgba(13, 22, 40, .92);
        --glass-sb: rgba(7, 13, 27, .86);
        --glass-border: rgba(160, 190, 255, .12);
        --glass-sheen: inset 0 1px 0 rgba(255, 255, 255, .06);
        --cta-glow: 0 4px 18px rgba(240, 128, 19, .35);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #0a1122;
    --surface: #111c33;
    --surface-2: #16233f;
    --border: #22345a;
    --border-strong: #5a6e96;
    --text: #e7ecf5;
    --muted: #9daac4;
    --accent: #86abea;
    --accent-strong: #aec6f2;
    --accent-soft: #1a2e55;
    --on-accent: #ffffff;
    /* Botón primario en oscuro: azul saturado con texto blanco (antes celeste lavado) */
    --accent-fill: #2f66c8;
    --accent-fill-hover: #3a6fd0;
    --accent-2: #f08013;
    --accent-2-hover: #ffa24d;
    --accent-2-strong: #ffa24d;
    --accent-2-soft: #3a2412;
    --on-accent-2: #0b1426;
    --brand-orange: #f08013;
    --danger: #f08a80;
    --danger-soft: #3d1f1c;
    --warn: #e8b85a;
    --warn-soft: #3a2f16;
    --info: #c3aef0;
    --info-soft: #2a2342;
    --upgrade: #c7a6f5;
    --upgrade-soft: #2e2150;
    --focus: #86abea;
    --overlay: rgba(0, 0, 0, .6);
    --shadow: 0 8px 24px rgba(0, 0, 0, .28);
    --shadow-raised: 0 -6px 16px rgba(0, 0, 0, .4);

    --sb-bg: #070d1b;
    --sb-surface: #0d1628;
    --sb-hover: #111c33;
    --sb-active: #16284a;
    --sb-text: #e7ecf5;
    --sb-active-text: #ffffff;
    --sb-muted: #9daac4;
    --sb-border: #1a2848;
    --sb-border-strong: #5a6e96;
    --sb-link: #aec6f2;
    --sb-focus: #ffa24d;

    --logo-on-light: none;
    --logo-on-dark: block;

    --page-bg: radial-gradient(1000px 560px at 100% 0%, rgba(240, 128, 19, .14), transparent 70%), radial-gradient(1000px 700px at 0% 100%, rgba(122, 79, 196, .22), transparent 70%), #0a1122;
    --glass-card: rgba(17, 28, 51, .80);
    --glass-bar: rgba(13, 22, 40, .92);
    --glass-sb: rgba(7, 13, 27, .86);
    --glass-border: rgba(160, 190, 255, .12);
    --glass-sheen: inset 0 1px 0 rgba(255, 255, 255, .06);
    --cta-glow: 0 4px 18px rgba(240, 128, 19, .35);
    color-scheme: dark;
}

/* 2) Base -------------------------------------------------------------- */
* { box-sizing: border-box; }

html, body { margin: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font: var(--text-base)/1.5 var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; line-height: 1.25; font-family: var(--font-brand); }
h1 { font-size: var(--text-2xl); font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: var(--text-lg); font-weight: 650; letter-spacing: -.005em; }
h3 { font-size: var(--text-base); font-weight: 650; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

kbd {
    display: inline-block; min-width: 18px; padding: 0 4px; border-radius: 4px;
    border: 1px solid var(--border-strong); border-bottom-width: 2px;
    background: var(--surface-2); color: var(--muted);
    font: 600 11px/16px var(--font-mono); text-align: center;
}

.skip-link {
    position: absolute; left: 8px; top: -60px; z-index: 50;
    background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: var(--radius-sm);
    border: 2px solid var(--focus); font-weight: 600;
}
.skip-link:focus { top: 8px; }
main:focus { outline: none; }

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 3) Layout ------------------------------------------------------------ */
.app { display: flex; min-height: 100vh; }

/* La sidebar y la barra móvil redefinen los tokens: todo lo que tienen adentro (links, select, botones) se adapta solo. */
.sidebar, .topbar-mobile {
    --surface: var(--sb-surface);
    --surface-2: var(--sb-hover);
    --accent-soft: var(--sb-active);
    --accent-strong: var(--sb-active-text);
    --accent: var(--sb-link);
    --text: var(--sb-text);
    --muted: var(--sb-muted);
    --border: var(--sb-border);
    --border-strong: var(--sb-border-strong);
    --focus: var(--sb-focus);
    background: var(--sb-bg);
    color: var(--sb-text);
}

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    border-right: 1px solid var(--sb-border);
    padding: 18px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand { font-family: var(--font-brand); font-weight: 700; font-size: 15px; letter-spacing: -.01em; padding: 4px 10px 14px; display: flex; gap: 8px; align-items: center; }
.brand-mark { width: 28px; height: auto; flex-shrink: 0; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand-orange); flex-shrink: 0; }
.logo-on-light { display: var(--logo-on-light); }
.logo-on-dark { display: var(--logo-on-dark); }

.nav-label { font-family: var(--font-brand); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 4px; }

.nav-link {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-brand);
    font-weight: 500;
}
.nav-link:hover { background: var(--surface-2); text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent-2); }

.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding: 12px 10px 0; font-size: var(--text-sm); }
.sidebar-footer select { padding: 4px 6px; font-size: var(--text-xs); margin-top: 8px; }

.main { flex: 1; min-width: 0; padding: 20px 28px 48px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head > div { min-width: 0; }
.page-head p { margin: 4px 0 0; }
.eyebrow { font-size: var(--text-sm); color: var(--muted); }

.topbar-mobile { display: none; }
.topbar-mobile .brand { padding: 0; }

@media (max-width: 860px) {
    .app { flex-direction: column; }
    .sidebar { display: none; }
    .sidebar.open {
        display: flex; position: fixed; inset: 0 auto 0 0; z-index: 30; width: min(280px, 85vw);
        box-shadow: 0 0 0 100vmax var(--overlay);
    }
    .topbar-mobile {
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        position: sticky; top: 0; z-index: 20;
        border-bottom: 1px solid var(--sb-border); padding: 8px 16px;
    }
    .main { padding: 16px 16px 40px; }
    h1 { font-size: var(--text-xl); }
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-lead { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
@media (max-width: 1100px) { .grid-lead, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 10px; }

/* 4) Componentes ------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-body { padding: 16px 18px; }
.card-head { padding: 12px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); }
@media (max-width: 860px) {
    .card-body { padding: 14px; }
    .card-head, .card-foot { padding: 12px 14px; }
}

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 12px 16px; }
.stat-label { font-size: var(--text-sm); color: var(--muted); }
.stat-value { font-family: var(--font-brand); font-size: var(--text-stat); font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; line-height: 1.2; }
.stat-hint { font-size: var(--text-xs); color: var(--muted); }
.stat.accent .stat-value { color: var(--accent); }
.stat.highlight .stat-value { color: var(--accent-2-strong); }
.stat.warn { border-color: var(--warn); }
.stat.warn .stat-value { color: var(--warn); }
a.stat { color: inherit; display: block; }
a.stat:hover { text-decoration: none; border-color: var(--accent); }
@media (max-width: 520px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .stat { padding: 10px 12px; }
    .stat-value { font-size: var(--text-xl); }
}

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: var(--text-xs); font-weight: 600; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 650; border-top: 2px solid var(--border); border-bottom: 0; }
td.num, th.num { text-align: right; }
@media (max-width: 760px) {
    .table-wrap th:first-child, .table-wrap td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
    .table-wrap th:first-child { background: var(--surface-2); }
}
tr.is-best td { background: var(--accent-soft); }
.row-link { color: var(--text); font-weight: 600; }
.row-link::after { content: ""; position: absolute; inset: 0; }
tr.clickable { position: relative; cursor: pointer; }
tr.clickable:focus-within { outline: 2px solid var(--focus); outline-offset: -2px; }

.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; min-width: 60px; }
.bar > span { display: block; height: 100%; background: var(--accent-2); }
.progress { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.progress > span { display: block; height: 100%; background: var(--accent-2); }

/* Badges */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: var(--text-xs); font-weight: 550; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; line-height: 1.6; }
.badge-green { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }
.badge-red { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-amber { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge-highlight { background: var(--accent-2-soft); color: var(--accent-2-strong); border-color: transparent; font-weight: 650; }

/* Forms */
label { display: block; font-weight: 550; margin-bottom: 4px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 550; padding: 0; margin-bottom: 4px; }
.field + .field { margin-top: 14px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 4px 0 0; }
.field-error { font-size: 12.5px; color: var(--danger); margin: 4px 0 0; font-weight: 550; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=file], select, textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    min-height: 38px;
}
textarea { min-height: 72px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; border-radius: var(--radius-sm); }
[aria-invalid="true"] { border-color: var(--danger) !important; }

.check { display: flex; gap: 8px; align-items: center; font-weight: 450; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
.check:has(input:disabled) { opacity: .5; cursor: not-allowed; }

.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form > div { min-width: 140px; }
.inline-form label { font-size: 12.5px; font-weight: 500; color: var(--muted); }
@media (max-width: 520px) { .inline-form > div { flex: 1 1 100%; } }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
    background: var(--surface); color: var(--text); font: inherit; font-family: var(--font-brand); font-weight: 600;
    cursor: pointer; white-space: nowrap; min-height: 38px;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); }
/* CTA del agente (una por pantalla): naranja con texto marino */
.btn-cta { background: var(--accent-2); border-color: var(--accent-2); color: var(--on-accent-2); font-weight: 700; }
.btn-cta:hover { background: var(--accent-2-hover); border-color: var(--accent-2-hover); }
.btn-lg { padding: 10px 20px; font-size: 15px; min-height: 44px; }
.btn-sm { padding: 4px 10px; font-size: var(--text-sm); min-height: 32px; }
.btn-link { border: 0; background: none; color: var(--accent); padding: 0; cursor: pointer; font: inherit; }
.btn kbd { background: transparent; border-color: currentColor; color: inherit; opacity: .75; }
.btn:disabled, .btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn.is-busy { opacity: .7; cursor: progress; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Grupo de opciones en línea (checkboxes de agentes) */
.chips { display: flex; flex-wrap: wrap; gap: 5px; }

/* Selector de resultado (ficha del lead): botón + panel con todos los resultados */
.outcome-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.outcome-label .label { font-weight: 550; }
.picker { position: relative; }
.picker-trigger {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 8px 12px;
    border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--muted); font: 500 15px/1.3 var(--font-sans);
    text-align: left; cursor: pointer;
}
.picker-trigger:hover { border-color: var(--accent); }
.picker-trigger.has-value { color: var(--text); font-weight: 600; }
.picker-trigger[aria-expanded="true"] { border-color: var(--accent); }
.picker-trigger.is-alta { border-color: var(--accent-2); box-shadow: inset 4px 0 0 var(--accent-2); background: var(--accent-2-soft); }
.picker-trigger[aria-invalid="true"] { border-color: var(--danger); }
.picker-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-caret { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); color: var(--muted); flex-shrink: 0; }
.picker-trigger[aria-expanded="true"] .picker-caret { transform: translateY(2px) rotate(-135deg); }

/* Mientras el panel está abierto la card del formulario pierde el vidrio: si no, backdrop-filter
   convierte a la card en el contenedor de position: fixed y el panel no podría salirse de ella. */
.call-form.picker-open { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); }

.picker-panel {
    position: fixed; z-index: 40; container-type: inline-size;
    max-height: calc(100vh - 16px); overflow-y: auto;
    padding: 12px 14px 14px; border: 1px solid var(--glass-border); border-radius: var(--radius);
    background: var(--glass-bar);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
    box-shadow: var(--glass-sheen), 0 14px 36px rgba(8, 16, 34, .22);
}
.picker-head { display: none; }
.picker-title { font: 600 11px/1.4 var(--font-brand); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 8px 4px; margin: 0; }

.picker-opt {
    display: flex; align-items: center; gap: 6px; width: 100%; margin: 0; padding: 3px 8px;
    border: 1px solid transparent; border-radius: 4px; background: none; color: var(--text);
    font: 450 13.5px/18px var(--font-sans); text-align: left; white-space: nowrap; cursor: pointer;
}
.picker-opt:hover { background: var(--surface-2); }
.picker-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.picker-opt:has(input:focus-visible), .picker-freq-opt:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.picker-opt:has(input:checked), .picker-freq-opt.is-selected { background: var(--accent-2); border-color: var(--accent-2); color: var(--on-accent-2); font-weight: 650; }

.picker-freq { padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--border); }
.picker-freq-list { display: flex; flex-wrap: wrap; gap: 4px; }
.picker-freq-opt { width: auto; border-color: var(--border-strong); background: var(--surface); }
.picker-freq-opt[data-conversion] { border-color: var(--accent-2); }
.picker-freq-opt kbd { min-width: 16px; line-height: 14px; font-size: 10.5px; }
.picker-freq-opt.is-selected kbd { color: inherit; border-color: currentColor; background: transparent; }

/* Las columnas toman el ancho de sus textos y, si no entran en el panel (resultados con nombres largos, como los
   de Greenpeace), se angostan y los textos se parten en vez de salirse del panel. */
.picker-cols { display: grid; grid-template-columns: repeat(4, auto); gap: 4px 14px; align-items: start; }
.picker-cols .picker-opt { white-space: normal; }
.picker-col { min-width: 0; }
.picker-col.is-alta .picker-title { color: var(--accent-2-strong); }
.picker-col.is-alta .picker-opt { color: var(--accent-2-strong); font-weight: 600; }
.picker-col.is-alta .picker-opt:has(input:checked) { color: var(--on-accent-2); }

/* Paneles angostos (pantallas chicas): dos columnas y los textos largos pueden partirse */
@container (max-width: 780px) {
    .picker-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
    .picker-opt { white-space: normal; }
}

.picker-scrim { position: fixed; inset: 0; z-index: 39; background: var(--overlay); }

/* Móvil: hoja inferior a ancho completo con scroll interno */
@media (max-width: 860px) {
    .picker-panel {
        left: 0; right: 0; bottom: 0; top: auto; max-height: 82vh; overflow-y: auto;
        border-radius: var(--radius) var(--radius) 0 0; padding-bottom: 20px;
    }
    .picker-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
    .picker-opt { padding: 8px 10px; font-size: 14.5px; }
}
@media (hover: none) { .picker-freq-opt kbd { display: none; } }

.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.segmented label { margin: 0; position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 5px 12px; cursor: pointer; font-weight: 500; font-size: var(--text-sm); }
.segmented label + label span { border-left: 1px solid var(--border-strong); }
.segmented input:checked + span { background: var(--accent-soft); color: var(--accent-strong); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }

/* Alerts */
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid transparent; }
.alert-ok { background: var(--accent-soft); color: var(--accent-strong); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.alert a { color: inherit; text-decoration: underline; font-weight: 600; }
.alert-row { display: flex; gap: 8px 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* Estado vacío */
.empty { padding: 28px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty .actions { justify-content: center; margin-top: 12px; }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 18px; }

/* Pasos (carga de base) */
.steps { display: flex; gap: 8px; list-style: none; margin: 0 0 18px; padding: 0; flex-wrap: wrap; counter-reset: step; }
.steps li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 550; font-size: var(--text-sm); }
.steps li::before {
    counter-increment: step; content: counter(step);
    display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
    border: 1px solid var(--border-strong); background: var(--surface); font-size: var(--text-xs);
}
.steps li:not(:last-child)::after { content: "→"; margin-left: 8px; color: var(--border-strong); }
.steps li[aria-current="step"] { color: var(--text); }
.steps li[aria-current="step"]::before { background: var(--accent-2); border-color: var(--accent-2); color: var(--on-accent-2); font-weight: 700; }
.steps li.done::before { content: "✓"; background: var(--accent-2-soft); border-color: transparent; color: var(--accent-2-strong); }

/* 5) Pantallas --------------------------------------------------------- */

/* Ficha del lead */
.lead-page { display: grid; gap: 16px; grid-template-columns: minmax(320px, 4fr) minmax(0, 7fr); align-items: start; }
.lead-side > * + * { margin-top: 16px; }
.call-form-foot { position: sticky; bottom: 0; z-index: 5; border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow-raised); }
@media (max-width: 1100px) {
    .lead-page { grid-template-columns: minmax(0, 1fr); }
    .lead-side { display: contents; }
    .lead-side > * + * { margin-top: 0; }
    .lead-contact { order: 1; }
    .call-form { order: 2; }
    .lead-details { order: 3; }
}

.lead-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 14px; }
.lead-title { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; margin-top: 2px; }
.lead-meta { display: flex; gap: 6px 8px; flex-wrap: wrap; align-items: center; }

.phone-block { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.phone-number { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: .01em; word-break: break-all; line-height: 1.2; }
.contact-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); margin-top: 10px; flex-wrap: wrap; }
.contact-value { font-weight: 550; word-break: break-all; }
.edit-email { flex-basis: 100%; display: grid; gap: 6px; padding-top: 4px; }
.edit-email[hidden] { display: none; }
.edit-email label { margin: 0; }
.timeline-change del { color: var(--muted); }
/* Llamados del mismo contacto en bases anteriores (duplicado cargado con su historial) */
.timeline-earlier { opacity: .78; }

.last-comment { margin: 8px 0 0; padding: 8px 10px; border-left: 3px solid var(--border-strong); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; white-space: pre-line; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; word-break: break-word; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 9px 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 82px 1fr; gap: 2px 10px; }
.timeline li:last-child { border-bottom: 0; }
.timeline time { color: var(--muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; line-height: 1.4; padding-top: 2px; }
.timeline-meta { display: flex; gap: 4px 8px; align-items: center; flex-wrap: wrap; font-size: var(--text-xs); color: var(--muted); }
.timeline-comment { grid-column: 2; white-space: pre-line; }
.timeline-outcome { font-weight: 600; color: var(--text); font-size: var(--text-sm); }

.call-form-head { display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.call-form-body { padding: 12px 18px; }
.call-form-body .field + .field { margin-top: 12px; }
.call-form-foot { padding: 10px 18px; border-top: 1px solid var(--border); background: var(--surface); display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; }
.call-form-foot .actions { flex-wrap: nowrap; }
.shortcut-legend { font-size: var(--text-xs); color: var(--muted); display: flex; gap: 4px 10px; flex-wrap: wrap; align-items: center; }
@media (max-width: 860px) {
    .shortcut-legend { display: none; }
    .call-form-foot .actions { width: 100%; }
    .call-form-foot .btn-primary { flex: 1; }
    .phone-number { font-size: 22px; }
}
@media (hover: none) { .btn kbd { display: none; } }

.callback-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.callback-row input { flex: 1 1 200px; width: auto; }

.conversion-box { border: 1px solid var(--accent-2); border-radius: var(--radius); padding: 12px 14px 14px; background: var(--surface); }
.conversion-box legend { padding: 0 6px; margin-left: -6px; }
@media (min-width: 1200px) { .conversion-box .grid-2 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.conversion-box .hint { font-size: var(--text-xs); }

/* Cola del agente */
.next-up { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 18px 20px; border-left: 4px solid var(--accent); margin-bottom: 16px; }
.next-up h2 { font-size: 20px; margin-top: 2px; }
.next-up .btn-lg { font-size: 16px; padding: 12px 22px; }
@media (max-width: 640px) { .next-up { grid-template-columns: 1fr; } .next-up .btn-lg { width: 100%; } }

.day-progress { display: flex; gap: 4px 14px; flex-wrap: wrap; align-items: baseline; }
.day-progress strong { font-size: 17px; font-variant-numeric: tabular-nums; }

.callback-list { list-style: none; margin: 0; padding: 0; }
.callback-list li { display: grid; grid-template-columns: 96px 1fr; gap: 2px 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); position: relative; }
.callback-list li:last-child { border-bottom: 0; }
.callback-list li:hover { background: var(--surface-2); }
.callback-list .when { font-weight: 650; font-variant-numeric: tabular-nums; }
.callback-list .soon .when { color: var(--warn); }

/* Distribución */
.assign-table td { vertical-align: middle; }
.assign-table input[type=number] { max-width: 110px; }
.assign-preview { font-weight: 650; font-variant-numeric: tabular-nums; }
.assign-summary { display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; flex-wrap: wrap; }

/* Mapeo de columnas */
.map-target { display: block; margin-top: 2px; font-weight: 600; color: var(--accent-strong); font-size: 11px; }
.column-select { min-height: 30px; padding: 3px 6px; font-size: var(--text-xs); margin-top: 4px; min-width: 130px; }
th.is-mapped { background: var(--accent-soft); color: var(--accent-strong); box-shadow: inset 0 3px 0 var(--accent-2); }
th.is-mapped .column-select { border-color: var(--accent); }
td.is-mapped { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
th.is-skipped .column-select { color: var(--muted); }
td.is-skipped { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--border-strong); opacity: .7; }

/* Dashboard */
.todo-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.quick-range { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.quick-range a { padding: 7px 12px; color: var(--text); font-weight: 500; font-size: var(--text-sm); }
.quick-range a + a { border-left: 1px solid var(--border-strong); }
.quick-range a[aria-current="true"] { background: var(--accent-soft); color: var(--accent-strong); }
.quick-range a:hover { text-decoration: none; background: var(--surface-2); }

.gestion-tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.gestion-tabs a { padding: 8px 14px; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.gestion-tabs a[aria-current="page"] { color: var(--accent-strong); border-bottom-color: var(--accent); }
.gestion-tabs a:hover { text-decoration: none; color: var(--text); }
.gestion-tabs .tab-count { display: inline-block; min-width: 22px; margin-left: 6px; padding: 0 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: var(--text-sm); text-align: center; }
.gestion-tabs a.is-upgrade[aria-current="page"] { color: var(--upgrade); border-bottom-color: var(--upgrade); }
.gestion-tabs a.is-upgrade[aria-current="page"] .tab-count { background: var(--upgrade-soft); color: var(--upgrade); }
.gestion-tabs a.is-conversion[aria-current="page"] .tab-count { background: var(--accent-soft); color: var(--accent-strong); }
.badge-upgrade { background: var(--upgrade-soft); color: var(--upgrade); border-color: transparent; font-weight: 650; }

.hour-chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: 8px; }
.hour-chart div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.hour-chart .col { width: 100%; background: var(--accent-2); border-radius: 3px 3px 0 0; min-height: 2px; }
.hour-chart small { font-size: 11px; color: var(--muted); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 24px; padding: 16px; }
.login-logo { width: 120px; height: auto; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: var(--text-lg); margin-bottom: 16px; }

/* Vidrio (glassmorphism) ------------------------------------------------
 * Solo en contenedores (cards, sidebar, barra móvil, barra de guardado), nunca por fila.
 * Las opacidades están elegidas para que el texto cumpla AA contra el color resultante
 * en el peor punto del degradé. Inputs, encabezados de tabla y chips siguen sólidos.
 */
body { background: var(--page-bg); background-attachment: fixed; }
.card {
    background: var(--glass-card);
    border-color: var(--glass-border);
    box-shadow: var(--glass-sheen), var(--shadow);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    backdrop-filter: blur(var(--glass-blur)) saturate(140%);
}
.stat.highlight { box-shadow: inset 0 3px 0 var(--accent-2), var(--glass-sheen), var(--shadow); }
.card.next-up { border-left-color: var(--accent); }
.sidebar, .topbar-mobile {
    background: var(--glass-sb);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    backdrop-filter: blur(18px) saturate(150%);
}
.sidebar { box-shadow: inset -1px 0 0 rgba(255, 255, 255, .06); }
.call-form-foot {
    background: var(--glass-bar);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.btn-cta { box-shadow: var(--cta-glow); }

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .card, .call-form-foot, .picker-panel { background: var(--surface); }
    .sidebar, .topbar-mobile { background: var(--sb-bg); }
}
@media (prefers-reduced-transparency: reduce) {
    body { background: var(--bg); }
    .card, .call-form-foot, .picker-panel { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
    .sidebar, .topbar-mobile { background: var(--sb-bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* 6) Utilidades -------------------------------------------------------- */
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.text-warn { color: var(--warn); }
.text-danger { color: var(--danger); }
.text-highlight { color: var(--accent-2-strong); }
@media (max-width: 640px) { .hide-mobile { display: none !important; } }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: no-preference) {
    .btn, .nav-link { transition: background-color .12s, border-color .12s, color .12s; }
}

/* Column mapping (import step 2) */
.mapping-table th { vertical-align: bottom; min-width: 160px; }
.mapping-table .column-name { font-size: 12px; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.mapping-table .column-select { font-size: 13px; padding: 5px 8px; }
.mapping-table th.is-mapped { box-shadow: inset 0 3px 0 var(--accent); }
.mapping-table td.is-mapped { background: var(--accent-soft); }
.mapping-table .is-skipped { opacity: .45; }
.mapping-table td.is-skipped { text-decoration: line-through; }

/* Full Canoa logo in the sidebar and mobile top bar (both are navy in every theme, so the negative logo is used) */
.brand-stacked { flex-direction: column; align-items: flex-start; gap: 10px; padding: 6px 10px 16px; }
.brand-logo { display: block; width: 104px; height: auto; }
.brand-app { font-size: 13px; font-weight: 600; opacity: .85; letter-spacing: .01em; }
.brand-inline { gap: 10px; }
.brand-logo-sm { display: block; width: 45px; height: auto; }
/* Free-text input shown when "Otro…" is chosen in the donor form */
.other-input { margin-top: 6px; }

/* Organization picker (agents choose the NGO before working their queue) */
.org-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; max-width: 980px; }
.org-grid form { margin: 0; }
.org-card {
    width: 100%; min-height: 170px; padding: 20px 22px; text-align: left; cursor: pointer;
    display: flex; flex-direction: column; gap: 6px; font: inherit; color: var(--text);
    border-top: 3px solid var(--accent-2);
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.org-card:hover { transform: translateY(-2px); border-color: var(--accent-2); }
.org-card:focus-visible { outline: 3px solid var(--focus, var(--accent)); outline-offset: 2px; }
.org-card.is-current { box-shadow: 0 0 0 2px var(--accent-2) inset; }
.org-card.is-empty { border-top-color: var(--border); }
.org-name { font-family: var(--font-brand, inherit); font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.org-count { font-size: 15px; }
.org-count strong { font-size: 28px; font-weight: 700; color: var(--accent-2-strong, var(--accent)); margin-right: 4px; }
.org-meta { font-size: 13px; color: var(--muted); }
.org-go { margin-top: auto; font-weight: 600; color: var(--accent); }
.org-card.is-empty .org-go { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .org-card { transition: none; } .org-card:hover { transform: none; } }

/* Working organization indicator in the sidebar */
.nav-org { margin: 2px 10px 6px; padding: 8px 10px; border-radius: var(--radius-sm, 5px); background: rgba(255, 255, 255, .08); font-size: 13px; line-height: 1.3; }
.nav-org strong { display: block; font-size: 14px; }
.nav-org a { font-size: 12.5px; }

/* Organization logos (always on a white plate: NGO logos are designed for light backgrounds) */
.org-logo { display: inline-flex; align-items: center; gap: 8px; vertical-align: middle; max-width: 100%; }
.org-logo-plate {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    background: #fff; border-radius: var(--radius-sm, 5px); border: 1px solid rgba(15, 30, 60, .08);
    box-shadow: 0 1px 2px rgba(10, 20, 40, .08);
}
.org-logo-plate img { display: block; width: auto; object-fit: contain; }
.org-logo-initials { font-family: var(--font-brand, inherit); font-weight: 700; color: #193d70; letter-spacing: .02em; }
.org-logo-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.org-logo-sm .org-logo-plate { padding: 3px 6px; }
.org-logo-sm .org-logo-plate img { height: 16px; max-width: 90px; }
.org-logo-sm .org-logo-initials { font-size: 11px; line-height: 16px; }
.org-logo-sm .org-logo-name { font-size: 13px; }

.org-logo-md .org-logo-plate { padding: 5px 9px; }
.org-logo-md .org-logo-plate img { height: 26px; max-width: 160px; }
.org-logo-md .org-logo-initials { font-size: 14px; line-height: 26px; }

.org-logo-lg .org-logo-plate { padding: 10px 14px; border-radius: var(--radius, 6px); }
.org-logo-lg .org-logo-plate img { height: 44px; max-width: 220px; }
.org-logo-lg .org-logo-initials { font-size: 22px; line-height: 44px; min-width: 44px; text-align: center; }
.org-logo-lg .org-logo-name { font-size: 20px; }

/* Picker card with logo */
.org-card .org-logo { margin-bottom: 6px; }
.gestion-name { font-size: 26px; font-weight: 700; color: var(--accent-2-strong, var(--accent)); }
.upgrade-amount { font-size: 20px; font-weight: 700; padding-top: 6px; }
.upgrade-increase { margin: 8px 0 0; font-weight: 600; }
.org-card .org-sub { font-size: 13px; color: var(--muted); margin-top: -2px; }

/* Sidebar "Llamando para" with logo */
.nav-org .org-logo { margin: 4px 0 6px; }
.nav-org .org-logo-name { color: inherit; }

.eyebrow-org, .queue-org { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Closed list banner */
.closed-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.closed-banner form { margin: 0; }

/* Results report of a closed list */
.report { max-width: 1100px; }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.report-brand { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.report-brand h1 { margin: 2px 0 4px; }
.report-meta { margin: 0; max-width: 640px; }
.report-section { margin-bottom: 16px; break-inside: avoid; }
.report-foot { margin-top: 20px; text-align: center; }

.category-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--surface-2); }
.category-bar span { display: block; height: 100%; }
.category-legend { list-style: none; margin: 10px 0 0; padding: 0; display: flex; gap: 6px 20px; flex-wrap: wrap; font-size: 13.5px; }
.category-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.seg-contacted { background: var(--accent); }
.seg-not-contacted { background: var(--border-strong, #8a93a6); }
.seg-invalid { background: var(--danger); }
.seg-none { background: var(--border); }
.bar > span.seg-contacted, .bar > span.seg-not-contacted, .bar > span.seg-invalid, .bar > span.seg-none { background-image: none; }

@media print {
    @page { size: A4; margin: 14mm; }
    body { background: #fff !important; color: #111 !important; }
    .sidebar, .topbar-mobile, .skip-link, .no-print, #flash-region, .alert { display: none !important; }
    .app { display: block; }
    .main { padding: 0 !important; }
    .card, .stat { background: #fff !important; box-shadow: none !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; border: 1px solid #d9dde5 !important; }
    .report { max-width: none; }
    .stats { grid-template-columns: repeat(3, 1fr) !important; }
    .table-wrap { overflow: visible !important; }
    th { background: #f1f3f7 !important; }
    .org-logo-plate { box-shadow: none; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* PDF download panel on the report */
.pdf-panel { margin-bottom: 16px; }
.pdf-panel fieldset { border: 0; margin: 0; padding: 0; }
.pdf-panel legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.pdf-options { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.pdf-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
[data-section] { transition: opacity .15s ease; }
[data-section].is-excluded { opacity: .35; }
@media print { [data-section].is-excluded { display: none !important; } }

/* Qualitative observations on the report (list of items with the browser spell checker) */
.note-list { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.note-item { display: flex; gap: 8px; align-items: flex-start; }
.note-item::marker { color: var(--accent-2-strong, var(--accent)); font-weight: 700; }
.note-item textarea { flex: 1; min-height: 40px; resize: none; overflow: hidden; line-height: 1.45; font: inherit; }
.note-tools { display: flex; gap: 4px; flex-shrink: 0; }
.btn-icon { min-width: 32px; padding-left: 0; padding-right: 0; justify-content: center; }
.notes-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.empty-notes { margin: 0 0 4px; }
@media (max-width: 640px) { .note-item { flex-direction: column; align-items: stretch; } .note-tools { justify-content: flex-end; } }

/* Logos never overflow their container: the plate and image shrink to fit (e.g. wide logos in the sidebar). */
.org-logo { min-width: 0; }
.org-logo-plate { max-width: 100%; min-width: 0; box-sizing: border-box; overflow: hidden; }
.org-logo-plate img { max-width: 100%; height: auto; object-fit: contain; }
.org-logo-sm .org-logo-plate img { height: auto; max-height: 16px; }
.org-logo-md .org-logo-plate img { height: auto; max-height: 26px; }
.org-logo-lg .org-logo-plate img { height: auto; max-height: 44px; }
.nav-org { overflow: hidden; }
.nav-org .org-logo { display: flex; width: 100%; }
.nav-org .org-logo-plate { width: 100%; justify-content: center; }
.org-card .org-logo { max-width: 100%; }
.org-card .org-logo-plate { max-width: 100%; }
.org-logo-sm .org-logo-plate img, .org-logo-md .org-logo-plate img, .org-logo-lg .org-logo-plate img { max-width: 100%; }
.org-logo-sm .org-logo-plate { max-width: min(100%, 110px); }
.org-logo-md .org-logo-plate { max-width: min(100%, 180px); }
.org-logo-lg .org-logo-plate { max-width: min(100%, 250px); }

.draft-banner { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }

/* Irreversible actions (deleting a list) */
.danger-zone { margin-top: 24px; border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.danger-zone .card-head h2 { color: var(--danger); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
.confirm-name { font-family: ui-monospace, Consolas, monospace; background: var(--surface-2); padding: 1px 6px; border-radius: 4px; user-select: all; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-danger { color: #0b1426; } }
:root[data-theme="dark"] .btn-danger { color: #0b1426; }

/* The outcome panel takes focus on mouse down (so clicking an option doesn't close it); no outline for that. */
.picker-panel:focus { outline: none; }

/* Password field with show/hide ("eye") button */
.password-field { position: relative; }
.password-field input { padding-right: 44px; }
.password-toggle {
    position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
    display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
    border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: var(--radius-sm);
}
.password-toggle:hover { color: var(--text); }
.password-toggle .icon-hide, .password-toggle[aria-pressed="true"] .icon-show { display: none; }
.password-toggle[aria-pressed="true"] .icon-hide { display: block; }

/* Delegated leads: handed over by a teammate; outlined in the brand orange so they stand out from regular ones */
.badge-delegated { background: transparent; color: var(--accent-2-strong); border-color: var(--accent-2); font-weight: 650; }
.alert-delegated { background: var(--accent-2-soft); color: var(--text); border-left: 4px solid var(--accent-2); }
.alert-delegated strong { color: var(--accent-2-strong); }
.delegation-note { display: block; margin: 4px 0 0; font-style: italic; }
tr.is-delegated td:first-child { box-shadow: inset 3px 0 0 var(--accent-2); }
.delegated-card { margin-bottom: 16px; border-left: 4px solid var(--accent-2); }
.delegated-list { list-style: none; margin: 0; padding: 0; }
.delegated-list li { display: flex; gap: 8px 12px; align-items: flex-start; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--border); position: relative; cursor: pointer; }
.delegated-list li:hover { background: var(--surface-2); }
.delegated-list li:focus-within { outline: 2px solid var(--focus); outline-offset: -2px; }
.delegated-list li:first-child { border-top: 0; }
.delegate-menu { position: relative; }
.delegate-menu > summary { list-style: none; }
.delegate-menu > summary::-webkit-details-marker { display: none; }
.delegate-menu[open] > summary { background: var(--accent-soft); }
.delegate-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: min(340px, calc(100vw - 32px)); padding: 14px 16px; text-align: left; }

/* Resultados del equipo: las filas propias, apenas resaltadas */
tr.is-mine td { background: var(--accent-soft); }

/* Mi cola: filtro por situación y último resultado */
.queue-filter { margin-bottom: 16px; }
.queue-filter-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.queue-filter-row > div { min-width: 220px; }
tr.is-closed td, tr.is-closed td .row-link { color: var(--muted); }
tr.is-closed td { background: var(--surface-2); }
select option.closed-option, select optgroup.closed-options { color: var(--muted); }
details.commission-agent > summary { cursor: pointer; list-style: none; }
details.commission-agent > summary::-webkit-details-marker { display: none; }
details.commission-agent > summary h2::before { content: "▸ "; color: var(--muted); }
details.commission-agent[open] > summary h2::before { content: "▾ "; }

/* Selección múltiple con casillas (filtros de resultado e intentos) */
.multi-select-field { display: grid; gap: 4px; min-width: 220px; }
.multi-select { position: relative; }
.multi-select > summary { list-style: none; cursor: pointer; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 32px 8px 10px; background: var(--surface); position: relative; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.multi-select > summary::-webkit-details-marker { display: none; }
.multi-select > summary::after { content: "▾"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.multi-select[open] > summary { border-color: var(--accent); }
.multi-select-panel { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 100%; max-height: 340px; overflow: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 6px 10px; }
.multi-select-panel .check { display: flex; gap: 8px; margin: 0; padding: 5px 0; white-space: nowrap; }
.multi-select-panel .check.is-muted { color: var(--muted); }
.multi-select-group { font-weight: 700; font-style: italic; color: var(--muted); font-size: var(--text-sm); padding: 8px 0 2px; border-top: 1px solid var(--border); margin-top: 4px; }
.multi-select-tools { display: flex; gap: 14px; padding: 2px 0 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.multi-select-tools .link-button { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: var(--text-sm); cursor: pointer; }
.multi-select-tools .link-button:hover { text-decoration: underline; }
.multi-select-panel [hidden] { display: none !important; }
/* El desplegable abierto tiene que quedar por encima de las tarjetas siguientes (cada .card con backdrop-filter es su propia capa) */
.queue-filter, .page-head { position: relative; z-index: 20; }
.card:has(details.multi-select[open]), .page-head:has(details.multi-select[open]) { position: relative; z-index: 40; }

/* Altas: domicilio de los socios de Greenpeace, editable en la fila */
.address-edit > summary { cursor: pointer; list-style: none; }
.address-edit > summary::-webkit-details-marker { display: none; }
.address-form { display: grid; gap: 6px; margin-top: 6px; min-width: 200px; }

/* Menú lateral: con muchas opciones se desplaza; los recuadros (gestión, organización) no se achican */
.sidebar > * { flex-shrink: 0; }

/* Datos del alta: títulos en una línea, así todos los campos quedan a la misma altura */
.conversion-box .grid > div > label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Botón a la búsqueda de socios de Greenpeace (verde Greenpeace con texto blanco legible) */
.btn-gp { background: #2e7d1f; border-color: #2e7d1f; color: #fff; }
.btn-gp:hover { background: #24661a; border-color: #24661a; color: #fff; text-decoration: none; }

/* Página de "sin acceso" (403) */
.access-denied { max-width: 620px; margin: 8vh auto 0; padding: 32px; text-align: center; }
.access-denied-icon { font-size: 40px; line-height: 1; margin-bottom: 12px; }
.access-denied h1 { margin: 0 0 10px; }
.access-denied-reason { font-size: 17px; font-weight: 600; margin: 0 0 10px; }
.access-denied .actions { justify-content: center; margin-top: 18px; }

/* Asistencia: estado de la jornada (menú lateral, Mi jornada, supervisión) */
:root {
    --status-active: #1e8a3c;
    --status-busy: #2f6fd0;
    --status-pause: #d08a00;
    --status-incidence: #c4352b;
    --status-off: #8a93a6;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) { --status-active: #4cc46d; --status-busy: #6ea2f2; --status-pause: #f0b43c; --status-incidence: #f07a70; --status-off: #7c88a3; }
}
:root[data-theme="dark"] { --status-active: #4cc46d; --status-busy: #6ea2f2; --status-pause: #f0b43c; --status-incidence: #f07a70; --status-off: #7c88a3; }

.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--status-off); flex-shrink: 0; vertical-align: middle; }
.status-dot-lg { width: 18px; height: 18px; }
.status-active { background: var(--status-active); box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-active) 25%, transparent); }
.status-busy { background: var(--status-busy); }
.status-pause { background: var(--status-pause); }
.status-incidence { background: var(--status-incidence); }
.status-off { background: transparent; border: 2px solid var(--status-off); }

.nav-shift { margin: 2px 10px 8px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, .08); font-size: 13px; }
.nav-shift > summary { display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; list-style: none; border-radius: var(--radius-sm); }
.nav-shift > summary::-webkit-details-marker { display: none; }
.nav-shift > summary:hover { background: rgba(255, 255, 255, .08); }
.nav-shift-label { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.nav-shift-label strong { font-size: 14px; }
.nav-shift-label span { font-size: 12px; opacity: .8; }
.nav-shift-caret { opacity: .7; transition: transform .15s; }
.nav-shift[open] .nav-shift-caret { transform: rotate(180deg); }
.nav-shift-panel { padding: 2px 6px 8px; display: flex; flex-direction: column; gap: 1px; }
.nav-shift-panel form { margin: 0; }
.nav-shift-context { font-size: 12px; opacity: .8; padding: 0 4px 6px; border-bottom: 1px solid rgba(255, 255, 255, .12); margin-bottom: 4px; }
.nav-shift-option { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 6px; border: 0; border-radius: 4px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.nav-shift-option:hover { background: rgba(255, 255, 255, .1); }
.nav-shift-option.is-current { background: rgba(255, 255, 255, .16); font-weight: 650; }
.nav-shift-panel a { display: block; padding: 6px 6px 0; font-size: 12.5px; }
.nav-shift-start { display: flex; align-items: center; gap: 9px; }

.shift-now { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; border-left: 4px solid var(--status-off); }
.shift-now.status-tone-active { border-left-color: var(--status-active); }
.shift-now.status-tone-busy { border-left-color: var(--status-busy); }
.shift-now.status-tone-pause { border-left-color: var(--status-pause); }
.shift-now.status-tone-incidence { border-left-color: var(--status-incidence); }
.shift-now-status { font-family: var(--font-brand); font-size: var(--text-2xl); font-weight: 700; line-height: 1.2; }
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin-top: 10px; }
.status-grid form { margin: 0; }
.status-option { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.status-option > span:last-child { display: flex; flex-direction: column; }
.status-option:hover { border-color: var(--border-strong); }
.status-option.is-current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.context-fixed { padding: 7px 0; font-weight: 600; }
.shift-close { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.shift-close .h-section, .shift-close p { margin: 0; }
.shift-banner .status-dot { margin-right: 4px; }
.shift-detail { margin-top: 2px; }
.shift-detail summary { cursor: pointer; }
.shift-segments { margin: 6px 0 0; padding-left: 18px; font-size: var(--text-sm); }
.shift-segments li { margin: 2px 0; }
.nav-shift-start { justify-content: flex-start; }
.context-fields > .field + .field { margin-top: 0; }
.attendance-page > .card { margin-bottom: 18px; }
.period-shortcuts { display: flex; gap: 6px; flex-wrap: wrap; margin: -6px 0 16px; }
.period-shortcuts .btn.is-current { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); font-weight: 650; }
.correction-table input[type="time"] { min-width: 110px; }
.correction-table input[type="text"] { min-width: 160px; }
.correction-table tr.is-new td { background: var(--surface-2); }
.attendance-page td.num { white-space: nowrap; }
details.now-panel { margin-bottom: 18px; }
details.now-panel > summary { cursor: pointer; list-style: none; }
details.now-panel > summary::-webkit-details-marker { display: none; }
details.now-panel > summary h2::before { content: "▸ "; color: var(--muted); }
details.now-panel[open] > summary h2::before { content: "▾ "; }
details.now-panel:not([open]) > summary { border-bottom: 0; }
.gp-template { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 18px; }
.gp-template > div { min-width: 0; flex: 1 1 320px; }
.gp-template .h-section { margin: 0 0 4px; }
.gp-template p { margin: 0; }
.gp-template-actions { display: grid; gap: 8px; justify-items: end; }
.gp-template-upload summary { cursor: pointer; }
.gp-template-upload form { margin-top: 8px; }
.inline-form > div:has(> .multi-select-field) { min-width: 200px; }
.inline-form .multi-select-field { min-width: 0; }
.inline-form .multi-select-field > .label { font-size: 12.5px; font-weight: 500; color: var(--muted); }
