* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif; background: #f4f5f7; color: #1f2329; }
.hidden { display: none !important; }
.muted { color: #6b7280; font-size: 13px; }
.err { color: #c0392b; margin-top: 8px; font-size: 14px; min-height: 18px; }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #c0392b; }
.login-card { background: #fff; padding: 32px; border-radius: 14px; width: 320px; box-shadow: 0 10px 40px rgba(0,0,0,.2); text-align: center; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card input { width: 100%; padding: 12px; margin: 16px 0 8px; border: 1px solid #ddd; border-radius: 8px; font-size: 15px; }
.login-card button { width: 100%; padding: 12px; background: #c0392b; color: #fff; border: none; border-radius: 8px; font-size: 15px; cursor: pointer; }

/* header */
header { display: flex; align-items: center; gap: 16px; background: #fff; padding: 10px 18px; box-shadow: 0 1px 4px rgba(0,0,0,.08); position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.brand { font-weight: 700; color: #c0392b; }
nav { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.tab { background: transparent; border: none; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; color: #444; }
.tab:hover { background: #f0f0f0; }
.tab.active { background: #c0392b; color: #fff; }
.logout { background: #eee; border: none; padding: 8px 12px; border-radius: 8px; cursor: pointer; }

main { max-width: 1000px; margin: 22px auto; padding: 0 18px; }
.tabpane { background: #fff; border-radius: 12px; padding: 22px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
h2 { margin: 0 0 16px; font-size: 19px; }
h3 { margin: 22px 0 10px; font-size: 15px; }

.rowbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
label { display: flex; flex-direction: column; font-size: 13px; color: #555; gap: 4px; flex: 1; min-width: 180px; }
label.block { display: block; margin: 14px 0; }
input, select { padding: 10px; border: 1px solid #d6d9dd; border-radius: 8px; font-size: 14px; background: #fff; }

button.primary { background: #c0392b; color: #fff; border: none; padding: 11px 18px; border-radius: 8px; cursor: pointer; font-size: 14px; }
button.primary:hover { background: #a93226; }
.filebtn { background: #eef; color: #2b3a67; padding: 11px 16px; border-radius: 8px; cursor: pointer; flex: none; display: inline-block; }

/* tablas */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 8px; border-bottom: 1px solid #eee; text-align: left; }
th { background: #fafafa; font-size: 12px; text-transform: uppercase; color: #888; }
td input { width: 90px; padding: 6px; }
.r { text-align: right; }

/* préstamos cards */
.pcard { border: 1px solid #eee; border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.pcard .ptop { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.pcard .flujo { font-weight: 600; }
.pcard .arrow { color: #c0392b; margin: 0 6px; }
.estado { font-size: 11px; padding: 3px 9px; border-radius: 20px; font-weight: 700; }
.estado.activo { background: #fff3cd; color: #8a6d3b; }
.estado.devuelto { background: #d4edda; color: #256029; }
.estado.parcial { background: #cfe2ff; color: #084298; }
.pitems { margin: 10px 0; font-size: 13px; color: #444; }
.pitems span { display: inline-block; background: #f4f5f7; padding: 3px 8px; border-radius: 6px; margin: 2px 3px; }
.pactions { display: flex; gap: 8px; flex-wrap: wrap; }
.pactions a, .pactions button { font-size: 13px; padding: 7px 12px; border-radius: 7px; border: 1px solid #ddd; background: #fff; cursor: pointer; text-decoration: none; color: #333; }

.resultados { max-height: 240px; overflow: auto; border: 1px solid #eee; border-radius: 8px; margin-bottom: 14px; }
.resultados .ritem { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-bottom: 1px solid #f2f2f2; cursor: pointer; }
.resultados .ritem:hover { background: #fbeceb; }
.resultados .sinmin { color: #c0392b; font-size: 12px; }
.carrito table td input { width: 70px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-card { background: #fff; border-radius: 12px; padding: 22px; width: 460px; max-width: 92vw; max-height: 85vh; overflow: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.modal-actions button { padding: 10px 16px; border-radius: 8px; border: 1px solid #ddd; background: #fff; cursor: pointer; }

.empty { text-align: center; color: #9aa0a6; padding: 30px; }

.estado.cancelado { background: #f0f0f0; color: #777; text-decoration: line-through; }

.login-card button.linklike { background: transparent; color: #c0392b; padding: 8px; font-size: 13px; margin-top: 4px; }
