:root {
    --bg: #1b2233;            /* sidebar: calm deep slate */
    --bg-soft: #2a3346;
    --panel: #ffffff;
    --muted: #6b7687;
    --line: #e8ebf0;
    --brand: #4c63b6;         /* refined muted indigo */
    --brand-d: #3f5398;
    --green: #3a9469;         /* soft sage green */
    --green-bg: #e9f4ee;
    --red: #c2616a;           /* muted rose */
    --red-bg: #f8ebec;
    --amber: #bb8a3e;         /* soft ochre */
    --amber-bg: #f7f0df;
    --blue: #4a7bb0;          /* muted steel blue */
    --blue-bg: #eaf1f8;
    --slate-bg: #f3f5f8;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(27, 34, 51, .06), 0 6px 20px rgba(27, 34, 51, .05);
}

body { background: #f5f6f9; color: #2b3242; }

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f6f7fb;
    color: #0f172a;
    font-size: 14px;
}

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

.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 244px;
    background: var(--bg);
    color: #cbd5e1;
    flex-shrink: 0;
    padding: 22px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }
.brand .logo {
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(135deg, #5b72c9, #4c63b6);
    color: #fff;
    display: grid; place-items: center; font-size: 20px;
}
.brand h1 { font-size: 15px; color: #fff; margin: 0; line-height: 1.2; }
.brand small { color: #94a3b8; font-size: 11px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    padding: 11px 13px; border-radius: 10px;
    color: #cbd5e1; font-weight: 500; font-size: 14px; margin-bottom: 1px;
    transition: background .15s, color .15s, transform .1s;
}
.nav a:hover { background: var(--bg-soft); color: #fff; }
.nav a:hover .ico { color: #fff; }
.nav a.active { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(76,99,182,.35); }
.nav a.active .ico { color: #fff; }
.nav a.active::before {
    content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
    width: 4px; height: 20px; border-radius: 0 4px 4px 0; background: #fff;
}
.nav a .ico,
.logout-btn .ico {
    width: 19px; height: 19px; flex-shrink: 0;
    color: #94a3b8; transition: color .15s;
}
.nav .nav-label { line-height: 1; }

/* Sidebar user + logout */
.nav-user { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.nav-user-info { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; }
.nav-user-info .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.nav-user-info strong { display: block; color: #fff; font-size: 13px; line-height: 1.2; }
.nav-user-info small { color: #94a3b8; font-size: 11px; }
.logout-btn { display: flex; align-items: center; gap: 11px; padding: 10px 13px; border-radius: 9px; color: #fca5a5; font-weight: 600; font-size: 14px; transition: background .15s, color .15s; }
.logout-btn .ico { color: #fca5a5; }
.logout-btn:hover { background: rgba(239,68,68,.14); color: #fecaca; }
.logout-btn:hover .ico { color: #fecaca; }

/* Auth / login page */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 20px; }
.auth-card { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.35); padding: 32px 28px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand .logo { width: 44px; height: 44px; border-radius: 12px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 700; }
.auth-brand h1 { font-size: 17px; margin: 0; color: #0f172a; }
.auth-brand small { color: var(--muted); font-size: 12px; }
.auth-title { font-size: 16px; margin: 0 0 18px; color: #334155; }
.auth-hint { text-align: center; font-size: 12px; margin: 18px 0 0; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Portal / landing chooser */
.portal { width: 100%; max-width: 720px; }
.portal-head { text-align: center; color: #fff; margin-bottom: 26px; }
.portal-head .logo { width: 52px; height: 52px; border-radius: 14px; background: var(--brand); display: grid; place-items: center; font-size: 26px; font-weight: 700; margin: 0 auto 14px; }
.portal-head h1 { font-size: 22px; margin: 0 0 4px; }
.portal-head .muted { color: #94a3b8; }
.portal-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.portal-cards.single { grid-template-columns: 1fr; max-width: 380px; margin: 0 auto; }
@media (max-width: 600px) { .portal-cards { grid-template-columns: 1fr; } }
.portal-card {
    display: flex; flex-direction: column; gap: 6px;
    background: #fff; border-radius: 16px; padding: 26px 24px;
    box-shadow: 0 24px 60px rgba(0,0,0,.35); color: #0f172a;
    border: 2px solid transparent; transition: transform .12s, border-color .12s, box-shadow .12s;
}
.portal-card:hover { transform: translateY(-3px); border-color: var(--brand); }
.portal-card .portal-ico { font-size: 32px; }
.portal-card strong { font-size: 17px; }
.portal-card small { color: var(--muted); font-size: 13px; line-height: 1.5; min-height: 38px; }
.portal-card .portal-go { margin-top: 10px; font-weight: 700; color: var(--brand); }

/* Main */
.main { flex: 1; min-width: 0; }
.topbar {
    background: #fff; border-bottom: 1px solid var(--line);
    padding: 16px 28px; display: flex; align-items: center; justify-content: space-between;
}
.topbar h2 { margin: 0; font-size: 18px; }
.content { padding: 26px 28px; max-width: 1200px; }

/* Cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.card-head h3 { margin: 0; font-size: 15px; }
.card-body { padding: 20px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

/* Salary-type cards: highlight the active default, dim the other */
.sal-card { transition: border-color .15s, box-shadow .15s, opacity .15s; }
.sal-card.sal-active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(76,99,182,.18), var(--shadow); }
.sal-card.sal-dim { opacity: .6; }
.sal-card.sal-dim:hover { opacity: 1; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* Stat tiles */
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 6px; }
.stat .icon { float: right; font-size: 22px; opacity: .85; }

/* Forms */
.form-row { margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
label .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
input[type=text], input[type=number], input[type=date], input[type=time], input[type=tel], input[type=password], select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line);
    border-radius: 9px; font-size: 14px; background: #fff; color: #0f172a; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
.checks { display: flex; flex-wrap: wrap; gap: 10px; }
.check { display: flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.check input { width: auto; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 10px 16px; border-radius: 9px; border: 1px solid transparent; font-weight: 600; font-size: 14px; cursor: pointer; background: var(--brand); color: #fff; transition: background .15s; }
.btn:hover { background: var(--brand-d); }
.btn.secondary { background: #fff; color: #334155; border-color: var(--line); }
.btn.secondary:hover { background: var(--slate-bg); }
.btn.danger { background: var(--red); }
.btn.success { background: var(--green); }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* Pagination */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; margin-top: 16px; }

/* Tables */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th, table.tbl td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); }
table.tbl th { background: var(--slate-bg); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr:hover td { background: #fafbff; }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.present { background: var(--green-bg); color: var(--green); }
.badge.absent { background: var(--red-bg); color: var(--red); }
.badge.weekly_off { background: var(--slate-bg); color: var(--muted); }
.badge.leave { background: var(--blue-bg); color: var(--blue); }
.badge.half_day { background: var(--amber-bg); color: var(--amber); }
.badge.monthly { background: var(--blue-bg); color: var(--blue); }
.badge.per_day { background: #e9ecf7; color: #4c63b6; }
.badge.active { background: var(--green-bg); color: var(--green); }
.badge.inactive { background: var(--red-bg); color: var(--red); }

/* Flash */
.flash { padding: 13px 16px; border-radius: 10px; margin-bottom: 20px; font-weight: 500; }
.flash.success { background: var(--green-bg); color: #15803d; }
.flash.error { background: var(--red-bg); color: #b91c1c; }
.flash.info { background: var(--blue-bg); color: #1d4ed8; }

.muted { color: var(--muted); }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 18px; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .spacer { flex: 1; }
.pill { background: var(--slate-bg); padding: 5px 12px; border-radius: 999px; font-size: 13px; }

/* Inline filter bar */
.filter-bar {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    background: linear-gradient(180deg, #fff, #fcfcff);
    border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 14px 18px; margin-bottom: 18px;
}
.filter-bar .filter-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.filter-bar .filter-title .muted { font-weight: 500; font-size: 13px; }
.filter-bar .filter-controls { display: flex; align-items: center; gap: 14px; margin-left: auto; flex-wrap: wrap; }
.filter-bar label { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.filter-bar select { width: auto; min-width: 132px; padding: 9px 12px; font-weight: 600; color: #0f172a; cursor: pointer; }
@media (max-width: 560px) {
    .filter-bar .filter-controls { margin-left: 0; width: 100%; }
    .filter-bar select { flex: 1; min-width: 0; }
}

/* Searchable employee filter (attendance) */
.att-filter { align-items: flex-end; gap: 16px; }
.emp-search { position: relative; flex: 1; min-width: 240px; max-width: 360px; }
.emp-search .emp-search-input { width: 100%; }
.filter-inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 0; }
.filter-inline select { min-width: 130px; }
.emp-search-list {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 45;
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
    box-shadow: var(--shadow); margin-top: 5px; max-height: 300px; overflow-y: auto;
}
.emp-search-item {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 13px; border-bottom: 1px solid var(--line); color: #0f172a; font-size: 14px;
}
.emp-search-item:last-child { border-bottom: none; }
.emp-search-item strong { font-weight: 600; }
.emp-search-item:hover, .emp-search-item.kbd { background: var(--slate-bg); }
.emp-search-item.active { background: var(--brand); color: #fff; }
.emp-search-item.active .muted { color: #e0e7ff; }
.emp-search-empty { padding: 12px 13px; }
@media (max-width: 600px) {
    .att-filter { align-items: stretch; }
    .emp-search { max-width: none; }
    .filter-inline { width: 100%; }
    .filter-inline > div { flex: 1; }
    .filter-inline select { width: 100%; min-width: 0; }
}

/* Employee header */
.emp-header { display: flex; align-items: center; gap: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; margin-bottom: 16px; }
.emp-avatar { width: 48px; height: 48px; border-radius: 12px; background: linear-gradient(135deg, #5b72c9, #4c63b6); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 700; flex-shrink: 0; }
.emp-meta { flex: 1; }
.emp-meta h3 { margin: 0 0 3px; font-size: 17px; }

/* Summary chips */
.summary-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.summary-chips .chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 600; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.summary-chips .chip b { font-size: 16px; }
.summary-chips .chip::before { content: ""; width: 9px; height: 9px; border-radius: 50%; }
.summary-chips .chip.working::before { background: var(--brand); }
.summary-chips .chip.present::before { background: var(--green); }
.summary-chips .chip.absent::before { background: var(--red); }
.summary-chips .chip.half_day::before { background: var(--amber); }
.summary-chips .chip.leave::before { background: var(--blue); }
.summary-chips .chip.weekly_off::before { background: var(--muted); }
.summary-chips .chip.ot { background: var(--amber-bg); border-color: var(--amber); color: var(--amber); }
.summary-chips .chip.ot::before { background: var(--amber); }
.summary-chips .chip.adv { background: rgba(99,102,241,.10); border-color: var(--brand); color: var(--brand); }
.summary-chips .chip.adv::before { background: var(--brand); }

.quick-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Attendance table */
.att-scroll { max-height: 70vh; overflow: auto; }
.att-table { font-size: 13px; }
.att-table thead th { position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -1px 0 var(--line); }
.att-table td { padding: 6px 10px; }
.att-table input { padding: 6px 8px; font-size: 13px; }
.att-table input[type=time] { width: 100%; }
.att-row.off td { background: #f8fafc; }
.att-row.today td { background: #eef2ff; }
.att-row.today .d-num { color: var(--brand); }
.att-row:hover td { background: #f5f7ff; }

.day-cell { white-space: nowrap; }
.day-cell .d-num { font-size: 17px; font-weight: 700; }
.day-cell .d-mon { color: var(--muted); margin-left: 2px; }
.day-cell .d-dow { display: block; font-size: 11px; color: var(--muted); }
.day-cell .d-dow.weekend { color: var(--red); }

/* Color-coded status select */
.status-select { font-weight: 600; border-radius: 8px; }
.status-select.st-present    { background: var(--green-bg); color: #15803d; border-color: #bbf7d0; }
.status-select.st-absent     { background: var(--red-bg); color: #b91c1c; border-color: #fecaca; }
.status-select.st-weekly_off { background: var(--slate-bg); color: var(--muted); }
.status-select.st-leave      { background: var(--blue-bg); color: #1d4ed8; border-color: #bfdbfe; }
.status-select.st-half_day   { background: var(--amber-bg); color: #b45309; border-color: #fde68a; }

.punch-log { display: flex; flex-wrap: wrap; gap: 6px; }
.punch-log a { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; background: var(--slate-bg); padding: 5px 9px; border-radius: 7px; }
.punch-log a span { color: var(--muted); }

.sticky-save { position: sticky; bottom: 0; background: #f6f7fb; padding: 14px 0; z-index: 5; }

/* Calendar */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-head { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 6px 0; text-transform: uppercase; letter-spacing: .04em; }
.cal-cell { min-height: 96px; border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 10px; padding: 8px 9px; background: #fff; cursor: pointer; display: flex; flex-direction: column; gap: 5px; transition: box-shadow .15s, transform .08s; }
.cal-cell:hover { box-shadow: 0 6px 18px rgba(15,23,42,.12); transform: translateY(-1px); }
.cal-cell.empty { background: transparent; border: none; cursor: default; box-shadow: none; transform: none; }
.cal-cell .c-date { display: flex; align-items: center; gap: 7px; }
.cal-cell .c-num { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-weight: 700; font-size: 15px; color: #0f172a; }
.cal-cell .c-num.sun { color: var(--red); }
.cal-cell .c-dow { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.cal-cell .c-today { margin-left: auto; font-size: 9px; font-weight: 700; color: #fff; background: var(--brand); padding: 2px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.cal-cell.today .c-num { background: var(--brand); color: #fff; }
.cal-cell.today .c-num.sun { color: #fff; }
.cal-cell .c-status { align-self: flex-start; }
.cal-cell .c-info { margin-top: auto; font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.cal-cell .c-icons { display: flex; gap: 5px; align-items: center; }
.cal-cell .c-icons b { font-size: 10px; background: var(--amber-bg); color: var(--amber); padding: 0 5px; border-radius: 5px; }
.cal-cell .c-ot { align-self: flex-start; font-size: 10px; font-weight: 700; background: var(--amber-bg); color: var(--amber); padding: 2px 7px; border-radius: 999px; white-space: nowrap; line-height: 1.4; }
.cal-cell.has-ot { border-top: 2px solid var(--amber); }
.cal-cell .c-adv { align-self: flex-start; font-size: 10px; font-weight: 700; background: rgba(99,102,241,.12); color: var(--brand); padding: 2px 7px; border-radius: 999px; white-space: nowrap; line-height: 1.4; }
.cal-cell .c-short { align-self: flex-start; font-size: 10px; font-weight: 700; background: var(--red-bg); color: var(--red); padding: 2px 7px; border-radius: 999px; white-space: nowrap; line-height: 1.4; }
.cal-cell .c-late { align-self: flex-start; font-size: 10px; font-weight: 700; background: var(--amber-bg); color: #b45309; padding: 2px 7px; border-radius: 999px; white-space: nowrap; line-height: 1.4; }
.cal-cell.has-late-half { border-top: 2px solid var(--amber); }
.cal-cell.today { box-shadow: 0 0 0 2px var(--brand); }

/* Status accent on calendar cells */
.cal-cell.st-present    { border-left-color: var(--green); }
.cal-cell.st-absent     { border-left-color: var(--red); background: #fffafa; }
.cal-cell.st-weekly_off { border-left-color: var(--muted); background: #fafbfc; }
.cal-cell.st-leave      { border-left-color: var(--blue); background: #fafbff; }
.cal-cell.st-half_day   { border-left-color: var(--amber); background: #fffdf7; }

.cal-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }

/* Multi-select */
.cal-grid.selecting .cal-cell:not(.empty) { cursor: copy; }
.cal-cell.selected { box-shadow: 0 0 0 2px var(--brand); position: relative; }
.cal-cell.selected::after {
    content: "✓"; position: absolute; top: 6px; right: 6px;
    width: 18px; height: 18px; border-radius: 50%; background: var(--brand);
    color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.select-bar {
    position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
    display: none; align-items: center; gap: 10px; z-index: 90;
    background: #fff; border: 1px solid var(--line); border-radius: 14px;
    padding: 12px 16px; box-shadow: 0 16px 40px rgba(27,34,51,.22);
    opacity: 0; transition: opacity .15s, transform .15s;
}
.select-bar.show { display: flex; opacity: 1; transform: translateX(-50%) translateY(0); }
.select-bar .sel-count { font-weight: 600; }
.select-bar .sel-count b { color: var(--brand); font-size: 16px; }
.select-bar select { width: auto; padding: 8px 10px; }

@media (max-width: 760px) {
    .cal-cell { min-height: 78px; padding: 6px; }
    .cal-cell .c-date { font-size: 13px; }
    .cal-cell .c-status { font-size: 10px; padding: 2px 6px; }
}

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal-overlay.show { display: flex; }
.modal-box { background: #fff; border-radius: 16px; width: 440px; max-width: 96vw; box-shadow: 0 24px 60px rgba(0,0,0,.35); animation: pop .15s ease; }
@keyframes pop { from { transform: scale(.96); opacity: .6; } to { transform: scale(1); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-x { background: none; border: none; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); text-align: right; }

/* Payslip (legacy line layout, still used elsewhere) */
.payslip { max-width: 720px; }
.payslip .line { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.payslip .total { font-size: 18px; font-weight: 700; padding-top: 12px; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 8px; }

/* Payslip document (redesigned) */
.payslip-doc { max-width: 760px; overflow: hidden; padding: 0; }
.ps-top {
    display: flex; align-items: center; justify-content: space-between;
    padding: 22px 26px; color: #fff;
    background: linear-gradient(120deg, var(--brand) 0%, var(--brand-d) 100%);
}
.ps-brand { display: flex; align-items: center; gap: 13px; }
.ps-logo { width: 44px; height: 44px; border-radius: 11px; background: rgba(255,255,255,.18); display: grid; place-items: center; font-size: 24px; font-weight: 800; }
.ps-app { font-size: 16px; font-weight: 700; letter-spacing: .01em; }
.ps-sub { font-size: 12px; opacity: .82; text-transform: uppercase; letter-spacing: .14em; }
.ps-period { text-align: right; }
.ps-period-m { font-size: 16px; font-weight: 700; }
.ps-type { display: inline-block; margin-top: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: rgba(255,255,255,.2); padding: 3px 10px; border-radius: 999px; }

.ps-emp { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 26px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ps-emp-id { display: flex; align-items: center; gap: 14px; }
.ps-avatar { width: 50px; height: 50px; border-radius: 13px; background: linear-gradient(135deg, #5b72c9, #4c63b6); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 700; flex-shrink: 0; }
.ps-emp-id h3 { margin: 0 0 2px; font-size: 18px; }
.ps-emp-id .muted { font-size: 13px; }
.ps-net { text-align: right; background: var(--green-bg); border: 1px solid #cfe7da; border-radius: 12px; padding: 10px 18px; }
.ps-net span { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--green); }
.ps-net b { font-size: 24px; color: #2c7a55; }

.ps-att { display: flex; flex-wrap: wrap; gap: 10px; padding: 18px 26px; border-bottom: 1px solid var(--line); }
.ps-pill { flex: 1; min-width: 92px; background: var(--slate-bg); border-radius: 10px; padding: 10px 12px; text-align: center; }
.ps-pill span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ps-pill b { font-size: 19px; font-weight: 700; }
.ps-pill.green b { color: var(--green); }
.ps-pill.red b { color: var(--red); }
.ps-pill.amber b { color: var(--amber); }
.ps-pill.blue b { color: var(--blue); }

.ps-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.ps-col { padding: 18px 26px; }
.ps-col + .ps-col { border-left: 1px solid var(--line); }
.ps-col-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding-bottom: 6px; margin-bottom: 8px; border-bottom: 2px solid; display: flex; align-items: center; gap: 7px; }
.ps-col-head.earn { color: var(--green); border-color: var(--green); }
.ps-col-head.deduct { color: var(--red); border-color: var(--red); }
.ps-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13.5px; border-bottom: 1px dashed var(--line); }
.ps-row span:first-child { color: #475569; }
.ps-row .amt { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.ps-row.muted span { color: var(--muted); }
.ps-row.sub { border-bottom: none; border-top: 1.5px solid var(--line); margin-top: 4px; padding-top: 10px; font-weight: 700; }
.ps-row.sub .amt { font-size: 15px; }
.ps-col-head.earn ~ .ps-row.sub .amt { color: var(--green); }
.ps-col-head.deduct ~ .ps-row.sub .amt { color: var(--red); }

.ps-netbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 26px; background: #0f172a; color: #fff; }
.ps-netbar span { font-size: 14px; font-weight: 600; opacity: .9; }
.ps-netbar b { font-size: 26px; font-weight: 800; }
.ps-foot { padding: 14px 26px; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 16px; background: var(--slate-bg); }
.ps-foot span b { color: #334155; }

@media (max-width: 680px) {
    .ps-cols { grid-template-columns: 1fr; }
    .ps-col + .ps-col { border-left: none; border-top: 1px solid var(--line); }
}

/* ---------------------------------------------------------------------------
   Mobile navbar + responsive layout
   --------------------------------------------------------------------------- */
.menu-toggle { display: none; }
.sidebar-overlay { display: none; }

@media (max-width: 860px) {
    /* Hamburger button in the topbar */
    .menu-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        width: 42px; height: 42px; flex-shrink: 0;
        border: 1px solid var(--line); border-radius: 10px;
        background: #fff; color: #0f172a; font-size: 20px; line-height: 1; cursor: pointer;
    }
    .menu-toggle:active { background: var(--slate-bg); }

    /* Sticky top bar with title */
    .topbar {
        position: sticky; top: 0; z-index: 60;
        padding: 11px 14px; gap: 12px;
    }
    .topbar h2 { font-size: 16px; flex: 1; min-width: 0; }
    .topbar-date { display: none; }

    .content { padding: 16px 14px; }

    /* Off-canvas slide-in sidebar */
    .sidebar {
        position: fixed; top: 0; left: 0;
        width: min(82vw, 280px); height: 100vh;
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 200;
        box-shadow: 0 0 50px rgba(0,0,0,.45);
    }
    .sidebar.open { transform: translateX(0); }

    .sidebar-overlay {
        position: fixed; inset: 0;
        background: rgba(15,23,42,.5);
        z-index: 150; opacity: 0;
        transition: opacity .2s ease;
    }
    .sidebar-overlay.show { display: block; opacity: 1; }

    /* Let wide tables scroll horizontally inside their card */
    .card-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table.tbl { min-width: 640px; }

    .toolbar { gap: 8px; }
    .toolbar .btn, .toolbar form { flex: 0 0 auto; }
}

@media (max-width: 480px) {
    .content { padding: 14px 10px; }
    .stat .value { font-size: 22px; }
    .ps-top, .ps-emp, .ps-att, .ps-netbar, .ps-foot { padding-left: 16px; padding-right: 16px; }
    .ps-col { padding: 16px; }
    .ps-advance, .ps-totals { margin-left: 16px !important; margin-right: 16px !important; }
}

@media print {
    .sidebar, .topbar, .menu-toggle, .sidebar-overlay, .no-print { display: none !important; }
    .content { padding: 0; }
    body { background: #fff; }
    .card { box-shadow: none; border: none; }
    .payslip-doc { border: 1px solid var(--line) !important; box-shadow: none; max-width: 100%; }
    .ps-top { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .ps-netbar, .ps-net, .ps-pill, .ps-foot, .ps-type { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
