/*
 * Payroll — application stylesheet
 * Mobile-first. No framework, no build step, no web fonts.
 *
 * Layout model:
 *   < 900px  single column, sidebar becomes an off-canvas drawer,
 *            wide tables collapse into stacked cards
 *   >= 900px persistent sidebar + fluid content column
 */

/* ------------------------------------------------------------------ tokens */

:root {
    --ink:          #111827;
    --ink-soft:     #374151;
    --muted:        #6b7280;
    --faint:        #9ca3af;
    --line:         #e5e7eb;
    --line-strong:  #d1d5db;
    --surface:      #ffffff;
    --canvas:       #f6f7f9;
    --raised:       #f9fafb;

    --brand:        #0f766e;
    --brand-dark:   #115e59;
    --brand-soft:   #ecfdf5;
    --brand-line:   #99f6e4;

    --danger:       #b91c1c;
    --danger-soft:  #fef2f2;
    --danger-line:  #fecaca;
    --warn:         #92400e;
    --warn-soft:    #fffbeb;
    --warn-line:    #fde68a;
    --info:         #1e40af;
    --info-soft:    #eff6ff;
    --info-line:    #bfdbfe;
    --ok:           #166534;
    --ok-soft:      #f0fdf4;
    --ok-line:      #bbf7d0;

    --radius:       10px;
    --radius-sm:    6px;
    --shadow:       0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --shadow-lg:    0 10px 25px rgba(16, 24, 40, .10), 0 4px 8px rgba(16, 24, 40, .06);

    --sidebar-w:    248px;
    --header-h:     56px;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
            Arial, "Noto Sans", sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --ink:         #f3f4f6;
        --ink-soft:    #d1d5db;
        --muted:       #9ca3af;
        --faint:       #6b7280;
        --line:        #2b3240;
        --line-strong: #3a4354;
        --surface:     #171b23;
        --canvas:      #0f131a;
        --raised:      #1d222c;

        --brand:       #2dd4bf;
        --brand-dark:  #5eead4;
        --brand-soft:  #0d2b29;
        --brand-line:  #115e59;

        --danger:      #fca5a5;  --danger-soft: #2a1416;  --danger-line: #7f1d1d;
        --warn:        #fcd34d;  --warn-soft:   #2a2110;  --warn-line:   #78350f;
        --info:        #93c5fd;  --info-soft:   #101b2e;  --info-line:   #1e3a8a;
        --ok:          #86efac;  --ok-soft:     #0d1f14;  --ok-line:     #14532d;

        --shadow:      0 1px 2px rgba(0, 0, 0, .5);
        --shadow-lg:   0 10px 30px rgba(0, 0, 0, .55);
    }
}

/* ------------------------------------------------------------- foundation */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
h4 { font-size: .9rem; }
p  { margin: 0 0 .75rem; }

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

hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }

small, .small { font-size: .82rem; }
.muted  { color: var(--muted); }
.faint  { color: var(--faint); }
.mono   { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num    { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right  { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 650; }
.upper  { text-transform: uppercase; letter-spacing: .04em; font-size: .75rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 3px;
}

/* ------------------------------------------------------------------ shell */

.app-shell { min-height: 100vh; }

.topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: .75rem;
    height: var(--header-h);
    padding: 0 .875rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.topbar-brand {
    display: flex; align-items: center; gap: .5rem;
    font-weight: 700; color: var(--ink); font-size: .98rem;
    text-decoration: none; min-width: 0;
}
.topbar-brand:hover { text-decoration: none; }
.topbar-brand .logo {
    width: 28px; height: 28px; border-radius: 7px; flex: 0 0 auto;
    background: var(--brand); color: #fff;
    display: grid; place-items: center;
    font-size: .8rem; font-weight: 700; letter-spacing: -.02em;
}
.topbar-brand .name {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.topbar-spacer { flex: 1 1 auto; }

.icon-button {
    display: grid; place-items: center;
    width: 38px; height: 38px; flex: 0 0 auto;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--ink-soft);
    cursor: pointer; padding: 0;
}
.icon-button:hover { background: var(--raised); }
.icon-button svg { width: 18px; height: 18px; }

@media (min-width: 900px) {
    #nav-toggle { display: none; }
}

/* user menu ---------------------------------------------------------------- */

.user-menu { position: relative; }

.user-menu-trigger {
    display: flex; align-items: center; gap: .5rem;
    padding: .3rem .5rem .3rem .3rem;
    border: 1px solid var(--line); border-radius: 999px;
    background: var(--surface); color: var(--ink); cursor: pointer;
    font: inherit; font-size: .85rem;
}
.user-menu-trigger:hover { background: var(--raised); }

.avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--brand-soft); color: var(--brand-dark);
    display: grid; place-items: center;
    font-size: .72rem; font-weight: 700; flex: 0 0 auto;
}

.user-menu-name { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .user-menu-name { display: none; } }

.dropdown {
    position: absolute; right: 0; top: calc(100% + .4rem);
    min-width: 220px; padding: .35rem;
    background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 50;
}
.dropdown[hidden] { display: none; }
.dropdown-header { padding: .5rem .6rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; }
.dropdown a, .dropdown button {
    display: block; width: 100%; text-align: left;
    padding: .45rem .6rem; border: 0; border-radius: var(--radius-sm);
    background: none; color: var(--ink); font: inherit; cursor: pointer;
}
.dropdown a:hover, .dropdown button:hover { background: var(--raised); text-decoration: none; }
.dropdown form { margin: 0; }

/* ---------------------------------------------------------------- sidebar */

.layout { display: block; }

.sidebar {
    position: fixed; inset: var(--header-h) auto 0 0;
    width: var(--sidebar-w); z-index: 45;
    padding: .875rem .6rem 2rem;
    background: var(--surface);
    border-right: 1px solid var(--line);
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform .18s ease-out;
}
.sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }

.nav-group + .nav-group { margin-top: 1.1rem; }
.nav-group-label {
    padding: 0 .65rem .35rem;
    font-size: .7rem; font-weight: 700; letter-spacing: .07em;
    text-transform: uppercase; color: var(--faint);
}
.nav-link {
    display: flex; align-items: center; gap: .6rem;
    padding: .5rem .65rem; margin-bottom: 1px;
    border-radius: var(--radius-sm);
    color: var(--ink-soft); font-size: .9rem;
}
.nav-link:hover { background: var(--raised); text-decoration: none; color: var(--ink); }
.nav-link.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.nav-link svg { width: 17px; height: 17px; flex: 0 0 auto; opacity: .85; }
.nav-link .badge { margin-left: auto; }

.scrim {
    position: fixed; inset: 0; z-index: 44;
    background: rgba(15, 23, 42, .45);
    opacity: 0; pointer-events: none;
    transition: opacity .18s ease-out;
}
.scrim.visible { opacity: 1; pointer-events: auto; }

.content { padding: 1rem .875rem 3rem; }

@media (min-width: 900px) {
    .sidebar  { transform: none; box-shadow: none; }
    .scrim    { display: none; }
    .content  { margin-left: var(--sidebar-w); padding: 1.5rem 1.75rem 4rem; }
}

@media (min-width: 1500px) {
    .content > .content-inner { max-width: 1400px; }
}

/* ------------------------------------------------------------ page header */

.page-head {
    display: flex; flex-wrap: wrap; align-items: flex-start;
    gap: .75rem; margin-bottom: 1.15rem;
}
.page-head .titles { flex: 1 1 16rem; min-width: 0; }
.page-head h1 { margin-bottom: .15rem; }
.page-head .subtitle { color: var(--muted); font-size: .88rem; margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.breadcrumb { font-size: .8rem; color: var(--muted); margin-bottom: .3rem; }
.breadcrumb a { color: var(--muted); }
.breadcrumb span::after { content: "/"; margin: 0 .4rem; color: var(--faint); }

/* ------------------------------------------------------------------ cards */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}
.card-head {
    display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
    padding: .8rem 1rem; border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 { margin: 0; font-size: .95rem; }
.card-head .spacer { flex: 1 1 auto; }
.card-body { padding: 1rem; }
.card-body.tight { padding: .6rem 1rem; }
.card-foot {
    padding: .7rem 1rem; border-top: 1px solid var(--line);
    background: var(--raised);
    border-radius: 0 0 var(--radius) var(--radius);
    display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
}

/* ------------------------------------------------------------------- grid */

.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: 1fr; }
.grid.cols-3 { grid-template-columns: 1fr; }
.grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (min-width: 700px) {
    .grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
    .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.grid.sidebar-right { grid-template-columns: 1fr; }
@media (min-width: 1100px) {
    .grid.sidebar-right { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}

/* ------------------------------------------------------------------- stat */

.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .85rem .9rem;
    box-shadow: var(--shadow);
}
.stat .label {
    font-size: .72rem; font-weight: 650; letter-spacing: .05em;
    text-transform: uppercase; color: var(--muted);
    display: block; margin-bottom: .3rem;
}
.stat .value {
    font-size: 1.35rem; font-weight: 680; line-height: 1.15;
    font-variant-numeric: tabular-nums; color: var(--ink);
    word-break: break-word;
}
.stat .hint { font-size: .78rem; color: var(--muted); margin-top: .25rem; }
.stat.accent { border-left: 3px solid var(--brand); }

/* ----------------------------------------------------------------- tables */

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

table.data {
    width: 100%; border-collapse: collapse; font-size: .875rem;
}
table.data th, table.data td {
    padding: .55rem .65rem;
    border-bottom: 1px solid var(--line);
    text-align: left; vertical-align: middle;
}
table.data thead th {
    position: sticky; top: 0; z-index: 1;
    background: var(--raised);
    font-size: .72rem; font-weight: 700; letter-spacing: .05em;
    text-transform: uppercase; color: var(--muted);
    white-space: nowrap;
}
table.data tbody tr:hover { background: var(--raised); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tfoot td {
    font-weight: 650; background: var(--raised);
    border-top: 2px solid var(--line-strong); border-bottom: 0;
}
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .actions { white-space: nowrap; text-align: right; }
table.data.compact th, table.data.compact td { padding: .38rem .5rem; font-size: .83rem; }

.table-empty {
    padding: 2.25rem 1rem; text-align: center; color: var(--muted);
}
.table-empty .big { font-size: 1rem; color: var(--ink-soft); margin-bottom: .3rem; }

/*
 * Below 760px a table marked .stacked turns each row into a card and shows
 * the column name from data-label, so nothing needs horizontal scrolling.
 */
@media (max-width: 760px) {
    table.data.stacked thead { display: none; }
    table.data.stacked, table.data.stacked tbody,
    table.data.stacked tr, table.data.stacked td { display: block; width: 100%; }
    table.data.stacked tr {
        border: 1px solid var(--line); border-radius: var(--radius);
        margin-bottom: .6rem; padding: .3rem .1rem; background: var(--surface);
    }
    table.data.stacked td {
        display: flex; justify-content: space-between; gap: 1rem;
        border-bottom: 1px dashed var(--line);
        padding: .45rem .7rem; text-align: right;
    }
    table.data.stacked td:last-child { border-bottom: 0; }
    table.data.stacked td::before {
        content: attr(data-label);
        font-size: .74rem; font-weight: 700; letter-spacing: .04em;
        text-transform: uppercase; color: var(--muted);
        text-align: left; flex: 0 0 45%;
    }
    table.data.stacked td.actions { justify-content: flex-end; }
    table.data.stacked td:empty { display: none; }
}

/* --------------------------------------------------------------- pagination */

.pagination {
    display: flex; flex-wrap: wrap; gap: .25rem;
    align-items: center; margin-top: 1rem;
}
.page-link {
    display: inline-block; min-width: 2.1rem; text-align: center;
    padding: .35rem .55rem;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--ink-soft); font-size: .85rem;
}
.page-link:hover { background: var(--raised); text-decoration: none; }
.page-link.active {
    background: var(--brand); border-color: var(--brand);
    color: #fff; font-weight: 650;
}
.page-link.disabled { color: var(--faint); background: var(--raised); cursor: default; }
.page-ellipsis { padding: 0 .3rem; color: var(--faint); }

.result-count { font-size: .82rem; color: var(--muted); }

/* ----------------------------------------------------------------- buttons */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .5rem .85rem;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--ink);
    font: inherit; font-size: .875rem; font-weight: 550;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--raised); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }

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

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

.btn-ghost { background: none; border-color: transparent; }
.btn-ghost:hover { background: var(--raised); }

.btn-sm { padding: .3rem .55rem; font-size: .8rem; }
.btn-block { width: 100%; }

.btn-group { display: inline-flex; flex-wrap: wrap; gap: .4rem; }

/* ------------------------------------------------------------------ forms */

form { margin: 0; }

.field { margin-bottom: .9rem; }
.field > label,
.field-label {
    display: block; margin-bottom: .3rem;
    font-size: .82rem; font-weight: 600; color: var(--ink-soft);
}
.field .req { color: var(--danger); margin-left: .15rem; }
.field .help { display: block; margin-top: .3rem; font-size: .78rem; color: var(--muted); }
.field .error { display: block; margin-top: .3rem; font-size: .8rem; color: var(--danger); }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="search"], input[type="tel"], input[type="url"],
input[type="month"], input[type="file"], select, textarea {
    width: 100%;
    padding: .5rem .6rem;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--ink);
    font: inherit; font-size: .9rem;
    /* 16px on mobile stops iOS zooming the viewport on focus */
}
@media (max-width: 760px) {
    input, select, textarea { font-size: 16px; }
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
input[readonly], input:disabled, select:disabled, textarea:disabled {
    background: var(--raised); color: var(--muted); cursor: not-allowed;
}
input.is-invalid, select.is-invalid, textarea.is-invalid { border-color: var(--danger); }

textarea { min-height: 5rem; resize: vertical; }

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8.5 1.5 4h9z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .55rem center;
    background-size: 11px;
    padding-right: 1.9rem;
}

.check {
    display: flex; align-items: flex-start; gap: .5rem;
    margin-bottom: .5rem; font-size: .88rem;
}
.check input[type="checkbox"], .check input[type="radio"] {
    width: 16px; height: 16px; margin: .15rem 0 0; flex: 0 0 auto;
    accent-color: var(--brand);
}
.check label { font-weight: 500; color: var(--ink-soft); }
.check .help { display: block; font-size: .78rem; color: var(--muted); }

.field-row { display: grid; gap: 0 .9rem; grid-template-columns: 1fr; }
@media (min-width: 640px) {
    .field-row.two   { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .field-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .field-row.four  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1000px) {
    .field-row.four  { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

fieldset {
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: .9rem 1rem .3rem; margin: 0 0 1.1rem;
}
legend {
    padding: 0 .4rem; font-size: .78rem; font-weight: 700;
    letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
}

.input-prefix { position: relative; }
.input-prefix > span {
    position: absolute; left: .6rem; top: 50%; transform: translateY(-50%);
    color: var(--muted); font-size: .88rem; pointer-events: none;
}
.input-prefix > input { padding-left: 1.6rem; }

.filter-bar {
    display: grid; gap: .6rem; grid-template-columns: 1fr;
    padding: .8rem 1rem; align-items: end;
}
@media (min-width: 700px) {
    .filter-bar { grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); }
}
.filter-bar .field { margin-bottom: 0; }
.filter-bar .filter-actions { display: flex; gap: .4rem; }

/* ------------------------------------------------------------------ flash */

.flash-stack { margin-bottom: 1rem; display: grid; gap: .5rem; }

.alert {
    display: flex; align-items: flex-start; gap: .6rem;
    padding: .7rem .85rem;
    border: 1px solid var(--line); border-left-width: 3px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
}
.alert svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: .1rem; }
.alert .alert-body { flex: 1 1 auto; min-width: 0; }
.alert .alert-close {
    border: 0; background: none; cursor: pointer;
    color: inherit; opacity: .6; font-size: 1.1rem; line-height: 1; padding: 0 .1rem;
}
.alert .alert-close:hover { opacity: 1; }

.alert-success { background: var(--ok-soft);     border-color: var(--ok-line);     color: var(--ok); }
.alert-error   { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.alert-warning { background: var(--warn-soft);   border-color: var(--warn-line);   color: var(--warn); }
.alert-info    { background: var(--info-soft);   border-color: var(--info-line);   color: var(--info); }

/* ------------------------------------------------------------------ badge */

.badge {
    display: inline-block; padding: .12rem .45rem;
    border: 1px solid transparent; border-radius: 999px;
    font-size: .72rem; font-weight: 650; letter-spacing: .02em;
    white-space: nowrap; text-transform: capitalize;
}
.badge-neutral  { background: var(--raised);      color: var(--muted);  border-color: var(--line); }
.badge-success  { background: var(--ok-soft);     color: var(--ok);     border-color: var(--ok-line); }
.badge-danger   { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.badge-warning  { background: var(--warn-soft);   color: var(--warn);   border-color: var(--warn-line); }
.badge-info     { background: var(--info-soft);   color: var(--info);   border-color: var(--info-line); }
.badge-brand    { background: var(--brand-soft);  color: var(--brand-dark); border-color: var(--brand-line); }

/* -------------------------------------------------------- definition list */

.dl {
    display: grid; grid-template-columns: 1fr; gap: .1rem .9rem;
    margin: 0; font-size: .875rem;
}
@media (min-width: 560px) {
    .dl { grid-template-columns: max-content 1fr; }
}
.dl dt {
    color: var(--muted); font-size: .8rem; padding-top: .3rem;
}
.dl dd {
    margin: 0 0 .5rem; color: var(--ink); padding-top: .3rem;
    word-break: break-word;
}
@media (max-width: 559px) {
    .dl dt { padding-top: .5rem; }
    .dl dd { margin-bottom: .35rem; }
}

/* ------------------------------------------------------------------- tabs */

.tabs {
    display: flex; gap: .15rem; overflow-x: auto;
    border-bottom: 1px solid var(--line);
    margin-bottom: 1.15rem; -webkit-overflow-scrolling: touch;
}
.tabs a {
    padding: .5rem .8rem; white-space: nowrap;
    color: var(--muted); font-size: .875rem; font-weight: 550;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }

/* --------------------------------------------------------------- bar chart */

.bars {
    display: flex; align-items: flex-end; gap: .5rem;
    height: 150px; padding-top: .5rem;
}
.bars .bar-col {
    flex: 1 1 0; display: flex; flex-direction: column;
    align-items: center; justify-content: flex-end; height: 100%; min-width: 0;
}
.bars .bar {
    width: 100%; max-width: 46px;
    background: var(--brand); border-radius: 4px 4px 0 0;
    min-height: 3px;
}
.bars .bar.muted { background: var(--brand-line); }
.bars .bar-label {
    margin-top: .35rem; font-size: .68rem; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.bars .bar-value { font-size: .68rem; color: var(--muted); margin-bottom: .2rem; }

/* -------------------------------------------------------------- progress */

.meter {
    height: 6px; border-radius: 999px; background: var(--line);
    overflow: hidden;
}
.meter > span { display: block; height: 100%; background: var(--brand); }

/* ----------------------------------------------------------- payslip view */

.payslip {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); overflow: hidden;
}
.payslip-head {
    padding: 1.1rem 1.15rem; border-bottom: 2px solid var(--line-strong);
    display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start;
}
.payslip-head .company { flex: 1 1 15rem; min-width: 0; }
.payslip-head .company h2 { margin-bottom: .15rem; font-size: 1.1rem; }
.payslip-head .period { text-align: left; }
@media (min-width: 640px) { .payslip-head .period { text-align: right; } }

.payslip-columns {
    display: grid; grid-template-columns: 1fr; gap: 0;
}
@media (min-width: 800px) {
    .payslip-columns { grid-template-columns: 1fr 1fr; }
    .payslip-columns > div:first-child { border-right: 1px solid var(--line); }
}
.payslip-columns > div { padding: 0; }
.payslip-columns h3 {
    margin: 0; padding: .55rem .9rem;
    background: var(--raised); font-size: .78rem;
    letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
    border-bottom: 1px solid var(--line);
}

.net-strip {
    padding: 1rem 1.15rem;
    background: var(--brand-soft); border-top: 1px solid var(--brand-line);
    border-bottom: 1px solid var(--brand-line);
}
.net-strip .amount {
    font-size: 1.55rem; font-weight: 700; color: var(--brand-dark);
    font-variant-numeric: tabular-nums;
}
.net-strip .words { font-size: .85rem; color: var(--ink-soft); margin-top: .2rem; }

/* --------------------------------------------------------------- attendance */

.attendance-grid table.data th,
.attendance-grid table.data td { padding: .35rem .4rem; }
.attendance-grid input[type="number"],
.attendance-grid input[type="text"] {
    padding: .3rem .4rem; font-size: .82rem; min-width: 5rem;
}
.attendance-grid .sticky-col {
    position: sticky; left: 0; background: var(--surface); z-index: 2;
    border-right: 1px solid var(--line);
}
.attendance-grid thead .sticky-col { background: var(--raised); z-index: 3; }

/* --------------------------------------------------------------- auth page */

.auth-page {
    min-height: 100vh;
    display: grid; place-items: center;
    padding: 1.5rem 1rem;
    background: var(--canvas);
}
.auth-card {
    width: 100%; max-width: 25rem;
    background: var(--surface);
    border: 1px solid var(--line); border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 1.75rem 1.5rem;
}
.auth-brand {
    display: flex; align-items: center; gap: .6rem;
    justify-content: center; margin-bottom: 1.25rem;
}
.auth-brand .logo {
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--brand); color: #fff;
    display: grid; place-items: center; font-weight: 700;
}
.auth-brand .name { font-weight: 700; font-size: 1.05rem; }
.auth-card h1 { font-size: 1.15rem; text-align: center; margin-bottom: .3rem; }
.auth-card .lede { text-align: center; color: var(--muted); font-size: .87rem; margin-bottom: 1.25rem; }
.auth-foot { margin-top: 1.1rem; text-align: center; font-size: .84rem; color: var(--muted); }
.auth-legal { margin-top: 1.25rem; text-align: center; font-size: .75rem; color: var(--faint); }

/* -------------------------------------------------------------- error page */

.error-page {
    min-height: 100vh; display: grid; place-items: center;
    padding: 2rem 1rem; text-align: center;
    font-family: var(--font); background: var(--canvas); color: var(--ink);
}
.error-page .code {
    font-size: 3.5rem; font-weight: 750; line-height: 1;
    color: var(--brand); margin-bottom: .4rem;
}
.error-page h1 { font-size: 1.25rem; }
.error-page p { color: var(--muted); max-width: 32rem; margin-inline: auto; }
.error-page pre {
    text-align: left; max-width: 60rem; margin: 1.5rem auto 0;
    padding: 1rem; overflow: auto; font-size: .78rem;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); color: var(--ink-soft);
}

/* --------------------------------------------------------------- utilities */

.stack   { display: grid; gap: .5rem; }
.row     { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.row.between { justify-content: space-between; }
.divider { border-top: 1px solid var(--line); margin: .85rem 0; }

.callout {
    padding: .7rem .85rem; border-radius: var(--radius-sm);
    background: var(--raised); border: 1px solid var(--line);
    font-size: .85rem; color: var(--ink-soft);
}
.callout.brand { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-dark); }

.chip {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .15rem .5rem; border-radius: 999px;
    background: var(--raised); border: 1px solid var(--line);
    font-size: .76rem; color: var(--ink-soft);
}

.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: .4rem 0; border-bottom: 1px solid var(--line); font-size: .87rem; }
.list-plain li:last-child { border-bottom: 0; }

/* ------------------------------------------------------------------- print */

@media print {
    .topbar, .sidebar, .scrim, .page-actions,
    .pagination, .flash-stack, .no-print { display: none !important; }
    body { background: #fff; font-size: 12px; }
    .content { margin: 0; padding: 0; }
    .card, .payslip { border: 1px solid #999; box-shadow: none; break-inside: avoid; }
    a { color: #000; text-decoration: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
