:root {
    --verde-oscuro: #1e3d0f;
    --verde-principal: #2d5a1b;
    --verde-medio: #3d7a26;
    --verde-claro: #e8f0e2;
    --cacao: #6b3f2a;
    --crema: #faf6ee;
    --texto: #26331f;
    --rojo-saldo: #c0392b;
    --sidebar-width: 250px;
}

* { box-sizing: border-box; }

body {
    background-color: var(--crema);
    color: var(--texto);
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 0.94rem;
}

/* ---------- Layout general ---------- */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--verde-oscuro), var(--verde-principal));
    color: #fff;
    min-height: 100vh;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1030;
    transition: transform 0.25s ease;
    overflow-y: auto;
    transform: translateX(-100%);
}
.sidebar.show { transform: translateX(0); }

.sidebar-brand {
    padding: 18px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}
.sidebar-brand img { width: 42px; height: 42px; border-radius: 50%; background: #fff; object-fit: cover; }
.sidebar-brand .brand-text { font-family: 'Georgia', serif; font-size: 1.3rem; font-weight: bold; line-height: 1; }
.sidebar-brand .brand-text small { display:block; font-size: 0.65rem; font-weight: normal; letter-spacing: 2px; opacity: 0.85; }

.sidebar-nav { list-style: none; padding: 10px 0; margin: 0; }
.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: rgba(255,255,255,0.88);
    text-decoration: none;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    transition: background 0.15s;
}
.sidebar-nav li a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-nav li a.active {
    background: rgba(255,255,255,0.14);
    border-left-color: #fff;
    color: #fff;
    font-weight: 600;
}
.sidebar-nav li a i { width: 18px; text-align: center; }

.main-content {
    margin-left: 0;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid #e3e0d8;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1020;
}
.topbar .btn-toggle { display: inline-block; background: none; border: none; font-size: 1.3rem; color: var(--verde-principal); }

.content-area { padding: 20px; flex: 1; }

.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1025;
}
.sidebar-overlay.show { display: block; }

/* ---------- Tarjetas / paneles ---------- */
.card-panel {
    background: #fff;
    border: 1px solid #e6e2d8;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card-panel h6.panel-title {
    color: var(--verde-principal);
    font-weight: 700;
    letter-spacing: 0.5px;
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-bottom: 14px;
    border-bottom: 2px solid var(--verde-claro);
    padding-bottom: 8px;
}

.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 18px;
    border: 1px solid #e6e2d8;
    text-align: center;
}
.stat-card .stat-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: #7a7566; font-weight: 600; }
.stat-card .stat-value { font-size: 1.7rem; font-weight: 800; color: var(--verde-principal); margin-top: 6px; }
.stat-card .stat-value.rojo { color: var(--rojo-saldo); }
.stat-card i { font-size: 1.6rem; color: var(--verde-medio); }

.total-box {
    background: var(--verde-claro);
    border-radius: 8px;
    padding: 10px 16px;
    text-align: right;
}
.total-box .valor { font-size: 1.6rem; font-weight: 800; color: var(--verde-principal); }

/* Botones */
.btn-zamlo { background: var(--verde-principal); border-color: var(--verde-principal); color: #fff; }
.btn-zamlo:hover { background: var(--verde-oscuro); border-color: var(--verde-oscuro); color: #fff; }
.btn-outline-zamlo { border-color: var(--verde-principal); color: var(--verde-principal); }
.btn-outline-zamlo:hover { background: var(--verde-principal); color: #fff; }

/* Tablas */
.table-zamlo thead { background: var(--verde-claro); }
.table-zamlo thead th { color: var(--verde-oscuro); font-size: 0.78rem; text-transform: uppercase; letter-spacing: .5px; border-bottom: 2px solid var(--verde-medio); }
.table-zamlo td, .table-zamlo th { vertical-align: middle; }
.badge-saldo-pendiente { background: #fdecea; color: var(--rojo-saldo); font-weight: 600; }
.badge-saldo-cero { background: #e6f4ea; color: #1e7e34; font-weight: 600; }

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--verde-oscuro), var(--cacao));
}
.login-box {
    background: #fff;
    border-radius: 14px;
    padding: 36px 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.login-box img { width: 72px; height: 72px; border-radius: 50%; display: block; margin: 0 auto 10px; }

/* ---------- Comprobante 58mm ---------- */
.ticket-58 {
    width: 58mm;
    margin: 0 auto;
    font-family: 'Courier New', monospace;
    font-size: 10.5px;
    color: #000;
    padding: 4px 2px;
}
.ticket-58 .centrado { text-align: center; }
.ticket-58 .linea { border-top: 1px dashed #000; margin: 4px 0; }
.ticket-58 table { width: 100%; border-collapse: collapse; font-size: 9.5px; }
.ticket-58 .logo-ticket { width: 40px; height: 40px; border-radius: 50%; margin-bottom: 2px; }
.ticket-58 h5 { font-size: 12px; margin: 2px 0; font-family: 'Courier New', monospace; }
.ticket-58 .total-final { font-size: 13px; font-weight: bold; }

@media print {
    body * { visibility: hidden; }
    #areaImprimir, #areaImprimir * { visibility: visible; }
    #areaImprimir { position: absolute; top: 0; left: 0; }
    @page { margin: 0; size: 58mm auto; }
}

/* Utilidades */
.text-verde { color: var(--verde-principal); }
.cursor-pointer { cursor: pointer; }
