/* ============================================================
   Control de Fondo de Garantia - Correduria La Nacional
   Paleta tomada del logotipo: rojo-naranja de las flechas,
   azul marino del globo terraqueo.
   ============================================================ */

:root {
    --rojo: #E34120;
    --rojo-dark: #C22F11;
    --rojo-light: #FBEAE4;
    --azul: #0B4F8C;
    --azul-dark: #08355E;
    --azul-light: #EAF2FA;
    --gris-950: #1A2027;
    --gris-800: #2E3742;
    --gris-600: #5B6675;
    --gris-400: #9AA5B1;
    --gris-300: #C7D0DA;
    --gris-200: #E4E8EC;
    --gris-100: #F4F6F8;
    --blanco: #FFFFFF;
    --verde: #1E8A5F;
    --verde-light: #E4F5EE;
    --sidebar-w: 250px;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(20,30,45,0.08), 0 1px 2px rgba(20,30,45,0.06);
    --shadow-md: 0 4px 14px rgba(20,30,45,0.10);
}

* { box-sizing: border-box; }

/* ---------- Modal de Observaciones ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20,30,45,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal-box {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 440px;
    padding: 22px 24px;
    position: relative;
}
.modal-close-x {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--gris-600);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close-x:hover {
    background: var(--gris-100);
    color: var(--gris-950);
}
.modal-box h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    color: var(--gris-950);
}
.modal-box textarea {
    width: 100%;
    border: 1.5px solid var(--gris-200);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 13.5px;
    resize: vertical;
    margin-top: 10px;
}
.modal-box textarea:focus {
    outline: none;
    border-color: var(--azul);
}
.btn-obs {
    background: none;
    border: 1.5px solid var(--gris-200);
    border-radius: 8px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--gris-400);
    transition: all .15s;
}
.btn-obs:hover { border-color: var(--gris-400); color: var(--gris-600); }
.btn-obs.tiene-obs { border-color: var(--azul); color: var(--azul); background: var(--azul-light); }


html, body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
    background: var(--gris-100);
    color: var(--gris-950);
    font-size: 14.5px;
}

a { color: inherit; text-decoration: none; }

/* ---------- LOGIN ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--azul-dark) 0%, var(--azul) 55%, var(--rojo-dark) 130%);
    padding: 20px;
}
.login-card {
    background: var(--blanco);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 380px;
    padding: 38px 34px 30px;
    text-align: center;
}
.login-card img.logo { width: 92px; height: 92px; object-fit: contain; margin-bottom: 6px; }
.login-card h1 { font-size: 17px; color: var(--azul-dark); margin: 6px 0 2px; font-weight: 700; }
.login-card p.subt { color: var(--gris-600); font-size: 12.5px; margin: 0 0 22px; }
.login-card label { display:block; text-align:left; font-size:12.5px; font-weight:600; color:var(--gris-800); margin: 14px 0 5px; }
.login-card input[type=text], .login-card input[type=password] {
    width: 100%; padding: 11px 13px; border-radius: 8px; border: 1.5px solid var(--gris-200);
    font-size: 14px; outline: none; transition: border-color .15s;
}
.login-card input:focus { border-color: var(--azul); }
.btn-login {
    width: 100%; margin-top: 22px; padding: 12px; border: none; border-radius: 8px;
    background: var(--rojo); color: #fff; font-weight: 700; font-size: 14.5px; cursor: pointer;
    transition: background .15s;
}
.btn-login:hover { background: var(--rojo-dark); }
.login-error {
    background: #FDECEA; color: #B42318; border: 1px solid #F5C2BC; border-radius: 8px;
    padding: 9px 12px; font-size: 12.5px; margin-bottom: 6px; text-align: left;
}
.login-foot { margin-top: 26px; font-size: 11px; color: var(--gris-400); }

/* ---------- APP LAYOUT ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--azul-dark);
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 40;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-brand img { width: 42px; height: 42px; object-fit: contain; flex-shrink:0; }
.sidebar-brand .txt { line-height: 1.25; }
.sidebar-brand .txt b { display:block; font-size: 13.5px; }
.sidebar-brand .txt span { display:block; font-size: 10.5px; color: #B9CBE0; }

.sidebar-nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.sidebar-nav .grp-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: #7C97B8; padding: 14px 10px 6px; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px; margin-bottom: 2px;
    color: #D9E4F2; font-size: 13.5px; font-weight: 500;
}
.sidebar-nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.sidebar-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-nav a.active { background: var(--rojo); color: #fff; }
.sidebar-nav a.active svg { opacity: 1; }

.sidebar-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 11.5px; color: #96AFC9; }
.sidebar-foot .userline { display:flex; align-items:center; gap:8px; margin-bottom:8px; color:#E7EEF7; font-size:12.5px; }
.sidebar-foot a.logout { color: #FFD3C7; font-weight:600; }
.sidebar-foot a.logout:hover { color: #fff; }

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

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--gris-200);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 19px; margin: 0; color: var(--azul-dark); font-weight: 700; }
.topbar .breadcrumb { font-size: 12px; color: var(--gris-600); margin-top: 2px; }
.topbar .actions { display: flex; gap: 10px; }

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

/* ---------- MOBILE MENU TOGGLE ---------- */
.menu-toggle { display: none; background:none; border:none; cursor:pointer; padding:6px; }
.menu-toggle svg { width: 24px; height: 24px; color: var(--azul-dark); }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .menu-toggle { display: block; }
    .content { padding: 18px 14px 50px; }
    .topbar { padding: 12px 14px; }
}

/* ---------- CARDS / KPIs ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; margin-bottom: 24px; }
.kpi {
    background: #fff; border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
    border-left: 4px solid var(--azul);
}
.kpi.rojo { border-left-color: var(--rojo); }
.kpi.verde { border-left-color: var(--verde); }
.kpi .lbl { font-size: 11.5px; color: var(--gris-600); text-transform: uppercase; letter-spacing:.04em; font-weight:600; }
.kpi .val { font-size: 24px; font-weight: 800; color: var(--gris-950); margin-top: 6px; }
.kpi .sub { font-size: 11.5px; color: var(--gris-400); margin-top: 4px; }

.card {
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 22px 24px; margin-bottom: 22px;
}
.card h2 { font-size: 15.5px; margin: 0 0 16px; color: var(--azul-dark); font-weight: 700; }
.card h2 .muted { color: var(--gris-400); font-weight: 500; font-size: 12.5px; }

/* ---------- TABLES ---------- */
.table-wrap { overflow-x: auto; border-radius: 8px; border: 1.5px solid var(--gris-400); }
table.datatable { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 600px; }
table.datatable thead th {
    background: var(--azul-light); color: var(--azul-dark); text-align: left; font-weight: 700;
    padding: 10px 12px; border-bottom: 2.5px solid var(--azul-dark); white-space: nowrap; font-size: 12px;
    text-transform: uppercase; letter-spacing: .02em;
}
table.datatable tbody td { padding: 9px 12px; border-bottom: 1.5px solid var(--gris-300); vertical-align: middle; }
table.datatable tbody tr:hover { background: #FAFBFC; }
table.datatable tbody tr:last-child td { border-bottom: none; }
table.datatable td.num, table.datatable th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.datatable td.center, table.datatable th.center { text-align: center; }
table.datatable tfoot td { padding: 10px 12px; font-weight: 700; background: var(--gris-100); border-top: 2.5px solid var(--gris-400); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge.activo { background: var(--verde-light); color: var(--verde); }
.badge.inactivo { background: var(--rojo-light); color: var(--rojo-dark); }
.badge.rojo { background: var(--rojo-light); color: var(--rojo-dark); }

/* ---------- FORMS ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.field { margin-bottom: 14px; }
.field label { display:block; font-size: 12.5px; font-weight: 600; color: var(--gris-800); margin-bottom: 5px; }
.field input[type=text], .field input[type=number], .field input[type=email],
.field input[type=password], .field input[type=date], .field select, .field textarea {
    width: 100%; padding: 10px 12px; border-radius: 8px; border: 1.5px solid var(--gris-200);
    font-size: 13.5px; outline: none; font-family: inherit; transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--azul); }
.field .hint { font-size: 11px; color: var(--gris-400); margin-top: 4px; }

.btn {
    display: inline-flex; align-items: center; gap: 7px; padding: 10px 18px; border-radius: 8px;
    font-size: 13.5px; font-weight: 700; border: none; cursor: pointer; text-decoration: none;
    transition: background .15s, box-shadow .15s;
}
.btn-primary { background: var(--rojo); color: #fff; }
.btn-primary:hover { background: var(--rojo-dark); }
.btn-secondary { background: var(--azul-light); color: var(--azul-dark); }
.btn-secondary:hover { background: #DCEAF8; }
.btn-outline { background: #fff; color: var(--gris-800); border: 1.5px solid var(--gris-200); }
.btn-outline:hover { border-color: var(--gris-400); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-danger { background: #FDECEA; color: #B42318; }
.btn-danger:hover { background: #F9D6D2; }
.btn svg { width: 15px; height: 15px; }

/* ---------- Botones de accion con color + icono (Guardar / Editar / Eliminar) ---------- */
.btn-guardar { background: var(--verde); color: #fff; }
.btn-guardar:hover { background: #166B49; }
.btn-ver { background: var(--verde); color: #fff; }
.btn-ver:hover { background: #166B49; }
.btn-editar { background: var(--azul); color: #fff; }
.btn-editar:hover { background: var(--azul-dark); }
.btn-eliminar { background: var(--rojo); color: #fff; }
.btn-eliminar:hover { background: var(--rojo-dark); }
.btn-guardar svg, .btn-editar svg, .btn-eliminar svg { width: 14px; height: 14px; flex-shrink: 0; }

.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 18px; }
.alert-ok { background: var(--verde-light); color: var(--verde); border: 1px solid #BFE6D5; }
.alert-error { background: #FDECEA; color: #B42318; border: 1px solid #F5C2BC; }
.alert-warn { background: #FFF6E5; color: #8A5A00; border: 1px solid #F5DFA0; }
.alert-info { background: var(--azul-light); color: var(--azul-dark); border: 1px solid #CFE1F2; }

.tag-mes {
    display: inline-flex; align-items:center; gap:6px; background: var(--azul-light); color: var(--azul-dark);
    padding: 6px 14px; border-radius: 20px; font-weight: 700; font-size: 13px;
}

.empty-state { text-align:center; padding: 50px 20px; color: var(--gris-400); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity:.5; }

.pill-nav { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:20px; }
.pill-nav a {
    padding: 7px 15px; border-radius: 20px; font-size: 12.5px; font-weight: 600;
    background: #fff; border: 1.5px solid var(--gris-200); color: var(--gris-600);
}
.pill-nav a.active { background: var(--azul); border-color: var(--azul); color: #fff; }

.search-box { position: relative; max-width: 320px; }
.search-box input { width:100%; padding: 9px 12px 9px 34px; border-radius: 8px; border: 1.5px solid var(--gris-200); font-size: 13px; }
.search-box svg { position:absolute; left:11px; top:50%; transform:translateY(-50%); width:15px; height:15px; color: var(--gris-400); }

.grid-2 { display:grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

.text-muted { color: var(--gris-400); }
.text-rojo { color: var(--rojo); }
.text-verde { color: var(--verde); }
.font-mono { font-variant-numeric: tabular-nums; }

.divider { height:1px; background: var(--gris-200); margin: 18px 0; border:none; }

.avatar-circle {
    width: 34px; height: 34px; border-radius: 50%; background: var(--azul-light); color: var(--azul-dark);
    display:flex; align-items:center; justify-content:center; font-weight:700; font-size:13px; flex-shrink:0;
}
