/* ===== RUAH ERP — CSS Principal (Paleta Ruah Gestión) ===== */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

:root {
    /* ---- Paleta nueva ---- */
    --ruah-ink:    #1F2F3F;        /* antes #1a1410 — azul profundo */
    --ruah-gold:   #CFAF7A;        /* antes #c9943a — dorado elegante */
    --ruah-gold-l: #F7E7C1;        /* antes #f5e9cc — dorado claro */
    --ruah-teal:   #D87A8C;        /* antes #1d6e61 — ahora rosa principal */
    --ruah-teal-l: #F5D6DC;        /* antes #d4ede9 — ahora rosa suave */
    --ruah-pink:   #D87A8C;        /* alias explícito rosa principal */
    --ruah-pink-l: #F5D6DC;        /* alias explícito rosa suave */
    --ruah-cream:  #F8F4F2;        /* antes #faf8f4 — crema base */
    --ruah-border: rgba(31,47,63,0.1);
    --ruah-muted:  #6F6F6F;        /* antes #6b5f52 — gris texto secundario */
    --sidebar-w:   240px;

    /* Gradientes */
    --grad-pink:   linear-gradient(135deg, #D87A8C, #F5D6DC);
    --grad-gold:   linear-gradient(135deg, #CFAF7A, #F7E7C1, #B8962E);
}

* { box-sizing: border-box; }
body {
    font-family: 'DM Sans', sans-serif;
    background: var(--ruah-cream);
    color: var(--ruah-ink);
    margin: 0;
}

/* ---- SIDEBAR ---- */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--ruah-ink);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}
.sidebar-brand {
    padding: 1.5rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.sidebar-brand .brand-name {
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
}
.sidebar-brand .brand-name span { color: var(--ruah-pink); }  /* antes gold */
.sidebar-brand .brand-sub {
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 2px;
}
.sidebar-nav { padding: 1rem 0; flex: 1; }
.nav-section-label {
    font-size: 9px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.25);
    padding: 0.75rem 1.25rem 0.3rem;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.55rem 1.25rem;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
    border-radius: 0;
    transition: all .15s;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
    color: #fff;
    background: rgba(255,255,255,0.07);
}
.sidebar-nav a.active { border-left: 3px solid var(--ruah-pink); }  /* antes gold */
.sidebar-nav a .nav-icon { font-size: 1rem; width: 20px; text-align: center; }
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.07);
    font-size: 11px;
    color: rgba(255,255,255,0.3);
}
.sidebar-footer a { color: rgba(255,255,255,0.5); text-decoration: none; }

/* ---- MAIN LAYOUT ---- */
.main-wrapper {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--ruah-border);
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--ruah-ink);
}
.topbar-user {
    font-size: 0.85rem;
    color: var(--ruah-muted);
    display: flex;
    align-items: center;
    gap: 12px;
}
.page-content { padding: 2rem; flex: 1; }

/* ---- CARDS ---- */
.card-ruah {
    background: #fff;
    border: 1px solid var(--ruah-border);
    border-radius: 8px;
    padding: 1.5rem;
}
.card-ruah-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 1rem;
    color: var(--ruah-ink);
}

/* ---- KPI CARDS ---- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.kpi-card {
    background: #fff;
    border: 1px solid var(--ruah-border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    position: relative;
    overflow: hidden;
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}
.kpi-gold::before   { background: var(--ruah-gold); }
.kpi-teal::before   { background: var(--ruah-pink); }      /* antes teal, ahora pink */
.kpi-danger::before { background: #dc3545; }
.kpi-info::before   { background: var(--ruah-pink-l); }    /* antes cyan */
.kpi-label {
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ruah-muted);
    margin-bottom: 0.4rem;
}
.kpi-value {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--ruah-ink);
    line-height: 1.1;
}
.kpi-sub { font-size: 0.78rem; color: var(--ruah-muted); margin-top: 4px; }

/* ---- BADGES DE ESTADO ---- */
.badge-estado {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
}
.estado-pendiente      { background: #FEF3C7; color: #92610A; }   /* amarillo pastel suave */
.estado-pago_pendiente { background: #FEF3C7; color: #92610A; }   /* amarillo pastel suave */
.estado-pagado         { background: #D1FAE5; color: #065F46; }   /* verde menta pastel */
.estado-en_produccion  { background: #DBEAFE; color: #1E40AF; }   /* azul cielo pastel */
.estado-listo          { background: #D1FAE5; color: #065F46; }   /* verde menta pastel */
.estado-enviado        { background: #D1FAE5; color: #065F46; }   /* verde menta pastel */
.estado-entregado      { background: #D1FAE5; color: #065F46; }   /* verde menta pastel */
.estado-finalizado     { background: #F3F4F6; color: #4B5563; }   /* gris pastel neutro */
.estado-cancelado      { background: #FFE4E6; color: #9F1239; }   /* rosa rojizo pastel */

/* ---- BOTONES ---- */
.btn-ruah {
    background: var(--ruah-pink);
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background .15s;
}
.btn-ruah:hover { background: #c4647a; color: #fff; }
.btn-ruah-outline {
    background: transparent;
    color: var(--ruah-pink);
    border: 1px solid var(--ruah-pink);
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all .15s;
}
.btn-ruah-outline:hover { background: var(--ruah-pink); color: #fff; }
.btn-teal {
    background: var(--ruah-ink);   /* antes teal, ahora azul profundo */
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background .15s;
}
.btn-teal:hover { background: #152230; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ---- TABLA ---- */
.table-ruah { width: 100%; border-collapse: collapse; }
.table-ruah th {
    background: #f8f4f2;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ruah-muted);
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--ruah-border);
}
.table-ruah td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--ruah-border);
    font-size: 0.875rem;
    vertical-align: middle;
}
.table-ruah tr:hover td { background: #fdf0f3; }   /* antes #fdf9f3 */
.table-ruah tr:last-child td { border-bottom: none; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 1rem; }
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--ruah-muted);
    margin-bottom: 5px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--ruah-border);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: 'DM Sans', sans-serif;
    background: #fff;
    transition: border-color .15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--ruah-pink);
    box-shadow: 0 0 0 3px rgba(216,122,140,0.15);   /* antes gold */
}
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* ---- ALERTAS ---- */
.alert-ruah {
    padding: 0.875rem 1.25rem;
    border-radius: 6px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #6EE7B7; }   /* verde menta pastel */
.alert-warning { background: #FEF3C7; color: #92610A; border: 1px solid #FCD34D; }   /* amarillo pastel */
.alert-danger  { background: #FFE4E6; color: #9F1239; border: 1px solid #FCA5A5; }   /* rosa rojizo pastel */
.alert-info    { background: #E0F2FE; color: #0C4A6E; border: 1px solid #7DD3FC; }   /* celeste pastel */

/* ---- PROGRESS BAR ---- */
.progress-ruah {
    height: 10px;
    background: #ede0e4;
    border-radius: 10px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--grad-pink);   /* antes gold→teal */
    border-radius: 10px;
    transition: width .5s ease;
}

/* ---- PAGE HEADER ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.page-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--ruah-ink);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-wrapper { margin-left: 0; }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ---- MISC ---- */
.mono { font-family: 'DM Mono', monospace; font-size: 0.85em; }
.text-gold  { color: var(--ruah-gold); }
.text-teal  { color: var(--ruah-pink); }       /* clase mantenida, apunta al nuevo acento */
.text-muted { color: var(--ruah-muted); }
.divider { border: none; border-top: 1px solid var(--ruah-border); margin: 1.5rem 0; }
.vencido-row td { background: #FEF3C7 !important; }   /* amarillo pastel — alerta de vencimiento */
.stock-bajo { color: #dc3545; font-weight: 600; }