:root {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --primary-soft: #eef2ff;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #172033;
    --muted: #64748b;
    --border: #e2e8f0;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --success: #15803d;
    --success-soft: #dcfce7;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    background: radial-gradient(circle at top left, #eef2ff 0, transparent 32rem), var(--bg);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select {
    font: inherit;
}

label {
    display: block;
    margin: 0 0 0.35rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: #334155;
}

input,
select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.78rem 0.9rem;
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.login-page {
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.login-card {
    width: min(430px, 100%);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    backdrop-filter: blur(12px);
}

.brand-block,
.brand-inline {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.brand-block {
    margin-bottom: 1.5rem;
}

.brand-block h1 {
    margin: 0;
    font-size: 1.65rem;
}

.brand-block p,
.brand-inline span {
    display: block;
    margin: 0.15rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.brand-icon {
    width: 3.4rem;
    height: 3.4rem;
    border-radius: 1.1rem;
    display: grid;
    place-items: center;
    color: white;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary), #9333ea);
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.25);
}

.brand-icon.small {
    width: 2.65rem;
    height: 2.65rem;
    border-radius: 0.9rem;
    font-size: 0.85rem;
}

.login-card form {
    display: grid;
    gap: 0.85rem;
}

.login-help {
    margin: 1rem 0 0;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.5;
}

.btn {
    border: 0;
    border-radius: 0.8rem;
    padding: 0.78rem 1rem;
    cursor: pointer;
    font-weight: 800;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 12px 24px rgba(79, 70, 229, 0.18);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-ghost {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.btn-small {
    padding: 0.45rem 0.7rem;
    border-radius: 0.55rem;
    font-size: 0.82rem;
}

.alert {
    padding: 0.85rem 1rem;
    border-radius: 0.9rem;
    margin-bottom: 1rem;
    font-weight: 700;
    font-size: 0.9rem;
}

.alert-error {
    background: var(--danger-soft);
    color: #991b1b;
}

.alert-success {
    background: var(--success-soft);
    color: #166534;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
}

.topbar-inner {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    min-height: 4.3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-actions a {
    padding: 0.6rem 0.8rem;
    border-radius: 999px;
    color: #475569;
    font-weight: 700;
    font-size: 0.88rem;
}

.nav-actions a:hover,
.nav-actions a.active {
    color: var(--primary-dark);
    background: var(--primary-soft);
}

.page-shell {
    width: min(1180px, calc(100% - 2rem));
    margin: 1.4rem auto 3rem;
}

.page-shell.narrow {
    width: min(900px, calc(100% - 2rem));
}

.hero {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.hero.compact {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    padding: 1.35rem;
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.05);
}

.eyebrow {
    margin: 0 0 0.25rem;
    color: var(--primary);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
}

.hero h1 {
    margin: 0;
    font-size: clamp(1.6rem, 3vw, 2.35rem);
}

.hero p {
    margin: 0.45rem 0 0;
    color: var(--muted);
}

.hero-card {
    min-width: 190px;
    background: var(--primary);
    color: #fff;
    border-radius: 1.2rem;
    padding: 1rem;
    display: grid;
    align-content: center;
    box-shadow: 0 14px 35px rgba(79, 70, 229, 0.2);
}

.hero-card span {
    font-size: 0.78rem;
    opacity: 0.85;
}

.hero-card strong {
    margin-top: 0.25rem;
    font-size: 1.6rem;
}

.calendar-card,
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1.35rem;
    box-shadow: var(--shadow);
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.calendar-header h2 {
    margin: 0;
    text-transform: capitalize;
    text-align: center;
}

.calendar-header p {
    margin: 0.15rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
}

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

.calendar-table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
    table-layout: fixed;
}

.calendar-table th {
    background: #f8fafc;
    color: #64748b;
    padding: 0.85rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.calendar-table td {
    border: 1px solid #edf2f7;
    height: 152px;
    vertical-align: top;
    background: #fff;
}

.day-cell {
    cursor: pointer;
    padding: 0.55rem;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.day-cell:hover {
    background: #fbfdff;
    box-shadow: inset 0 0 0 2px rgba(79, 70, 229, 0.15);
}

.day-cell.today {
    background: #f5f7ff;
}

.empty-cell {
    background: #f8fafc !important;
}

.day-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.45rem;
}

.day-num {
    color: #94a3b8;
    font-weight: 900;
    font-size: 0.92rem;
}

.today .day-num {
    color: var(--primary-dark);
}

.day-count {
    min-width: 1.45rem;
    height: 1.45rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: #fff;
    font-weight: 900;
    font-size: 0.72rem;
}

.day-reservas {
    display: grid;
    gap: 0.35rem;
    max-height: 112px;
    overflow-y: auto;
    padding-right: 0.15rem;
}

.reserva-item {
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 0.55rem;
    padding: 0.4rem;
    background: #fff;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.04);
}

.reserva-item strong {
    display: block;
    color: var(--primary-dark);
    font-size: 0.72rem;
}

.reserva-item span {
    display: block;
    color: var(--text);
    font-weight: 800;
    font-size: 0.72rem;
    margin-top: 0.08rem;
}

.reserva-item em {
    display: block;
    color: var(--muted);
    font-size: 0.69rem;
    font-style: normal;
}

.modal-bg {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.55);
    z-index: 50;
    padding: 1rem;
}

.modal {
    width: min(460px, 100%);
    max-height: 92vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 1.35rem;
    padding: 1.1rem;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.26);
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.modal-head h3 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-head p {
    margin: 0.25rem 0 0;
    color: var(--muted);
}

.modal-close {
    border: 0;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 999px;
    background: #f1f5f9;
    cursor: pointer;
    font-size: 1.4rem;
    color: #475569;
}

.lista-existente {
    display: grid;
    gap: 0.55rem;
    margin: 1rem 0;
}

.item-lista {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    padding: 0.75rem;
}

.item-lista strong,
.item-lista span,
.item-lista em {
    display: block;
}

.item-lista strong {
    color: var(--primary-dark);
}

.item-lista span {
    margin-top: 0.15rem;
    color: var(--text);
    font-weight: 700;
    font-size: 0.88rem;
}

.item-lista em {
    color: var(--muted);
    margin-top: 0.15rem;
    font-size: 0.82rem;
    font-style: normal;
}

.btn-del-small {
    border: 0;
    border-radius: 0.55rem;
    background: var(--danger-soft);
    color: var(--danger);
    padding: 0.52rem 0.7rem;
    cursor: pointer;
    font-weight: 900;
    font-size: 0.75rem;
}

.form-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1rem;
    display: grid;
    gap: 0.8rem;
}

.form-box > strong {
    font-size: 0.98rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.form-message {
    min-height: 1.2rem;
    font-weight: 800;
    font-size: 0.86rem;
}

.form-message.success {
    color: var(--success);
}

.form-message.error {
    color: var(--danger);
}

.empty-state,
.load-error {
    color: var(--muted);
    margin: 0;
    font-size: 0.92rem;
}

.load-error {
    text-align: center;
    padding: 2rem !important;
}

.panel {
    padding: 1rem;
    margin-bottom: 1rem;
}

.panel h2 {
    margin: 0 0 0.8rem;
    font-size: 1.15rem;
}

.panel p {
    margin: 0.2rem 0 0;
    color: var(--muted);
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.inline-form,
.filter-form {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 0.8rem;
}

.filter-form {
    grid-template-columns: minmax(130px, 180px) minmax(130px, 180px) auto;
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.85rem;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    color: #475569;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f8fafc;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.compact-table td,
.compact-table th {
    padding: 0.65rem;
}

.action-form {
    margin: 0;
}

.report-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 780px) {
    .topbar-inner,
    .hero,
    .calendar-header,
    .panel-head {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-actions {
        justify-content: flex-start;
    }

    .hero-card {
        min-width: 0;
    }

    .calendar-header .btn {
        width: 100%;
    }

    .inline-form,
    .filter-form,
    .report-grid,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .calendar-table {
        min-width: 720px;
    }

    .calendar-table td {
        height: 135px;
    }
}

@media print {
    .topbar,
    .filter-form,
    .panel-head .btn {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .page-shell {
        width: 100%;
        margin: 0;
    }

    .panel,
    .hero.compact {
        box-shadow: none;
        border-color: #ddd;
    }
}
