@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-main: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f8fafc;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --accent-primary: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-info: #06b6d4;

    --border-color: #e2e8f0;
    
    --font-family: 'Inter', sans-serif;
    
    --sidebar-width: 260px;
    --header-height: 64px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.08), 0 8px 10px -6px rgb(0 0 0 / 0.04);
    
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    --transition-speed: 0.2s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, svg, canvas, video {
    max-width: 100%;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
}

.text-secondary {
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════
   SIDEBAR – Premium Light Design
   ═══════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-width);
    background-color: #ffffff;
    border-right: 1px solid var(--border-color);
    position: fixed;
    height: 100vh;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-speed) ease;
}

.mobile-sidebar-overlay,
.mobile-menu-toggle {
    display: none;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.logo-brand {
    font-size: 1.15rem;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.logo-brand strong {
    font-weight: 700;
}

.logo-tagline {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 2px;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 0.75rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.nav-section-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 1.25rem 0.75rem 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
    margin-bottom: 2px;
    font-weight: 500;
    font-size: 0.875rem;
    position: relative;
}

.nav-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: #eff6ff;
    color: var(--accent-primary);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    width: 3px;
    background: linear-gradient(180deg, #2563eb, #7c3aed);
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active .nav-icon {
    opacity: 1;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-md);
    background-color: transparent;
}

.sidebar-user .avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.sidebar-user .avatar.avatar-photo {
    background: transparent;
    border: none;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-logout {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0.35rem;
    border-radius: 6px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.sidebar-logout:hover {
    color: var(--accent-danger);
    background-color: #fef2f2;
}

/* ═══════════════════════════════════════
   MAIN CONTENT AREA
   ═══════════════════════════════════════ */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

/* Top Header */
.top-header {
    height: var(--header-height);
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
    backdrop-filter: blur(12px);
    background-color: rgba(255, 255, 255, 0.85);
}

.header-search {
    display: flex;
    align-items: center;
    background-color: var(--bg-main);
    border-radius: var(--radius-lg);
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    width: 320px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}

.header-search:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.header-search input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    outline: none;
    padding-left: 0.5rem;
    width: 100%;
    font-size: 0.875rem;
}

.header-search input::placeholder {
    color: var(--text-muted);
}

.global-search-results {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    width: 420px;
    max-height: 360px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
    z-index: 120;
    padding: 0.35rem;
}

.global-search-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.15rem 0.6rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-primary);
}

.global-search-item:hover {
    background: var(--bg-hover);
}

.global-search-type {
    grid-row: span 2;
    align-self: center;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--accent-primary);
    text-transform: uppercase;
    background: rgba(37, 99, 235, 0.08);
    padding: 0.2rem 0.35rem;
    border-radius: 4px;
}

.global-search-title {
    font-size: 0.86rem;
    font-weight: 600;
}

.global-search-meta,
.global-search-empty {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.global-search-empty {
    padding: 0.75rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.notification-menu {
    position: relative;
}

.notification-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.7rem);
    right: 0;
    width: min(380px, calc(100vw - 1.5rem));
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16);
    z-index: 140;
    overflow: hidden;
}

.notification-menu.open .notification-dropdown {
    display: block;
}

.notification-dropdown-head,
.notification-dropdown-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 0.95rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.notification-dropdown-head strong {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.notification-dropdown-head span {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
}

.notification-dropdown-list {
    max-height: 340px;
    overflow-y: auto;
}

.notification-dropdown-item {
    display: grid;
    grid-template-columns: 38px 1fr;
    gap: 0.75rem;
    padding: 0.85rem 0.95rem;
    border-bottom: 1px solid var(--border-color);
    color: inherit;
}

.notification-dropdown-item:hover {
    background: var(--bg-hover);
}

.notification-dropdown-icon {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: rgba(37, 99, 235, 0.08);
    color: var(--accent-primary);
}

.notification-dropdown-type {
    display: block;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 0.15rem;
}

.notification-dropdown-item strong,
.notification-dropdown-item em {
    display: block;
    line-height: 1.35;
}

.notification-dropdown-item strong {
    color: var(--text-primary);
    font-size: 0.84rem;
}

.notification-dropdown-item em {
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-style: normal;
    margin-top: 0.15rem;
}

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

.notification-dropdown-footer {
    justify-content: center;
    border-bottom: 0;
    border-top: 1px solid var(--border-color);
    color: var(--accent-primary);
    font-size: 0.82rem;
    font-weight: 800;
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    position: relative;
    transition: color 0.15s ease;
    padding: 0.35rem;
    border-radius: 6px;
}

.action-btn:hover {
    color: var(--accent-primary);
    background-color: #eff6ff;
}

.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: var(--accent-danger);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent-primary), #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    overflow: hidden;
    flex-shrink: 0;
}

.avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    object-position: center;
}

.avatar-photo {
    background: #fff;
    border: 1px solid var(--border-color);
}

/* ═══════════════════════════════════════
   PAGE CONTENT
   ═══════════════════════════════════════ */
.content-area {
    padding: 1.75rem 2rem;
    flex: 1;
    min-width: 0;
}

.page-header {
    margin-bottom: 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.page-header > div:last-child,
.page-header > form {
    min-width: 0;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-primary);
}

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

/* ═══════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    padding: 0.55rem 1.15rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    font-family: var(--font-family);
    line-height: 1.2;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3), 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

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

.page-header-actions,
.adms-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
    max-width: 100%;
    min-width: 0;
}

.page-filter-form,
.page-action-form,
.adms-filter-form,
.adms-action-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    min-width: 0;
}

.page-control,
.adms-control {
    min-width: 0;
    max-width: 100%;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    outline: none;
}

.page-filter-form .page-control {
    flex: 1 1 150px;
}

.page-filter-form input[type="search"].page-control {
    flex-basis: 180px;
}

input.page-control,
input.adms-control {
    color-scheme: light;
}

/* ═══════════════════════════════════════
   CARDS
   ═══════════════════════════════════════ */
.card {
    background-color: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
    max-width: 100%;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.metric-info h3 {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.metric-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.trend-up { color: var(--accent-success); }
.trend-down { color: var(--accent-danger); }

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.icon-blue { background-color: rgba(37, 99, 235, 0.08); color: var(--accent-primary); }
.icon-green { background-color: rgba(16, 185, 129, 0.08); color: var(--accent-success); }
.icon-orange { background-color: rgba(245, 158, 11, 0.08); color: var(--accent-warning); }

/* ═══════════════════════════════════════
   TABLES
   ═══════════════════════════════════════ */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    min-width: 720px;
    border-collapse: separate;
    border-spacing: 0;
}

.table th, .table td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background-color: var(--bg-main);
}

.table tr:last-child td {
    border-bottom: none;
}

.table tbody tr {
    transition: background-color 0.12s ease;
}

.table tbody tr:hover {
    background-color: var(--bg-hover);
}

.payroll-card {
    padding: 0;
    overflow: hidden;
}

.payroll-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.payroll-summary-item {
    display: grid;
    gap: 0.35rem;
    padding: 0.95rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.payroll-summary-item span {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.payroll-summary-item strong {
    color: var(--text-primary);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 1rem;
    line-height: 1.2;
}

.payroll-summary-net {
    background: #111827;
    border-color: #111827;
}

.payroll-summary-net span,
.payroll-summary-net strong {
    color: #ffffff;
}

.payroll-table {
    min-width: 1260px;
}

.payroll-table th,
.payroll-table td {
    padding: 0.95rem 0.9rem;
    vertical-align: middle;
}

.payroll-table th {
    font-size: 0.7rem;
    letter-spacing: 0.055em;
}

.payroll-employee-cell {
    min-width: 220px;
}

.payroll-employee-name {
    color: var(--text-primary);
    font-weight: 800;
    line-height: 1.2;
}

.payroll-employee-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.payroll-employee-meta span {
    display: inline-flex;
    align-items: center;
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.payroll-employee-meta span + span::before {
    content: "";
    width: 4px;
    height: 4px;
    margin-right: 0.35rem;
    border-radius: 999px;
    background: var(--border-color);
    flex-shrink: 0;
}

.payroll-money-col {
    text-align: right;
    white-space: nowrap;
}

.payroll-center-col {
    text-align: center;
    white-space: nowrap;
}

.payroll-amount,
.payroll-net {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    color: var(--text-primary);
    font-size: 0.92rem;
    font-weight: 800;
}

.payroll-net {
    font-size: 1rem;
}

.payroll-positive {
    color: var(--accent-success);
}

.payroll-negative {
    color: var(--accent-danger);
}

.payroll-money-block,
.payroll-net-block {
    display: inline-grid;
    justify-items: end;
    gap: 0.28rem;
    min-width: 132px;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #ffffff;
}

.payroll-money-block-positive {
    border-color: rgba(16, 185, 129, 0.18);
    background: rgba(16, 185, 129, 0.04);
}

.payroll-money-block-danger {
    border-color: rgba(239, 68, 68, 0.18);
    background: rgba(239, 68, 68, 0.04);
}

.payroll-line-label,
.payroll-net-block span {
    color: var(--text-muted);
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.payroll-net-block {
    border-color: #1f2937;
    background: #111827;
}

.payroll-net-block span,
.payroll-net-block .payroll-net {
    color: #ffffff;
}

.payroll-chip,
.payroll-note {
    display: inline-flex;
    justify-content: flex-end;
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
}

.payroll-chip {
    padding: 0.16rem 0.45rem;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-success);
}

.payroll-chip-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-danger);
}

.payroll-note {
    display: block;
}

.payroll-note-muted {
    max-width: 190px;
    margin-left: auto;
    color: var(--text-secondary);
    white-space: normal;
    line-height: 1.35;
}

.payroll-statutory-stack {
    display: inline-grid;
    gap: 0.35rem;
    min-width: 210px;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #ffffff;
}

.payroll-statutory-row {
    display: grid;
    grid-template-columns: minmax(86px, 1fr) auto;
    align-items: center;
    gap: 0.65rem;
}

.payroll-statutory-row span {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 800;
    text-align: left;
}

.payroll-statutory-row strong {
    color: var(--text-primary);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.78rem;
}

.payroll-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.payroll-action-form {
    margin: 0;
}

.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.table-pagination-info {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.table-pagination-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.table-page-button {
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.65rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    background: var(--bg-card);
    font-family: var(--font-family);
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
}

.table-page-button:hover:not(:disabled) {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.table-page-button.active {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}

.table-page-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.table-page-button.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* ═══════════════════════════════════════
   BADGES
   ═══════════════════════════════════════ */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.15;
    white-space: nowrap;
}

.status-active { background-color: rgba(16, 185, 129, 0.08); color: var(--accent-success); }
.status-leave { background-color: rgba(245, 158, 11, 0.08); color: var(--accent-warning); }

/* ═══════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════ */
select, input[type="text"], input[type="date"], input[type="time"], input[type="month"], input[type="number"], input[type="email"], input[type="password"], textarea {
    font-family: var(--font-family);
    font-size: 0.875rem;
    color-scheme: light;
    max-width: 100%;
}

/* ═══════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════ */
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-4 { margin-top: 2rem; }

/* Dashboard */
.dashboard-header { margin-bottom: 1.5rem; }
.dashboard-header .page-title { font-size: 1.75rem; }
.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.dashboard-metric {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-sm);
    min-width: 0;
}
.dashboard-metric:hover { box-shadow: var(--shadow-md); }
.dashboard-metric-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.05rem;
}
.dashboard-metric-blue { border-left: 4px solid var(--accent-primary); }
.dashboard-metric-green { border-left: 4px solid var(--accent-success); }
.dashboard-metric-amber { border-left: 4px solid var(--accent-warning); }
.dashboard-metric-cyan { border-left: 4px solid var(--accent-info); }
.dashboard-metric-violet { border-left: 4px solid #7c3aed; }
.dashboard-metric-blue .dashboard-metric-icon { background: rgba(37, 99, 235, 0.08); color: var(--accent-primary); }
.dashboard-metric-green .dashboard-metric-icon { background: rgba(16, 185, 129, 0.08); color: var(--accent-success); }
.dashboard-metric-amber .dashboard-metric-icon { background: rgba(245, 158, 11, 0.1); color: var(--accent-warning); }
.dashboard-metric-cyan .dashboard-metric-icon { background: rgba(6, 182, 212, 0.1); color: var(--accent-info); }
.dashboard-metric-violet .dashboard-metric-icon { background: rgba(124, 58, 237, 0.08); color: #7c3aed; }
.dashboard-metric-label {
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.dashboard-metric-value {
    color: var(--text-primary);
    font-size: 1.55rem;
    font-weight: 750;
    line-height: 1.15;
    margin-top: 0.2rem;
}
.dashboard-metric-value span {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}
.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}
.dashboard-clock-card,
.dashboard-trend-card,
.dashboard-widget {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.4rem;
}
.dashboard-clock-card { text-align: center; }
.dashboard-card-title,
.dashboard-widget-title {
    color: var(--text-primary);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 1rem;
}
.dashboard-card-title { justify-content: center; }
.dashboard-card-title i { color: var(--accent-primary); }
.dashboard-widget-title i { color: var(--accent-warning); }
.dashboard-widget-title-info i { color: var(--accent-info); }
.dashboard-widget-title-success i { color: var(--accent-success); }
.dashboard-widget-title-danger i { color: var(--accent-danger); }
.dashboard-widget-link {
    margin-left: auto;
    color: var(--accent-primary);
    font-size: 0.76rem;
    font-weight: 800;
    text-decoration: none;
}
.dashboard-widget-link:hover {
    color: var(--accent-hover);
}
.dashboard-insights-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}
.dashboard-trend-card {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}
.dashboard-chart-wrap {
    position: relative;
    height: 280px;
    width: 100%;
}
.dashboard-clock {
    color: var(--accent-primary);
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    margin: 1.35rem 0;
}
.dashboard-clock-status {
    min-height: 3.2rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    justify-content: center;
    margin-bottom: 1.4rem;
}
.dashboard-state { color: var(--text-muted); font-weight: 700; }
.dashboard-state-success { color: var(--accent-success); }
.dashboard-state-info { color: var(--accent-info); }
.dashboard-state-danger { color: var(--accent-danger); }
.dashboard-attendance-panel {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    padding: 0.8rem;
    text-align: left;
}
.dashboard-attendance-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.dashboard-attendance-row:last-of-type { border-bottom: none; }
.dashboard-attendance-row strong {
    color: var(--text-primary);
    font-family: monospace;
    white-space: nowrap;
}
.dashboard-attendance-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding-top: 0.75rem;
}
.dashboard-flag {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 0.74rem;
    font-weight: 800;
}
.dashboard-flag-danger { background: rgba(239, 68, 68, 0.1); color: var(--accent-danger); }
.dashboard-flag-warning { background: rgba(245, 158, 11, 0.1); color: var(--accent-warning); }
.dashboard-flag-info { background: rgba(59, 130, 246, 0.1); color: var(--accent-primary); }
.dashboard-clock-action {
    width: 100%;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
    font-family: var(--font-family);
    font-size: 0.98rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    cursor: pointer;
}
.dashboard-clock-action-primary { background: var(--accent-primary); color: #fff; }
.dashboard-clock-action-danger { background: var(--accent-danger); color: #fff; }
.dashboard-clock-action-disabled {
    background: var(--bg-hover);
    color: var(--text-muted);
    cursor: not-allowed;
}
.dashboard-main-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}
.dashboard-leave-banner {
    background: #1d4ed8;
    color: #fff;
    border-radius: var(--radius-md);
    padding: 1.25rem 1.4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}
.dashboard-leave-copy {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}
.dashboard-leave-copy > i {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.14);
    flex-shrink: 0;
}
.dashboard-leave-banner h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    color: #ffffff;
}
.dashboard-leave-banner p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.88rem;
    color: #ffffff;
}
.dashboard-banner-action {
    color: var(--accent-primary);
    background: #fff;
    text-decoration: none;
    border-radius: var(--radius-md);
    padding: 0.7rem 1rem;
    font-weight: 700;
    white-space: nowrap;
}
.dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}
.dashboard-list { display: flex; flex-direction: column; }
.dashboard-list-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border-color);
}
.dashboard-list-row:first-child { padding-top: 0; }
.dashboard-list-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.dashboard-list-title {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 700;
}
.dashboard-list-meta {
    color: var(--text-muted);
    font-size: 0.76rem;
    margin-top: 0.2rem;
}
.dashboard-list-time {
    text-align: right;
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-primary);
    flex-shrink: 0;
}
.dashboard-list-time .status-badge {
    display: inline-flex;
    margin-top: 0.3rem;
    font-family: var(--font-family);
}
.dashboard-empty {
    min-height: 150px;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    text-align: center;
}
.dashboard-empty i {
    font-size: 1.7rem;
    opacity: 0.35;
}
.dashboard-empty-compact {
    min-height: 120px;
}
@media (max-width: 1200px) {
    .dashboard-metrics,
    .dashboard-widgets,
    .dashboard-insights-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-layout { grid-template-columns: 1fr; }
}

@media (min-width: 901px) and (max-width: 1400px) {
    .content-area {
        padding: 1.35rem 1.35rem;
    }

    .page-header {
        gap: 0.75rem;
    }

    .btn {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
        font-size: 0.82rem;
    }

    .status-badge {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        font-size: 0.68rem;
    }

    .table th,
    .table td {
        padding-left: 0.72rem;
        padding-right: 0.72rem;
    }
}

@media (max-width: 900px) {
    body {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        width: min(84vw, 320px);
        box-shadow: 18px 0 40px rgba(15, 23, 42, 0.18);
        z-index: 200;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .mobile-sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.38);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.18s ease, visibility 0.18s ease;
        z-index: 190;
    }

    body.sidebar-open .mobile-sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .main-wrapper {
        margin-left: 0;
        width: 100%;
    }

    .top-header {
        height: auto;
        min-height: var(--header-height);
        padding: 0.75rem 1rem;
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .mobile-menu-toggle {
        width: 40px;
        height: 40px;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        background: #fff;
        color: var(--text-primary);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 1rem;
        flex-shrink: 0;
    }

    .header-search {
        order: 3;
        width: 100%;
    }

    .global-search-results {
        width: min(100%, calc(100vw - 2rem));
    }

    .header-actions {
        margin-left: auto;
        gap: 0.75rem;
    }

    .user-profile .user-info {
        display: none;
    }

    .content-area {
        padding: 1.25rem 1rem;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .page-header .btn,
    .page-header a.btn {
        width: 100%;
        justify-content: center;
    }

    .page-header-actions,
    .page-filter-form,
    .page-action-form,
    .page-control,
    .adms-header-actions,
    .adms-filter-form,
    .adms-action-form,
    .adms-control {
        width: 100%;
    }

    .page-filter-form,
    .adms-filter-form {
        flex-direction: column;
    }
}
@media (max-width: 760px) {
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr 1fr"],
    [style*="grid-template-columns: 150px 1fr"],
    [style*="grid-template-columns: 1.4fr 1fr 1fr 1fr auto"] {
        grid-template-columns: 1fr !important;
    }

    [style*="display: flex"][style*="gap"] {
        flex-wrap: wrap;
    }

    form[style*="display: flex"],
    .page-header > div[style*="display: flex"] {
        width: 100%;
    }

    form[style*="display: flex"] select,
    form[style*="display: flex"] input,
    form[style*="display: flex"] button,
    form[style*="display: flex"] .btn {
        min-width: 0;
    }

    .dashboard-metrics,
    .dashboard-widgets,
    .dashboard-insights-grid { grid-template-columns: 1fr; }
    .table-pagination {
        align-items: flex-start;
        flex-direction: column;
    }
    .dashboard-leave-banner,
    .dashboard-list-row {
        align-items: flex-start;
        flex-direction: column;
    }
    .dashboard-list-time { text-align: left; }
    .dashboard-clock { font-size: 2.4rem; }

    .grid-cards {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .card,
    .dashboard-clock-card,
    .dashboard-trend-card,
    .dashboard-widget {
        padding: 1rem;
    }

    .metric-card,
    .dashboard-metric {
        align-items: flex-start;
    }

    .metric-value {
        font-size: 1.65rem;
    }

    .page-title,
    .dashboard-header .page-title {
        font-size: 1.35rem;
        line-height: 1.25;
    }

    .btn {
        min-height: 40px;
    }
}

@media (max-width: 520px) {
    [style*="padding: 3rem"] {
        padding: 1.25rem !important;
    }

    [style*="max-width: 800px"],
    [style*="max-width: 680px"],
    [style*="max-width: 600px"],
    [style*="max-width: 500px"] {
        max-width: 100% !important;
    }

    form[style*="display: flex"],
    div[style*="display: flex"][style*="align-items: center"] {
        align-items: stretch !important;
    }

    form[style*="display: flex"] select,
    form[style*="display: flex"] input,
    form[style*="display: flex"] button,
    form[style*="display: flex"] .btn {
        width: 100%;
    }

    .top-header {
        padding: 0.65rem 0.75rem;
    }

    .content-area {
        padding: 1rem 0.75rem;
    }

    .header-actions {
        gap: 0.45rem;
    }

    .avatar {
        width: 32px;
        height: 32px;
        font-size: 0.76rem;
    }

    .dashboard-clock {
        font-size: 2rem;
    }

    .dashboard-chart-wrap {
        height: 230px;
    }

    .dashboard-leave-copy {
        align-items: flex-start;
    }

    .dashboard-banner-action {
        width: 100%;
        text-align: center;
    }

    .table th,
    .table td {
        padding: 0.7rem 0.8rem;
    }
}
