/* =====================================================================
 *  Attendance Register — Admin Panel Stylesheet
 *  Used by every page under /admin/.
 *
 *  Design brief: Clean modern light theme.
 *    - Inter / system-ui, 14px base
 *    - Neutral slate palette with indigo accent
 *    - Soft borders, subtle shadows, gentle rounding
 *    - Supports both the simple .shell layout and the rich .app shell
 *    - All legacy class names preserved for HTML compatibility
 * ===================================================================== */


/* =====================================================================
 *  DESIGN TOKENS
 * ===================================================================== */
:root {
    /* Surfaces */
    --bg-app:           #fbfcfd;
    --bg-surface:       #ffffff;
    --bg-subtle:        #f5f7fa;
    --bg-muted:         #eef1f5;
    --bg-topbar:        #ffffff;
    --bg-sidebar:       #fcfcfd;

    /* Borders */
    --border:           #edf0f4;
    --border-strong:    #dfe4ea;
    --border-focus:     #4f46e5;

    /* Text */
    --text:             #0b1524;
    --text-secondary:   #3d4856;
    --text-muted:       #6b7785;
    --text-faint:       #9aa4b1;
    --text-inverse:     #ffffff;

    /* Accent (Indigo) */
    --accent:           #4f46e5;
    --accent-hover:     #4338ca;
    --accent-active:    #3730a3;
    --accent-soft:      #eef2ff;
    --accent-soft-bd:   #c7d2fe;

    /* Semantic */
    --success:          #15803d;
    --success-bg:       #f0fdf6;
    --success-bd:       #bbf7d0;

    --danger:           #dc2626;
    --danger-bg:        #fef2f2;
    --danger-bd:        #fecaca;

    --warning:          #b45309;
    --warning-bg:       #fffbeb;
    --warning-bd:       #fde68a;

    --info:             #2563eb;
    --info-bg:          #eff6ff;
    --info-bd:          #bfdbfe;

    /* Effects */
    --radius-sm: 8px;
    --radius:    10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --shadow-xs: 0 1px 2px rgba(11, 21, 36, 0.04);
    --shadow-sm: 0 1px 2px rgba(11, 21, 36, 0.05), 0 1px 3px rgba(11, 21, 36, 0.05);
    --shadow-md: 0 4px 14px rgba(11, 21, 36, 0.07), 0 2px 6px rgba(11, 21, 36, 0.04);

    /* Typography */
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
                 Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas,
                 "Liberation Mono", monospace;

    /* Motion */
    --t: 160ms cubic-bezier(0.4, 0, 0.2, 1);
}


/* =====================================================================
 *  RESET / BASE
 * ===================================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    background: var(--bg-app);
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--t);
}
a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
    text-underline-offset: 2px;
}

h1, h2, h3, h4 {
    font-family: var(--font-sans);
    font-weight: 600;
    color: var(--text);
    margin: 0 0 8px;
    letter-spacing: -0.01em;
}
h1 { font-size: 22px; letter-spacing: -0.02em; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}

::selection {
    background: var(--accent-soft);
    color: var(--accent-active);
}


/* =====================================================================
 *  LAYOUT  —  legacy .shell (topbar above sidebar+main)
 * ===================================================================== */
.topbar {
    background: var(--bg-topbar);
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
    letter-spacing: -0.01em;
}
.topbar .brand svg { display: block; color: var(--accent); }

.topbar .user-block {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 12px;
}
.topbar .user-block b { color: var(--text); font-weight: 600; }
.topbar .user-block a {
    color: var(--text-secondary);
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    transition: background var(--t), border-color var(--t), color var(--t);
}
.topbar .user-block a:hover {
    background: var(--bg-subtle);
    border-color: var(--border-strong);
    color: var(--text);
    text-decoration: none;
}

.shell {
    display: flex;
    min-height: calc(100vh - 56px);
}

.sidebar {
    width: 224px;
    background: var(--bg-sidebar);
    color: var(--text-secondary);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar nav { padding: 12px 8px; }
.sidebar nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sidebar nav li { border-bottom: none; }
.sidebar nav a {
    display: block;
    padding: 8px 12px;
    margin: 1px 0;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius);
    border-left: 3px solid transparent;
    transition: background var(--t), color var(--t);
}
.sidebar nav a:hover {
    background: var(--bg-subtle);
    color: var(--text);
    text-decoration: none;
}
.sidebar nav a.active {
    background: var(--accent-soft);
    color: var(--accent-active);
    border-left-color: var(--accent);
    font-weight: 600;
}
.sidebar nav .section-label {
    color: var(--text-faint);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 16px 12px 6px;
    letter-spacing: 0.06em;
}

.main {
    flex: 1;
    padding: 24px 28px 40px;
    min-width: 0;
}

.page-head {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.page-head h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}
.page-head .crumb {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}


/* =====================================================================
 *  RICH ADMIN SHELL  —  used by admin_header.php
 *  Sidebar (full-height) | (Topbar above Main)
 * ===================================================================== */
.app {
    display: flex;
    min-height: 100vh;
}
.app-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app .sidebar {
    display: flex;
    flex-direction: column;
    width: 240px;
    background: var(--bg-sidebar);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    transition: background var(--t);
}
.brand:hover {
    background: var(--bg-subtle);
    text-decoration: none;
    color: var(--text);
}
.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
    box-shadow: 0 4px 10px -3px rgba(79,70,229,0.45);
}
.brand-name {
    display: flex;
    flex-direction: column;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text);
    letter-spacing: -0.01em;
}
.brand-name small {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0;
    margin-top: 2px;
}

.app .sidebar nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}
.nav-label {
    color: var(--text-faint);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 6px 10px;
    letter-spacing: 0.06em;
}
.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    margin: 2px 0;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius);
    transition: background var(--t), color var(--t);
}
.nav-item svg {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color var(--t);
}
.nav-item:hover {
    background: var(--bg-subtle);
    color: var(--text);
    text-decoration: none;
}
.nav-item:hover svg { color: var(--text-secondary); }
.nav-item.active {
    background: var(--accent-soft);
    color: var(--accent-active);
    font-weight: 600;
}
.nav-item.active::before {
    content: "";
    position: absolute;
    left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 18px; border-radius: 0 3px 3px 0;
    background: var(--accent);
}
.nav-item.active svg { color: var(--accent); }

.sidebar-footer {
    padding: 10px;
    border-top: 1px solid var(--border);
}
.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius);
    text-decoration: none;
    transition: background var(--t);
}
.user-card:hover {
    background: var(--bg-subtle);
    text-decoration: none;
}
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-active);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}
.user-card .user-info {
    flex: 1;
    min-width: 0;
}
.user-card .user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-card .user-role {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}

.app-body .topbar {
    height: 60px;
    padding: 0 24px;
    gap: 16px;
    justify-content: flex-start;
}

.topbar-search {
    flex: 1;
    max-width: 460px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: var(--bg-subtle);
    border: 1px solid transparent;
    border-radius: var(--radius);
    transition: background var(--t), border-color var(--t), box-shadow var(--t);
}
.topbar-search:focus-within {
    background: var(--bg-surface);
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.topbar-search svg {
    color: var(--text-muted);
    flex-shrink: 0;
}
.topbar-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    outline: 0;
    font: inherit;
    font-size: 14px;
    color: var(--text);
    padding: 0;
}
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search kbd {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    flex-shrink: 0;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}
.topbar-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: var(--text-secondary);
    border-radius: var(--radius);
    text-decoration: none;
    transition: background var(--t), color var(--t);
}
.topbar-action:hover {
    background: var(--bg-subtle);
    color: var(--text);
    text-decoration: none;
}
.topbar-divider {
    width: 1px;
    height: 22px;
    background: var(--border);
    margin: 0 6px;
}
.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    border-radius: 999px;
}
.topbar-user .avatar {
    width: 28px;
    height: 28px;
    font-size: 11px;
}
.topbar-user .label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.app-body .main .page-head {
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 18px;
}
.page-head .eyebrow {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.page-head .page-title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.page-head .page-title em {
    font-style: normal;
    color: var(--text-muted);
    font-weight: 500;
}
.page-head .page-sub {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}
.page-head .page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid;
    border-left-width: 3px;
}
.flash svg { flex-shrink: 0; }
.flash.ok {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success-bd);
    border-left-color: var(--success);
}
.flash.err {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger-bd);
    border-left-color: var(--danger);
}


/* =====================================================================
 *  PANEL
 * ===================================================================== */
.panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    overflow: hidden;
}
.panel .caption {
    background: var(--bg-surface);
    color: var(--text);
    padding: 16px 20px;
    font-weight: 650;
    font-size: 14.5px;
    letter-spacing: -0.01em;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.panel .caption .actions a,
.panel .caption .actions button {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    padding: 5px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    margin-left: 6px;
    cursor: pointer;
    transition: background var(--t), border-color var(--t), color var(--t);
}
.panel .caption .actions a:hover,
.panel .caption .actions button:hover {
    background: var(--bg-subtle);
    border-color: var(--border-strong);
    color: var(--text);
    text-decoration: none;
}
.panel .body { padding: 18px; }
.panel .body.tight { padding: 0; }


/* =====================================================================
 *  DATA TABLES
 * ===================================================================== */
table.data {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-surface);
    font-size: 14px;
}
table.data th,
table.data td {
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
    vertical-align: middle;
    text-align: left;
}
table.data thead th {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-strong);
    white-space: nowrap;
}
table.data tbody tr { transition: background var(--t); }
table.data tbody tr:hover { background: var(--bg-subtle); }
table.data tbody tr:last-child td { border-bottom: none; }

table.data td.amount,
table.data th.amount {
    text-align: right;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
table.data td.center,
table.data th.center { text-align: center; }
table.data td.nowrap { white-space: nowrap; }

/* --- Sortable / filterable column headers (opt-in via .sortable/.filterable) --- */
table.data thead th.sortable,
table.data thead th.filterable {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}
table.data thead th.sortable:hover,
table.data thead th.filterable:hover {
    color: var(--text);
    background: var(--accent-soft);
}
table.data thead th .sort-ind {
    display: inline-block;
    margin-left: 5px;
    font-size: 10px;
    opacity: 0.35;
    vertical-align: middle;
}
table.data thead th.sort-asc .sort-ind,
table.data thead th.sort-desc .sort-ind {
    opacity: 1;
    color: var(--accent);
}
table.data thead th .filter-tag {
    display: inline-block;
    margin-left: 5px;
    font-size: 10px;
    font-weight: 700;
    color: var(--accent);
    text-transform: none;
    letter-spacing: 0;
}

table.data tfoot td {
    background: var(--bg-subtle);
    font-weight: 600;
    border-top: 1px solid var(--border-strong);
    color: var(--text);
}

.empty-row td {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 16px;
    font-style: normal;
}


/* =====================================================================
 *  FORMS
 * ===================================================================== */
table.form {
    width: 100%;
    border-collapse: collapse;
}
table.form td {
    padding: 8px 8px;
    vertical-align: top;
}
table.form td.label {
    width: 180px;
    color: var(--text-secondary);
    text-align: right;
    padding-right: 14px;
    padding-top: 11px;
    white-space: nowrap;
    font-weight: 500;
    font-size: 14px;
}
table.form td.label .req { color: var(--danger); }

table.form input[type="text"],
table.form input[type="password"],
table.form input[type="number"],
table.form input[type="email"],
table.form input[type="tel"],
table.form input[type="date"],
table.form input[type="month"],
table.form select,
table.form textarea {
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    background: var(--bg-surface);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    width: 100%;
    max-width: 440px;
    transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
table.form input[type="number"] {
    max-width: 220px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
table.form input[type="date"],
table.form input[type="month"]  { max-width: 240px; }
table.form textarea {
    max-width: 560px;
    min-height: 84px;
    resize: vertical;
    line-height: 1.5;
}

table.form input:focus,
table.form select:focus,
table.form textarea:focus {
    border-color: var(--border-focus);
    background: var(--bg-surface);
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
table.form input:disabled,
table.form select:disabled {
    background: var(--bg-muted);
    color: var(--text-faint);
    cursor: not-allowed;
}
table.form .hint {
    color: var(--text-muted);
    font-size: 12px;
    display: block;
    margin-top: 4px;
}

/* Shared field helper + error text (used across all admin forms). */
.helper-text { color: var(--text-muted); font-size: 12px; display: block; margin-top: 4px; line-height: 1.5; }
.field-msg   { color: var(--danger); font-size: 12.5px; display: block; margin-top: 5px; }
.field-error { border-color: var(--danger) !important; background: var(--danger-bg) !important; }

/* Segmented radio (e.g. Employee Type) — modern pill toggle. */
.seg-radio { display: flex; gap: 8px; flex-wrap: wrap; }
.seg-radio label { padding: 9px 18px; border: 1px solid var(--border-strong); border-radius: var(--radius);
    cursor: pointer; font-weight: 500; font-size: 14px; color: var(--text-secondary); transition: border-color var(--t), background var(--t), color var(--t); }
.seg-radio input { position: absolute; opacity: 0; pointer-events: none; }
.seg-radio label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-active); font-weight: 600; }

/* Inline checkbox row (OT applicable / exempt, etc.). */
.check-row { display: flex; align-items: center; gap: 9px; }
.check-row input { width: 18px; height: 18px; accent-color: var(--accent); }

.inline-choices label {
    margin-right: 16px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
}
.inline-choices input {
    margin-right: 6px;
    accent-color: var(--accent);
}

.form-actions {
    padding: 16px 8px 6px;
    border-top: 1px solid var(--border);
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}


/* =====================================================================
 *  BUTTONS
 * ===================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: var(--accent);
    color: var(--text-inverse);
    border: 1px solid var(--accent);
    padding: 9px 18px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.4;
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(79,70,229,0.12);
    transition: background var(--t), border-color var(--t),
                box-shadow var(--t), transform var(--t);
}
.btn:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--text-inverse);
    text-decoration: none;
}
.btn:active {
    background: var(--accent-active);
    border-color: var(--accent-active);
    transform: translateY(0.5px);
}
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.28);
}
.btn:disabled,
.btn.disabled {
    background: var(--bg-muted);
    border-color: var(--border);
    color: var(--text-faint);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border-color: var(--border-strong);
}
.btn-secondary:hover {
    background: var(--bg-subtle);
    color: var(--text);
    border-color: var(--border-strong);
}
.btn-secondary:active { background: var(--bg-muted); }

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
}
.btn-danger:hover  { background: #991b1b; border-color: #991b1b; }
.btn-danger:active { background: #7f1d1d; border-color: #7f1d1d; }

.btn-small {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    padding: 0;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.btn-link:hover { color: var(--accent-hover); }


/* =====================================================================
 *  ALERTS
 * ===================================================================== */
.alert {
    border: 1px solid var(--danger-bd);
    background: var(--danger-bg);
    color: var(--danger);
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 14px;
    border-radius: var(--radius);
    border-left: 3px solid var(--danger);
}
.alert b { color: var(--danger); font-weight: 600; }

.alert.success {
    border-color: var(--success-bd);
    background: var(--success-bg);
    color: var(--success);
    border-left-color: var(--success);
}
.alert.success b { color: var(--success); }

.alert.info {
    border-color: var(--info-bd);
    background: var(--info-bg);
    color: var(--info);
    border-left-color: var(--info);
}
.alert.info b { color: var(--info); }

.alert.warning {
    border-color: var(--warning-bd);
    background: var(--warning-bg);
    color: var(--warning);
    border-left-color: var(--warning);
}
.alert.warning b { color: var(--warning); }


/* =====================================================================
 *  DASHBOARD TILES
 * ===================================================================== */
.tile-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.tile {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 18px 20px;
    transition: box-shadow var(--t), transform var(--t);
}
.tile:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.tile .tile-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    margin-bottom: 10px;
}
.tile .tile-value {
    color: var(--text);
    font-size: 30px;
    font-weight: 700;
    line-height: 1.05;
    margin-bottom: 6px;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}
.tile .tile-sub {
    color: var(--text-muted);
    font-size: 12px;
}
.tile.accent-green .tile-value { color: var(--success); }
.tile.accent-red   .tile-value { color: var(--danger); }
.tile.accent-amber .tile-value { color: var(--warning); }


/* =====================================================================
 *  FILTER BAR
 * ===================================================================== */
.filter-bar {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    font-size: 14px;
    box-shadow: var(--shadow-xs);
}
.filter-bar label {
    color: var(--text-secondary);
    font-weight: 500;
    margin-right: 2px;
    font-size: 13px;
}
.filter-bar input,
.filter-bar select {
    padding: 7px 10px;
    border: 1px solid var(--border-strong);
    background: var(--bg-surface);
    border-radius: var(--radius);
    font: inherit;
    font-size: 14px;
    color: var(--text);
    transition: border-color var(--t), box-shadow var(--t);
}
.filter-bar input:focus,
.filter-bar select:focus {
    border-color: var(--border-focus);
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}


/* =====================================================================
 *  PAGINATION
 * ===================================================================== */
.pagination {
    margin-top: 16px;
    text-align: right;
    font-size: 13px;
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    flex-wrap: wrap;
}
.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius);
    transition: background var(--t), border-color var(--t), color var(--t);
}
.pagination a:hover {
    background: var(--bg-subtle);
    border-color: var(--border-strong);
    color: var(--text);
    text-decoration: none;
}
.pagination .current {
    background: var(--accent);
    color: var(--text-inverse);
    border-color: var(--accent);
    font-weight: 600;
}
.pagination .disabled {
    color: var(--text-faint);
    background: var(--bg-muted);
    cursor: not-allowed;
}


/* =====================================================================
 *  STATUS BADGES
 * ===================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    border: 1px solid;
    letter-spacing: 0.04em;
    white-space: nowrap;
    border-radius: 999px;
    line-height: 1.6;
}
.badge.status-active   { background: var(--success-bg); color: var(--success); border-color: var(--success-bd); }
.badge.status-left     { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger-bd); }
.badge.status-paid     { background: var(--info-bg);    color: var(--info);    border-color: var(--info-bd); }
.badge.status-pending  { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-bd); }
.badge.status-inactive { background: var(--bg-muted);   color: var(--text-muted); border-color: var(--border-strong); }
.badge.type-salaried   { background: var(--accent-soft); color: var(--accent-active); border-color: var(--accent-soft-bd); }
.badge.type-daily      { background: #fff7ed;           color: #9a3412;        border-color: #fed7aa; }


/* Attendance code badges (P / A / HD / WO / H) */
.att-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    padding: 2px 6px;
    font-weight: 600;
    font-size: 12px;
    border: 1px solid;
    border-radius: var(--radius-sm);
    font-variant-numeric: tabular-nums;
}
.att-P  { background: var(--success-bg); color: var(--success); border-color: var(--success-bd); }
.att-A  { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger-bd); }
.att-HD { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-bd); }
.att-WO { background: var(--info-bg);    color: var(--info);    border-color: var(--info-bd); }
.att-H  { background: #faf5ff;           color: #6b21a8;        border-color: #e9d5ff; }


/* =====================================================================
 *  UTILITIES
 * ===================================================================== */
.text-right   { text-align: right;  }
.text-center  { text-align: center; }
.text-left    { text-align: left;   }
.nowrap       { white-space: nowrap; }
.muted        { color: var(--text-muted); }
.small        { font-size: 12px; }
.tiny         { font-size: 11px; }
.strong       { font-weight: 600; }
.mt-0         { margin-top: 0 !important; }
.mt-1         { margin-top: 8px;    }
.mt-2         { margin-top: 16px;   }
.mb-0         { margin-bottom: 0 !important; }
.mb-1         { margin-bottom: 8px; }
.mb-2         { margin-bottom: 16px;}
.amount       { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.danger-text  { color: var(--danger);  }
.success-text { color: var(--success); }


/* =====================================================================
 *  PAGE FOOTER
 * ===================================================================== */
.pagefoot {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-app);
    margin-top: 24px;
}


/* =====================================================================
 *  SCROLLBAR
 * ===================================================================== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-app); }
::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
    border: 2px solid var(--bg-app);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }


/* =====================================================================
 *  PRINT
 * ===================================================================== */
@media print {
    .topbar, .sidebar, .pagefoot, .filter-bar, .form-actions, .no-print {
        display: none !important;
    }
    .shell, .app { display: block; }
    .app-body, .main  { padding: 0; }
    body   { background: #fff; }
    .panel {
        border: 1px solid #ccc;
        box-shadow: none;
        border-radius: 0;
    }
}


/* =====================================================================
 *  RESPONSIVE
 * ===================================================================== */
@media (max-width: 980px) {
    .app .sidebar { width: 220px; }
    .topbar-search { max-width: none; }
    .topbar-user .label { display: none; }
}

@media (max-width: 768px) {
    .topbar { padding: 0 16px; height: 52px; }
    .main   { padding: 16px; }

    /* Legacy shell */
    .shell { flex-direction: column; }
    .shell > .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .shell > .sidebar nav { padding: 8px; }
    .shell > .sidebar nav ul {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }
    .shell > .sidebar nav li { border-bottom: none; }
    .shell > .sidebar nav a {
        padding: 6px 12px;
        border-left: none;
        border-bottom: 2px solid transparent;
        margin: 0;
    }
    .shell > .sidebar nav a.active {
        border-left: none;
        border-bottom-color: var(--accent);
    }
    .shell > .sidebar nav .section-label { display: none; }

    /* Rich app shell */
    .app { flex-direction: column; }
    .app .sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
    .app .sidebar .brand {
        border-bottom: 0;
        flex: 1;
        min-width: 0;
    }
    .app .sidebar nav {
        order: 3;
        width: 100%;
        padding: 6px 8px;
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        border-top: 1px solid var(--border);
    }
    .nav-label { display: none; }
    .nav-item { margin: 0; padding: 6px 10px; }
    .nav-item span { display: none; }
    .sidebar-footer {
        border-top: 0;
        padding: 8px;
    }
    .user-card { padding: 4px; }
    .user-card .user-info { display: none; }
    .app-body .topbar {
        padding: 0 16px;
        height: 56px;
    }
    .topbar-search kbd { display: none; }

    .page-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .app-body .main .page-head {
        align-items: flex-start;
    }

    table.form td.label {
        width: auto;
        text-align: left;
        padding-top: 5px;
        padding-bottom: 0;
        padding-right: 0;
    }
    table.form td { display: block; }
    table.form input,
    table.form select,
    table.form textarea {
        width: 100%;
        min-width: 0;
    }
}


/* =====================================================================
 *  ============   UI REFRESH 2026  —  MOTION & POLISH LAYER   ==========
 *  Purely presentational. Adds micro-interactions, entrance animations,
 *  ripple/press feedback and refined depth on top of the existing
 *  design tokens. No markup or class names changed.
 * ===================================================================== */

/* ---- Smoother base rendering & momentum scroll ---- */
html { scroll-behavior: smooth; }
body { -webkit-text-size-adjust: 100%; }

/* ---- Richer, layered shadows for a more premium feel ---- */
:root {
    --shadow-sm: 0 1px 2px rgba(11,21,36,.04), 0 2px 6px rgba(11,21,36,.05);
    --shadow-md: 0 6px 22px -6px rgba(11,21,36,.12), 0 2px 8px rgba(11,21,36,.05);
    --shadow-lg: 0 18px 48px -12px rgba(11,21,36,.20), 0 6px 16px rgba(11,21,36,.06);
    --ring: 0 0 0 3px rgba(79,70,229,.18);
    --ease: cubic-bezier(.4, 0, .2, 1);
    --ease-out: cubic-bezier(.16, 1, .3, 1);
}

/* ---- Page entrance: content fades in once ----
 * opacity-only on purpose, so it never breaks position:fixed descendants. */
@keyframes ui-rise { from { opacity: 0; } to { opacity: 1; } }
.app-body .main > * { animation: ui-rise .5s var(--ease-out) both; }
.app-body .main > *:nth-child(1) { animation-delay: .02s; }
.app-body .main > *:nth-child(2) { animation-delay: .06s; }
.app-body .main > *:nth-child(3) { animation-delay: .10s; }
.app-body .main > *:nth-child(4) { animation-delay: .14s; }
.app-body .main > *:nth-child(5) { animation-delay: .18s; }
.app-body .main > *:nth-child(n+6) { animation-delay: .22s; }

/* ---- KPI tiles: smoother lift + sheen on hover ---- */
.tile { position: relative; overflow: hidden; transition: box-shadow .25s var(--ease), transform .25s var(--ease), border-color .25s var(--ease); }
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.tile::after {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
    background: radial-gradient(420px circle at var(--mx,50%) var(--my,0%), rgba(79,70,229,.07), transparent 60%);
    transition: opacity .3s var(--ease);
}
.tile:hover::after { opacity: 1; }
.tile .tile-value { transition: color .2s var(--ease); }

/* ---- Panels: gentle entrance-friendly depth + hover ---- */
.panel { transition: box-shadow .25s var(--ease), border-color .25s var(--ease); }
.panel:hover { box-shadow: var(--shadow-md); }

/* ---- Buttons: ripple + press + loading spinner ---- */
.btn { position: relative; overflow: hidden; }
.btn .ui-ripple {
    position: absolute; border-radius: 50%; transform: scale(0);
    background: rgba(255,255,255,.45); pointer-events: none;
    animation: ui-ripple .6s var(--ease-out);
}
.btn-secondary .ui-ripple { background: rgba(79,70,229,.18); }
@keyframes ui-ripple { to { transform: scale(2.6); opacity: 0; } }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
    content: ""; position: absolute; top: 50%; left: 50%;
    width: 16px; height: 16px; margin: -8px 0 0 -8px;
    border: 2px solid rgba(255,255,255,.45); border-top-color: #fff;
    border-radius: 50%; animation: ui-spin .6s linear infinite;
}
.btn-secondary.is-loading::after { border-color: rgba(79,70,229,.35); border-top-color: var(--accent); }
@keyframes ui-spin { to { transform: rotate(360deg); } }

/* ---- Nav items: animated active indicator + smoother hover ---- */
.nav-item { transition: background .18s var(--ease), color .18s var(--ease), transform .12s var(--ease); }
.nav-item:active { transform: translateX(1px) scale(.99); }
.nav-item.active::before { animation: ui-grow .35s var(--ease-out) both; }
@keyframes ui-grow { from { height: 0; opacity: 0; } to { height: 18px; opacity: 1; } }

/* ---- Table rows: subtle reveal + cleaner hover ---- */
table.data tbody tr { transition: background .15s var(--ease); }
table.data tbody tr:hover { background: var(--accent-soft); }

/* ---- Flash / alert slide-in ---- */
.flash, .alert { animation: ui-flash .45s var(--ease-out) both; }
@keyframes ui-flash { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---- Inputs: smoother focus glow ---- */
table.form input:focus, table.form select:focus, table.form textarea:focus,
.filter-bar input:focus, .filter-bar select:focus { box-shadow: var(--ring); }

/* ---- Badges: tiny pop ---- */
.badge { transition: transform .12s var(--ease); }

/* ---- Ripple containment + small layout polish ---- */
.nav-item { overflow: hidden; }                 /* clip ui.js ripple to the item */
.pagination a, .pagination span { position: relative; overflow: hidden; }
.page-actions { flex-wrap: wrap; }              /* avoid crowding on dense headers */
summary::-webkit-details-marker { display: none; }  /* styled captions, no triangle */

/* ---- Honour reduced-motion preferences ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}
