/* ═══════════════════════════════════════════════════════════════
   GastosApp — Hoja de estilos global
   Controltecnica Group · 2026
═══════════════════════════════════════════════════════════════ */

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

:root {
    --blue:      #1a3b6e;
    --blue-lt:   #2a52a0;
    --blue-bg:   #e6f1fb;
    --red:       #c0392b;
    --black:     #0d0d0d;
    --white:     #ffffff;
    --g50:       #f7f8fa;
    --g100:      #eef0f3;
    --g200:      #dde1e7;
    --g400:      #9aa3b0;
    --g600:      #5a6478;
    --g800:      #2c3345;
    --green:     #0f6e56;
    --green-bg:  #e1f5ee;
    --amber:     #854f0b;
    --amber-bg:  #faeeda;
    --rose:      #a32d2d;
    --rose-bg:   #fcebeb;
    --sky:       #185fa5;
    --sky-bg:    #e6f1fb;
    --radius:    8px;
    --radius-lg: 12px;
    --shadow:    0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,.10);
    --font:      'Segoe UI', system-ui, -apple-system, sans-serif;
}

html, body {
    font-family: var(--font);
    font-size: 14px;
    color: var(--g800);
    background: var(--g50);
    line-height: 1.55;
    min-height: 100vh;
}

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

/* ── Barra superior ─────────────────────────────────────────── */
.topbar {
    background: var(--black);
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 2px 10px rgba(0,0,0,.35);
}

.topbar-logo img { height: 30px; object-fit: contain; display: block; }

.topbar-nav { display: flex; gap: 2px; }
.topbar-nav a {
    color: rgba(255,255,255,.65);
    padding: 6px 13px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    transition: background .15s, color .15s;
    text-decoration: none;
}
.topbar-nav a:hover  { background: rgba(255,255,255,.1); color: #fff; }
.topbar-nav a.active { background: var(--blue); color: #fff; }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,.75);
    font-size: 13px;
}
.topbar-user a { color: rgba(255,255,255,.4); font-size: 12px; }
.topbar-user a:hover { color: rgba(255,255,255,.8); text-decoration: none; }

/* ── Avatar ──────────────────────────────────────────────────── */
.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    flex-shrink: 0;
}
.av-blue  { background: var(--blue);  color: #fff; }
.av-green { background: var(--green); color: #fff; }
.av-amber { background: var(--amber); color: #fff; }

/* ── Empresa pill ────────────────────────────────────────────── */
.emp { display: inline-block; font-size: 11px; font-weight: 700;
       padding: 2px 7px; border-radius: 4px; letter-spacing: .04em; }
.emp-BIO { background: #e1f5ee; color: #085041; }
.emp-CAL { background: #e6f1fb; color: #0c447c; }
.emp-CTR { background: var(--blue); color: #fff; }

/* ── Página ──────────────────────────────────────────────────── */
.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 20px 70px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 12px;
    flex-wrap: wrap;
}
.page-header h1 { font-size: 20px; font-weight: 700; color: var(--g800); }
.page-header p  { color: var(--g600); font-size: 13px; margin-top: 2px; }

/* ── Card ────────────────────────────────────────────────────── */
.card {
    background: var(--white);
    border: 1px solid var(--g200);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.card-title {
    font-size: 14px; font-weight: 700; color: var(--g800);
    margin-bottom: 16px; padding-bottom: 12px;
    border-bottom: 1px solid var(--g100);
    display: flex; align-items: center; justify-content: space-between;
}

/* ── Métricas ────────────────────────────────────────────────── */
.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.metric {
    background: var(--white); border: 1px solid var(--g200);
    border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.metric-label { font-size: 11px; color: var(--g600); font-weight: 600;
                text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.metric-val   { font-size: 24px; font-weight: 700; color: var(--g800); }
.metric-val.green { color: var(--green); }
.metric-val.amber { color: var(--amber); }
.metric-val.blue  { color: var(--sky); }
.metric-val.red   { color: var(--rose); }

/* ── Tabla ───────────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--g200);
    box-shadow: var(--shadow);
}
table.tbl { width: 100%; border-collapse: collapse; background: var(--white); font-size: 13px; }
table.tbl th {
    background: var(--g50);
    padding: 10px 14px;
    text-align: left;
    font-size: 11px; font-weight: 700;
    color: var(--g600);
    text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 1px solid var(--g200);
    white-space: nowrap;
}
table.tbl td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--g100);
    color: var(--g800);
    vertical-align: middle;
}
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover td { background: var(--g50); }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
    display: inline-block; font-size: 11px; font-weight: 700;
    padding: 3px 9px; border-radius: 20px; white-space: nowrap;
}
.badge-gray  { background: var(--g100);    color: var(--g600); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red   { background: var(--rose-bg);  color: var(--rose); }
.badge-blue  { background: var(--sky-bg);   color: var(--sky); }

/* ── Botones ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 18px; border-radius: var(--radius);
    font-size: 13px; font-weight: 600; cursor: pointer;
    border: 1px solid transparent;
    transition: all .15s; text-decoration: none; line-height: 1;
    font-family: var(--font);
}
.btn:hover { text-decoration: none; }
.btn-primary   { background: var(--blue);  color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-lt); }
.btn-success   { background: var(--green); color: #fff; border-color: var(--green); }
.btn-success:hover { background: #0a5040; }
.btn-danger    { background: var(--rose-bg); color: var(--rose); border-color: #f7c1c1; }
.btn-danger:hover { background: #f7c1c1; }
.btn-secondary { background: var(--white); color: var(--g800); border-color: var(--g200); }
.btn-secondary:hover { background: var(--g50); }
.btn-warning   { background: var(--amber-bg); color: var(--amber); border-color: #fac775; }
.btn-sm  { padding: 5px 13px; font-size: 12px; }
.btn-xs  { padding: 3px 9px;  font-size: 11px; }
.btn-block { width: 100%; justify-content: center; }

/* ── Formularios ─────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-size: 12px; font-weight: 700;
    color: var(--g600); margin-bottom: 5px;
    text-transform: uppercase; letter-spacing: .03em;
}
.form-control {
    width: 100%; padding: 9px 12px;
    border: 1px solid var(--g200); border-radius: var(--radius);
    font-size: 14px; color: var(--g800); background: var(--white);
    transition: border-color .15s, box-shadow .15s;
    font-family: var(--font);
}
.form-control:focus {
    outline: none; border-color: var(--blue-lt);
    box-shadow: 0 0 0 3px rgba(42,82,160,.12);
}
textarea.form-control { resize: vertical; min-height: 80px; }
.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(--g200); border-radius: var(--radius-lg);
    padding: 32px; text-align: center; cursor: pointer;
    position: relative; transition: border-color .2s, background .2s;
}
.upload-zone:hover { border-color: var(--blue-lt); background: var(--sky-bg); }
.upload-zone input[type=file] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.upload-icon  { font-size: 38px; margin-bottom: 10px; }
.upload-title { font-size: 15px; font-weight: 700; color: var(--g800); }
.upload-sub   { font-size: 12px; color: var(--g400); margin-top: 4px; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px; border-radius: var(--radius);
    font-size: 13px; margin-bottom: 16px; border: 1px solid transparent;
}
.alert-success { background: var(--green-bg); color: var(--green); border-color: #5dcaa5; }
.alert-error   { background: var(--rose-bg);  color: var(--rose);  border-color: #f09595; }
.alert-warning { background: var(--amber-bg); color: var(--amber); border-color: #ef9f27; }
.alert-info    { background: var(--sky-bg);   color: var(--sky);   border-color: #85b7eb; }

/* ── Login ───────────────────────────────────────────────────── */
.login-wrap {
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center;
    background: var(--black); padding: 20px;
}
.login-card {
    background: var(--white); border-radius: var(--radius-lg);
    padding: 40px 36px; width: 100%; max-width: 400px;
    box-shadow: 0 24px 80px rgba(0,0,0,.5);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { height: 46px; object-fit: contain; }
.login-title { font-size: 18px; font-weight: 700; color: var(--g800); text-align: center; margin-bottom: 24px; }

/* ── Ticket thumbnail ────────────────────────────────────────── */
.thumb { width: 46px; height: 38px; border-radius: var(--radius);
         object-fit: cover; border: 1px solid var(--g200); cursor: pointer; }
.thumb-empty { width: 46px; height: 38px; border-radius: var(--radius);
               background: var(--g100); display: flex; align-items: center;
               justify-content: center; font-size: 20px; color: var(--g400); }

/* ── Modal lightbox ──────────────────────────────────────────── */
#lightbox {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.85);
    z-index: 9999; align-items: center; justify-content: center;
}
#lightbox.open { display: flex; }
#lightbox img  { max-width: 92vw; max-height: 90vh; border-radius: var(--radius); }
#lightbox-close {
    position: fixed; top: 16px; right: 20px; color: #fff;
    font-size: 28px; cursor: pointer; line-height: 1;
}

/* ── Checkbox ────────────────────────────────────────────────── */
.chk { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.chk input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--blue); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .topbar-nav  { display: none; }
    .page        { padding: 16px 12px 60px; }
    .metrics     { grid-template-columns: repeat(2,1fr); }
    .metric-val  { font-size: 20px; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

/* ── Utils ───────────────────────────────────────────────────── */
.flex            { display: flex; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.text-right  { text-align: right; }
.text-muted  { color: var(--g400); font-size: 12px; }
.text-small  { font-size: 12px; color: var(--g600); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.w-full { width: 100%; }