:root {
    --bg: #07111f;
    --bg-2: #0d1830;
    --glass: rgba(10, 20, 45, 0.58);
    --glass-border: rgba(120, 220, 255, 0.22);
    --text: #ecf8ff;
    --muted: #9cb6d3;
    --cyan: #3cf4ff;
    --pink: #ff4fd8;
    --green: #38ffb3;
    --yellow: #ffd95c;
    --red: #ff6b81;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(60, 244, 255, 0.18), transparent 28%),
        radial-gradient(circle at top right, rgba(255, 79, 216, 0.16), transparent 30%),
        linear-gradient(145deg, var(--bg), var(--bg-2));
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    position: relative;
    overflow-x: hidden;
}

a {
    color: inherit;
}

.bg-orb {
    position: fixed;
    width: 320px;
    height: 320px;
    border-radius: 999px;
    filter: blur(80px);
    opacity: 0.35;
    pointer-events: none;
}

.orb-1 { top: -60px; left: -80px; background: var(--cyan); }
.orb-2 { top: 160px; right: -60px; background: var(--pink); }
.orb-3 { bottom: -100px; left: 30%; background: var(--green); }

.app-shell {
    position: relative;
    z-index: 1;
    max-width: 1360px;
    margin: 0 auto;
    padding: 24px;
}

.glass {
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    margin-bottom: 26px;
}

.brand {
    color: var(--text);
    text-decoration: none;
    font-size: 1.4rem;
    font-weight: 800;
    text-shadow: 0 0 18px rgba(60, 244, 255, 0.45);
}

.small { font-size: 0.92rem; }
.muted { color: var(--muted); }
.mt-2 { margin-top: 20px; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
}

.user-chip {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(60, 244, 255, 0.08);
    border: 1px solid rgba(60, 244, 255, 0.2);
}

.content-wrap {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.page-head h1,
.panel h2,
.auth-card h1 {
    margin: 0 0 8px;
}

.actions-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn-primary {
    background: linear-gradient(135deg, rgba(60, 244, 255, 0.24), rgba(60, 244, 255, 0.12));
    box-shadow: 0 0 24px rgba(60, 244, 255, 0.25);
}
.btn-secondary {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.09);
}
.btn-danger {
    background: linear-gradient(135deg, rgba(255, 107, 129, 0.26), rgba(255, 107, 129, 0.12));
    box-shadow: 0 0 24px rgba(255, 107, 129, 0.2);
}
.btn-sm {
    padding: 8px 12px;
    font-size: 0.9rem;
}
.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.panel {
    padding: 22px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.stat-card {
    padding: 20px;
    min-height: 128px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-label {
    color: var(--muted);
    font-size: 0.95rem;
}

.stat-card strong {
    font-size: 1.8rem;
    line-height: 1.1;
    text-shadow: 0 0 18px rgba(255,255,255,0.16);
}

.stat-card.success { border-color: rgba(56, 255, 179, 0.28); }
.stat-card.warning { border-color: rgba(255, 217, 92, 0.28); }
.stat-card.danger { border-color: rgba(255, 107, 129, 0.28); }

.grid-two {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 20px;
}

.stack-list {
    display: grid;
    gap: 14px;
}

.batch-cards {
    display: grid;
    gap: 14px;
}

.batch-card,
.mini-card {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 16px;
    border-radius: 18px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
}

.batch-card-top,
.mini-card-top,
.metric-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.mini-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    font-size: 0.95rem;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

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

th, td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-weight: 700;
    font-size: 0.92rem;
    letter-spacing: 0.02em;
}

.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form-grid.single-col {
    grid-template-columns: 1fr;
}

.full-col {
    grid-column: 1 / -1;
}

label {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label span {
    color: var(--muted);
    font-weight: 600;
}

input, select, textarea {
    width: 100%;
    padding: 13px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.09);
    background: rgba(255,255,255,0.05);
    color: var(--text);
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: rgba(60, 244, 255, 0.5);
    box-shadow: 0 0 0 4px rgba(60, 244, 255, 0.08);
}

option {
    color: #111827;
}

textarea {
    resize: vertical;
}

.inline-check {
    flex-direction: row;
    align-items: center;
}

.inline-check input {
    width: auto;
}

.auth-wrap {
    min-height: calc(100vh - 180px);
    display: grid;
    place-items: center;
}

.auth-card {
    width: min(560px, 100%);
    padding: 28px;
}

.auth-link {
    margin-top: 20px;
}

.auth-link a {
    color: var(--cyan);
}

.alert {
    padding: 16px 18px;
}

.alert ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.alert-success { border-color: rgba(56, 255, 179, 0.3); }
.alert-danger { border-color: rgba(255, 107, 129, 0.3); }

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.badge-incubando,
.badge-activa,
.badge-ingreso,
.badge-pendiente {
    background: rgba(60, 244, 255, 0.14);
    border: 1px solid rgba(60, 244, 255, 0.24);
}

.badge-finalizado,
.badge-mantenimiento,
.badge-parcial,
.badge-gasto_extra {
    background: rgba(255, 217, 92, 0.14);
    border: 1px solid rgba(255, 217, 92, 0.24);
}

.badge-cancelado,
.badge-inactiva,
.badge-retiro,
.badge-compra_huevos,
.badge-entregado {
    background: rgba(255, 107, 129, 0.14);
    border: 1px solid rgba(255, 107, 129, 0.24);
}

.badge-success-lite {
    background: rgba(56, 255, 179, 0.14);
    border: 1px solid rgba(56, 255, 179, 0.24);
}

.badge-danger-lite {
    background: rgba(255, 107, 129, 0.14);
    border: 1px solid rgba(255, 107, 129, 0.24);
}

.code-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(60, 244, 255, 0.14);
    border: 1px solid rgba(60, 244, 255, 0.26);
    color: var(--text);
    font-weight: 800;
    text-decoration: none;
}

.note-box {
    padding: 14px;
    border-radius: 16px;
    background: rgba(255,255,255,0.05);
    border: 1px dashed rgba(255,255,255,0.12);
    color: var(--text);
}

.detail-list {
    display: grid;
    gap: 12px;
}

.detail-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255,255,255,0.04);
}

.detail-list span {
    color: var(--muted);
}

.filters-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filters-row input,
.filters-row select {
    flex: 1 1 180px;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.pager-meta {
    color: var(--muted);
}

.metric-row {
    padding: 14px;
    border-radius: 18px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
}

.progress-wrap {
    position: relative;
    height: 11px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    overflow: hidden;
    margin: 8px 0 10px;
}

.progress-wrap.big {
    height: 16px;
}

.progress-bar {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(60, 244, 255, 0.9), rgba(56, 255, 179, 0.95));
    box-shadow: 0 0 20px rgba(60, 244, 255, 0.35);
}

@media (max-width: 980px) {
    .grid-two {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .app-shell {
        padding: 14px;
    }

    .topbar {
        padding: 16px;
    }

    .form-grid,
    .stats-grid,
    .card-grid {
        grid-template-columns: 1fr;
    }

    .page-head,
    .nav-links,
    .table-actions,
    .actions-row {
        width: 100%;
    }

    .nav-links {
        justify-content: flex-start;
    }

    .mini-grid {
        grid-template-columns: 1fr;
    }
}
