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

:root {
    --primary: #1d4ed8;
    --primary-dark: #1e3a8a;
    --background: #f5f7fb;
    --white: #ffffff;
    --text: #172033;
    --muted: #6b7280;
    --border: #e5e7eb;
    --sidebar: #111827;
    --sidebar-hover: #1f2937;
    --success: #16a34a;
    --danger: #dc2626;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

body {
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: var(--background);
    color: var(--text);
    min-height: 100vh;
}

button,
input {
    font-family: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}


/* ============================= */
/* LOGIN */
/* ============================= */

.page {
    min-height: 100vh;
}

.login-container {
    min-height: 100vh;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 30px;

    background:
        radial-gradient(
            circle at top left,
            rgba(29, 78, 216, 0.12),
            transparent 35%
        ),
        linear-gradient(
            135deg,
            #f8fafc,
            #eef2ff
        );
}

.brand {
    text-align: center;
    margin-bottom: 25px;
}

.brand-logo {
    width: 64px;
    height: 64px;

    margin: 0 auto 12px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 18px;

    background: linear-gradient(
        135deg,
        var(--primary),
        var(--primary-dark)
    );

    color: white;

    font-size: 30px;
    font-weight: 800;

    box-shadow:
        0 10px 25px rgba(29, 78, 216, 0.3);
}

.brand h1 {
    font-size: 30px;
    letter-spacing: -0.5px;
}

.brand p {
    color: var(--muted);
    margin-top: 4px;
}

.login-card {
    width: 100%;
    max-width: 430px;

    background: white;

    border: 1px solid var(--border);

    border-radius: 20px;

    padding: 34px;

    box-shadow: var(--shadow);
}

.login-card h2 {
    font-size: 25px;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: 28px;
}

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

.form-group label {
    display: block;

    font-size: 14px;
    font-weight: 600;

    margin-bottom: 8px;
}

.form-group input {
    width: 100%;

    height: 48px;

    border: 1px solid #d1d5db;

    border-radius: 10px;

    padding: 0 14px;

    font-size: 15px;

    outline: none;

    transition: 0.2s;
}

.form-group input:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px rgba(29, 78, 216, 0.12);
}

.primary-button {
    width: 100%;

    min-height: 48px;

    border: none;

    border-radius: 10px;

    background: var(--primary);

    color: white;

    font-weight: 700;

    font-size: 15px;

    transition: 0.2s;
}

.primary-button:hover {
    background: #1e40af;
}

.primary-button:disabled {
    opacity: 0.7;
    cursor: wait;
}

.primary-button.small {
    width: auto;
    padding: 0 24px;
}

.error-message {
    min-height: 20px;

    color: var(--danger);

    font-size: 14px;

    margin-bottom: 10px;
}

.spinner {
    display: inline-block;

    width: 18px;
    height: 18px;

    border: 2px solid rgba(255, 255, 255, 0.4);

    border-top-color: white;

    border-radius: 50%;

    animation: spin 0.8s linear infinite;

    vertical-align: middle;
}

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

.login-footer {
    margin-top: 25px;

    font-size: 13px;

    color: var(--muted);
}


/* ============================= */
/* DASHBOARD */
/* ============================= */

.dashboard-page {
    min-height: 100vh;

    display: flex;
}

.sidebar {
    width: 255px;

    min-height: 100vh;

    background: var(--sidebar);

    color: white;

    display: flex;
    flex-direction: column;

    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
}

.sidebar-brand {
    padding: 24px 20px;

    display: flex;
    align-items: center;

    gap: 12px;

    border-bottom:
        1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 12px;

    background: var(--primary);

    font-size: 21px;
    font-weight: 800;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 800;
}

.sidebar-subtitle {
    font-size: 12px;

    color: #9ca3af;

    margin-top: 2px;
}

.navigation {
    padding: 20px 12px;

    display: flex;
    flex-direction: column;

    gap: 5px;
}

.nav-item {
    width: 100%;

    padding: 12px 14px;

    border: none;

    border-radius: 9px;

    background: transparent;

    color: #d1d5db;

    text-align: left;

    display: flex;
    align-items: center;

    gap: 12px;

    font-size: 14px;

    transition: 0.2s;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: white;
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-icon {
    width: 20px;
    text-align: center;
}

.sidebar-bottom {
    margin-top: auto;

    padding: 15px;

    border-top:
        1px solid rgba(255, 255, 255, 0.08);
}

.logged-user {
    display: flex;
    align-items: center;

    gap: 10px;

    margin-bottom: 14px;
}

.user-avatar,
.top-avatar {
    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: #2563eb;

    color: white;

    font-weight: 700;
}

.user-avatar {
    width: 36px;
    height: 36px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-info strong {
    font-size: 13px;
}

.user-info span {
    color: #9ca3af;
    font-size: 11px;
}

.logout-button {
    width: 100%;

    border: 1px solid #374151;

    background: transparent;

    color: #d1d5db;

    border-radius: 8px;

    padding: 9px;

    font-size: 13px;
}

.logout-button:hover {
    background: #1f2937;
    color: white;
}


/* ============================= */
/* MAIN */
/* ============================= */

.main-content {
    margin-left: 255px;

    width: calc(100% - 255px);

    min-height: 100vh;
}

.topbar {
    height: 78px;

    background: white;

    border-bottom: 1px solid var(--border);

    padding: 0 30px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar h1 {
    font-size: 23px;
}

.topbar p {
    color: var(--muted);

    font-size: 13px;

    margin-top: 3px;
}

.topbar-right {
    display: flex;
    align-items: center;

    gap: 18px;
}

.api-status {
    color: var(--success);

    font-size: 13px;

    font-weight: 600;
}

.top-avatar {
    width: 38px;
    height: 38px;
}


/* ============================= */
/* CONTENT */
/* ============================= */

.content-section {
    padding: 30px;
}

.welcome-card {
    min-height: 150px;

    padding: 28px;

    border-radius: 18px;

    color: white;

    background:
        linear-gradient(
            135deg,
            #1d4ed8,
            #312e81
        );

    display: flex;

    align-items: center;
    justify-content: space-between;

    box-shadow:
        0 12px 30px rgba(29, 78, 216, 0.2);

    margin-bottom: 25px;
}

.welcome-label {
    font-size: 11px;

    letter-spacing: 1.4px;

    opacity: 0.75;
}

.welcome-card h2 {
    font-size: 26px;

    margin: 8px 0;
}

.welcome-card p {
    opacity: 0.8;

    font-size: 14px;
}

.welcome-icon {
    width: 90px;
    height: 90px;

    border-radius: 25px;

    background: rgba(255, 255, 255, 0.12);

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 40px;

    font-weight: 800;
}

.stats-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 18px;

    margin-bottom: 25px;
}

.stat-card {
    background: white;

    border: 1px solid var(--border);

    border-radius: 15px;

    padding: 20px;

    display: flex;

    align-items: center;

    gap: 15px;

    box-shadow:
        0 4px 15px rgba(15, 23, 42, 0.04);
}

.stat-icon {
    width: 48px;
    height: 48px;

    border-radius: 12px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 20px;
}

.stat-icon.blue {
    background: #dbeafe;
}

.stat-icon.green {
    background: #dcfce7;
}

.stat-icon.purple {
    background: #ede9fe;
}

.stat-icon.orange {
    background: #ffedd5;
}

.stat-icon.teal {
    background: #ccfbf1;
}

.stat-icon.red {
    background: #fee2e2;
}

.stat-icon.gray {
    background: #f3f4f6;
}

.stat-content {
    min-width: 0;

    display: flex;
    flex-direction: column;
}

.stat-content span {
    font-size: 12px;

    color: var(--muted);
}

.stat-content strong {
    font-size: 24px;

    margin: 2px 0;
}

.stat-content small {
    font-size: 11px;

    color: #9ca3af;
}

.dashboard-panels {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 20px;
}

.panel,
.section-card {
    background: white;

    border: 1px solid var(--border);

    border-radius: 15px;

    box-shadow:
        0 4px 15px rgba(15, 23, 42, 0.04);
}

.panel {
    padding: 22px;
}

.panel-header,
.section-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    margin-bottom: 20px;
}

.panel-header h3,
.section-header h2 {
    font-size: 17px;
}

.panel-header p,
.section-header p {
    color: var(--muted);

    font-size: 12px;

    margin-top: 4px;
}

.status-badge {
    padding: 6px 10px;

    border-radius: 20px;

    background: #dcfce7;

    color: #166534;

    font-size: 11px;

    font-weight: 700;
}

.status-list {
    display: flex;
    flex-direction: column;

    gap: 14px;
}

.status-row {
    display: flex;

    justify-content: space-between;

    padding-bottom: 12px;

    border-bottom: 1px solid #f1f5f9;

    font-size: 13px;
}

.status-row:last-child {
    border-bottom: none;
}

.online {
    color: var(--success);
}

.quick-actions {
    display: flex;
    flex-direction: column;

    gap: 9px;
}

.quick-action {
    border: 1px solid var(--border);

    background: #fafafa;

    border-radius: 10px;

    padding: 12px;

    display: flex;
    align-items: center;

    gap: 12px;

    text-align: left;
}

.quick-action:hover {
    background: #f1f5f9;
}

.quick-action > span {
    font-size: 20px;
}

.quick-action div {
    display: flex;
    flex-direction: column;
}

.quick-action strong {
    font-size: 13px;
}

.quick-action small {
    color: var(--muted);

    font-size: 11px;

    margin-top: 2px;
}


/* ============================= */
/* SECTION PAGES */
/* ============================= */

.section-card {
    padding: 25px;
}

.search-bar {
    display: flex;

    gap: 10px;

    margin-bottom: 20px;
}

.search-bar input {
    flex: 1;

    height: 45px;

    border: 1px solid #d1d5db;

    border-radius: 9px;

    padding: 0 13px;

    outline: none;
}

.search-bar input:focus {
    border-color: var(--primary);
}

.table-container {
    overflow-x: auto;
}

.empty-state,
.coming-soon {
    padding: 50px 20px;

    text-align: center;

    color: var(--muted);
}

.coming-soon > div {
    font-size: 40px;

    margin-bottom: 12px;
}

.coming-soon h3 {
    color: var(--text);

    margin-bottom: 8px;
}

.coming-soon p {
    font-size: 13px;
}

.employee-table {
    width: 100%;

    border-collapse: collapse;

    font-size: 13px;
}

.employee-table th {
    background: #f8fafc;

    color: #64748b;

    text-align: left;

    padding: 12px;

    border-bottom: 1px solid var(--border);
}

.employee-table td {
    padding: 12px;

    border-bottom: 1px solid #f1f5f9;
}

.employee-table tr:hover {
    background: #f8fafc;
}

.employee-name {
    font-weight: 600;
}

.employee-kgid {
    color: var(--primary);

    font-weight: 600;
}


/* ============================= */
/* RESPONSIVE */
/* ============================= */

@media (max-width: 1100px) {

    .stats-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

}

@media (max-width: 800px) {

    .sidebar {
        width: 70px;
    }

    .sidebar-brand {
        justify-content: center;
    }

    .sidebar-title,
    .sidebar-subtitle,
    .user-info,
    .logout-button {
        display: none;
    }

    .navigation {
        padding: 15px 10px;
    }

    .nav-item {
        justify-content: center;

        padding: 12px 5px;
    }

    .nav-item {
        font-size: 0;
    }

    .nav-icon {
        font-size: 18px;
    }

    .main-content {
        margin-left: 70px;

        width: calc(100% - 70px);
    }

    .dashboard-panels {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 600px) {

    .topbar {
        padding: 0 18px;
    }

    .content-section {
        padding: 18px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .welcome-card {
        padding: 22px;
    }

    .welcome-icon {
        display: none;
    }

    .topbar p {
        display: none;
    }

    .api-status {
        display: none;
    }

}
/* ==========================================================================
   KSPSTA EMPLOYEE MANAGEMENT
   ========================================================================== */

.employee-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.employee-modal.hidden {
    display: none;
}

.employee-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(3px);
}

.employee-modal-card {
    position: relative;
    z-index: 1;
    width: min(1100px, 96vw);
    max-height: 94vh;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 25px 70px rgba(15, 23, 42, 0.25);
}

.employee-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 22px 25px;
    border-bottom: 1px solid #e5e7eb;
}

.employee-modal-header h2 {
    margin: 0;
    font-size: 22px;
}

.employee-modal-header p {
    margin-top: 5px;
    color: #6b7280;
    font-size: 14px;
}

.employee-modal-close {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: #f3f4f6;
    color: #374151;
    font-size: 25px;
    line-height: 1;
}

.employee-modal-close:hover {
    background: #e5e7eb;
}

.employee-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    padding: 25px;
}

.employee-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.employee-field-wide {
    grid-column: span 2;
}

.employee-field label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.employee-field input {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #ffffff;
    color: #111827;
    font-size: 14px;
}

.employee-field input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.employee-field input[readonly] {
    background: #f3f4f6;
    color: #6b7280;
}

.employee-checkbox {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding-top: 18px;
}

.employee-checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
}

.employee-checkbox input {
    width: 18px;
    height: 18px;
}

.employee-modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 18px 25px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.employee-action-right {
    display: flex;
    gap: 10px;
}

.employee-primary-button,
.employee-secondary-button {
    min-height: 40px;
    padding: 9px 16px;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.employee-primary-button {
    background: #2563eb;
    color: white;
}

.employee-primary-button:hover {
    background: #1d4ed8;
}

.employee-primary-button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.employee-secondary-button {
    background: #e5e7eb;
    color: #374151;
}

.employee-secondary-button:hover {
    background: #d1d5db;
}

.employee-modal-message {
    margin: 18px 25px 0;
    padding: 11px 14px;
    border-radius: 7px;
    font-size: 14px;
}

.employee-message-success {
    background: #dcfce7;
    color: #166534;
}

.employee-message-error {
    background: #fee2e2;
    color: #991b1b;
}


/* Make employee result rows clearly clickable */

#employeeResults .employee-table tbody tr {
    cursor: pointer;
    transition: background 0.15s ease;
}

#employeeResults .employee-table tbody tr:hover {
    background: #eff6ff;
}

#employeeResults .employee-kgid {
    color: #2563eb;
    font-weight: 700;
}


/* Audit */

.employee-audit-panel {
    border-top: 1px solid #e5e7eb;
    padding: 22px 25px 25px;
}

.employee-audit-panel.hidden {
    display: none;
}

.employee-audit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 15px;
}

.employee-audit-header h3 {
    margin: 0;
    font-size: 18px;
}

.employee-audit-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.employee-audit-table {
    width: 100%;
    min-width: 750px;
    border-collapse: collapse;
}

.employee-audit-table th,
.employee-audit-table td {
    padding: 11px 12px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
    font-size: 13px;
}

.employee-audit-table th {
    background: #f9fafb;
    color: #374151;
    font-weight: 700;
}

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

.employee-audit-loading,
.employee-audit-empty,
.employee-audit-error {
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
}

.employee-audit-loading {
    background: #f9fafb;
    color: #6b7280;
}

.employee-audit-empty {
    background: #f9fafb;
    color: #6b7280;
}

.employee-audit-error {
    background: #fee2e2;
    color: #991b1b;
}


/* Mobile */

@media (max-width: 700px) {

    .employee-modal {
        padding: 8px;
    }

    .employee-modal-card {
        width: 100%;
        max-height: 98vh;
        border-radius: 10px;
    }

    .employee-form-grid {
        grid-template-columns: 1fr;
        padding: 18px;
        gap: 15px;
    }

    .employee-field-wide {
        grid-column: span 1;
    }

    .employee-modal-header {
        padding: 18px;
    }

    .employee-modal-actions {
        padding: 15px 18px;
        flex-direction: column;
        align-items: stretch;
    }

    .employee-action-right {
        width: 100%;
    }

    .employee-action-right button {
        flex: 1;
    }

    .employee-audit-panel {
        padding: 18px;
    }

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