/* SKS Attendance — HR dashboard (sidebar layout) */
:root {
    --bg: #f1f5f9;
    --surface: #fff;
    --text: #0f172a;
    --text-muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: rgba(37, 99, 235, 0.1);
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --warning: #d97706;
    --success: #059669;
    --info: #0284c7;
    --border: #e2e8f0;
    --sidebar-bg: linear-gradient(180deg, #0f172a 0%, #0b1224 100%);
    --sidebar-w: 268px;
    --topbar-h: 3.25rem;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ Layout */
.att-app {
    display: flex;
    min-height: 100dvh;
    width: 100%;
}

.att-sidebar {
    flex: 0 0 var(--sidebar-w);
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.9rem 1.35rem;
    box-shadow: 4px 0 32px rgba(15, 23, 42, 0.18);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 300;
    overflow-y: auto;
    transition: transform 0.22s ease, opacity 0.18s ease;
}

.att-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 290;
}

.att-sidebar-backdrop.is-visible { display: block; }

.att-main {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.att-topbar {
    position: sticky;
    top: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: var(--topbar-h);
    padding: 0.65rem 1.25rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.att-topbar-start {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.att-sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
}

.att-sidebar-toggle:hover { background: var(--bg); }

.att-page-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.att-topbar-end {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
}

.att-content {
    flex: 1;
    padding: 1.25rem clamp(1rem, 2.5vw, 2rem) 2rem;
    max-width: 1720px;
    width: 100%;
    margin: 0 auto;
}

/* Sidebar brand & nav */
.att-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
    margin-bottom: 1.1rem;
    padding: 0 0.75rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.att-brand-link { display: block; line-height: 0; }

.att-brand-logo {
    display: block;
    max-width: 112px;
    height: auto;
    filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.3));
}

.att-brand-sub {
    margin: 0;
    font-size: 0.68rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.att-nav-section { margin-bottom: 0.95rem; }

.att-nav-label {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    margin: 0 0 0.4rem;
    padding: 0 0.75rem;
}

.att-nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin: 0;
    padding: 0;
}

.att-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    color: #cbd5e1;
    text-decoration: none !important;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    background: transparent;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 0.15s;
}

.att-nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    text-decoration: none !important;
}

.att-nav-link.is-active {
    background: linear-gradient(135deg, #0052cc 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 82, 204, 0.35);
}

.att-nav-link.is-active:hover {
    background: linear-gradient(135deg, #0041a3 0%, #1d4ed8 100%);
    color: #fff;
}

.att-nav-chevron {
    margin-left: auto;
    transition: transform 0.2s ease;
}

.att-nav-group.open .att-nav-chevron { transform: rotate(180deg); }

.att-nav-submenu {
    display: none;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.25rem 0 0.25rem 0.75rem;
    margin: 0;
}

.att-nav-group.open .att-nav-submenu { display: flex; }

.att-nav-sublink {
    display: block;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    color: #94a3b8;
    font-size: 0.85rem;
    text-decoration: none !important;
}

.att-nav-sublink:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
    text-decoration: none !important;
}

.att-nav-sublink.is-active {
    color: #fff;
    background: rgba(37, 99, 235, 0.25);
}

.att-sidebar-footer {
    margin-top: auto;
    padding: 1rem 0.75rem 0;
}

.att-sidebar-help {
    background: rgba(30, 41, 59, 0.9);
    border-radius: 10px;
    padding: 0.85rem;
    font-size: 0.78rem;
    color: #94a3b8;
    line-height: 1.45;
}

.att-sidebar-help strong {
    display: block;
    color: #e2e8f0;
    margin-bottom: 0.25rem;
    font-size: 0.82rem;
}

.att-user-chip {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.3rem 0.75rem 0.3rem 0.35rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    max-width: 12rem;
}

.att-user-avatar {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: linear-gradient(145deg, #3b82f6, #1e40af);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.att-user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
    overflow: hidden;
}

.att-user-name {
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.att-user-role {
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.att-btn-logout {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.85rem;
    border-radius: 10px;
    font-size: 0.84rem;
    font-weight: 600;
    color: #475569;
    background: #fff;
    border: 1px solid var(--border);
    text-decoration: none;
}

.att-btn-logout:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: var(--danger);
    text-decoration: none;
}

@media (max-width: 960px) {
    .att-sidebar {
        transform: translateX(-100%);
    }
    .att-sidebar.is-open {
        transform: translateX(0);
    }
    .att-main { margin-left: 0; }
    .att-sidebar-toggle { display: inline-flex; }
    .att-user-meta { display: none; }
    .att-user-chip { padding: 0.25rem; border-radius: 10px; }
}

@media (min-width: 961px) {
    body.att-sidebar-collapsed .att-sidebar {
        transform: translateX(-100%);
        opacity: 0;
        pointer-events: none;
    }
    body.att-sidebar-collapsed .att-main { margin-left: 0; }
    body.att-sidebar-collapsed .att-sidebar-toggle { display: inline-flex; }
}

/* ------------------------------------------------------------------ Page */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1 { margin: 0; font-size: 1.5rem; font-weight: 700; }

.page-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.page-subtitle {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

@media (min-width: 768px) { .card { padding: 1.25rem 1.5rem; } }

.card-title {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    font-weight: 600;
}

/* ------------------------------------------------------------------ KPI */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.1rem 1.15rem;
    box-shadow: var(--shadow);
}

.kpi-card--primary {
    border-color: rgba(37, 99, 235, 0.25);
    background: linear-gradient(145deg, #fff 0%, #f8faff 100%);
}

.kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.kpi-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kpi-icon {
    font-size: 1.1rem;
    opacity: 0.7;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.kpi-value--sm { font-size: 1.35rem; }

.kpi-meta {
    margin-top: 0.35rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.kpi-card--present { border-left: 4px solid var(--success); }
.kpi-card--absent { border-left: 4px solid var(--danger); }
.kpi-card--late { border-left: 4px solid var(--warning); }
.kpi-card--leave { border-left: 4px solid var(--info); }

/* ------------------------------------------------------------------ Tables */
table { width: 100%; border-collapse: collapse; }

th, td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

th {
    font-weight: 600;
    background: var(--bg);
    font-size: 0.85rem;
    color: #475569;
}

tr:hover td { background: rgba(0, 0, 0, 0.015); }

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

.data-table { table-layout: auto; min-width: 640px; }

.data-table th,
.data-table td { word-break: break-word; }

.data-table .table-actions { white-space: nowrap; }

.table-actions a,
.table-actions button,
.table-actions form { margin-right: 0.35rem; display: inline-block; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

.table-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
}

/* ------------------------------------------------------------------ Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    text-transform: capitalize;
}

.badge--present { background: #d1fae5; color: #065f46; }
.badge--absent { background: #fee2e2; color: #991b1b; }
.badge--late { background: #fef3c7; color: #92400e; }
.badge--half_day { background: #ffedd5; color: #9a3412; }
.badge--leave { background: #dbeafe; color: #1e40af; }
.badge--holiday { background: #ede9fe; color: #5b21b6; }
.badge--weekly_off { background: #f1f5f9; color: #475569; }
.badge--missed_punch { background: #ffedd5; color: #c2410c; }
.badge--pending { background: #fef3c7; color: #92400e; }
.badge--approved { background: #d1fae5; color: #065f46; }
.badge--rejected { background: #fee2e2; color: #991b1b; }
.badge--cancelled { background: #f1f5f9; color: #64748b; }
.badge--active { background: #d1fae5; color: #065f46; }
.badge--inactive { background: #f1f5f9; color: #64748b; }
.badge--default { background: #e2e8f0; color: #475569; }

/* ------------------------------------------------------------------ Filters */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
    padding: 1rem 1.15rem;
    margin-bottom: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.filter-field label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.filter-field input,
.filter-field select {
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    background: #fff;
    min-width: 140px;
}

.filter-field input:focus,
.filter-field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-left: auto;
}

/* ------------------------------------------------------------------ Buttons & forms */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    background: var(--border);
    color: var(--text);
    font-family: inherit;
    line-height: 1.2;
}

.btn:hover { opacity: 0.92; text-decoration: none; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }

.btn-outline {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover { background: var(--bg); color: var(--primary); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); color: #fff; }

.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.85rem; }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text-muted);
    cursor: pointer;
}

.btn-icon:hover { background: var(--bg); color: var(--primary); }

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    max-width: 480px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
}

.form-group textarea { min-height: 90px; resize: vertical; }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0 1.25rem;
}

.form-error { color: var(--danger); font-size: 0.85rem; margin-top: 0.25rem; }
.form-hint { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.25rem; }

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* ------------------------------------------------------------------ Alerts & pagination */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.pagination-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.pagination-info select {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.88rem;
}

.pagination-pages {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.pagination-pages a,
.pagination-pages span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    border: 1px solid transparent;
}

.pagination-pages a:hover {
    background: var(--bg);
    color: var(--primary);
    text-decoration: none;
}

.pagination-pages .page-current {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ------------------------------------------------------------------ Login */
.login-page {
    margin: 0;
    min-height: 100vh;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #fff;
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: 100vh;
}

.login-aside {
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 2rem;
}

.login-aside-inner {
    max-width: 22rem;
    margin: 0 auto;
    text-align: center;
}

.login-aside-logo {
    display: block;
    margin: 0 auto 1.25rem;
    max-width: 10rem;
    width: 100%;
    height: auto;
}

.login-aside-kicker {
    margin: 0 0 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #108a6d;
}

.login-aside-title {
    margin: 0 0 0.75rem;
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.login-aside-text {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.55;
}

.login-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 24rem;
}

.login-heading {
    margin: 0 0 0.35rem;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.login-lede {
    margin: 0 0 1.5rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.login-form .form-group { margin-bottom: 1.1rem; }

.login-password-wrap {
    position: relative;
    max-width: 480px;
}

.login-password-wrap input { padding-right: 2.75rem; max-width: none; }

.login-password-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
}

.btn-login {
    width: 100%;
    max-width: 480px;
    padding: 0.75rem 1rem;
    background: #108a6d;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-login:hover { background: #0d7359; color: #fff; }

@media (max-width: 768px) {
    .login-shell { grid-template-columns: 1fr; }
    .login-aside { display: none; }
}

/* ------------------------------------------------------------------ Report */
.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.report-stat {
    padding: 0.85rem 1rem;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.report-stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.report-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 0.2rem;
}
