*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #f0f2f5;
    color: #2c3e50;
    font-size: 14px;
}

/* ── Nav ──────────────────────────────────────────────────────────────────── */

nav {
    background: #1f538d;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 2px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand {
    color: white;
    font-size: 1rem;
    font-weight: 700;
    margin-right: 20px;
    white-space: nowrap;
}

nav a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 16px 18px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

nav a:hover { background: rgba(255,255,255,0.1); color: white; }
nav a.active { background: rgba(255,255,255,0.18); color: white; }

/* ── Layout ───────────────────────────────────────────────────────────────── */

main {
    max-width: 1360px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* ── Card ─────────────────────────────────────────────────────────────────── */

.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    overflow: hidden;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #eef0f3;
}

.card-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a2637;
}

/* ── Table ────────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead th {
    background: #1f538d;
    color: white;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

thead th.center { text-align: center; }
thead th:first-child { padding-left: 16px; }

tbody td {
    padding: 9px 14px;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: middle;
}

tbody td:first-child { padding-left: 16px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafd; }

.td-right { text-align: right; }
.td-center { text-align: center; }
.nowrap { white-space: nowrap; }
.text-muted { color: #7f8c8d; }
.text-center { text-align: center; }

.empty-row td {
    text-align: center;
    padding: 32px;
    color: #7f8c8d;
    font-style: italic;
}

/* ── Badge ────────────────────────────────────────────────────────────────── */

.badge {
    background: #e8f0fb;
    color: #1f538d;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.badge-admin {
    background: #fef3e2;
    color: #b7641a;
}

.badge-log {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-active {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-consumed {
    background: #f0f2f5;
    color: #4a5568;
}

.summary-inline {
    font-size: 13px;
    font-weight: 600;
    color: #1f538d;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    transition: background 0.15s;
    white-space: nowrap;
}

.btn-primary   { background: #1f538d; color: white; }
.btn-primary:hover   { background: #174070; }
.btn-danger    { background: #c0392b; color: white; }
.btn-danger:hover    { background: #a93226; }
.btn-secondary { background: #eef0f3; color: #2c3e50; }
.btn-secondary:hover { background: #e2e5ea; }
.btn-outline   { background: transparent; border: 1px solid #1f538d; color: #1f538d; }
.btn-outline:hover   { background: #e8f0fb; }

.btn-sm { padding: 5px 11px; font-size: 12px; }

.actions { display: flex; gap: 4px; align-items: center; }

/* ── Forms ────────────────────────────────────────────────────────────────── */

.form-grid { display: grid; gap: 14px; }

.form-group { display: flex; flex-direction: column; gap: 5px; }

label.field-label {
    font-size: 11px;
    font-weight: 600;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

input[type=text],
input[type=date],
input[type=email],
select,
textarea {
    padding: 8px 11px;
    border: 1px solid #dde1e7;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: #2c3e50;
    background: white;
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #1f538d;
    box-shadow: 0 0 0 3px rgba(31,83,141,0.12);
}

input:disabled, select:disabled, textarea:disabled {
    background: #f5f6fa;
    color: #aab0bc;
    cursor: not-allowed;
}

input[type=checkbox] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #1f538d;
    flex-shrink: 0;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 2px;
}

.checkbox-row label {
    font-size: 13px;
    font-weight: 500;
    color: #2c3e50;
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
}

/* ── Dialog ───────────────────────────────────────────────────────────────── */

dialog {
    border: none;
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.22);
    padding: 0;
    width: 500px;
    max-width: 96vw;
}

dialog::backdrop { background: rgba(0,0,0,0.45); }

.dialog-header {
    padding: 16px 22px 14px;
    border-bottom: 1px solid #eef0f3;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dialog-header h3 { font-size: 0.95rem; font-weight: 600; }

.dialog-body { padding: 20px 22px; }

.dialog-footer {
    padding: 12px 22px 18px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    border-top: 1px solid #eef0f3;
}

.close-btn {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #7f8c8d;
    line-height: 1;
    padding: 0 4px;
}
.close-btn:hover { color: #2c3e50; }

/* ── Filter bar ───────────────────────────────────────────────────────────── */

.filter-bar {
    background: white;
    border-radius: 10px;
    padding: 14px 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-bar .form-group { min-width: 120px; }

/* ── Bulk bar ─────────────────────────────────────────────────────────────── */

.bulk-bar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: #e8f0fb;
    border-bottom: 1px solid #cddaf0;
    font-size: 13px;
    color: #1f538d;
    font-weight: 500;
}

.bulk-bar.visible { display: flex; }

/* ── Summary bar ──────────────────────────────────────────────────────────── */

.summary {
    padding: 12px 20px;
    text-align: right;
    font-weight: 600;
    color: #1f538d;
    font-size: 13px;
    border-top: 2px solid #eef0f3;
}

/* ── Hidden ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Nav user ─────────────────────────────────────────────────────────────── */

.nav-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
}

.nav-username {
    color: rgba(255,255,255,0.75);
    font-size: 13px;
}

.nav-logout {
    color: rgba(255,255,255,0.6);
    font-size: 12px;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.25);
    padding: 4px 10px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}
.nav-logout:hover { background: rgba(255,255,255,0.12); color: white; }

/* ── Login ────────────────────────────────────────────────────────────────── */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f0f2f5;
}

.login-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.10);
    padding: 36px 40px 32px;
    width: 340px;
}

.login-logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1f538d;
    text-align: center;
    margin-bottom: 2px;
}

.login-subtitle {
    text-align: center;
    color: #7f8c8d;
    font-size: 12px;
    margin-bottom: 28px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.login-error {
    background: #fdecea;
    border: 1px solid #f5c6cb;
    color: #a93226;
    border-radius: 6px;
    padding: 9px 12px;
    font-size: 13px;
    margin-bottom: 16px;
}

/* ── Alerts ───────────────────────────────────────────────────────────────── */

.alert {
    border-radius: 8px;
    padding: 11px 16px;
    font-size: 13px;
    margin-bottom: 14px;
}

.alert a { font-weight: 600; }

.alert-warning {
    background: #fff8e1;
    border: 1px solid #ffe082;
    color: #7a5c00;
}

.alert-warning a { color: #7a5c00; }

.alert-success {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #1b5e20;
}

.alert-success a { color: #1b5e20; }

/* ── Bono status (tabla clientes) ─────────────────────────────────────────── */

.bono-remaining {
    display: block;
    font-weight: 600;
    color: #1f538d;
    font-size: 13px;
}

.bono-detail {
    display: block;
    font-size: 11px;
    color: #7f8c8d;
    margin-top: 1px;
}

.bono-none {
    color: #b0b8c4;
    font-size: 12px;
    font-style: italic;
}

/* ── Bono info (dialogs horas) ────────────────────────────────────────────── */

.bono-info {
    font-size: 12px;
    color: #1f538d;
    background: #e8f0fb;
    border-radius: 5px;
    padding: 6px 10px;
}

.bono-info.bono-warn {
    color: #7a5c00;
    background: #fff8e1;
}

/* ── Help page ────────────────────────────────────────────────────────────── */

.help-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 28px;
    align-items: start;
}

.help-toc {
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    padding: 18px 0 14px;
    position: sticky;
    top: 80px;
}

.help-toc-title {
    font-size: 11px;
    font-weight: 700;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 0 18px 10px;
    border-bottom: 1px solid #eef0f3;
    margin-bottom: 6px;
}

.help-toc a {
    display: block;
    padding: 6px 18px;
    font-size: 13px;
    color: #2c3e50;
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.help-toc a:hover {
    background: #f0f4fb;
    color: #1f538d;
    border-left-color: #1f538d;
}

.help-content {
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    padding: 32px 36px 40px;
}

.help-h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1a2637;
    margin-bottom: 10px;
}

.help-intro {
    color: #4a5568;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eef0f3;
}

.help-content section {
    margin-bottom: 36px;
    padding-bottom: 36px;
    border-bottom: 1px solid #f0f2f5;
}

.help-content section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.help-h2 {
    font-size: 1rem;
    font-weight: 700;
    color: #1f538d;
    margin-bottom: 12px;
}

.help-h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1a2637;
    margin-top: 18px;
    margin-bottom: 7px;
}

.help-content p {
    font-size: 13.5px;
    line-height: 1.65;
    color: #2c3e50;
    margin-bottom: 8px;
}

.help-content ol,
.help-content ul {
    margin: 6px 0 10px 20px;
    font-size: 13.5px;
    line-height: 1.7;
    color: #2c3e50;
}

.help-content li { margin-bottom: 3px; }

.help-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 10px;
}

.help-table thead th {
    background: #1f538d;
    color: white;
    padding: 9px 14px;
    text-align: left;
    font-weight: 600;
}

.help-table tbody td {
    padding: 8px 14px;
    border-bottom: 1px solid #f0f2f5;
    color: #2c3e50;
}

.help-table tbody tr:last-child td { border-bottom: none; }
.help-table tbody tr:hover td { background: #f8fafd; }
