:root {
    --bg: #f3f4f6;
    --ink: #0f172a;
    --muted: #6b7280;
    --panel: #ffffff;
    --line: #d1d5db;
    --brand: #0b3a61;
    --accent: #2f855a;
    --error: #c53030;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: linear-gradient(145deg, #e9edf3, #f8fafc 40%, #eef2f7);
    color: var(--ink);
    font-family: "Segoe UI", Tahoma, sans-serif;
    overflow-x: hidden;
}

a { color: var(--brand); text-decoration: none; }

.content {
    min-width: 0;
}

.nav-pills .nav-link {
    color: #dbe7f3;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 10px 12px;
}

.nav-pills .nav-link:hover,
.nav-pills .nav-link:focus {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

h2 { margin-top: 0; font-size: 28px; }
h3 { margin: 0 0 10px; }

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 20px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stats article {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
}

.stats h3 { margin: 0; font-size: 30px; color: var(--brand); }
.stats p { margin: 4px 0 0; color: var(--muted); }

.grid-form {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

label {
    display: flex;
    flex-direction: column;
    font-size: 14px;
    gap: 6px;
}

.full { grid-column: 1 / -1; }

input, select, textarea {
    font: inherit;
    color: var(--ink);
}

table {
    width: 100%;
    margin-bottom: 18px;
    white-space: nowrap;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.work-calendar-shell {
    min-height: 720px;
}

.fc {
    --fc-border-color: var(--line);
    --fc-button-bg-color: var(--brand);
    --fc-button-border-color: var(--brand);
    --fc-button-hover-bg-color: #0a3253;
    --fc-button-hover-border-color: #0a3253;
    --fc-button-active-bg-color: #0a3253;
    --fc-button-active-border-color: #0a3253;
    --fc-today-bg-color: rgba(11, 58, 97, 0.08);
}

.fc .fc-toolbar.fc-header-toolbar {
    margin-bottom: 1rem;
    gap: 0.75rem;
}

.fc .fc-toolbar-title {
    font-size: 1.4rem;
}

.fc .fc-daygrid-day-frame {
    min-height: 118px;
    padding: 0.35rem;
}

.fc .fc-scrollgrid,
.fc .fc-scrollgrid table {
    border-color: var(--line);
}

.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number {
    color: var(--ink);
    text-decoration: none;
}

.fc .fc-col-header-cell {
    background: #f8fafc;
}

.fc .fc-daygrid-day.fc-day-working,
.fc .fc-daygrid-day.fc-day-working .fc-daygrid-day-frame {
    background-color: #ffffff;
}

.fc .fc-daygrid-day.fc-day-weekend,
.fc .fc-daygrid-day.fc-day-weekend .fc-daygrid-day-frame {
    background-color: #f8fafc;
}

.fc .fc-daygrid-day.fc-day-public-holiday,
.fc .fc-daygrid-day.fc-day-public-holiday .fc-daygrid-day-frame {
    background-color: #fff5f5;
}

.fc .fc-daygrid-day.fc-day-working-saturday,
.fc .fc-daygrid-day.fc-day-working-saturday .fc-daygrid-day-frame {
    background-color: #fffaf0;
}

.fc .fc-day-today {
    box-shadow: inset 0 0 0 2px rgba(11, 58, 97, 0.18);
}

.fc .fc-day-today .fc-daygrid-day-frame {
    background: rgba(13, 110, 253, 0.10);
}

.fc .fc-day-today .fc-daygrid-day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.9rem;
    height: 1.9rem;
    border-radius: 999px;
    background: #0d6efd;
    color: #fff;
    font-weight: 700;
}

.fc .fc-event {
    border: 0;
    border-radius: 999px;
    padding: 0.15rem 0.45rem;
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fc .fc-event-holiday {
    background-color: #ef4444;
    color: #fff;
}

.fc .fc-event-working-saturday {
    background-color: #fbbf24;
    color: #1f2937;
}

.fc .fc-event-custom {
    background-color: #0d6efd;
    color: #fff;
}

.fc .fc-event-time-off {
    background-color: #198754;
    color: #fff;
}

@media (max-width: 900px) {
    .inline-form { flex-direction: column; align-items: stretch; }
    h2 { font-size: 24px; }
    .card {
        padding: 12px;
        overflow-x: hidden;
    }
    .table {
        font-size: 14px;
    }
    .table td,
    .table th {
        padding: 8px 10px;
    }
    .d-flex.gap-2 {
        flex-wrap: wrap;
    }
    .btn {
        white-space: nowrap;
    }
    .work-calendar-shell {
        min-height: 640px;
    }
}

@media (max-width: 576px) {
    .card {
        padding: 10px;
    }
    .table {
        font-size: 13px;
    }
    .table td,
    .table th {
        padding: 7px 8px;
    }
    .offcanvas {
        max-width: 85vw;
    }
    .fc .fc-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .fc .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
    }
    .fc .fc-toolbar-title {
        font-size: 1.2rem;
        text-align: center;
    }
    .fc .fc-daygrid-day-frame {
        min-height: 86px;
    }
    .fc .fc-daygrid-event {
        margin-top: 2px;
    }
}
