:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;

    --primary: #111827;
    --accent: #b8835a;
    --accent-soft: #fff7ed;

    --success: #059669;
    --success-soft: #ecfdf5;

    --danger: #dc2626;
    --danger-soft: #fef2f2;

    --warning: #d97706;
    --warning-soft: #fffbeb;

    --info: #2563eb;
    --info-soft: #eff6ff;

    --radius: 18px;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.07);

    /* alias usados en algunos inline styles existentes */
    --color-border: var(--border);
    --color-success: var(--success);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

a { color: inherit; }

/* ===================== LAYOUT + SIDEBAR FIJO TIPO SRO/INVENTARIO ===================== */

.layout {
    display: block;
    min-height: 100vh;
}

.cc-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100vh;
    background: linear-gradient(180deg, #1e2b4f 0%, #0f172a 100%);
    color: #ffffff;
    padding: 24px 16px;
    z-index: 900;
    overflow-y: auto;
    box-shadow: 18px 0 45px rgba(15, 23, 42, 0.18);
}

.cc-sidebar * { box-sizing: border-box; }

.cc-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 22px;
    border-bottom: 1px solid rgba(255,255,255,0.14);
    margin-bottom: 18px;
}

.cc-logo-box {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    flex-shrink: 0;
}

.cc-logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }

.cc-sidebar-brand h2 {
    margin: 0;
    font-size: 17px;
    line-height: 1.15;
    color: #ffffff;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.cc-sidebar-brand p {
    margin: 6px 0 0;
    color: #cbd5e1;
    font-size: 12px;
}

.cc-user-card {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.13);
    border-radius: 18px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.cc-user-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--accent);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 15px;
    flex-shrink: 0;
}

.cc-user-card strong { display: block; color: #ffffff; font-size: 14px; line-height: 1.2; }
.cc-user-card span { display: block; color: #cbd5e1; font-size: 12px; margin-top: 3px; }

.cc-menu { display: flex; flex-direction: column; gap: 8px; }

.cc-menu-group { border-radius: 14px; overflow: hidden; }

.cc-menu-group summary {
    list-style: none;
    cursor: pointer;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.10);
    color: #ffffff;
    padding: 13px 14px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: 0.18s ease;
}

.cc-menu-group summary::-webkit-details-marker { display: none; }
.cc-menu-group summary:hover { background: rgba(255,255,255,0.13); }
.cc-menu-group[open] summary { background: rgba(255,255,255,0.14); }
.cc-menu-group summary small { color: #cbd5e1; font-size: 12px; transition: 0.18s ease; }
.cc-menu-group[open] summary small { transform: rotate(180deg); }

.cc-menu-links { padding: 8px 4px 4px; display: flex; flex-direction: column; gap: 5px; }

.cc-menu-links a {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 10px 14px 10px 32px;
    border-radius: 12px;
    color: #e5e7eb;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    transition: 0.18s ease;
}

.cc-menu-links a::before {
    content: "";
    position: absolute;
    left: 14px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.85;
}

.cc-menu-links a:hover { background: rgba(255,255,255,0.10); color: #ffffff; }
.cc-menu-links a.active { background: rgba(255,255,255,0.14); color: #ffffff; }
.cc-menu-links a.active::before { background: #ffffff; }

.cc-logout-link { background: rgba(184,131,90,0.22); color: #ffffff; }

.cc-sidebar-note {
    margin-top: 20px;
    padding: 14px;
    border-radius: 14px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: #dbeafe;
    font-size: 12px;
    line-height: 1.45;
}

.cc-sidebar::-webkit-scrollbar { width: 7px; }
.cc-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.22); border-radius: 999px; }

.content {
    margin-left: 300px;
    width: calc(100% - 300px);
    padding: 30px 36px 40px;
}

@media (max-width: 980px) {
    .cc-sidebar { position: relative; width: 100%; height: auto; min-height: auto; padding: 18px 16px; box-shadow: none; }
    .content { margin-left: 0; width: 100%; padding: 20px 14px 32px; }
    .cc-sidebar-note { display: none; }
}

/* ===================== TOPBAR / PAGE HEAD ===================== */

.topbar, .page-head {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.topbar h1, .page-head h1 { margin: 0; font-size: 24px; letter-spacing: -0.02em; }
.topbar p, .page-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.user-pill {
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 9px 14px;
    border-radius: 999px;
    font-size: 13px;
    color: #334155;
    white-space: nowrap;
}

/* ===================== HERO (dashboards) ===================== */

.cc-hero {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #ffffff;
    border-radius: 24px;
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.cc-hero h1 { margin: 0; font-size: 27px; letter-spacing: -0.03em; }
.cc-hero p { margin: 8px 0 0; color: #cbd5e1; font-size: 14px; max-width: 640px; }

.cc-hero-logo {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    flex-shrink: 0;
}
.cc-hero-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }

.hero-badge, .cc-date {
    background: rgba(184, 131, 90, 0.22);
    color: #f3d9bf;
    border: 1px solid rgba(184, 131, 90, 0.45);
    padding: 9px 14px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 13px;
    white-space: nowrap;
}

/* ===================== KPI CARDS (stat-grid) ===================== */

.stat-grid, .cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card, .card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.stat-card .icon, .card-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    margin-bottom: 10px;
    font-size: 14px;
}

.icon-info { background: var(--info-soft); color: var(--info); }
.icon-success { background: var(--success-soft); color: var(--success); }
.icon-warning { background: var(--warning-soft); color: var(--warning); }
.icon-danger { background: var(--danger-soft); color: var(--danger); }
.icon-accent { background: var(--accent-soft); color: #92400e; }

.stat-card .label, .card-title { color: var(--muted); font-size: 13px; margin: 0; font-weight: 700; }
.stat-card .num, .card-number { font-size: 30px; font-weight: 900; margin-top: 8px; letter-spacing: -0.04em; line-height: 1; }
.card-footer { margin-top: 6px; font-size: 12px; color: var(--muted); }

.success { color: var(--success); }
.danger { color: var(--danger); }
.warning { color: var(--warning); }
.info { color: var(--info); }

/* ===================== PANEL (alias de .card como contenedor genérico) ===================== */

.panel {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(226, 232, 240, 0.8);
    margin-bottom: 18px;
}

.panel-header, .page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.panel h2 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.panel-subtitle, .help-text { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ===================== TABLES ===================== */

.table-wrap { overflow-x: auto; margin-bottom: 18px; }

table, .table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--card); }

thead th, .table th {
    background: #f8fafc;
    color: #475569;
    text-align: left;
    padding: 12px 13px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

tbody td, .table td {
    padding: 12px 13px;
    border-bottom: 1px solid var(--border);
    color: #334155;
    vertical-align: middle;
}

tbody tr:hover td { background: #f8fafc; }

/* ===================== BADGES ===================== */

.badge { padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; display: inline-block; white-space: nowrap; }

.badge-ok, .badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warn, .badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-neutral { background: #f1f5f9; color: #64748b; }

/* ===================== BUTTONS ===================== */

button, .btn, .btn-inline, input[type="submit"] {
    display: inline-block;
    text-decoration: none;
    border: none;
    padding: 11px 16px;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
    font-size: 14px;
    background: var(--primary);
    color: #ffffff;
    width: auto;
    margin-top: 0;
    font-family: inherit;
}

button:hover, .btn:hover, .btn-inline:hover { background: #020617; }

.btn-primary { background: var(--primary); color: #ffffff; }
.btn-primary:hover { background: #020617; }

.btn-accent, .btn-secondary, .btn-sm {
    background: var(--accent-soft);
    color: #92400e;
}
.btn-accent:hover, .btn-secondary:hover, .btn-sm:hover { background: #ffedd5; }

.btn-light { background: #f8fafc; color: #334155; border: 1px solid var(--border); }
.btn-light:hover { background: #f1f5f9; }

.btn-danger { background: var(--danger-soft); color: #991b1b; }
.btn-danger:hover { background: #fecaca; }

.btn-sm { padding: 8px 12px; font-size: 13px; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }

/* ===================== FORMS ===================== */

label {
    display: block;
    margin-top: 14px;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 800;
    color: #374151;
}

input, select, textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    background: #fff;
    font-family: inherit;
    color: var(--text);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #94a3b8;
    box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.18);
}

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 18px; }
.form-grid-full { grid-column: 1 / -1; }

.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters label { margin: 0 0 4px; }
.filters > div { min-width: 160px; }

/* ===================== ALERTS / FLASH ===================== */

.alert-error, .flash-error {
    background: var(--danger-soft);
    color: var(--danger);
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 14px;
    font-weight: 700;
}

.alert-success, .flash-ok {
    background: var(--success-soft);
    color: var(--success);
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 14px;
    font-weight: 700;
}
.flash { }

/* ===================== EMPTY STATE ===================== */

.empty-state { text-align: center; padding: 30px; color: var(--muted); }
.empty-state strong { display: block; color: var(--text); margin-bottom: 6px; }

/* ===================== LOGIN ===================== */

.login-body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(184, 131, 90, 0.22), transparent 32%),
        linear-gradient(135deg, #0f172a, #1e2b4f);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0f172a;
}

.login-shell {
    width: min(1000px, 92vw);
    min-height: 560px;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 30px 90px rgba(15, 23, 42, 0.35);
    background: #fff;
}

.brand-panel {
    background: linear-gradient(135deg, #0f172a, #1e2b4f);
    color: #fff;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.brand-top { display: flex; align-items: center; gap: 18px; }

.logo-box {
    width: 86px;
    height: 86px;
    border-radius: 22px;
    background: rgba(255,255,255,0.09);
    border: 1px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    flex-shrink: 0;
}
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }

.brand-name h2 { margin: 0; font-size: 22px; line-height: 1.15; letter-spacing: -0.02em; }
.brand-name p { margin: 6px 0 0; color: #dbeafe; font-size: 14px; }

.brand-content h1 { margin: 28px 0 0; font-size: 32px; line-height: 1.15; letter-spacing: -0.04em; }
.brand-content p { margin-top: 16px; max-width: 460px; color: #e5e7eb; font-size: 15px; line-height: 1.55; }

.tags { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.tag { padding: 9px 14px; border-radius: 999px; background: rgba(255,255,255,0.11); border: 1px solid rgba(255,255,255,0.18); font-weight: 800; font-size: 13px; }

.brand-footer { color: #cbd5e1; font-size: 12px; border-top: 1px solid rgba(255,255,255,0.16); padding-top: 20px; margin-top: 28px; }

.form-panel { padding: 48px; display: flex; align-items: center; justify-content: center; }
.login-card, .form-card { width: 100%; max-width: 380px; }
.login-card h1, .form-card h1 { margin: 0; font-size: 24px; letter-spacing: -0.02em; }
.login-card .login-subtitle, .form-card p { color: var(--muted); font-size: 14px; margin-bottom: 20px; }

@media (max-width: 860px) {
    .login-shell { grid-template-columns: 1fr; }
    .brand-panel { display: none; }
    .form-panel { padding: 32px 24px; }
}

/* ===================== RESPONSIVE GENERAL ===================== */

@media (max-width: 900px) {
    .topbar, .page-head, .cc-hero { flex-direction: column; align-items: flex-start; }
    .stat-grid, .cards { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    input, select, textarea { min-height: 46px; font-size: 16px; }
    button, .btn, .btn-inline { min-height: 44px; }
    table { min-width: 720px; }
}
