/* ============================================================
   Payroll Pro — Enterprise Payroll Distribution
   Professional navy palette for enterprise payroll distribution
   Plus Jakarta Sans (display/body) · IBM Plex Mono (figures)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
    /* palette — warm ledger */
    --paper: #f8fafc;
    --surface: #ffffff;
    --ink: #0f172a;
    --primary: #0369a1;
    --primary-dark: #075985;
    --primary-light: #0284c7;
    --success: #3d7a4c;
    --success-dark: #2f6b3c;
    --warning: #b98214;
    --warning-dark: #7c5314;
    --error: #c0442c;
    --error-dark: #a83722;

    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --white: #ffffff;

    /* letterpress shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

    --radius: 6px;
    --radius-lg: 10px;

    --font-display: 'Plus Jakarta Sans', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    --font-body: 'Plus Jakarta Sans', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
}

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

::selection {
    background: var(--primary);
    color: var(--white);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--paper);
    color: var(--gray-800);
    line-height: 1.55;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

/* thin ink-toned scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 6px; border: 2px solid var(--gray-100); }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ---------- layout ---------- */

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

.sidebar {
    width: 260px;
    background: var(--ink);

    color: var(--white);
    padding: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 253, 246, 0.08);
}

.sidebar-header {
    padding: 26px 20px 20px;
    border-bottom: 1px solid rgba(255, 253, 246, 0.12);
}

.sidebar-header h1 {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header h1 .icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-family: var(--font-mono);
    box-shadow: var(--shadow-sm);
}

.sidebar-header .company-name {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gray-400);
    margin-top: 6px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    margin: 2px 10px;
    border-radius: var(--radius);
    color: var(--gray-400);
    text-decoration: none;
    transition: all 0.18s ease;
    border-left: 3px solid transparent;
    font-weight: 500;
}

.sidebar-nav a:hover {
    color: var(--white);
    background: rgba(255, 253, 246, 0.07);
}

.sidebar-nav a.active {
    color: var(--white);
    background: rgba(255, 253, 246, 0.09);
    border-left-color: var(--primary);
}

.sidebar-nav a .nav-icon {
    font-size: 17px;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 253, 246, 0.12);
}

.sidebar-footer .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.sidebar-footer .user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border: 1px solid rgba(255, 253, 246, 0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    font-family: var(--font-display);
}

.sidebar-footer .user-details {
    flex: 1;
}

.sidebar-footer .user-name {
    font-weight: 600;
    font-size: 13px;
}

.sidebar-footer .user-role {
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gray-400);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 24px 32px;
    background: transparent;
    min-height: 100vh;
}

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

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header h2 {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--gray-900);
}

.page-header .actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13.5px;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
    border: 1px solid transparent;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.btn:active {
    transform: translate(1px, 1px);
    box-shadow: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translate(-1px, -1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--surface);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    transform: translate(-1px, -1px);
}

.btn-success {
    background: var(--success);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-success:hover {
    background: var(--success-dark);
    transform: translate(-1px, -1px);
}

.btn-danger {
    background: var(--error);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-danger:hover {
    background: var(--error-dark);
    transform: translate(-1px, -1px);
}

/* ---------- cards & stats ---------- */

.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--gray-200);
    gap: 12px;
    flex-wrap: wrap;
}

.card-header h3 {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 600;
    color: var(--gray-900);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    position: relative;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translate(-1px, -2px);
    box-shadow: var(--shadow-md);
}

.stat-card .stat-label {
    font-size: 11px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
}

.stat-card .stat-change {
    font-size: 12px;
    color: var(--success);
    margin-top: 6px;
    font-family: var(--font-mono);
}

.stat-card.warning .stat-value {
    color: var(--warning);
}

.stat-card.danger .stat-value {
    color: var(--error);
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--gray-50);
}

th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200);
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
    font-variant-numeric: tabular-nums;
}

tbody tr {
    transition: background 0.12s ease;
}

tbody tr:hover {
    background: var(--gray-50);
}

/* ---------- badges ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 11px;
    border-radius: 9999px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}

.badge-success {
    background: #e2ecda;
    color: #2f5d3a;
    border-color: #cfe0c6;
}

.badge-warning {
    background: #f4e7c5;
    color: #7c5314;
    border-color: #e8d5a4;
}

.badge-danger {
    background: #f2dcd2;
    color: #7c2d1c;
    border-color: #e6c5b6;
}

.badge-info {
    background: #f7e2d2;
    color: #8a3310;
    border-color: #eec9ac;
}

.badge-gray {
    background: var(--gray-100);
    color: var(--gray-600);
    border-color: var(--gray-200);
}

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

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--gray-800);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.14);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%238a816c' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3E");
    background-position: right 8px center;
    background-repeat: no-repeat;
    background-size: 20px;
    padding-right: 36px;
}

input[type="checkbox"].form-control,
input[type="radio"].form-control {
    width: auto;
}

/* ---------- login ---------- */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--ink);
    background-color: var(--ink);
    padding: 20px;
}

.login-box {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 8px;
    color: var(--gray-900);
}

.login-box .subtitle {
    text-align: center;
    color: var(--gray-500);
    margin-bottom: 32px;
}

/* ---------- alerts ---------- */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid transparent;
}

.alert-error {
    background: #f2dcd2;
    color: #7c2d1c;
    border-color: #e6c5b6;
}

.alert-success {
    background: #e2ecda;
    color: #2f5d3a;
    border-color: #cfe0c6;
}

/* ---------- modal ---------- */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(34, 28, 18, 0.55);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: all 0.2s;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--gray-200);
    background: var(--gray-50);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    color: var(--gray-500);
    transition: all 0.15s;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ---------- grids & utilities ---------- */

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--gray-500);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-danger { color: var(--error); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--gray-500); }

.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

/* ---------- responsive ---------- */

@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }
    .sidebar-header h1 span { display: none; }
    .sidebar-nav a span { display: none; }
    .sidebar-footer .user-details { display: none; }
    .main-content { margin-left: 80px; padding: 16px; }
}

@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

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

.sidebar-header h1 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 18px;
    margin: 0;
    padding: 0;
}

.sidebar-header h1 img {
    height: 32px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    /* Allow transparent logo to display cleanly */
    filter: none;
}

.sidebar-header h1 .icon {
    font-size: 20px;
}

.sidebar-header .company-name {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 4px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ---------- reduced motion ---------- */

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