:root {
    --primary: #0f4c81;
    --primary-light: #1a6bb5;
    --bg: #f5f7fa;
    --white: #ffffff;
    --text: #2d3748;
    --text-light: #718096;
    --border: #e2e8f0;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.navbar {
    background: var(--primary);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    color: var(--white);
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-logo {
    height: 36px;
    width: auto;
    border-radius: 4px;
}

.navbar-links a {
    color: var(--white);
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.navbar-links a:hover {
    opacity: 1;
}

.layout {
    flex: 1;
    display: flex;
}

.sidebar {
    width: 240px;
    background: var(--white);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    flex-shrink: 0;
}

.sidebar-section {
    padding: 0 1rem;
}

.sidebar-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
}

.sidebar-link {
    display: block;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
    margin-bottom: 0.15rem;
}

.sidebar-link:hover {
    background: var(--bg);
    color: var(--primary);
}

.sidebar-link--active {
    background: var(--primary);
    color: var(--white);
}

.sidebar-link--active:hover {
    background: var(--primary-light);
    color: var(--white);
}

.main-content {
    flex: 1;
    max-width: 1100px;
    padding: 2rem;
    width: 100%;
    min-width: 0;
}

.main-content--full {
    max-width: 1100px;
    margin: 0 auto;
}

.container {
    flex: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

.hero {
    text-align: center;
    padding: 4rem 0 3rem;
}

.hero h1 {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.hero-description {
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

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

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 2rem 0;
}

.feature-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}

.feature-card h3 {
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.login-section {
    display: flex;
    justify-content: center;
    padding: 4rem 0;
}

.login-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

.login-card h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    flex: 1;
    padding-right: 2.5rem;
}

.password-toggle {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.25rem;
    line-height: 1;
    opacity: 0.6;
}

.password-toggle:hover {
    opacity: 1;
}

.login-form .btn {
    width: 100%;
    margin-top: 0.5rem;
}

.login-footer {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-light);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 0.75rem 0;
    }

    .sidebar-section {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
        align-items: center;
    }

    .sidebar-label {
        width: 100%;
        margin-bottom: 0.25rem;
    }
}

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

.form-check {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.form-check input[type="checkbox"] {
    width: auto;
    margin-top: 0.25rem;
}

.form-check label {
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.4;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-error {
    background: #fee;
    color: #c53030;
    border: 1px solid #feb2b2;
}

.alert-success {
    background: #f0fff4;
    color: #276749;
    border: 1px solid #9ae6b4;
}

.dashboard-section {
    padding: 2rem 0;
}

.dashboard-section h1 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.dashboard-subtitle {
    color: var(--text-light);
    margin-bottom: 2rem;
}

.empty-state {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 3rem;
    text-align: center;
    color: var(--text-light);
}

.admin-section {
    padding: 2rem 0;
}

.admin-section h1 {
    color: var(--primary);
    margin-bottom: 1.5rem;
}

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

.admin-header h1 {
    margin-bottom: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    display: block;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.admin-actions {
    margin-top: 1.5rem;
}

.data-table {
    width: 100%;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    border-collapse: collapse;
    font-size: 0.9rem;
}

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

.data-table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text);
}

.data-table a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.data-table a:hover {
    text-decoration: underline;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-active {
    background: #c6f6d5;
    color: #276749;
}

.badge-inactive {
    background: #fed7d7;
    color: #c53030;
}

.btn-secondary {
    background: var(--white);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
}

.btn-small {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-danger {
    background: #c53030;
    color: var(--white);
}

.btn-danger:hover {
    background: #e53e3e;
}

.btn-success {
    background: #276749;
    color: var(--white);
}

.btn-success:hover {
    background: #2f855a;
}

.detail-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.detail-row {
    display: flex;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    width: 200px;
    flex-shrink: 0;
    color: var(--text-light);
}

.locations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.location-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.location-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(15, 76, 129, 0.1);
}

.location-card h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.location-card p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.stat-available {
    color: #276749;
}

.stat-reserved {
    color: #c05621;
}

.box-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

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

.box-header h3 {
    color: var(--primary);
    font-size: 1.1rem;
    margin: 0;
}

.box-info {
    display: flex;
    gap: 1.5rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

.location-info-bar {
    display: flex;
    gap: 2rem;
    padding: 0.75rem 1rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

.section-title {
    color: var(--primary);
    margin: 2rem 0 1rem;
    font-size: 1.3rem;
}

.planning-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.75rem;
}

@media (max-width: 900px) {
    .planning-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}

.planning-day {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    transition: border-color 0.2s;
}

.planning-day:hover {
    border-color: var(--primary-light);
}

.planning-day--full {
    border-color: #feb2b2;
    background: #fff5f5;
}

.planning-day--free {
    border-color: #9ae6b4;
    background: #f0fff4;
}

.planning-day-header {
    margin-bottom: 0.75rem;
}

.planning-day-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.planning-day-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: #e2e8f0;
    margin-bottom: 0.75rem;
}

.bar-segment {
    height: 100%;
    min-width: 0;
    transition: width 0.3s;
}

.bar-reserved {
    background: #ed8936;
}

.bar-available {
    background: #38a169;
}

.planning-day-stats {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.planning-stat {
    font-size: 0.75rem;
    font-weight: 500;
}

.planning-stat--available {
    color: #276749;
}

.planning-stat--reserved {
    color: #c05621;
}

.planning-legend {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    padding: 0.75rem 0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot--available {
    background: #38a169;
}

.legend-dot--reserved {
    background: #ed8936;
}

/* Reservations page */
.reservations-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.reservation-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.reservation-card--active {
    border-left: 4px solid #38a169;
}

.reservation-card--completed {
    border-left: 4px solid var(--text-light);
}

.reservation-card--cancelled {
    border-left: 4px solid #e53e3e;
}

.reservation-card > summary {
    list-style: none;
    cursor: pointer;
}

.reservation-card > summary::-webkit-details-marker {
    display: none;
}

.reservation-card-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.reservation-dates {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-left: auto;
}

.reservation-toggle-icon::after {
    content: "▸";
    font-size: 0.85rem;
    color: var(--text-light);
    margin-left: 0.5rem;
    transition: transform 0.2s;
    display: inline-block;
}

.reservation-card[open] .reservation-toggle-icon::after {
    transform: rotate(90deg);
}

.reservation-id-badge {
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text-light);
    background: var(--border);
    padding: 0.15rem 0.5rem;
    border-radius: 8px;
}

.reservation-type-badge {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--primary);
}

.reservation-created {
    font-size: 0.75rem;
    color: var(--text-light);
}

.badge-active {
    background: #c6f6d5;
    color: #276749;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-completed {
    background: #e2e8f0;
    color: var(--text-light);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-cancelled {
    background: #fed7d7;
    color: #c53030;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-pending {
    background: #e2e8f0;
    color: var(--text-light);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-scheduled {
    background: #fefcbf;
    color: #975a16;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.reservation-card-body {
    padding: 1rem 1.25rem;
}

.reservation-info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    font-size: 0.85rem;
}

.reservation-info-label {
    color: var(--text-light);
}

.reservation-info-value {
    font-weight: 600;
    color: var(--text);
}

.reservation-simulated {
    color: #ed8936;
}

.reservation-accesses {
    border-top: 1px solid var(--border);
    padding: 1rem 1.25rem;
}

.accesses-title {
    font-size: 0.85rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.access-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
}

.access-item:last-child {
    margin-bottom: 0;
}

.access-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.access-movement-badge {
    background: var(--primary);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
}

.access-date {
    font-size: 0.8rem;
    color: var(--text-light);
}

.access-item-label {
    font-size: 0.8rem;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.access-code-box {
    background: var(--white);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 0.5rem;
    text-align: center;
}

.access-code-icon {
    font-size: 1.5rem;
    color: var(--primary);
}

.access-code-value {
    display: block;
    font-size: 0.65rem;
    color: var(--text-light);
    word-break: break-all;
    margin-top: 0.2rem;
}

.access-item-recipient {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    font-style: italic;
}

.access-booking-code {
    margin-bottom: 0.35rem;
}

.access-code-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-light);
    margin-bottom: 0.15rem;
}

.access-checkin-link {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.access-checkin-link:hover {
    text-decoration: underline;
}

.reservation-card-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 1.25rem;
    text-align: right;
}

.btn-danger {
    background: #e53e3e;
    color: var(--white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-danger:hover {
    background: #c53030;
}

.btn-danger:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Admin locations & keys */
.locations-admin-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.location-admin-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.location-admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.location-admin-header h3 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--primary);
}

.location-admin-keys {
    padding: 1rem 1.25rem;
}

.badge-info {
    background: #bee3f8;
    color: #2b6cb0;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-inactive {
    background: #fed7d7;
    color: #c53030;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
}

.text-muted {
    color: var(--text-light);
    font-size: 0.85rem;
}

.empty-hint {
    color: var(--text-light);
    font-size: 0.9rem;
    padding: 1rem 1.25rem;
}

.location-admin-badges {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.location-admin-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: #fffaf0;
    border-bottom: 1px solid var(--border);
}

.action-bar-text {
    color: #c05621;
    font-size: 0.85rem;
    font-weight: 500;
    margin: 0;
}


