/* public/css/cnt.css — Estilos compartidos sistema contabilidad */
:root {
    --c-bg:       #f7f8fa;
    --c-surface:  #ffffff;
    --c-border:   #e2e6ea;
    --c-primary:  #1a56a0;
    --c-primary-h:#154285;
    --c-accent:   #e8f0fc;
    --c-text:     #1a1d23;
    --c-muted:    #6b7280;
    --c-success:  #16a34a;
    --c-danger:   #dc2626;
    --c-warn:     #d97706;
    --c-info:     #0284c7;
    --c-debe:     #fff0f0;
    --c-haber:    #f0fff4;
    --radius:     6px;
    --shadow:     0 1px 3px rgba(0,0,0,.08);
    --font:       'Segoe UI', system-ui, sans-serif;
    --font-mono:  'Consolas', 'Courier New', monospace;
}

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

body {
    font-family: var(--font);
    font-size: 14px;
    background: var(--c-bg);
    color: var(--c-text);
    line-height: 1.5;
}

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

.sidebar {
    width: 215px;
    background: #1a2332;
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}
.sidebar-logo {
    padding: 16px 14px 14px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-logo-icon {
    width: 32px; height: 32px;
    background: #3b7dd8;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 900; color: #fff;
    flex-shrink: 0;
}
.sidebar-logo-title { font-size: 13px; font-weight: 700; color: #fff; }
.sidebar-logo-sub   { font-size: 10px; color: rgba(255,255,255,.4); margin-top: 1px; }

.sidebar-nav { padding: 6px 0; flex: 1; overflow-y: auto; }
.sidebar-nav .nav-section {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,.3);
    padding: 12px 14px 3px;
    font-weight: 600;
}
.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    font-size: 13px;
    border-left: 2px solid transparent;
    transition: all .15s;
    border-radius: 0 4px 4px 0;
    margin-right: 6px;
}
.sidebar-nav .nav-item:hover {
    background: rgba(255,255,255,.07);
    color: rgba(255,255,255,.9);
    border-left-color: rgba(255,255,255,.3);
}
.sidebar-nav .nav-item.active {
    background: rgba(59,125,216,.25);
    color: #7db8f7;
    border-left-color: #3b7dd8;
    font-weight: 600;
}
.nav-icon {
    width: 16px;
    text-align: center;
    font-size: 12px;
    opacity: .7;
    flex-shrink: 0;
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    padding: 0 24px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: var(--shadow);
}
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.content { padding: 24px; flex: 1; overflow-y: auto; }

/* ── Cards ── */
.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-header h2 { font-size: 14px; font-weight: 600; }
.card-body { padding: 18px; }

/* ── Grid helpers ── */
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.col { flex: 1; min-width: 0; }
.col-2 { flex: 2; min-width: 0; }
.col-auto { flex: 0 0 auto; }
.gap-sm { gap: 8px; }
.mb { margin-bottom: 16px; }
.mb-sm { margin-bottom: 8px; }

/* ── Formularios ── */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; font-weight: 600; color: var(--c-muted); text-transform: uppercase; letter-spacing: .4px; }
.field input, .field select, .field textarea {
    padding: 7px 10px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font);
    background: var(--c-surface);
    color: var(--c-text);
    transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(26,86,160,.1);
}
.field input[readonly], .field select[disabled] {
    background: var(--c-bg);
    color: var(--c-muted);
}
.field-hint { font-size: 11px; color: var(--c-muted); }

/* ── Botones ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 13px;
    font-family: var(--font);
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, opacity .15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--c-primary);  color: #fff; }
.btn-primary:hover  { background: var(--c-primary-h); }
.btn-outline  { background: transparent; border-color: var(--c-border); color: var(--c-text); }
.btn-outline:hover  { background: var(--c-bg); }
.btn-danger   { background: var(--c-danger); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 6px; }

/* ── Tabla ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
    background: var(--c-bg);
    padding: 8px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--c-muted);
    border-bottom: 1px solid var(--c-border);
    white-space: nowrap;
}
tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--c-border);
    font-size: 13.5px;
}
tbody tr:hover { background: var(--c-accent); }
tbody tr:last-child td { border-bottom: none; }
.tr-total td { font-weight: 700; background: var(--c-bg); }

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-mono { font-family: var(--font-mono); }
.text-muted { color: var(--c-muted); }
.text-success { color: var(--c-success); }
.text-danger  { color: var(--c-danger); }
.text-warn    { color: var(--c-warn); }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-warn    { background: #fef3c7; color: #92400e; }
.badge-info    { background: #e0f2fe; color: #0369a1; }
.badge-muted   { background: var(--c-border); color: var(--c-muted); }

/* ── Asiento líneas ── */
.lineas-asiento { width: 100%; border-collapse: collapse; }
.lineas-asiento th { background: var(--c-bg); padding: 6px 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--c-muted); border-bottom: 2px solid var(--c-border); }
.lineas-asiento td { padding: 5px 4px; border-bottom: 1px solid var(--c-border); }
.lineas-asiento .td-debe  { background: var(--c-debe); }
.lineas-asiento .td-haber { background: var(--c-haber); }
.lineas-asiento input { width: 100%; border: 1px solid var(--c-border); border-radius: 4px; padding: 5px 7px; font-size: 13px; }
.lineas-asiento tfoot td { font-weight: 700; padding: 8px; background: var(--c-bg); border-top: 2px solid var(--c-border); }
.lineas-asiento .cuadrado td { border-bottom-color: var(--c-success); }
.lineas-asiento .descuadrado td { border-bottom-color: var(--c-danger); }

/* ── Subformularios IVA / Cartera ── */
.subform {
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 14px;
    margin-top: 12px;
    background: var(--c-accent);
}
.subform-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--c-primary);
    margin-bottom: 10px;
}

/* ── Alert ── */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 12px; border-left: 4px solid; }
.alert-danger  { background: #fee2e2; border-color: var(--c-danger);  color: #7f1d1d; }
.alert-success { background: #dcfce7; border-color: var(--c-success); color: #14532d; }
.alert-warn    { background: #fef3c7; border-color: var(--c-warn);    color: #78350f; }
.alert-info    { background: #e0f2fe; border-color: var(--c-info);    color: #0c4a6e; }

/* ── Loading ── */
.loading { display: flex; align-items: center; gap: 8px; color: var(--c-muted); font-size: 13px; padding: 20px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--c-border); border-top-color: var(--c-primary); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Filtros toolbar ── */
.filters { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; padding: 12px; background: var(--c-bg); border-bottom: 1px solid var(--c-border); }
.filters .field label { font-size: 11px; }
.filters .field input, .filters .field select { font-size: 13px; padding: 5px 8px; }

/* ── Stats ── */
.stats-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat-card { flex: 1; min-width: 140px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 14px 16px; }
.stat-card .stat-label { font-size: 11px; color: var(--c-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.stat-card .stat-value { font-size: 22px; font-weight: 700; margin-top: 4px; font-family: var(--font-mono); }
.stat-card .stat-sub   { font-size: 11px; color: var(--c-muted); margin-top: 2px; }

/* ── Modal ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: var(--c-surface); border-radius: var(--radius); box-shadow: 0 8px 32px rgba(0,0,0,.18); min-width: 420px; max-width: 92vw; max-height: 90vh; display: flex; flex-direction: column; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--c-border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--c-border); display: flex; gap: 8px; justify-content: flex-end; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .content { padding: 12px; }
    .modal { min-width: 95vw; }
}
