/* ============================================================
   ORGANIC LAIT ERP — Hoja de estilos global
   Fuente: Inter (Google Fonts / fallback sistema)
   Paleta: slate-900 primario, light mode siempre
   ============================================================ */

/* --- VARIABLES CANÓNICAS ----------------------------------- */
:root {
    /* Marca */
    --primary:     #0f172a;   /* slate-900  — textos, headers */
    --dark:        #1e293b;   /* slate-800  — texto secundario */
    --ink:         #334155;   /* slate-700  — cuerpo de texto */
    --text:        #475569;   /* slate-600  — subtítulos */
    --muted:       #64748b;   /* slate-500  — hints, metadatos */
    --light:       #94a3b8;   /* slate-400  — placeholders */

    /* Acento */
    --accent:      #3b82f6;   /* blue-500 */
    --blue:        #2563eb;   /* blue-600 */
    --purple:      #7c3aed;   /* violet-600 */

    /* Semánticos */
    --success:     #16a34a;   /* green-600 */
    --green:       #16a34a;
    --danger:      #dc2626;   /* red-600 */
    --red:         #dc2626;
    --warning:     #d97706;   /* amber-600 */
    --amber:       #d97706;
    --orange:      #ea580c;   /* orange-600 */
    --warn:        #f59e0b;   /* amber-400 — variante clara */

    /* Fondos semánticos (pasteles) */
    --bg-success:  #dcfce7;
    --bg-danger:   #fee2e2;
    --bg-warning:  #fef9c3;
    --bg-blue:     #dbeafe;
    --bg-purple:   #ede9fe;

    /* Layout */
    --bg:          #f8fafc;
    --card:        #ffffff;
    --border:      #e2e8f0;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);

    /* Tipografía */
    --font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono:        'JetBrains Mono', 'Fira Code', monospace;
    --font-size:   13px;
}

/* --- BASE -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font);
    font-size:   var(--font-size);
    background:  var(--bg);
    color:       var(--dark);
    margin: 0;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- LAYOUT ------------------------------------------------ */
.main-content { padding: 28px 30px; }

.container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    gap: 24px;
}

/* --- CARDS ------------------------------------------------- */
.card {
    background: var(--card);
    padding: 24px;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
}

.card h3 {
    margin: 0 0 18px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 14px;
}

/* --- FORMULARIOS ------------------------------------------ */
label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 14px 0 5px;
}

input, textarea, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 0.9rem;
    font-family: var(--font);
    background: white;
    color: var(--dark);
    transition: border-color .15s, box-shadow .15s;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,.12);
    outline: none;
}

/* --- BOTONES ---------------------------------------------- */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 9px;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
    text-decoration: none;
    white-space: nowrap;
}
button:hover, .btn:hover { opacity: .88; transform: translateY(-1px); }
button:active, .btn:active { transform: translateY(0); }

.btn-primary  { background: var(--primary); color: white; }
.btn-accent   { background: var(--accent);  color: white; }
.btn-success  { background: var(--success); color: white; }
.btn-danger   { background: var(--danger);  color: white; }
.btn-warning  { background: var(--warning); color: white; }
.btn-outline  { background: white; color: var(--dark); border: 1px solid var(--border); }
.btn-ghost    { background: transparent; color: var(--muted); }
.btn-sm       { padding: 6px 12px; font-size: 0.78rem; }
.btn-xs       { padding: 4px 9px;  font-size: 0.72rem; }
.btn-full     { width: 100%; }

/* --- TABLAS ----------------------------------------------- */
.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th {
    background: #f1f5f9;
    padding: 11px 14px;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 13px 14px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.88rem;
    color: var(--dark);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

.td-num {
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.td-center { text-align: center; }
.td-muted  { color: var(--muted); font-size: 0.8rem; }

/* --- BADGES / PILLS --------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

.badge-success  { background: var(--bg-success); color: #166534; }
.badge-danger   { background: var(--bg-danger);  color: #991b1b; }
.badge-warning  { background: var(--bg-warning); color: #92400e; }
.badge-blue     { background: var(--bg-blue);    color: #1e40af; }
.badge-purple   { background: var(--bg-purple);  color: #5b21b6; }
.badge-muted    { background: #f1f5f9;           color: var(--muted); }
.badge-info     { background: #e0f2fe;           color: #0369a1; }

/* --- ALERTAS ---------------------------------------------- */
.alerta {
    padding: 13px 16px;
    border-radius: 9px;
    margin-bottom: 18px;
    font-weight: 500;
    font-size: 0.9rem;
}
.exito  { background: var(--bg-success); color: #166534; border: 1px solid #bbf7d0; }
.error  { background: var(--bg-danger);  color: #991b1b; border: 1px solid #fecaca; }
.aviso  { background: var(--bg-warning); color: #92400e; border: 1px solid #fde68a; }

/* --- STATS CARDS ------------------------------------------ */
.stat-card {
    background: white;
    padding: 18px 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--card-shadow);
}
.stat-icon {
    background: rgba(59,130,246,.1);
    color: var(--accent);
    padding: 11px;
    border-radius: 9px;
    font-size: 1.3rem;
    flex-shrink: 0;
}

/* --- SEARCH ----------------------------------------------- */
.search-bar { padding-left: 38px !important; }

/* ============================================================
   UTILIDADES
   Reemplazando los patrones inline más comunes del codebase
   ============================================================ */

/* Texto */
.text-right   { text-align: right !important; }
.text-center  { text-align: center !important; }
.text-left    { text-align: left !important; }
.text-xs      { font-size: 0.75rem !important; }
.text-sm      { font-size: 0.82rem !important; }
.text-lg      { font-size: 1.05rem !important; }
.text-muted   { color: var(--muted) !important; }
.text-light   { color: var(--light) !important; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-blue    { color: var(--blue) !important; }
.no-underline { text-decoration: none !important; }
.uppercase    { text-transform: uppercase !important; }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Label estilo tabla (9px bold uppercase muted) */
.label-tiny {
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    color: var(--muted) !important;
    text-transform: uppercase !important;
    letter-spacing: .04em;
}

/* Peso */
.fw-400 { font-weight: 400 !important; }
.fw-500 { font-weight: 500 !important; }
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }
.fw-800 { font-weight: 800 !important; }

/* Spacing */
.m-0   { margin: 0 !important; }
.mt-0  { margin-top: 0 !important; }
.mt-1  { margin-top: 4px !important; }
.mt-2  { margin-top: 8px !important; }
.mt-3  { margin-top: 16px !important; }
.mb-0  { margin-bottom: 0 !important; }
.mb-1  { margin-bottom: 4px !important; }
.mb-2  { margin-bottom: 8px !important; }
.p-0   { padding: 0 !important; }

/* Display */
.d-none    { display: none !important; }
.d-block   { display: block !important; }
.d-flex    { display: flex !important; }
.d-inline  { display: inline !important; }

/* Flex helpers */
.flex-1        { flex: 1 !important; }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.flex-gap      { display: flex; align-items: center; gap: 8px; }
.flex-wrap     { flex-wrap: wrap !important; }

/* Overflow */
.overflow-x    { overflow-x: auto !important; }
.overflow-hide { overflow: hidden !important; }

/* Bordes y fondos rápidos */
.bg-white    { background: white !important; }
.bg-light    { background: var(--bg) !important; }
.rounded     { border-radius: 9px !important; }
.rounded-lg  { border-radius: 14px !important; }
.border      { border: 1px solid var(--border) !important; }
.shadow-sm   { box-shadow: var(--card-shadow) !important; }

/* Width helpers */
.w-full  { width: 100% !important; }
.w-auto  { width: auto !important; }
