/* ════════════════════════════════════════════════════════════════════════
   alertas.css  —  Control de DOs: Semáforos & Alertas
   Prefijo: al-
   ════════════════════════════════════════════════════════════════════════ */

:root {
    --al-bg:          #f0fafa;
    --al-surface:     #ffffff;
    --al-surface2:    #e8f7f6;
    --al-border:      #c2e8e6;
    --al-border-dark: #8dd4d0;
    --al-teal:        #00a99d;
    --al-teal-dark:   #007f76;
    --al-teal-deep:   #005f58;
    --al-teal-light:  #e0f5f4;
    --al-text:        #0d3533;
    --al-text-mid:    #2a5a57;
    --al-muted:       #6ba3a0;
    --al-green:       #2a9d6e;
    --al-red:         #c0392b;
    --al-amber:       #d97706;
    --al-info:        #0891b2;
    --al-purple:      #7c3aed;
    --al-ok-bg:       rgba(42,157,110,0.10);
    --al-ok-text:     #1e7a56;
    --al-ok-border:   rgba(42,157,110,0.25);
    --al-err-bg:      rgba(192,57,43,0.10);
    --al-err-text:    #c0392b;
    --al-err-border:  rgba(192,57,43,0.25);
}

/* ── TITLE BAND ─────────────────────────────────────────────────────── */
.al-titleband {
    background: var(--al-teal);
    border-bottom: 3px solid var(--al-teal-dark);
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.al-titleband h1 {
    font-weight: 700;
    font-size: 12.5px;
    letter-spacing: 2px;
    color: #fff;
    text-transform: uppercase;
    font-family: 'Inter', sans-serif;
}

/* ── TABS ───────────────────────────────────────────────────────────── */
.al-tabs {
    background: var(--al-surface);
    border-bottom: 2px solid var(--al-border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 0;
    box-shadow: 0 2px 8px rgba(0,169,157,0.08);
}
.al-tab-btn {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 14px 22px;
    border: none;
    background: transparent;
    color: var(--al-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all .2s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.al-tab-btn:hover { color: var(--al-teal-dark); }
.al-tab-active-dash  { color: var(--al-teal-dark) !important; border-bottom: 3px solid var(--al-teal) !important; }
.al-tab-active-det   { color: var(--al-teal-dark) !important; border-bottom: 3px solid var(--al-teal-dark) !important; }

/* ── MAIN WRAPPER ───────────────────────────────────────────────────── */
.al-main        { padding: 20px 24px; max-width: 2200px; margin: 0 auto; background: var(--al-bg); min-height: 100vh; }
.al-main-charts { padding: 20px 24px; max-width: 1400px; margin: 0 auto; background: var(--al-bg); min-height: 100vh; }

/* ── KPI CARDS ──────────────────────────────────────────────────────── */
.al-kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.al-kpi {
    background: var(--al-surface);
    border-radius: 14px;
    border: 1.5px solid var(--al-border);
    padding: 14px 16px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
}
.al-kpi:hover          { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,169,157,0.15); }
.al-kpi.al-kpi-active  { box-shadow: 0 0 0 2.5px var(--al-teal); }
.al-kpi::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    border-radius: 14px 14px 0 0;
}
.al-kpi-red::before    { background: var(--al-red); }
.al-kpi-yellow::before { background: var(--al-amber); }
.al-kpi-green::before  { background: var(--al-green); }
.al-kpi-purple::before { background: var(--al-purple); }
.al-kpi-info::before   { background: var(--al-info); }
.al-kpi-teal::before   { background: var(--al-teal); }

.al-kpi-ico   { font-size: 18px; margin-bottom: 6px; }
.al-kpi-val   { font-weight: 800; font-size: 28px; color: var(--al-teal-deep); line-height: 1; }
.al-kpi-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.4px; color: var(--al-muted); margin-top: 4px; }
.al-kpi-sub   { font-size: 10px; color: var(--al-text-mid); margin-top: 2px; }

/* ── CHARTS ─────────────────────────────────────────────────────────── */
.al-charts-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
    margin-bottom: 18px;
}
.al-charts-grid-full {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 18px;
}
.al-chart-card {
    background: var(--al-surface);
    border-radius: 14px;
    border: 1.5px solid var(--al-border);
    padding: 18px 20px;
    overflow: hidden;
}
.al-chart-title    { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--al-teal-dark); margin-bottom: 3px; }
.al-chart-subtitle { font-size: 10.5px; color: var(--al-muted); margin-bottom: 14px; }
.al-chart-wrap     { position: relative; }
.al-chart-wrap.h300 { height: 300px; }
.al-chart-wrap.h280 { height: 280px; }

/* ── LEYENDA ────────────────────────────────────────────────────────── */
.al-leyenda {
    background: var(--al-surface);
    border-radius: 10px;
    border: 1.5px solid var(--al-border);
    padding: 10px 18px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.al-ley-title { font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--al-teal-dark); }
.al-ley-item  { font-size: 11px; color: var(--al-text-mid); }
.al-ley-sep   { width: 1px; height: 16px; background: var(--al-border); }
.al-ley-ok    { background: var(--al-ok-bg); color: var(--al-ok-text); border: 1px solid var(--al-ok-border); border-radius: 5px; padding: 2px 7px; font-size: 10px; font-weight: 700; }
.al-ley-err   { background: var(--al-err-bg); color: var(--al-err-text); border: 1px solid var(--al-err-border); border-radius: 5px; padding: 2px 7px; font-size: 10px; font-weight: 700; }

/* ── RESUMEN POR OPERATIVO ──────────────────────────────────────────── */
.al-resumen-card { background: var(--al-surface); border-radius: 12px; border: 1.5px solid var(--al-border); margin-bottom: 14px; overflow: hidden; }
.al-resumen-top  {
    background: var(--al-teal-deep);
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}
.al-resumen-top span { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: #fff; }
.al-resumen-body { padding: 14px 18px; }
.al-op-grid      { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.al-op-card {
    background: var(--al-bg);
    border-radius: 10px;
    border: 1.5px solid var(--al-border);
    padding: 11px 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all .15s;
}
.al-op-card:hover        { border-color: var(--al-teal); background: var(--al-teal-light); }
.al-op-card.al-op-active { border-color: var(--al-teal); box-shadow: 0 0 0 2px rgba(0,169,157,0.25); }
.al-op-av {
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 10px; color: #fff; flex-shrink: 0;
}
.al-op-name { font-size: 11px; font-weight: 700; color: var(--al-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.al-op-badges { display: flex; gap: 4px; margin-top: 3px; flex-wrap: wrap; }
.al-ob { font-size: 9px; font-weight: 700; padding: 2px 5px; border-radius: 10px; white-space: nowrap; }
.al-ob-r  { background: rgba(192,57,43,0.12);  color: #c0392b; border: 1px solid rgba(192,57,43,0.25); }
.al-ob-y  { background: rgba(217,119,6,0.10);  color: #92400e; border: 1px solid rgba(217,119,6,0.25); }
.al-ob-g  { background: rgba(42,157,110,0.12); color: #1e7a56; border: 1px solid rgba(42,157,110,0.25); }
.al-ob-al { background: rgba(109,40,217,0.08); color: #5b21b6; border: 1px solid rgba(109,40,217,0.2); }

/* ── FILTERS ────────────────────────────────────────────────────────── */
.al-filter-card {
    background: var(--al-surface);
    border-radius: 12px;
    border: 1.5px solid var(--al-border);
    padding: 14px 18px;
    margin-bottom: 14px;
}
.al-filter-title { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--al-teal-dark); margin-bottom: 12px; }
.al-filters-row  { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr 1fr auto auto; gap: 12px; align-items: end; }
.al-f-label      { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--al-muted); margin-bottom: 5px; }
.al-f-input {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    background: var(--al-bg);
    border: 1.5px solid var(--al-border);
    border-radius: 8px;
    padding: 7px 10px;
    color: var(--al-text);
    width: 100%;
    outline: none;
    transition: border .2s, box-shadow .2s;
    cursor: pointer;
}
.al-f-input:focus { border-color: var(--al-teal); box-shadow: 0 0 0 3px rgba(0,169,157,0.12); }
.al-btn-p {
    background: var(--al-teal);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 10.5px;
    letter-spacing: .8px;
    text-transform: uppercase;
    padding: 8px 16px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(0,169,157,0.3);
    transition: all .2s;
}
.al-btn-p:hover { transform: translateY(-1px); }
.al-btn-s {
    background: transparent;
    border: 1.5px solid var(--al-border);
    border-radius: 8px;
    color: var(--al-muted);
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 10.5px;
    letter-spacing: .8px;
    text-transform: uppercase;
    padding: 8px 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all .2s;
}
.al-btn-s:hover { color: var(--al-red); border-color: var(--al-red); }

/* ── TABLE ──────────────────────────────────────────────────────────── */
.al-table-card { background: var(--al-surface); border-radius: 12px; border: 1.5px solid var(--al-border); overflow: hidden; margin-top: 14px; }
.al-table-header {
    background: var(--al-teal);
    padding: 11px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.al-table-title { font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: 1.5px; color: #fff; }
.al-table-count { font-size: 11px; color: rgba(255,255,255,0.78); background: rgba(255,255,255,0.15); border-radius: 20px; padding: 3px 11px; }
.al-table-wrap  { overflow-x: auto; }

.al-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.al-table thead tr.al-group-row th {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 6px 10px 4px;
    text-align: center;
    color: #fff;
}
.al-th-base  { background: var(--al-teal-deep); }
.al-th-alert { background: #9b2335; }
.al-th-count { background: #5b21b6; }

.al-table thead tr.al-col-row th {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1.3px;
    color: var(--al-teal-dark);
    padding: 7px 10px;
    border-bottom: 2px solid var(--al-border-dark);
    white-space: nowrap;
    text-align: left;
    background: var(--al-surface2);
    cursor: pointer;
    user-select: none;
}
.al-table thead tr.al-col-row th:hover  { color: var(--al-teal); }
.al-th-a    { color: #9b2335 !important; background: #fdf0ef !important; }
.al-th-cnt  { color: #5b21b6 !important; background: #f5f0ff !important; }

.al-table td {
    font-size: 11px;
    color: var(--al-text);
    padding: 8px 10px;
    border-bottom: 1px solid rgba(194,232,230,0.4);
    vertical-align: middle;
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
}
.al-table tr:last-child td { border-bottom: none; }
.al-row-red    td { background: rgba(192,57,43,0.035); }
.al-row-red:hover td { background: rgba(192,57,43,0.08); }
.al-row-yellow    td { background: rgba(217,119,6,0.025); }
.al-row-yellow:hover td { background: rgba(217,119,6,0.07); }
.al-row-green    td { background: rgba(42,157,110,0.03); }
.al-row-green:hover td { background: rgba(42,157,110,0.07); }

.al-cell-ok  { background: var(--al-ok-bg) !important; color: var(--al-ok-text); font-family: 'Inter', sans-serif; font-size: 10px; font-weight: 700; text-align: center; border-left: 2px solid var(--al-ok-border); }
.al-cell-err { background: var(--al-err-bg) !important; color: var(--al-err-text); font-family: 'Inter', sans-serif; font-size: 10px; font-weight: 700; text-align: center; border-left: 2px solid var(--al-err-border); }

.al-empty-row td { text-align: center; padding: 28px; font-family: 'Inter', sans-serif; font-size: 13px; color: var(--al-muted); }

/* ── BADGES ─────────────────────────────────────────────────────────── */
.al-badge      { font-family: 'Inter', sans-serif; font-weight: 700; font-size: 9.5px; letter-spacing: .4px; padding: 3px 9px; border-radius: 20px; display: inline-block; white-space: nowrap; }
.al-b-fact     { background: rgba(217,119,6,.10); color: #92400e; border: 1px solid rgba(217,119,6,.28); }
.al-b-tram     { background: rgba(8,145,178,.10); color: #0369a1; border: 1px solid rgba(8,145,178,.28); }
.al-b-cerrar   { background: rgba(42,157,110,.12); color: #1e7a56; border: 1px solid rgba(42,157,110,.3); }
.al-b-alerta   { background: rgba(192,57,43,.10); color: #c0392b; border: 1px solid rgba(192,57,43,.28); }
.al-b-tipo     { background: var(--al-surface2); color: var(--al-teal-dark); border: 1px solid var(--al-border-dark); font-size: 9px; }
.al-b-poliza   { background: rgba(109,40,217,.08); color: #5b21b6; border: 1px solid rgba(109,40,217,.2); font-size: 9px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; display: inline-block; }

/* ── OPERATIVO CELL ─────────────────────────────────────────────────── */
.al-av     { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 8.5px; color: #fff; flex-shrink: 0; }
.al-op-cell { display: flex; align-items: center; gap: 6px; }
.al-op-name { font-family: 'Inter', sans-serif; font-size: 10.5px; color: var(--al-text-mid); }
.al-do-code { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; font-weight: 500; color: var(--al-teal-dark); background: #e8f7f6; border: 1px solid var(--al-border); border-radius: 5px; padding: 2px 7px; }
.al-sem-dot { font-size: 14px; display: block; text-align: center; }
.al-act-text { font-family: 'Inter', sans-serif; font-size: 10.5px; color: var(--al-text-mid); max-width: 170px; overflow: hidden; text-overflow: ellipsis; display: block; }
.al-eta-val  { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: var(--al-text-mid); }
.al-dias-c   { text-align: center; font-weight: 500; }
.al-nd       { color: var(--al-muted); font-size: 13px; }
.al-emp-tag  { font-family: 'Inter', sans-serif; font-size: 8.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; background: var(--al-surface2); color: var(--al-teal-dark); border: 1px solid var(--al-border); border-radius: 4px; padding: 2px 6px; white-space: nowrap; }
.al-row-num  { font-size: 10px; color: var(--al-muted); font-family: 'JetBrains Mono', monospace; }

/* ── BARRA PROGRESO ─────────────────────────────────────────────────── */
.al-prog-wrap  { display: flex; align-items: center; gap: 6px; min-width: 90px; }
.al-prog-bar   { flex: 1; height: 7px; background: rgba(0,0,0,0.07); border-radius: 4px; overflow: hidden; }
.al-prog-fill  { height: 100%; border-radius: 4px; }
.al-p0 { background: #2a9d6e; width: 0%; }
.al-p1 { background: #2a9d6e; width: 20%; }
.al-p2 { background: #65a830; width: 40%; }
.al-p3 { background: var(--al-amber); width: 60%; }
.al-p4 { background: #d05b0a; width: 80%; }
.al-p5 { background: var(--al-red); width: 100%; }
.al-prog-label { font-weight: 800; font-size: 11px; min-width: 22px; text-align: right; }
.al-pl0 { color: #1e7a56; } .al-pl1 { color: #2a9d6e; } .al-pl2 { color: #65a830; }
.al-pl3 { color: #b45309; } .al-pl4 { color: #d05b0a; } .al-pl5 { color: var(--al-red); }

/* ── FOOTER ─────────────────────────────────────────────────────────── */
.al-footer {
    margin-top: 20px;
    padding: 12px 0 6px;
    border-top: 2px solid var(--al-border);
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--al-muted);
}
.al-footer span:nth-child(2) { text-align: center; }
.al-footer span:nth-child(3) { text-align: right; }

/* ── NO DATA ────────────────────────────────────────────────────────── */
.al-nodata { text-align: center; padding: 40px; font-family: 'Inter', sans-serif; font-size: 13px; color: var(--al-muted); }

/* ── EXPORT BUTTON ──────────────────────────────────────────────────── */
.al-btn-export {
    background: var(--al-teal);
    border: 1.5px solid var(--al-teal-dark);
    border-radius: 8px;
    color: #fff;
    font-weight: 700;
    font-size: 10.5px;
    letter-spacing: .8px;
    text-transform: uppercase;
    padding: 7px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background .2s;
    margin-right: 4px;
}
.al-btn-export:hover    { background: var(--al-teal-dark); }
.al-btn-export:disabled { opacity: 0.45; cursor: not-allowed; }

@keyframes al-fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.al-fadein { animation: al-fadeUp .35s ease both; }
