:root {
    --sidebar-width: 248px;
    --sidebar-collapsed: 76px;
    --ink: #1c2834;
    --muted: #5c6b7a;
    --line: #d9e1ea;
    --canvas: #eef2f6;
    --sidebar: #1b2836;
    --sidebar-text: #d5deea;
    --accent: #1f6f8b;
    --accent-dark: #164e63;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 14.5px;
}

a { color: var(--accent-dark); }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: var(--sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 30;
    overflow: hidden;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 18px 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    flex: 0 0 auto;
}

.brand strong { display: block; color: #fff; font-size: 15px; line-height: 1.2; }
.brand small { color: #93a4b8; }

.side-nav {
    padding: 12px 10px 24px;
    overflow: auto;
}

.nav-section {
    margin: 14px 8px 6px;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8ea0b5;
}

.side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 2px;
}

.side-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.side-link.active { background: rgba(31, 111, 139, 0.35); color: #fff; }

.main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    height: 64px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-title { font-weight: 650; color: var(--ink); }
.user-chip { color: var(--muted); margin-right: 12px; }

.content { padding: 24px 28px 40px; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 18px;
}

.page-header h1 { font-size: 26px; margin: 0; font-weight: 650; }
.page-header p { margin: 4px 0 0; color: var(--muted); }

.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.panel-body { padding: 16px 18px; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.stat-card { padding: 16px 18px; }
.stat-card span { display: block; color: var(--muted); font-size: 13px; }
.stat-card strong { display: block; margin-top: 6px; font-size: 28px; line-height: 1; font-weight: 650; }
.stat-card.accent strong { color: var(--accent-dark); }
.stat-card.warn strong { color: #b54708; }
.stat-card.danger strong { color: #b42318; }

.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 12px 14px;
    align-items: end;
}

.filter-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.table-wrap {
    overflow: auto;
    max-height: calc(100vh - 250px);
}

.table {
    margin-bottom: 0;
    white-space: nowrap;
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f7f9fb;
    color: #3d4d5c;
    font-size: 12px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-weight: 650;
    border-bottom: 1px solid var(--line);
}

.table td, .table th { padding: 10px 12px; vertical-align: middle; }
.table tbody tr:hover { background: #f8fbfd; }

.badge-status {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 650;
}

.badge-status-on-time { background: #e7f6ee; color: #0f7a3d; }
.badge-status-late { background: #fdecec; color: #b42318; }
.badge-status-early { background: #fff4e5; color: #b54708; }
.badge-status-missing { background: #eef2f6; color: #475569; }
.badge-status-off { background: #e8f1fb; color: #175cd3; }

.day-schedule { width: 100%; }
.day-schedule td { vertical-align: middle; }
.day-custom[hidden] { display: none !important; }

.badge-active { background: #e7f6ee; color: #0f7a3d; }
.badge-inactive { background: #eef2f6; color: #475569; }

.sort-link { color: inherit; text-decoration: none; }
.sort-link:hover { color: var(--accent-dark); }

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
}

.login-aside {
    background: var(--sidebar);
    color: #fff;
    padding: 64px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-aside h1 { font-size: 40px; font-weight: 650; max-width: 520px; }
.login-aside p { color: #c5d0dc; max-width: 460px; font-size: 16px; }

.login-form-wrap {
    display: grid;
    place-items: center;
    padding: 40px 24px;
    background: #f7f9fb;
}

.login-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.login-card h2 { margin: 0 0 6px; font-size: 24px; }
.hint { background: #f4f7fa; border-radius: 8px; padding: 10px 12px; color: var(--muted); font-size: 13px; }

body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
body.sidebar-collapsed .main { margin-left: var(--sidebar-collapsed); }
body.sidebar-collapsed .label,
body.sidebar-collapsed .nav-section,
body.sidebar-collapsed .brand small,
body.sidebar-collapsed .brand strong { display: none; }

.icon-btn {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    width: 36px;
    height: 36px;
}

.empty { padding: 28px; text-align: center; color: var(--muted); }

@media (max-width: 1200px) {
    .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .filter-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
}

@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: none; }
    .main { margin-left: 0; }
    .login-shell { grid-template-columns: 1fr; }
    .login-aside { display: none; }
}
