/* ── Componentes interactivos de la consola ─────────────────────────────── */
[hidden] { display: none !important; }
button { font-family: var(--font); }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* Login */
.login { display: grid; grid-template-columns: 1fr 1fr; height: 100vh; width: 100%; background: var(--surface); }
.l-brand { background: var(--navy); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; }
.l-brand .mark { display: flex; align-items: center; gap: 12px; }
.l-brand .mark img { width: 44px; height: 44px; border-radius: 10px; }
.l-brand .mark b { font-size: 18px; font-weight: 700; }
.l-brand .mid { margin: auto 0; max-width: 440px; }
.l-brand h2 { font-size: 30px; line-height: 1.2; margin: 0 0 14px; font-weight: 700; letter-spacing: -.02em; }
.l-brand p { color: var(--navy-text); font-size: 15px; line-height: 1.6; margin: 0; }
.l-brand footer { color: #6f81a0; font-size: 12px; }
.l-form { display: grid; place-items: center; padding: 40px; }
.l-form form { width: 100%; max-width: 360px; }
.l-form h1 { font-size: 24px; margin: 0 0 6px; font-weight: 700; letter-spacing: -.01em; }
.l-form .sub { color: var(--text-2); margin: 0 0 26px; font-size: 14px; }
.l-form label { display: block; font-weight: 600; font-size: 13px; margin: 0 0 6px; }
.l-form .input { height: 40px; font-size: 14px; margin-bottom: 16px; }
.l-form .row { display: flex; justify-content: space-between; align-items: center; margin: -4px 0 22px; font-size: 13px; }
.l-form .row label { display: inline-flex; gap: 7px; align-items: center; color: var(--text-2); font-weight: 500; margin: 0; cursor: pointer; }
.l-form .btn { width: 100%; height: 42px; justify-content: center; font-size: 14.5px; }
.l-form .err { color: var(--danger); background: var(--danger-bg); border-radius: 6px; padding: 8px 10px; margin-bottom: 14px; font-size: 13px; }

/* Menús desplegables */
.menu { position: fixed; z-index: 50; min-width: 200px; max-width: 320px; max-height: 380px; overflow-y: auto; background: var(--surface);
        border: 1px solid var(--border-2); border-radius: 8px; box-shadow: 0 10px 30px rgba(16,24,40,.16); padding: 4px; }
.menu .it { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: 6px;
            font: 13px var(--font); color: var(--text); text-align: left; cursor: pointer; }
.menu .it:hover, .menu .it.act { background: #f0f3f7; }
.menu .it .ok { margin-left: auto; color: var(--brand); }
.menu .sepm { height: 1px; background: var(--border); margin: 4px 2px; }
.menu .hd { padding: 6px 10px 4px; font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.menu input.input { margin: 4px 0 6px; }

/* Ventana modal */
.modal-bg { position: fixed; inset: 0; z-index: 60; background: rgba(11,31,58,.38); display: grid; place-items: center; padding: 20px; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow-y: auto; background: var(--surface); border-radius: 12px; box-shadow: 0 24px 60px rgba(16,24,40,.25); }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal header h3 { margin: 0; font-size: 16px; font-weight: 700; }
.modal .body { padding: 18px 20px; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 12px 12px; }
.fld { margin-bottom: 14px; }
.fld label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 5px; }
.fld .help { color: var(--text-3); font-size: 12px; margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
textarea.input { height: auto; min-height: 90px; padding: 8px 10px; resize: vertical; line-height: 1.5; }

/* Avisos emergentes */
.toasts { position: fixed; z-index: 70; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #1b2430; color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 500; box-shadow: var(--shadow-2); display: flex; gap: 8px; align-items: center; }
.toast.err { background: var(--danger); }

/* Buscador global */
.search-res { position: absolute; top: 38px; left: 0; width: 560px; max-height: 520px; overflow-y: auto; z-index: 40; background: var(--surface);
              border: 1px solid var(--border-2); border-radius: 10px; box-shadow: 0 14px 40px rgba(16,24,40,.18); padding: 6px; }
.search-res .hd { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.search-res a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 6px; color: var(--text); }
.search-res a:hover, .search-res a.act { background: #f0f3f7; text-decoration: none; }
.search-res a .id { color: var(--text-3); font-size: 12px; font-weight: 600; white-space: nowrap; }
.search-res a .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-res .empty { padding: 14px 10px; color: var(--text-3); }

/* Notificaciones */
.notif .it { align-items: flex-start; }
.notif .it small { display: block; color: var(--text-3); font-size: 11.5px; }
.notif .it.nueva { background: var(--brand-50); }
.bell.sin::after { display: none; }

/* Estados vacíos y carga */
.empty-state { padding: 60px 20px; text-align: center; color: var(--text-2); }
.empty-state .ic { width: 34px; height: 34px; color: var(--text-3); margin-bottom: 10px; }
.empty-state h3 { margin: 0 0 4px; color: var(--text); font-size: 15px; }
.cargando { padding: 40px; text-align: center; color: var(--text-3); }
.banner { display: flex; align-items: center; gap: 8px; padding: 8px 22px; font-size: 12.5px; }
.banner.info { background: var(--brand-50); color: var(--brand-700); border-bottom: 1px solid var(--brand-100); }
.banner .link { font-weight: 600; }

/* Tabla */
table.tk tbody tr { cursor: pointer; }
table.tk tr.kb td { box-shadow: inset 3px 0 0 var(--brand); }
.cb { cursor: pointer; }
.fbtn { cursor: pointer; }
.view { cursor: pointer; }

/* Editor */
.ctext[contenteditable] { outline: none; color: var(--text); min-height: 90px; max-height: 260px; overflow-y: auto; }
.ctext[contenteditable]:empty::before { content: attr(data-ph); color: var(--text-3); }
.ctext p { margin: 0 0 6px; }
.composer.nota { border-color: var(--note-border); }
.composer.nota .ctext { background: #fffdf3; }
.ctab { cursor: pointer; background: none; border-top: 0; border-left: 0; border-right: 0; font: 600 13px var(--font); }
.ctab.on.n { color: var(--note); border-color: #d9a400; }
.adjs { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 14px 8px; }
.adjs .chip { height: 24px; }
.msg .mb a { word-break: break-all; }
.msg .mb ul, .msg .mb ol { margin: 0 0 8px; padding-left: 20px; }
.msg .mb blockquote { margin: 0 0 8px; padding-left: 10px; border-left: 3px solid var(--border-2); color: var(--text-2); }

/* Panel derecho */
.tags { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.tags .chip .x { cursor: pointer; opacity: .6; }
.tags input { border: 0; outline: none; font: 12.5px var(--font); width: 100px; padding: 2px; }
.cust textarea { width: 100%; }

/* Páginas de contenido (clientes, ajustes) */
.page { flex: 1; overflow-y: auto; }
.page-head { padding: 20px 26px 14px; background: var(--surface); border-bottom: 1px solid var(--border); }
.page-head h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.page-body { padding: 20px 26px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 18px; }
.panel > header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.panel > header h2 { margin: 0; font-size: 14px; font-weight: 700; }
table.simple { width: 100%; border-collapse: collapse; }
table.simple th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text-2); padding: 8px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
table.simple td { padding: 9px 14px; border-bottom: 1px solid #eef1f4; }
table.simple tr.cl { cursor: pointer; }
table.simple tr.cl:hover td { background: #f8fafd; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; padding: 14px 16px; margin: 0; }
.kv dt { color: var(--text-2); } .kv dd { margin: 0; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 15px; background: var(--surface-2); border: 1px dashed var(--border-2); padding: 10px 12px; border-radius: 6px; user-select: all; }

/* Pestañas: la x de cerrar no se recorta; líneas de sistema con texto continuo */
.tab [data-cerrar] { flex: none; overflow: visible; opacity: .6; }
.tab [data-cerrar]:hover { opacity: 1; }
.ev-sys > span b { font-weight: 600; }

/* ── Informes ─────────────────────────────────────────────────────────── */
.filtros { display: flex; align-items: center; gap: 12px; padding: 12px 26px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.filtros .spacer { flex: 1; }
.seg-f { display: flex; background: #eef1f5; border-radius: 8px; padding: 3px; }
.seg-f button { height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: none; font: 600 12.5px var(--font); color: var(--text-2); cursor: pointer; }
.seg-f button:hover { color: var(--text); }
.seg-f button.on { background: #fff; color: var(--text); box-shadow: var(--shadow-1); }
.rng { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 12.5px; }
.rng .input { height: 32px; width: 150px; }
.inf-body { transition: opacity .15s; }
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; }
.kpi .lbl { color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.kpi .val { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 6px 0 4px; color: var(--text); }
.kpi .sub { color: var(--text-3); font-size: 12px; line-height: 1.4; }
.bad { color: var(--danger); display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.inf-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.chart-p .chart { padding: 10px 14px 0; }
.chart svg { display: block; }
.chart .ax { font-size: 11px; fill: #7d889a; font-family: var(--font); font-variant-numeric: tabular-nums; }
.leyenda { display: flex; gap: 14px; color: var(--text-2); font-size: 12px; }
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.datos { padding: 4px 16px 12px; }
.datos summary { cursor: pointer; color: var(--brand); font-size: 12.5px; font-weight: 600; padding: 6px 0; }
.tabla-scroll { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; }
table.simple .r { text-align: right; }
.des-t td.k { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.des-t td, .des-t th { padding: 7px 14px; }
.hbar { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.hbar i { display: block; height: 8px; border-radius: 0 4px 4px 0; background: var(--brand); max-width: calc(100% - 34px); }
.hbar span { font-size: 12.5px; color: var(--text); }
.inf-tip { position: fixed; z-index: 80; pointer-events: none; background: #fff; border: 1px solid var(--border-2); border-radius: 8px;
           box-shadow: var(--shadow-2); padding: 8px 10px; font-size: 12px; min-width: 150px; }
.inf-tip .t { color: var(--text-2); margin-bottom: 4px; }
.inf-tip .f { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.inf-tip .f i { width: 12px; height: 2px; border-radius: 1px; display: inline-block; }
.inf-tip .f b { font-size: 13px; font-weight: 700; color: var(--text); min-width: 18px; }
.inf-tip .f span { color: var(--text-2); }
@media (max-width: 1400px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .inf-grid2 { grid-template-columns: 1fr; } }

/* Ajustes: reglas */
.casillas { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.casillas label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13px; }
.sub-h { margin: 6px 0 10px; font-size: 13px; font-weight: 700; padding-top: 10px; border-top: 1px solid var(--border); }
.sub-h .faint { font-weight: 400; font-size: 12px; }
