.psm-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(255,255,255,0.9), rgba(241,241,241,0.95)),
        linear-gradient(135deg, #f5f1e8, #f8f6f0);
}

.psm-card {
    background: #fdfcf9;
    border-radius: 10px;
    padding: 22px 22px 20px;
    margin-bottom: 22px;
    border: 1px solid rgba(145, 120, 90, 0.18);
    box-shadow:
        0 12px 24px rgba(0,0,0,0.12),
        0 1px 0 rgba(255,255,255,0.8) inset;
    position: relative;
}

.psm-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 10px;
    pointer-events: none;
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.7) inset,
        0 0 40px rgba(255,255,255,0.4) inset;
}

.psm-card-header {
    border-bottom: 1px solid rgba(140, 120, 100, 0.25);
    padding-bottom: 14px;
    margin-bottom: 16px;
}

.psm-card-title {
    font-size: 1.4em;
    color: #3b2f25;
    margin: 0;
    text-shadow: 0 1px 0 rgba(255,255,255,0.9);
}

.psm-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.psm-table th,
.psm-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.psm-table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.psm-table tr:hover {
    background-color: #f8f9fa;
}

.psm-btn {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    border: none;
    box-shadow:
        0 2px 0 rgba(0,0,0,0.18),
        0 0 0 1px rgba(255,255,255,0.7) inset;
}

.psm-btn-primary {
    background-image: linear-gradient(to bottom, #2b7bff, #1356c8);
    color: #fff;
}

.psm-btn-primary:hover {
    background-image: linear-gradient(to bottom, #2265d6, #0f4cb5);
    transform: translateY(1px);
    box-shadow:
        0 1px 0 rgba(0,0,0,0.2),
        0 0 0 1px rgba(255,255,255,0.7) inset;
}

.psm-btn-secondary {
    background-image: linear-gradient(to bottom, #d0d4da, #a5abb5);
    color: #fff;
}

.psm-btn-secondary:hover {
    background-image: linear-gradient(to bottom, #bcc2cc, #9197a3);
    transform: translateY(1px);
    box-shadow:
        0 1px 0 rgba(0,0,0,0.2),
        0 0 0 1px rgba(255,255,255,0.7) inset;
}

.psm-alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.psm-alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.psm-alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.psm-alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.psm-form-group {
    margin-bottom: 20px;
}

.psm-form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.psm-form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1em;
}

.psm-form-control:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.psm-leave-balance-box {
    padding: 10px 14px;
    background: #f0f6fc;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
}
.psm-leave-balance-box .psm-leave-unpaid-notice {
    display: block;
    margin-top: 6px;
    color: #b32d2e;
    font-size: 12px;
}
.psm-leave-balance-box .psm-loading {
    color: #646970;
}

.psm-salary-slip {
    background: #fff;
    padding: 30px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.psm-salary-slip-header {
    text-align: center;
    margin-bottom: 30px;
}

.psm-salary-slip-title {
    font-size: 24px;
    margin-bottom: 10px;
}

.psm-salary-slip-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.psm-salary-slip-section {
    margin-bottom: 30px;
}

.psm-salary-slip-section-title {
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

.psm-salary-slip-total {
    text-align: right;
    font-weight: bold;
    font-size: 18px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

.psm-salary-slip-benefits-note {
    margin-top: 16px;
    padding: 12px 16px;
    background: #f0f7ff;
    border-left: 4px solid #2271b1;
    font-size: 14px;
}

/* Frontend portal: login box */
.psm-portal-login {
    max-width: 400px;
    margin: 2rem auto;
}
.psm-portal-login-box {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
}
.psm-portal-login-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    color: #1f2937;
}
.psm-portal-login-desc {
    color: #6b7280;
    margin: 0 0 1.5rem 0;
    font-size: 0.95rem;
    line-height: 1.5;
}
.psm-portal-login-form label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
}
.psm-portal-login-form input[type="text"],
.psm-portal-login-form input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 1rem;
}
.psm-portal-login-form input[type="submit"] {
    width: 100%;
    padding: 12px;
    margin-top: 0.5rem;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}
.psm-portal-login-form input[type="submit"]:hover {
    background: #1d4ed8;
}
.psm-portal-login-form button[type="submit"] {
    position: relative;
}
.psm-portal-login-form button[type="submit"].is-loading {
    cursor: wait;
    opacity: 0.95;
}
.psm-portal-login-form button[type="submit"].is-loading::after {
    content: "";
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #ffffff;
    border-radius: 50%;
    display: inline-block;
    vertical-align: middle;
    animation: psmSpin 0.75s linear infinite;
}
@keyframes psmSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.psm-portal-login-message {
    display: none;
    margin-top: 0.5rem;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 0.92rem;
    line-height: 1.4;
}
.psm-portal-login-message.is-visible {
    display: block;
}
.psm-portal-login-message.is-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}
.psm-portal-login-message.is-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}
.psm-portal-login-links {
    margin-top: 1rem;
    font-size: 0.9rem;
}
.psm-portal-login-links a {
    color: #2563eb;
}

/* Portal wrapper: sidebar + main */
.psm-portal-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px;
}
.psm-portal-sidebar {
    flex: 0 0 240px;
    background: #f8fafc;
    border-radius: 8px;
    padding: 1.25rem;
    margin-right: 24px;
    border: 1px solid #e2e8f0;
}
.psm-portal-sidebar-header {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}
.psm-portal-avatar {
    width: 56px;
    height: 56px;
    margin: 0 0 0.65rem 0;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(180deg, #e2e8f0, #cbd5e1);
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12) inset;
    display: flex;
    align-items: center;
    justify-content: center;
}
.psm-portal-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.psm-portal-avatar span {
    color: #334155;
    font-weight: 700;
    font-size: 1rem;
}
.psm-portal-sidebar-title {
    margin: 0 0 0.25rem 0;
    font-size: 1.125rem;
    color: #1e293b;
}
.psm-portal-user {
    margin: 0;
    font-size: 0.875rem;
    color: #64748b;
}
.psm-portal-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.psm-portal-nav-list li {
    margin: 0 0 4px 0;
}
.psm-portal-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    color: #475569;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.psm-portal-nav-link:hover {
    background: #e2e8f0;
    color: #1e293b;
}
.psm-portal-nav-link.active {
    background: #2563eb;
    color: #fff;
}
.psm-portal-nav-link .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}
.psm-portal-sidebar-footer {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}
.psm-portal-logout {
    display: block;
    text-align: center;
    width: 100%;
}
.psm-portal-main {
    flex: 1;
    min-width: 0;
}
.psm-portal-alerts {
    margin-bottom: 1rem;
}
.psm-portal-panel {
    display: none;
}
.psm-portal-panel.active {
    display: block;
}

.psm-portal-profile-photo-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.psm-portal-profile-photo-preview {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}
.psm-portal-profile-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.psm-portal-profile-photo-preview span {
    font-size: 12px;
    color: #64748b;
    text-align: center;
    padding: 8px;
}
.psm-profile-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #475569;
}
.psm-btn-small {
    min-height: 36px;
    padding: 8px 14px;
    font-size: 13px;
    line-height: 1.2;
    width: fit-content;
}
.psm-portal-profile-separator {
    margin: 20px 0;
    border: 0;
    border-top: 1px solid #e2e8f0;
}

/* Legacy portal tab (backward compat) */
.psm-portal .psm-portal-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}
.psm-portal .psm-portal-tab.active {
    background-color: #0056b3;
}
.psm-portal-section {
    margin-top: 10px;
}

@media print {
    .psm-salary-slip {
        border: none;
        padding: 0;
    }
    
    .psm-btn {
        display: none;
    }
}

/* Empty state (portal) */
.psm-empty-state {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px dashed #dee2e6;
}
.psm-empty-state-title {
    font-size: 1.125rem;
    color: #495057;
    margin: 0 0 8px 0;
}
.psm-empty-state-text {
    color: #6c757d;
    margin: 0 0 20px 0;
    font-size: 0.95rem;
}

/* Mobile-friendly portal: larger tap targets, stacked layout, sticky submit */
.psm-btn,
.psm-form-control,
.psm-portal .psm-portal-tab {
    min-height: 44px;
}
.psm-btn {
    padding: 12px 20px;
}
.psm-form-control {
    padding: 12px 14px;
    font-size: 16px; /* avoids zoom on focus on iOS */
}

@media screen and (max-width: 768px) {
    .psm-container {
        padding: 12px;
    }
    .psm-card {
        padding: 16px;
    }
    .psm-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .psm-table th,
    .psm-table td {
        padding: 12px 10px;
        min-width: 80px;
    }
    /* Sticky submit for long forms */
    .psm-card form {
        padding-bottom: 80px;
    }
    .psm-card form .psm-btn-primary[type="submit"],
    .psm-card form button[type="submit"].psm-btn-primary {
        position: sticky;
        bottom: 16px;
        left: 0;
        right: 0;
        width: 100%;
        min-height: 48px;
        font-size: 1rem;
        z-index: 5;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }
    .psm-portal .psm-portal-nav {
        flex-direction: column;
    }
    .psm-portal .psm-portal-tab {
        width: 100%;
        text-align: center;
        padding: 14px;
    }
    /* Menu-driven portal: sidebar stacks on mobile */
    .psm-portal-wrapper {
        flex-direction: column;
        padding: 12px;
    }
    .psm-portal-sidebar {
        flex: 0 0 auto;
        margin-right: 0;
        margin-bottom: 1rem;
    }
    .psm-portal-nav-link {
        padding: 12px 14px;
    }
} 

/* Color styles: Classic / Warm / Midnight */
body.psm-color-classic .psm-container {
    background: #ffffff;
}
body.psm-color-classic .psm-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
body.psm-color-classic .psm-card-title {
    color: #1f2937;
    text-shadow: none;
}
body.psm-color-classic .psm-btn-primary {
    background-image: linear-gradient(to bottom, #2563eb, #1d4ed8);
}
body.psm-color-classic .psm-btn-secondary {
    background-image: linear-gradient(to bottom, #9ca3af, #6b7280);
}

/* Warm desk is current default style; keep by class for explicit selection */
body.psm-color-warm .psm-container {
    background:
        radial-gradient(circle at top left, rgba(255,255,255,0.9), rgba(241,241,241,0.95)),
        linear-gradient(135deg, #f5f1e8, #f8f6f0);
}

body.psm-color-midnight .psm-container {
    background: linear-gradient(145deg, #0f172a, #111827);
}
body.psm-color-midnight .psm-card {
    background: #111827;
    border: 1px solid #334155;
    box-shadow: 0 10px 24px rgba(0,0,0,0.45);
}
body.psm-color-midnight .psm-card::before {
    box-shadow: 0 0 0 1px rgba(255,255,255,0.06) inset;
}
body.psm-color-midnight .psm-card-title,
body.psm-color-midnight .psm-form-label,
body.psm-color-midnight .psm-table th,
body.psm-color-midnight .psm-table td,
body.psm-color-midnight .psm-portal-user,
body.psm-color-midnight .psm-portal-login-title,
body.psm-color-midnight .psm-portal-login-desc {
    color: #e5e7eb;
}
body.psm-color-midnight .psm-form-control {
    background: #0b1220;
    color: #e5e7eb;
    border-color: #334155;
}
body.psm-color-midnight .psm-table th {
    background-color: #0b1220;
}
body.psm-color-midnight .psm-table tr:hover {
    background-color: #1e293b;
}
body.psm-color-midnight .psm-portal-sidebar {
    background: #0b1220;
    border-color: #334155;
}
body.psm-color-midnight .psm-portal-avatar {
    background: linear-gradient(180deg, #1e293b, #0f172a);
    border-color: #334155;
}
body.psm-color-midnight .psm-portal-avatar span {
    color: #e5e7eb;
}
body.psm-color-midnight .psm-portal-nav-link {
    color: #cbd5e1;
}
body.psm-color-midnight .psm-portal-nav-link:hover {
    background: #1e293b;
    color: #fff;
}

/* High Contrast */
body.psm-color-contrast .psm-container {
    background: #000;
}
body.psm-color-contrast .psm-card {
    background: #111;
    border: 2px solid #ffd700;
    box-shadow: none;
}
body.psm-color-contrast .psm-card-title,
body.psm-color-contrast .psm-form-label,
body.psm-color-contrast .psm-table th,
body.psm-color-contrast .psm-table td,
body.psm-color-contrast .psm-portal-user,
body.psm-color-contrast .psm-portal-login-title,
body.psm-color-contrast .psm-portal-login-desc {
    color: #fff;
}
body.psm-color-contrast .psm-form-control {
    background: #000;
    color: #fff;
    border-color: #ffd700;
}
body.psm-color-contrast .psm-btn-primary {
    background-image: linear-gradient(to bottom, #ffd700, #ccac00);
    color: #000;
}
body.psm-color-contrast .psm-portal-sidebar {
    background: #111;
    border-color: #ffd700;
}
body.psm-color-contrast .psm-portal-nav-link {
    color: #fff;
}
body.psm-color-contrast .psm-portal-nav-link:hover {
    background: #222;
}

/* Ocean Blue */
body.psm-color-ocean .psm-container {
    background: linear-gradient(145deg, #e6f4ff, #d8ecff);
}
body.psm-color-ocean .psm-card {
    background: #f8fcff;
    border-color: #a7d2f5;
}
body.psm-color-ocean .psm-btn-primary {
    background-image: linear-gradient(to bottom, #0d6efd, #0a58ca);
}
body.psm-color-ocean .psm-portal-sidebar {
    background: #f0f8ff;
    border-color: #a7d2f5;
}

/* Sunset Copper */
body.psm-color-sunset .psm-container {
    background: linear-gradient(145deg, #fff4ec, #ffe7d6);
}
body.psm-color-sunset .psm-card {
    background: #fffaf5;
    border-color: #efc7a7;
}
body.psm-color-sunset .psm-btn-primary {
    background-image: linear-gradient(to bottom, #c56a2d, #9a4f1f);
}
body.psm-color-sunset .psm-portal-sidebar {
    background: #fff6ef;
    border-color: #efc7a7;
}