/* ============================================================
   PlanetGOLD Bolivia — Sistema de Monitoreo
   Paleta institucional aplicada
   ============================================================ */

:root {
    --gray:      #5B6770;
    --gray-dark: #4a545c;
    --gray-light:#eef0f1;
    --gold:      #B58500;
    --gold-light:#fff3e0;
    --blue:      #00A3E0;
    --blue-light:#e6f6fd;
    --green:     #83BD00;
    --teal:      #00C389;
    --orange:    #FF9E1B;
    --white:     #FFFFFF;
    --bg:        #f4f5f6;
    --text:      #2c3135;
    --text-muted:#5B6770;
    --border:    #d8dde1;

    --sem-red:   #E24B4A;
    --sem-amber: #EF9F27;
    --sem-green: #1D9E75;
    --sem-red-bg:#fde8e8;
    --sem-amb-bg:#fff3e0;
    --sem-grn-bg:#e6f7ef;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
}

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

/* ── Layout ─────────────────────────────────────────── */
.page-wrapper { max-width: 1400px; margin: 0 auto; }

.topbar {
    background: var(--gray);
    padding: 11px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-logo {
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .3px;
    text-decoration: none;
}
.topbar-logo span { color: var(--gold); }
.topbar-logo em { color: #c5d0d8; font-weight: 300; font-size: 13px; font-style: normal; }
.topbar-user { display: flex; align-items: center; gap: 14px; }
.user-info { color: #c5d0d8; font-size: 12px; }
.btn-logout {
    color: var(--blue);
    font-size: 12px;
    padding: 4px 10px;
    border: 1px solid var(--blue);
    border-radius: 4px;
    text-decoration: none;
}
.btn-logout:hover { background: var(--blue); color: #fff; text-decoration: none; }

.navbar {
    background: var(--gray-dark);
    display: flex;
    padding: 0 24px;
    overflow-x: auto;
}
.nav-link {
    color: #b0bec5;
    font-size: 13px;
    padding: 10px 18px;
    border-bottom: 3px solid transparent;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    display: block;
}
.nav-link:hover { color: #fff; text-decoration: none; background: rgba(255,255,255,.05); }
.nav-link.active { color: #fff; border-bottom-color: var(--gold); background: rgba(181,133,0,.10); }
.admin-link { margin-left: auto; color: var(--blue) !important; }
.admin-link.active { border-bottom-color: var(--blue) !important; }

.content { padding: 24px; }

/* ── Cards ───────────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: 8px;
    padding: 18px 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    margin-bottom: 18px;
}
.card-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

/* ── KPI Cards ───────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-card {
    background: var(--white);
    border-radius: 8px;
    padding: 16px 18px;
    border-left: 4px solid var(--gold);
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.kpi-card.blue  { border-left-color: var(--blue); }
.kpi-card.teal  { border-left-color: var(--teal); }
.kpi-card.orange{ border-left-color: var(--orange); }
.kpi-card.alert { border-left-color: var(--sem-red); }
.kpi-card.green { border-left-color: var(--sem-green); }
.kpi-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 5px; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1.1; }
.kpi-sub   { font-size: 11px; color: #8a9299; margin-top: 4px; }

/* ── Grid helpers ────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) { .grid-2, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ── Progress bars ───────────────────────────────────── */
.progress-track { background: var(--gray-light); border-radius: 4px; height: 20px; overflow: hidden; position: relative; }
.progress-fill  { height: 100%; border-radius: 4px; display: flex; align-items: center; justify-content: center; min-width: 40px; transition: width .4s ease; }
.progress-fill span { font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.progress-fill.red   { background: var(--sem-red); }
.progress-fill.amber { background: var(--sem-amber); }
.progress-fill.green { background: var(--sem-green); }

/* ── Badges / Semáforos ──────────────────────────────── */
.badge { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 10px; font-weight: 700; }
.badge.red   { background: var(--sem-red-bg);  color: #9b2222; }
.badge.amber { background: var(--sem-amb-bg);  color: #7a4a00; }
.badge.green { background: var(--sem-grn-bg);  color: #0a5a35; }
.badge.op    { background: var(--gold-light);   color: #7a5a00; }
.badge.info  { background: var(--blue-light);   color: #005880; }

.sem-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.sem-dot.red   { background: var(--sem-red); }
.sem-dot.amber { background: var(--sem-amber); }
.sem-dot.green { background: var(--sem-green); }

/* ── Alertas ─────────────────────────────────────────── */
.alert-bar {
    background: #fff8e1;
    border-left: 4px solid var(--orange);
    border-radius: 0 6px 6px 0;
    padding: 10px 16px;
    font-size: 12px;
    color: #7a4a00;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.alert-bar.info { background: var(--blue-light); border-left-color: var(--blue); color: #005880; }
.alert-success  { background: var(--sem-grn-bg); border-left: 4px solid var(--sem-green); border-radius: 0 6px 6px 0; padding: 10px 16px; font-size: 12px; color: #0a5a35; margin-bottom: 14px; }
.alert-error    { background: var(--sem-red-bg); border-left: 4px solid var(--sem-red); border-radius: 0 6px 6px 0; padding: 10px 16px; font-size: 12px; color: #7a1a1a; margin-bottom: 14px; }

/* ── Tabla de indicadores ────────────────────────────── */
.ind-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ind-table th {
    background: var(--gray);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 9px 10px;
    text-align: center;
    letter-spacing: .4px;
    text-transform: uppercase;
    white-space: nowrap;
}
.ind-table th.th-item { text-align: left; width: 170px; }
.ind-table td { border-bottom: 1px solid var(--gray-light); vertical-align: top; padding: 8px 6px; }
.ind-table tr:last-child td { border-bottom: none; }
.ind-table tr.row-header td { background: rgba(181,133,0,.10); padding: 7px 10px; }
.ind-table tr.row-op td { background: #f0f6ff; }
.ind-table tr.row-zero td { background: #fff8f8; }
.ind-table tr:hover td { background: #fafbfc; }
.ind-table tr.row-header:hover td, .ind-table tr.row-op:hover td { background: none; }

.cell-item { width: 170px; min-width: 150px; }
.cell-code {
    display: inline-block; padding: 2px 6px; border-radius: 3px;
    font-size: 10px; font-weight: 700; font-family: monospace;
    background: var(--blue-light); color: var(--blue); margin-bottom: 4px;
}
.cell-code.op { background: var(--gold-light); color: var(--gold); }
.cell-code.header { background: rgba(181,133,0,.15); color: var(--gold); font-size: 11px; }
.cell-name { font-size: 11px; color: var(--text); line-height: 1.4; }
.cell-name.muted { color: var(--text-muted); }
.cell-header-name { font-size: 11px; font-weight: 700; color: #5a3d00; line-height: 1.4; }

.cell-chart { width: 230px; min-width: 200px; }
.cell-avance { width: 150px; min-width: 130px; }
.cell-sexo { width: 210px; min-width: 190px; }

.chart-label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-align: center; margin-bottom: 4px; }
.chart-canvas-wrap { position: relative; height: 120px; }

.nota-box {
    background: #fffbe6;
    border: 1px solid #f0e0a0;
    border-radius: 5px;
    padding: 8px 10px;
    font-size: 10px;
    color: #5a4a00;
    line-height: 1.5;
}

/* Avance bar en tabla */
.avance-wrap { padding: 4px 0; }
.avance-row-label { font-size: 10px; color: var(--text-muted); margin-bottom: 3px; }
.avance-track { background: var(--gray-light); border-radius: 3px; height: 28px; position: relative; overflow: hidden; }
.avance-fill { height: 100%; border-radius: 3px; display: flex; align-items: center; justify-content: center; min-width: 42px; transition: width .5s; }
.avance-fill .pct-label { font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.25); }

/* Botón ingresar dato */
.btn-dato {
    display: inline-block;
    margin-top: 6px;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--gold);
    color: var(--gold);
    cursor: pointer;
    background: none;
    font-family: inherit;
    white-space: nowrap;
}
.btn-dato:hover { background: var(--gold); color: #fff; }
.btn-dato.primary { background: var(--gold); color: #fff; }
.btn-dato.primary:hover { background: #9a7000; }

/* ── Formulario modal ────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
    background: #fff;
    border-radius: 10px;
    padding: 28px;
    width: 540px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.modal-subtitle { font-size: 11px; color: var(--text-muted); margin-bottom: 18px; line-height: 1.5; }
.modal-close {
    position: absolute; top: 12px; right: 16px;
    font-size: 20px; cursor: pointer; color: var(--text-muted);
    background: none; border: none; line-height: 1;
}

/* ── Formularios ─────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid.cols3 { grid-template-columns: 1fr 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 11px; font-weight: 700; color: var(--text-muted); }
.field input, .field select, .field textarea {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(181,133,0,.15);
}
.field-note { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.gender-info { background: var(--blue-light); border-radius: 5px; padding: 8px 12px; font-size: 11px; color: #005880; margin-bottom: 12px; }

/* ── Botones ─────────────────────────────────────────── */
.btn { padding: 9px 20px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; font-family: inherit; display: inline-flex; align-items: center; gap: 6px; }
.btn-primary { background: var(--gold); color: #fff; }
.btn-primary:hover { background: #9a7000; }
.btn-secondary { background: #fff; color: var(--gray); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--gray-light); }
.btn-danger { background: var(--sem-red); color: #fff; }
.btn-danger:hover { background: #c03030; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap; }

/* ── Tabla admin ─────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; font-size: 11px; color: var(--text-muted); font-weight: 700; padding: 8px 12px; border-bottom: 2px solid var(--gray-light); text-transform: uppercase; letter-spacing: .4px; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-light); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbfc; }

/* ── Login page ──────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--gray-dark); }
.login-card { background: #fff; border-radius: 12px; padding: 40px; width: 380px; max-width: 95vw; box-shadow: 0 8px 32px rgba(0,0,0,.25); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .name { font-size: 26px; font-weight: 700; color: var(--gray); }
.login-logo .name span { color: var(--gold); }
.login-logo .sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; }
.login-field input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; font-family: inherit; }
.login-field input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px rgba(181,133,0,.15); }
.btn-login { width: 100%; padding: 12px; background: var(--gold); color: #fff; border: none; border-radius: 6px; font-size: 15px; font-weight: 700; cursor: pointer; margin-top: 8px; font-family: inherit; }
.btn-login:hover { background: #9a7000; }
.login-error { background: var(--sem-red-bg); color: #7a1a1a; padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; }

/* ── Dashboard comp bars ─────────────────────────────── */
.comp-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.comp-bar-name { font-size: 12px; font-weight: 500; color: var(--text-muted); width: 110px; flex-shrink: 0; }
.comp-bar-track { flex: 1; background: var(--gray-light); border-radius: 4px; height: 18px; overflow: hidden; }
.comp-bar-fill { height: 100%; border-radius: 4px; display: flex; align-items: center; padding: 0 6px; }
.comp-bar-fill span { font-size: 10px; font-weight: 700; color: #fff; }
.comp-bar-pct { width: 42px; text-align: right; font-size: 12px; font-weight: 600; flex-shrink: 0; }

/* ── Filtros tabs ────────────────────────────────────── */
.filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.tab-btn { font-size: 12px; padding: 5px 14px; border-radius: 20px; cursor: pointer; border: 1px solid var(--border); background: #fff; color: var(--text-muted); font-family: inherit; }
.tab-btn.active { background: var(--gray); color: #fff; border-color: var(--gray); }
.tab-btn:hover:not(.active) { background: var(--gray-light); }

/* ── Update bar ──────────────────────────────────────── */
.update-bar {
    background: #fff;
    border-radius: 6px;
    padding: 8px 16px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
    border-left: 4px solid var(--gold);
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.update-bar strong { color: var(--gold); }

/* ── Stat mini ───────────────────────────────────────── */
.stat-mini { background: var(--gray-light); border-radius: 6px; padding: 10px 14px; text-align: center; }
.stat-mini .num { font-size: 20px; font-weight: 700; color: var(--gold); }
.stat-mini .lbl { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; margin-top: 2px; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 1100px) {
    .cell-chart, .cell-avance, .cell-sexo { min-width: 140px; }
}
@media (max-width: 768px) {
    .content { padding: 14px; }
    .modal { padding: 20px; }
    .form-grid { grid-template-columns: 1fr; }
}

/* ── Scrollbar ───────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-light); }
::-webkit-scrollbar-thumb { background: var(--gray); border-radius: 3px; }

/* ── Page content wrapper ────────────────────────────── */
.page-content { max-width: 1400px; margin: 0 auto; padding: 24px 20px; }

/* ── Section title ───────────────────────────────────── */
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); margin: 0 0 14px; padding-bottom: 6px; border-bottom: 2px solid var(--gold); display: inline-block; }

/* ── Card ────────────────────────────────────────────── */
.card { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.07); padding: 20px; }
.card-title { font-size: 13px; font-weight: 700; color: var(--gray); margin-bottom: 14px; text-transform: uppercase; letter-spacing: .4px; }

/* ── KPI cards ───────────────────────────────────────── */
.kpi-card { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.07); padding: 18px 20px; border-top: 4px solid var(--gray); }
.kpi-card.kpi-blue   { border-top-color: var(--blue); }
.kpi-card.kpi-orange { border-top-color: var(--orange); }
.kpi-card.kpi-teal   { border-top-color: var(--teal); }
.kpi-card.kpi-red    { border-top-color: var(--sem-red); }
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 6px; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--gray-dark); line-height: 1.1; }
.kpi-sub   { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.kpi-bar   { height: 5px; background: var(--gray-light); border-radius: 3px; margin: 10px 0 4px; overflow: hidden; }
.kpi-bar-fill { height: 100%; border-radius: 3px; transition: width .3s; }
.kpi-pct   { font-size: 13px; font-weight: 700; }
.kpi-pct.green { color: var(--sem-green); }
.kpi-pct.amber { color: var(--sem-amber); }
.kpi-pct.red   { color: var(--sem-red); }

/* ── Status table (dashboard) ────────────────────────── */
.status-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.status-table th { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px; border-bottom: 2px solid var(--gray-light); }
.status-table td { padding: 10px 10px; border-bottom: 1px solid var(--gray-light); vertical-align: middle; }
.status-table tr:last-child td { border-bottom: none; }
.comp-link { font-weight: 600; color: var(--gray); }
.comp-link:hover { color: var(--gold); }

/* ── Component quick-access cards ───────────────────── */
.comp-card { display: flex; flex-direction: column; align-items: flex-start; background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.07); padding: 20px; border-left: 5px solid var(--gray); color: var(--text); transition: box-shadow .2s; text-decoration: none; }
.comp-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.12); text-decoration: none; }
.comp-card.comp-green { border-left-color: var(--sem-green); }
.comp-card.comp-amber { border-left-color: var(--sem-amber); }
.comp-card.comp-red   { border-left-color: var(--sem-red); }
.comp-num  { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); }
.comp-name { font-size: 14px; font-weight: 700; margin: 6px 0 10px; color: var(--gray-dark); }
.comp-pct  { font-size: 22px; font-weight: 700; color: var(--gray); }
.comp-sem  { margin-top: 8px; }

/* ── Alerts ──────────────────────────────────────────── */
.alert-success { background: var(--sem-grn-bg); color: #0a5438; padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; }
.alert-error   { background: var(--sem-red-bg); color: #7a1a1a;  padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; }

/* ── Component page header ───────────────────────────── */
.comp-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid var(--gray-light); }
.comp-header-title { font-size: 20px; font-weight: 700; color: var(--gray-dark); }
.comp-header-sub   { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.comp-header-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.year-selector { display: flex; gap: 4px; }
.year-btn { padding: 6px 14px; border-radius: 6px; border: 1px solid var(--border); background: #fff; font-size: 12px; color: var(--text-muted); font-weight: 600; cursor: pointer; }
.year-btn.active { background: var(--gold); color: #fff; border-color: var(--gold); }
.year-btn:hover:not(.active) { background: var(--gray-light); }

/* ── Section divider (between OP and component) ──────── */
.section-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 8px; }
.section-divider::before, .section-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.section-divider span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); white-space: nowrap; }

/* ── Indicator section headers ───────────────────────── */
.ind-section-header { background: var(--gray-light); border-radius: 6px; padding: 10px 16px; margin: 12px 0 4px; font-weight: 700; font-size: 13px; color: var(--gray); display: flex; align-items: center; gap: 10px; }
.ind-section-header.op-header { background: #e8f4f9; color: #005880; border-left: 4px solid var(--blue); }
.ind-code { font-size: 11px; font-weight: 700; background: var(--gray); color: #fff; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.ind-code.op-code { background: var(--blue); }

/* ── Indicator data row ──────────────────────────────── */
.ind-row { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 12px; overflow: hidden; border-left: 4px solid transparent; }
.ind-row.row-op   { border-left-color: var(--blue); }
.ind-row.row-zero { border-left-color: var(--sem-red); }

.ind-row-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 12px 16px 8px; border-bottom: 1px solid var(--gray-light); }
.ind-info { display: flex; align-items: flex-start; gap: 8px; flex: 1; flex-wrap: wrap; }
.ind-desc { font-size: 13px; color: var(--text); flex: 1; min-width: 200px; }
.ind-unit { font-size: 11px; color: var(--text-muted); font-style: italic; white-space: nowrap; }
.ind-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; white-space: nowrap; }
.meta-label { color: var(--text-muted); }
.meta-val   { font-weight: 700; color: var(--gray-dark); }

/* ── Trimester cells ─────────────────────────────────── */
.trim-row { display: flex; gap: 4px; padding: 10px 16px; flex-wrap: wrap; border-bottom: 1px solid var(--gray-light); }
.trim-cell { flex: 1; min-width: 80px; background: var(--gray-light); border-radius: 6px; padding: 8px 10px; text-align: center; }
.trim-cell.trim-total { background: #e8f4f9; border: 1px solid #b3d9ee; }
.trim-cell.trim-empty { opacity: .75; }
.trim-label { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.trim-value { font-size: 16px; font-weight: 700; color: var(--gray-dark); }
.trim-gender { font-size: 10px; color: var(--text-muted); margin-top: 3px; display: flex; gap: 6px; justify-content: center; }
.btn-dato { margin-top: 6px; font-size: 10px; padding: 3px 10px; background: var(--gold); color: #fff; border: none; border-radius: 4px; cursor: pointer; font-family: inherit; font-weight: 600; }
.btn-dato:hover { background: #9a7000; }

/* ── Charts row (3 panels) ───────────────────────────── */
.charts-row { display: grid; grid-template-columns: 2fr 1fr 2fr; gap: 12px; padding: 12px 16px; }
.chart-panel { display: flex; flex-direction: column; }
.chart-panel-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid var(--gray-light); }
.chart-wrap { position: relative; }
.chart-panel-empty { opacity: .5; }
.no-gender-msg { font-size: 11px; color: var(--text-muted); font-style: italic; padding: 20px 0; text-align: center; }
.avance-container { display: flex; flex-direction: column; justify-content: center; padding: 10px 0; flex: 1; }
.avance-row-label { font-size: 10px; color: var(--text-muted); margin-bottom: 4px; }
.avance-track { height: 28px; background: var(--gray-light); border-radius: 4px; overflow: hidden; }
.avance-fill { height: 100%; display: flex; align-items: center; padding: 0 8px; border-radius: 4px; min-width: 4%; transition: width .4s; }
.pct-label { font-size: 11px; font-weight: 700; color: #fff; white-space: nowrap; }

/* ── Modal ───────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal-card { background: #fff; border-radius: 10px; width: 100%; max-width: 500px; box-shadow: 0 8px 40px rgba(0,0,0,.25); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 14px; border-bottom: 1px solid var(--gray-light); }
.modal-ind-code { font-size: 11px; font-weight: 700; background: var(--gray); color: #fff; display: inline-block; padding: 2px 8px; border-radius: 4px; margin-bottom: 6px; }
.modal-ind-desc { font-size: 13px; color: var(--text); }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); flex-shrink: 0; }
.modal-period { font-size: 12px; font-weight: 700; color: var(--gold); padding: 10px 20px 0; }
.modal-period-row { display: flex; gap: 12px; padding: 10px 20px 0; }
.partial-mark { color: var(--sem-amber); font-size: 11px; cursor: help; }
.modal-card form { padding: 16px 20px 20px; }
.modal-field { margin-bottom: 14px; }
.modal-field label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 5px; }
.modal-field input, .modal-field textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; font-family: inherit; }
.modal-field input:focus, .modal-field textarea:focus { outline: none; border-color: var(--gold); }
.modal-gender-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.modal-gender-info { font-size: 11px; color: #005880; background: var(--blue-light); border-radius: 5px; padding: 7px 12px; margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.btn-primary { padding: 9px 22px; background: var(--gold); color: #fff; border: none; border-radius: 6px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; }
.btn-primary:hover { background: #9a7000; }
.btn-secondary { padding: 9px 18px; background: #fff; color: var(--gray); border: 1px solid var(--border); border-radius: 6px; font-size: 13px; cursor: pointer; font-family: inherit; }
.btn-secondary:hover { background: var(--gray-light); }
#modal-msg { min-height: 20px; }

/* ── Badges ──────────────────────────────────────────── */
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 12px; }
.badge.green { background: var(--sem-grn-bg); color: #0a5438; }
.badge.amber { background: var(--sem-amb-bg); color: #7a4a00; }
.badge.red   { background: var(--sem-red-bg);  color: #7a1a1a; }
.badge.op    { background: var(--blue-light);   color: #005880; }

/* ── Semaphore dot ───────────────────────────────────── */
.sem-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; flex-shrink: 0; }
.sem-dot.green { background: var(--sem-green); }
.sem-dot.amber { background: var(--sem-amber); }
.sem-dot.red   { background: var(--sem-red); }

/* ── Admin table ─────────────────────────────────────── */
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px; border-bottom: 2px solid var(--gray-light); }
.admin-table td { padding: 10px 10px; border-bottom: 1px solid var(--gray-light); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr.user-inactive { opacity: .6; }
.admin-actions { display: flex; gap: 6px; }
.btn-sm { padding: 4px 12px; font-size: 11px; font-weight: 600; cursor: pointer; border-radius: 4px; border: 1px solid var(--border); background: #fff; color: var(--gray); font-family: inherit; }
.btn-sm:hover { background: var(--gray-light); }
.btn-sm-danger  { background: var(--sem-red-bg);  color: var(--sem-red);   border-color: #f5c6c6; }
.btn-sm-success { background: var(--sem-grn-bg);  color: var(--sem-green); border-color: #b3e0d0; }

/* ── Grid helpers ────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }

@media (max-width: 1100px) {
  .charts-row { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 768px) {
  .charts-row { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .comp-header { flex-direction: column; }
  .trim-row { gap: 6px; }
}
