:root {
    --coop-primary: #0f766e;
    --coop-primary-dark: #115e59;
    --coop-sidebar: #134e4a;
    --bs-primary: #0f766e;
    --bs-primary-rgb: 15, 118, 110;
    --bs-link-color: #0f766e;
    --bs-link-hover-color: #115e59;
}

body { background: #f4f6f5; color: #1f2937; }

.btn-primary { --bs-btn-bg: var(--coop-primary); --bs-btn-border-color: var(--coop-primary); --bs-btn-hover-bg: var(--coop-primary-dark); --bs-btn-hover-border-color: var(--coop-primary-dark); --bs-btn-active-bg: var(--coop-primary-dark); }
.btn-outline-primary { --bs-btn-color: var(--coop-primary); --bs-btn-border-color: var(--coop-primary); --bs-btn-hover-bg: var(--coop-primary); --bs-btn-hover-border-color: var(--coop-primary); }
.page-link { color: var(--coop-primary); }
.active > .page-link { background: var(--coop-primary); border-color: var(--coop-primary); }

/* Estructura */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar { width: 240px; flex: 0 0 240px; background: var(--coop-sidebar); color: #fff; display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.app-sidebar .brand { color: #fff; text-decoration: none; font-size: 1.25rem; padding: 0 8px; }
.app-sidebar .brand i { color: #5eead4; }
.app-sidebar .brand-sub { font-size: .8rem; opacity: .8; padding: 2px 8px 0; }
.nav-list { margin-top: 18px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-list .nav-link { color: rgba(255,255,255,.85); border-radius: 8px; padding: 9px 12px; }
.nav-list .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-list .nav-link.active { background: rgba(94,234,212,.18); color: #fff; font-weight: 600; }
.nav-list .nav-link i { width: 22px; display: inline-block; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; opacity: .6; padding: 14px 12px 4px; }
.sidebar-user { border-top: 1px solid rgba(255,255,255,.15); padding: 12px 8px 0; }

.app-main { flex: 1; min-width: 0; }
.app-content { padding: 24px; max-width: 1280px; }
.app-topbar { display: flex; gap: 12px; align-items: center; padding: 10px 16px; background: #fff; border-bottom: 1px solid #e5e7eb; }

@media (max-width: 991.98px) {
    .app-sidebar { position: fixed; left: -260px; z-index: 1040; transition: left .2s; }
    .app-sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.3); }
    .app-content { padding: 16px; }
}

/* Componentes */
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-head h1 { font-size: 1.5rem; margin: 0; }
.card { border: 1px solid #e5e7eb; border-radius: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.card-header { background: #fff; font-weight: 600; border-bottom: 1px solid #eef0ef; }
.kpi { padding: 16px 18px; }
.kpi .kpi-label { font-size: .8rem; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; }
.kpi .kpi-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; margin-top: 4px; }
.kpi .kpi-sub { font-size: .85rem; color: #6b7280; }
.table > :not(caption) > * > * { padding: .6rem .75rem; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #6b7280; font-weight: 600; background: #fafafa; }
.money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty { padding: 40px; text-align: center; color: #6b7280; }
.empty i { font-size: 2rem; display: block; margin-bottom: 8px; opacity: .5; }

/* Autocompletar */
.ac-wrap { position: relative; }
.ac-list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid #d1d5db; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.1); max-height: 280px; overflow-y: auto; }
.ac-item { padding: 8px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.ac-item:hover, .ac-item.sel { background: #f0fdfa; }

/* Login */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #134e4a, #0f766e); padding: 16px; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 32px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }

/* Documentos imprimibles */
.doc { background: #fff; max-width: 800px; margin: 24px auto; padding: 40px; border-radius: 8px; }
.doc-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--coop-primary); padding-bottom: 12px; margin-bottom: 20px; }
@media print {
    body { background: #fff; }
    .no-print, .app-sidebar, .app-topbar, .alert { display: none !important; }
    .doc { margin: 0; padding: 0; max-width: none; }
    .app-content { padding: 0; }
    .card { border: 0; box-shadow: none; }
}
