/* TOMA PEDIDOS - Estilos panel admin */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg); color: var(--text); font-size: 14px;
}

/* Login */
.login-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #06b6d4 100%);
}
.login-wrap { width: 100%; max-width: 420px; padding: 20px; }
.login-card {
    background: white; padding: 40px 32px; border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo h1 { font-size: 1.4rem; margin: 12px 0 4px; color: var(--primary-dark); }
.login-logo p { color: var(--muted); font-size: 0.85rem; }
.logo-circle {
    width: 64px; height: 64px; border-radius: 50%; margin: 0 auto;
    background: linear-gradient(135deg, var(--primary), #06b6d4);
    color: white; display: flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 1.5rem;
}
form label { display: block; margin: 12px 0 4px; font-weight: 500; font-size: 0.85rem; color: #334155; }
form input, form select, form textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 14px; background: white;
    font-family: inherit;
}
form input:focus, form select:focus, form textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.btn-primary {
    background: var(--primary); color: white; border: 0; padding: 10px 18px;
    border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px;
    margin-top: 12px; transition: 0.2s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-link { background: none; border: 0; color: var(--primary); cursor: pointer; text-decoration: none; }
.btn-link:hover { text-decoration: underline; }
.hint { text-align: center; margin-top: 16px; color: var(--muted); font-size: 0.8rem; }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 0.9rem; }
.alert.error { background: #fee2e2; color: #991b1b; }
.alert.ok    { background: #d1fae5; color: #065f46; }

/* App shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 230px; background: #0f172a; color: white; padding: 16px 0;
    flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 10px;
    padding: 0 16px 20px; border-bottom: 1px solid #1e293b;
}
.sidebar .brand strong { font-size: 0.95rem; }
.sidebar .brand small { color: #94a3b8; font-size: 0.75rem; }
.sidebar nav { margin-top: 12px; }
.sidebar a {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 16px; color: #cbd5e1; text-decoration: none;
    transition: 0.15s; font-size: 0.92rem;
}
.sidebar a:hover { background: #1e293b; color: white; }
.sidebar a.active {
    background: var(--primary); color: white;
    border-left: 3px solid #06b6d4;
}
.sidebar .ico { font-size: 1.1rem; }

.main { flex: 1; min-width: 0; }
.topbar {
    background: white; padding: 12px 24px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.topbar h2 { font-size: 1.1rem; color: #1e293b; }
.user-info { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 0.9rem; }
.content { padding: 20px 24px; }

.card {
    background: var(--card); padding: 20px; border-radius: 12px;
    margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
}
.card h3 { font-size: 1rem; margin-bottom: 14px; color: #1e293b; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.kpi-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px; margin-bottom: 16px;
}
.kpi-card {
    background: white; padding: 16px; border-radius: 12px;
    display: flex; align-items: center; gap: 14px;
    border: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.kpi-ico { font-size: 2rem; }
.kpi-card small { color: var(--muted); font-size: 0.78rem; display: block; }
.kpi-card h3 { font-size: 1.4rem; margin: 2px 0; color: #1e293b; }
.kpi-sub { color: var(--success); font-size: 0.8rem; font-weight: 500; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 10px; text-align: left; font-size: 0.88rem; }
.table thead { background: #f8fafc; }
.table th { color: #475569; font-weight: 600; border-bottom: 1px solid var(--border); }
.table tbody tr { border-bottom: 1px solid #f1f5f9; }
.table tbody tr:hover { background: #f8fafc; }
.muted { color: var(--muted); text-align: center; padding: 20px; font-style: italic; }

.badge {
    display: inline-block; padding: 3px 9px; border-radius: 999px;
    font-size: 0.72rem; font-weight: 600; background: #e2e8f0; color: #475569;
    text-transform: uppercase; letter-spacing: 0.3px;
}
.estado-enviado { background: #dbeafe; color: #1e40af; }
.estado-aprobado, .estado-facturado { background: #d1fae5; color: #065f46; }
.estado-entregado { background: #ccfbf1; color: #115e59; }
.estado-rechazado, .estado-cancelado { background: #fee2e2; color: #991b1b; }
.estado-borrador { background: #f1f5f9; color: #475569; }
.badge.alerta { background: #fee2e2; color: #991b1b; }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.filters label { font-size: 0.85rem; color: #475569; display: block; }
.filters input, .filters select { padding: 7px 10px; min-width: 120px; }
.filters button { margin-top: 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Modal */
.modal {
    display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.55);
    align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal.open { display: flex; }
.modal-card {
    background: white; padding: 28px; border-radius: 14px;
    max-width: 720px; width: 100%; max-height: 90vh; overflow-y: auto;
}
.modal-card h3 { margin-bottom: 18px; font-size: 1.15rem; color: #1e293b; }
.modal-actions {
    display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px;
    border-top: 1px solid var(--border); padding-top: 14px;
}
.grid-2 label.full { grid-column: 1 / -1; }
