:root {
    --azul: #1a73e8;
    --gris-fondo: #f4f6f8;
    --gris-borde: #dfe3e8;
    --texto: #1f2933;
    --verde: #2e7d32;
    --naranja: #e65100;
    --rojo: #c62828;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    background: var(--gris-fondo);
    color: var(--texto);
}

.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

/* ---- Layout con menú lateral ---- */
.app-layout { display: flex; min-height: 100vh; }
.app-layout .container { flex: 1; min-width: 0; }

.sidebar {
    width: 232px;
    flex: 0 0 232px;
    background: #fff;
    border-right: 1px solid var(--gris-borde);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar__brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-weight: 700;
    color: var(--azul);
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--gris-borde);
    font-size: 1.05rem;
}
.sidebar__logo { height: 28px; width: auto; border-radius: 4px; }

.sidebar__nav { display: flex; flex-direction: column; padding: .75rem; gap: .15rem; overflow-y: auto; flex: 1; }
.sidebar__nav a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .75rem;
    border-radius: 8px;
    color: #4b5563;
    text-decoration: none;
    font-size: .92rem;
}
.sidebar__nav a svg { width: 19px; height: 19px; flex-shrink: 0; }
.sidebar__nav a:hover { background: var(--gris-fondo); color: var(--texto); }
.sidebar__nav a.active { background: #e8f0fe; color: var(--azul); font-weight: 600; }

.sidebar__user {
    padding: .9rem 1.25rem;
    border-top: 1px solid var(--gris-borde);
    display: flex;
    flex-direction: column;
    gap: .3rem;
    font-size: .85rem;
}
.sidebar__user-nombre { font-weight: 600; color: var(--texto); }
.sidebar__user a { color: var(--rojo); text-decoration: none; font-size: .82rem; }

@media (max-width: 860px) {
    .app-layout { flex-direction: column; }
    .sidebar { position: static; height: auto; width: 100%; flex: 0 0 auto; }
    .sidebar__nav { flex-direction: row; overflow-x: auto; padding: .5rem; }
    .sidebar__nav a span { display: none; }
    .sidebar__nav a { padding: .6rem; }
    .sidebar__user { flex-direction: row; justify-content: space-between; align-items: center; }
}

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }

h1 { font-size: 1.5rem; margin-bottom: .25rem; }
.muted { color: #6b7280; font-size: .9rem; }

.btn {
    display: inline-block;
    background: var(--azul);
    color: #fff;
    padding: .55rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: .95rem;
}
.btn--ghost { background: transparent; color: var(--texto); border: 1px solid var(--gris-borde); }

.tabla { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; }
.tabla th, .tabla td { padding: .65rem .9rem; border-bottom: 1px solid var(--gris-borde); text-align: left; font-size: .92rem; }
.tabla th { background: #fafbfc; font-weight: 600; }
.tabla .acciones a { margin-right: .75rem; color: var(--azul); text-decoration: none; font-size: .85rem; }

.badge { display: inline-block; padding: .2rem .55rem; border-radius: 999px; color: #fff; font-size: .78rem; }
.badge--ok { background: var(--verde); }
.badge--warn { background: #b0730a; }

.alert { padding: .75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: .9rem; }
.alert--error { background: #fdecea; color: var(--rojo); border: 1px solid #f5c6cb; }

.card-form {
    background: #fff;
    border: 1px solid var(--gris-borde);
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.card-form label { font-size: .85rem; font-weight: 600; margin-top: .5rem; }
.card-form input, .card-form select, .card-form textarea {
    padding: .55rem .7rem;
    border: 1px solid var(--gris-borde);
    border-radius: 6px;
    font-size: .95rem;
    font-family: inherit;
}
.card-form textarea { resize: vertical; }
.card-form button { margin-top: 1rem; }

.filtros { display: flex; gap: .75rem; align-items: center; }
.filtros select, .filtros input { padding: .5rem .7rem; border: 1px solid var(--gris-borde); border-radius: 6px; }

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a73e8, #0d3f7a);
}
.login-card {
    background: #fff;
    padding: 2.5rem;
    border-radius: 10px;
    width: 340px;
    display: flex;
    flex-direction: column;
    gap: .4rem;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.login-card h1 { margin: 0; color: var(--azul); }
.login-card label { font-size: .85rem; font-weight: 600; margin-top: .75rem; }
.login-card input {
    padding: .6rem .7rem;
    border: 1px solid var(--gris-borde);
    border-radius: 6px;
}
.login-card button {
    margin-top: 1.25rem;
    background: var(--azul);
    color: #fff;
    border: none;
    padding: .7rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
}

.qr-card {
    background: #fff;
    border: 1px solid var(--gris-borde);
    border-radius: 10px;
    padding: 2rem;
    max-width: 400px;
    text-align: center;
}
.qr-card__brand { display: flex; align-items: center; gap: .6rem; justify-content: center; margin-bottom: 1rem; }
.qr-card__logo { height: 36px; }
.qr-card__empresa { font-weight: 700; }
.qr-card__sub { font-size: .78rem; color: #6b7280; }
.qr-card__empleado { margin-top: 1rem; }
.qr-card__footer { margin-top: .75rem; font-size: .75rem; color: #9ca3af; }

/* El QR se genera en el servidor a su tamaño real (puede ser más grande
   que la tarjeta, sobre todo el de "Aprovisionar"). Lo mostramos al
   100% del ancho disponible en vez de forzar un tamaño fijo más chico
   -- forzar un tamaño menor hace que el navegador lo encoja con
   suavizado, lo cual difumina los cuadritos del QR y le cuesta mucho
   más a la cámara reconocerlo. "pixelated" evita ese desenfoque en
   cualquier escalado que sí llegue a pasar (ej. pantallas angostas). */
.qr-card__img {
    display: block;
    margin: 0 auto;
    width: 100%;
    height: auto;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

@media print {
    .sidebar, .btn { display: none !important; }
}
