/* ============================================================
   SISEG Reportes - Estilos globales
   UI operativa: limpia, densa, funcional
   ============================================================ */

:root {
    --c-dark:    #1F3864;
    --c-mid:     #2E75B6;
    --c-light:   #D6E4F0;
    --c-green:   #1F7246;
    --c-green-l: #E2EFDA;
    --c-red:     #C00000;
    --c-red-l:   #FCE4D6;
    --c-purple:  #4A235A;
    --c-purple-l:#EDE0F5;
    --c-orange:  #7F6000;
    --c-orange-l:#FFF2CC;
    --c-gray1:   #F4F6FB;
    --c-gray2:   #E8ECF4;
    --c-gray3:   #B0B8CC;
    --c-text:    #1A2340;
    --c-text-m:  #4A5568;
    --c-white:   #FFFFFF;
    --radius:    6px;
    --shadow:    0 2px 8px rgba(31,56,100,.10);
    --sidebar-w: 220px;
    --header-h:  56px;
}

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

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    color: var(--c-text);
    background: var(--c-gray1);
    min-height: 100vh;
}

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

/* ── LAYOUT ── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--c-dark);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,.10);
}
.sidebar-brand .app-name {
    font-size: 15px; font-weight: 700;
    color: var(--c-white); letter-spacing: .3px;
}
.sidebar-brand .app-sub {
    font-size: 11px; color: rgba(255,255,255,.50);
    margin-top: 2px;
}

.sidebar-empresa {
    padding: 10px 16px;
    background: rgba(255,255,255,.06);
    border-bottom: 1px solid rgba(255,255,255,.08);
    font-size: 11px;
    color: rgba(255,255,255,.60);
}
.sidebar-empresa strong {
    display: block;
    color: rgba(255,255,255,.90);
    font-size: 12px;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

nav { flex: 1; padding: 12px 0; }

.nav-section {
    font-size: 10px; font-weight: 600;
    color: rgba(255,255,255,.35);
    letter-spacing: 1px; text-transform: uppercase;
    padding: 14px 16px 4px;
}

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 16px;
    color: rgba(255,255,255,.75);
    font-size: 13px;
    cursor: pointer;
    transition: background .15s, color .15s;
    border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: var(--c-white); text-decoration: none; }
.nav-item.active {
    background: rgba(46,117,182,.30);
    color: var(--c-white);
    border-left-color: var(--c-mid);
}
.nav-item .icon { font-size: 15px; width: 18px; text-align: center; }

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,.10);
    font-size: 12px;
    color: rgba(255,255,255,.50);
}
.sidebar-footer a { color: rgba(255,255,255,.60); font-size: 12px; }
.sidebar-footer a:hover { color: var(--c-white); }

/* ── MAIN CONTENT ── */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: var(--header-h);
    background: var(--c-white);
    border-bottom: 1px solid var(--c-gray2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
}
.topbar-title { font-size: 16px; font-weight: 600; color: var(--c-dark); }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--c-text-m); }
.topbar-user .avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--c-dark); color: var(--c-white);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}

.content { padding: 28px; flex: 1; }

/* ── KPI CARDS ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 28px; }

.kpi-card {
    background: var(--c-white);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    border-top: 3px solid var(--c-mid);
}
.kpi-card.green  { border-top-color: var(--c-green); }
.kpi-card.red    { border-top-color: var(--c-red); }
.kpi-card.purple { border-top-color: var(--c-purple); }
.kpi-card.orange { border-top-color: var(--c-orange); }

.kpi-label { font-size: 11px; font-weight: 600; color: var(--c-text-m); text-transform: uppercase; letter-spacing: .5px; }
.kpi-value { font-size: 26px; font-weight: 700; color: var(--c-dark); margin-top: 6px; line-height: 1; }
.kpi-sub   { font-size: 11px; color: var(--c-text-m); margin-top: 4px; }

/* ── CARDS / PANELS ── */
.card {
    background: var(--c-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--c-gray2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--c-dark); }
.card-body  { padding: 20px; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
    background: var(--c-dark);
    color: var(--c-white);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--c-gray2); transition: background .1s; }
tbody tr:hover { background: var(--c-gray1); }
tbody td { padding: 10px 14px; color: var(--c-text); }
.td-center { text-align: center; }
.td-right  { text-align: right; }
.td-mono   { font-family: monospace; font-size: 12px; }

/* ── BADGES ── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-green  { background: var(--c-green-l);  color: var(--c-green); }
.badge-red    { background: var(--c-red-l);    color: var(--c-red); }
.badge-blue   { background: var(--c-light);    color: var(--c-dark); }
.badge-purple { background: var(--c-purple-l); color: var(--c-purple); }

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--c-text); margin-bottom: 6px; }
.form-label span { color: var(--c-red); }
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--c-gray3);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--c-text);
    background: var(--c-white);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}
.form-control:focus {
    border-color: var(--c-mid);
    box-shadow: 0 0 0 3px rgba(46,117,182,.12);
}
.form-hint { font-size: 11px; color: var(--c-text-m); margin-top: 4px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* Upload zone */
.upload-zone {
    border: 2px dashed var(--c-gray3);
    border-radius: var(--radius);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: var(--c-gray1);
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--c-mid);
    background: var(--c-light);
}
.upload-zone input[type=file] { display: none; }
.upload-zone .uz-icon { font-size: 32px; margin-bottom: 8px; }
.upload-zone .uz-label { font-size: 13px; color: var(--c-text-m); }
.upload-zone .uz-label strong { color: var(--c-mid); }
.upload-zone .uz-filename { font-size: 12px; color: var(--c-green); margin-top: 6px; font-weight: 600; }

/* ── BUTTONS ── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: 13px; font-weight: 600;
    border: none; cursor: pointer;
    transition: opacity .15s, transform .1s;
    white-space: nowrap;
    text-decoration: none;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-primary  { background: var(--c-mid);   color: var(--c-white); }
.btn-dark     { background: var(--c-dark);  color: var(--c-white); }
.btn-green    { background: var(--c-green); color: var(--c-white); }
.btn-red      { background: var(--c-red);   color: var(--c-white); }
.btn-ghost    { background: transparent; color: var(--c-mid); border: 1px solid var(--c-mid); }
.btn-sm       { padding: 5px 12px; font-size: 12px; }
.btn-icon     { padding: 6px 10px; }
.btn-block    { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── ALERTS ── */
.alert {
    padding: 12px 16px; border-radius: var(--radius);
    font-size: 13px; margin-bottom: 16px;
    display: flex; align-items: flex-start; gap: 10px;
}
.alert-error   { background: var(--c-red-l);    color: var(--c-red);    border-left: 4px solid var(--c-red); }
.alert-success { background: var(--c-green-l);  color: var(--c-green);  border-left: 4px solid var(--c-green); }
.alert-info    { background: var(--c-light);    color: var(--c-dark);   border-left: 4px solid var(--c-mid); }

/* ── LOGIN PAGE ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--c-dark) 0%, #2E4A80 100%);
}
.login-box {
    background: var(--c-white);
    border-radius: 10px;
    padding: 40px 36px;
    width: 380px;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .name { font-size: 22px; font-weight: 800; color: var(--c-dark); }
.login-logo .sub  { font-size: 12px; color: var(--c-text-m); margin-top: 2px; }

/* ── PAGE HEADER ── */
.page-header {
    display: flex; align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h1 { font-size: 20px; font-weight: 700; color: var(--c-dark); }
.page-header p  { font-size: 13px; color: var(--c-text-m); margin-top: 2px; }

/* ── UTILS ── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--c-text-m); }
.text-green { color: var(--c-green); }
.text-red   { color: var(--c-red); }
.text-sm    { font-size: 12px; }
.fw-bold    { font-weight: 700; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.flex  { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.empty-state {
    text-align: center; padding: 48px 20px;
    color: var(--c-text-m); font-size: 13px;
}
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }

/* ── SPINNER ── */
.spinner {
    display: inline-block; width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: white;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── MODAL ── */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 200;
    align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: var(--c-white); border-radius: 8px;
    width: 480px; max-width: 95vw;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
    animation: fadeUp .2s ease;
}
@keyframes fadeUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:none; } }
.modal-header {
    padding: 16px 20px; border-bottom: 1px solid var(--c-gray2);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--c-dark); }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--c-text-m); line-height: 1; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--c-gray2); display: flex; gap: 10px; justify-content: flex-end; }

/* ── LOGO PREVIEW ── */
.logo-preview {
    width: 80px; height: 80px; border-radius: var(--radius);
    border: 2px dashed var(--c-gray3);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; cursor: pointer;
    background: var(--c-gray1);
}
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }

/* ── PROCESS STEPS ── */
.process-steps {
    display: flex; gap: 0; margin-bottom: 24px;
    background: var(--c-white); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden;
}
.step {
    flex: 1; padding: 14px 16px; display: flex;
    align-items: center; gap: 10px;
    border-right: 1px solid var(--c-gray2);
    color: var(--c-text-m); font-size: 13px;
}
.step:last-child { border-right: none; }
.step.active { background: var(--c-light); color: var(--c-dark); }
.step.done   { background: var(--c-green-l); color: var(--c-green); }
.step-num {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--c-gray2); color: var(--c-text-m);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.step.active .step-num { background: var(--c-mid); color: white; }
.step.done   .step-num { background: var(--c-green); color: white; }
