:root {
    color-scheme: light dark;
}
body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: #f5f6f8;
    color: #1a1a1a;
    margin: 0;
    padding: 2rem 1rem;
}
.contenedor {
    max-width: 900px;
    margin: 0 auto;
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
h1 { margin-top: 0; font-size: 1.5rem; }
.alerta { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
.alerta.exito { background: #e6f4ea; color: #1e7e34; }
.alerta.error { background: #fbe9e7; color: #c62828; }
.form-subida {
    display: flex; flex-wrap: wrap; gap: 1rem; align-items: center;
    margin-bottom: 1.5rem; padding: 1rem; background: #fafafa;
    border-radius: 6px; border: 1px dashed #ccc;
}
.form-subida label { width: 100%; font-weight: 600; }
button, .boton-secundario {
    background: #2563eb; color: #fff; border: none; padding: 0.6rem 1.2rem;
    border-radius: 6px; cursor: pointer; text-decoration: none; display: inline-block;
    font-size: 0.95rem;
}
.boton-secundario { background: #4b5563; }
.acciones { margin-bottom: 1rem; }
.tabla-facturas { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.tabla-facturas th, .tabla-facturas td { text-align: left; padding: 0.6rem; border-bottom: 1px solid #eee; font-size: 0.9rem; }
.tabla-facturas th { background: #f0f2f5; }
.detalle-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; margin: 1.5rem 0; }
.detalle-grid h3 { margin-bottom: 0.3rem; font-size: 1rem; }
.detalle-grid p { margin: 0.2rem 0; font-size: 0.9rem; }
.totales { margin-top: 1rem; text-align: right; }
.totales .total { font-size: 1.1rem; }
.imagen-factura { max-width: 100%; border-radius: 6px; margin-top: 0.5rem; border: 1px solid #eee; }

.estado { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.estado-ok { background: #e6f4ea; color: #1e7e34; }
.estado-error { background: #fbe9e7; color: #c62828; cursor: help; }
.estado-pendiente { background: #fff3cd; color: #92650a; }

@media (prefers-color-scheme: dark) {
    body { background: #111827; color: #e5e7eb; }
    .contenedor { background: #1f2937; box-shadow: none; }
    .tabla-facturas th { background: #111827; }
    .tabla-facturas th, .tabla-facturas td { border-color: #374151; }
    .form-subida { background: #111827; border-color: #374151; }
    .alerta.exito { background: #14532d; color: #bbf7d0; }
    .alerta.error { background: #7f1d1d; color: #fecaca; }
}
