/* ============================================================
   Granja de Pollos - Hoja de estilos principal
   ============================================================ */
:root {
    --green:        #2f7d4f;
    --green-dark:   #1f5c39;
    --green-light:  #e8f5ee;
    --accent:       #f0a500;
    --bg:           #f4f6f8;
    --card:         #ffffff;
    --text:         #1f2937;
    --muted:        #6b7280;
    --border:       #e5e7eb;
    --danger:       #dc2626;
    --warning:      #d97706;
    --info:         #2563eb;
    --radius:       12px;
    --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-lg:    0 10px 30px rgba(0,0,0,.12);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

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

.icon { flex: none; }

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

.sidebar {
    width: 240px;
    background: var(--green-dark);
    color: #d1e7dc;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 50;
    transition: transform .25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 18px;
    font-size: 16px; font-weight: 700; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.brand-logo { color: var(--accent); display: flex; }
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; margin-bottom: 2px;
    border-radius: 8px; color: #cfe3d8; font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--green); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-foot { padding: 12px 10px; border-top: 1px solid rgba(255,255,255,.1); }

.main { flex: 1; margin-left: 240px; display: flex; flex-direction: column; min-width: 0; }

.topbar {
    display: flex; align-items: center; gap: 14px;
    background: var(--card);
    padding: 12px 22px;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30;
}
.topbar-title { margin: 0; font-size: 18px; }
.menu-toggle { display: none; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-meta { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.user-meta strong { font-size: 13px; }
.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--green); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
}

.content { padding: 22px; flex: 1; }
.footer { padding: 14px 22px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); }

.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.4); z-index: 40;
}

/* ---------------- Cards ---------------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}
.card-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--border);
}
.card-head h3 { margin: 0; font-size: 15px; }
.card-body { padding: 18px; }
.card-body.p0 { padding: 0; }

/* ---------------- Grid ---------------- */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------------- Stat cards ---------------- */
.stat {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px;
    box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center;
}
.stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--green-light); color: var(--green);
}
.stat-icon.warn { background: #fef3c7; color: var(--warning); }
.stat-icon.danger { background: #fee2e2; color: var(--danger); }
.stat-icon.info { background: #dbeafe; color: var(--info); }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 15px; border-radius: 8px; border: 1px solid transparent;
    font-size: 13px; font-weight: 600; cursor: pointer;
    background: #eef1f4; color: var(--text); text-decoration: none;
    transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(.96); text-decoration: none; }
.btn-primary { background: var(--green); color: #fff; }
.btn-accent  { background: var(--accent); color: #3a2a00; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-light   { background: #fff; border-color: var(--border); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 7px; }

/* ---------------- Forms ---------------- */
label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 13px; }
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=email], input[type=month], select, textarea {
    width: 100%; margin-top: 5px;
    padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(47,125,79,.15);
}
textarea { resize: vertical; min-height: 70px; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { margin-bottom: 0; }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #fafbfc; }
tbody tr:hover { background: #fafcfa; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn { margin-left: 4px; }
.table-empty { text-align: center; color: var(--muted); padding: 26px; }

/* ---------------- Badges & alerts ---------------- */
.badge {
    display: inline-block; padding: 3px 9px; border-radius: 999px;
    font-size: 11px; font-weight: 700; letter-spacing: .02em;
}
.badge-primary { background: var(--green-light); color: var(--green-dark); }
.badge-muted   { background: #eef1f4; color: var(--muted); }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }

.alert {
    padding: 12px 15px; border-radius: 8px; margin-bottom: 16px;
    font-size: 13px; border: 1px solid transparent;
}
.alert-success { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.alert-info    { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }

/* ---------------- Utilities ---------------- */
.text-muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--green); }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 14px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.chart-box { position: relative; height: 300px; }
select.select-inline { width: auto; margin: 0; padding: 6px 10px; font-size: 12px; }

/* ---------------- Login ---------------- */
.login-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--green-dark), var(--green));
    padding: 20px;
}
.login-card {
    background: #fff; border-radius: 16px; padding: 32px;
    width: 100%; max-width: 400px; box-shadow: var(--shadow-lg);
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand .brand-logo {
    width: 60px; height: 60px; margin: 0 auto 10px;
    background: var(--green-light); color: var(--green);
    border-radius: 16px; display: flex; align-items: center; justify-content: center;
}
.login-brand h1 { margin: 0 0 4px; font-size: 20px; }
.login-brand p { margin: 0; color: var(--muted); font-size: 13px; }
.login-foot { text-align: center; color: var(--muted); font-size: 12px; margin: 20px 0 0; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1000px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .sidebar-overlay.show { display: block; }
    .grid-2, .grid-3, .grid-4, .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .user-meta { display: none; }
}