* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg-gradient); color: var(--text-primary); }
a { color: var(--text-secondary); text-decoration: none; font-weight: 500; transition: color 0.15s ease-in-out; }
a:hover { color: var(--accent-color); text-decoration: underline; }

.app-container { display: flex; min-height: 100vh; }
.sidebar { width: 240px; flex-shrink: 0; background: var(--sidebar-bg); color: #ffffff; padding: 24px 12px; }
.sidebar a { display: block; padding: 10px 14px; border-radius: 10px; color: inherit; text-decoration: none; margin-bottom: 4px; opacity: 0.85; }
.sidebar a.active, .sidebar a:hover { background: rgba(255,255,255,0.1); opacity: 1; }
.main-content { flex: 1; padding: 32px; }

.glass-card { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 20px; padding: 24px; backdrop-filter: blur(16px); margin-bottom: 24px; transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; }

.btn { padding: 10px 18px; border-radius: 10px; border: none; cursor: pointer; font-weight: 600; }
a.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent-gradient); color: #fff; }
.btn-secondary { background: var(--input-bg); color: var(--text-primary); border: 1px solid var(--glass-border); }
.btn-danger { background: var(--danger); color: #fff; }

/* Sky variant for document/letterhead generation actions */
.btn-sky {
    background: linear-gradient(90deg, #0284c7, var(--accent-sky));
    color: #fff;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(56, 189, 248, 0.28);
    transition: box-shadow 0.15s ease, filter 0.15s ease;
}
.btn-sky:hover {
    color: #fff;
    text-decoration: none;
    filter: brightness(1.06);
    box-shadow: 0 8px 22px rgba(56, 189, 248, 0.42);
}
.btn-sky:focus-visible { outline: 2px solid var(--accent-sky); outline-offset: 2px; }

/* Outline variant: a visible but clearly secondary companion to a primary button */
.btn-outline {
    background: rgba(168, 85, 247, 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(168, 85, 247, 0.45);
    transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-outline:hover {
    background: rgba(168, 85, 247, 0.2);
    border-color: rgba(168, 85, 247, 0.7);
    color: var(--accent-color);
    text-decoration: none;
}
.btn-outline:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }

/* Card header: title + description on the left, primary actions on the right */
.card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px 32px;
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--glass-border);
}
.card-header__text { flex: 1 1 340px; min-width: 0; }
.card-header__title {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.3;
}
.card-header__subtitle {
    margin: 6px 0 0;
    max-width: 72ch;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text-secondary);
    opacity: 0.85;
}
.card-header__note {
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.45;
    color: #f59e0b;
}
.card-header__note a,
.card-header__note a:hover { color: inherit; text-decoration: underline; }
.card-header__actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex: 0 0 auto;
}
.card-header__actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}
.card-header__actions-row form { margin: 0; }
.card-header__actions-row .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding: 11px 20px;
    min-height: 44px;
    font-size: 12px;
    white-space: nowrap;
    text-decoration: none;
}
/* Keeps a button and its hint stacked, with siblings top-aligned to the button */
.card-header__action-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}
.card-header__action-group ~ .btn { align-self: flex-start; }
.card-header__action-group .card-header__hint { text-align: left; }
.card-header__hint {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    max-width: 320px;
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--text-muted);
    text-align: right;
}
.card-header__hint a { color: inherit; text-decoration: underline; }
.card-header__hint a:hover { color: var(--text-secondary); }

@media (max-width: 780px) {
    .card-header { flex-direction: column; align-items: stretch; }
    .card-header__text { flex: 0 0 auto; }
    .card-header__actions { align-items: stretch; width: 100%; }
    .card-header__actions-row { justify-content: flex-start; }
    .card-header__hint { max-width: none; text-align: left; }
}

/* In-page section navigation rendered as classic underline tabs */
.hr-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    column-gap: 0;
    row-gap: 2px;
    margin: 24px 0;
}
/* Filler keeps the baseline running to the edge of the row */
.hr-tabs::after {
    content: "";
    flex: 1 1 0;
    min-width: 0;
    border-bottom: 2px solid var(--glass-border);
}
.hr-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid var(--glass-border);
    border-radius: 0;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.hr-tab:hover {
    color: var(--text-primary);
    text-decoration: none;
    border-bottom-color: var(--accent-color);
    background: rgba(168, 85, 247, 0.08);
}
.hr-tab:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: -3px;
    color: var(--text-primary);
    text-decoration: none;
}
.hr-tab.active {
    color: var(--text-primary);
    font-weight: 700;
    border-bottom-color: var(--accent-color);
    background: linear-gradient(180deg, rgba(168, 85, 247, 0) 0%, rgba(168, 85, 247, 0.16) 100%);
}
/* Trailing tab pushed past the filler to the far right of the row */
.hr-tab--end { order: 1; }

@media (max-width: 640px) {
    .hr-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: thin;
        scrollbar-color: var(--glass-border) transparent;
        -webkit-overflow-scrolling: touch;
    }
    .hr-tabs::-webkit-scrollbar { height: 3px; }
    .hr-tabs::-webkit-scrollbar-track { background: transparent; }
    .hr-tabs::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 99px; }
    .hr-tab { padding: 10px 12px; }
}

table.hr-table { width: 100%; border-collapse: collapse; }
table.hr-table th, table.hr-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--glass-border); }
table.hr-table tbody tr.clickable-row { cursor: pointer; transition: background 0.15s ease, transform 0.15s ease; }
table.hr-table tbody tr.clickable-row:hover { background: rgba(56, 189, 248, 0.08); }
table.hr-table td.hr-table__empty { text-align: center; padding: 30px 12px; font-size: 12px; line-height: 1.6; color: var(--text-muted); }

/* Horizontal scroll container so wide tables stay usable on narrow/mobile screens */
.hr-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; }
/* Pure White spin button arrows for number inputs on dark theme */
input[type="number"] {
    -webkit-appearance: none !important;
    -moz-appearance: textfield !important;
    appearance: none !important;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="14" viewBox="0 0 10 14" fill="none"><path d="M1 5L5 1L9 5" stroke="%23ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M1 9L5 13L9 9" stroke="%23ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>') !important;
    background-repeat: no-repeat !important;
    background-position: right 8px center !important;
    padding-right: 24px !important;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 700; line-height: 1.3; letter-spacing: 0.2px; text-decoration: none; }
.badge-danger    { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.35); }
.badge-warning   { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.35); }
.badge-success   { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.35); }
.badge-info      { background: rgba(56, 189, 248, 0.15); color: var(--accent-sky); border: 1px solid rgba(56, 189, 248, 0.35); }
.badge-secondary { background: rgba(148, 163, 184, 0.15); color: var(--text-secondary); border: 1px solid rgba(148, 163, 184, 0.3); }

/* Global Modern Empty States */
.hr-empty-state {
    text-align: center;
    padding: 44px 24px;
    margin: 16px 0;
    border: 1px dashed var(--glass-border);
    border-radius: 16px;
    background: var(--surface-subtle);
}
.hr-empty-state__icon { font-size: 36px; margin-bottom: 12px; line-height: 1; }
.hr-empty-state__title { font-size: 16px; font-weight: 700; margin: 0 0 6px 0; color: var(--text-primary); }
.hr-empty-state__subtitle { font-size: 12px; color: var(--text-secondary); margin: 0 auto 16px auto; max-width: 460px; line-height: 1.5; }
.hr-empty-state__actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* Universal Approvals 2-Pane Split-Screen Layout */
.approvals-split-container {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 1024px) {
    .approvals-split-container {
        grid-template-columns: 1fr;
    }
}
.approvals-list-pane {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    padding-right: 6px;
}
.approval-item-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    text-decoration: none;
    color: inherit;
    display: block;
}
.approval-item-card:hover {
    background: var(--row-hover-bg);
    border-color: rgba(168, 85, 247, 0.4);
    transform: translateY(-1px);
}
.approval-item-card.active {
    background: rgba(168, 85, 247, 0.14) !important;
    border: 1px solid #a855f7 !important;
    box-shadow: 0 4px 14px rgba(168, 85, 247, 0.2);
}
.approval-detail-pane {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 24px;
    backdrop-filter: blur(16px);
    position: sticky;
    top: 20px;
}

.file-badge { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; margin-right: 6px; letter-spacing: 0.5px; vertical-align: middle; line-height: 1; }
.file-badge-pdf  { background: rgba(220, 38, 38, 0.2); color: #ef4444; border: 1px solid rgba(220, 38, 38, 0.4); }
.file-badge-word { background: rgba(37, 99, 235, 0.2); color: #3b82f6; border: 1px solid rgba(37, 99, 235, 0.4); }
.file-badge-img  { background: rgba(16, 185, 129, 0.2); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.4); }
.file-badge-file { background: rgba(148, 163, 184, 0.2); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.4); }

.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; }
.alert-error { background: rgba(220,38,38,0.1); color: var(--danger); border: 1px solid rgba(220,38,38,0.2); }
/* Text stays on --text-primary so the tinted background keeps AA contrast in both themes */
.alert-success { background: rgba(5,150,105,0.12); color: var(--text-primary); border: 1px solid rgba(5,150,105,0.3); font-weight: 600; }
.alert-info { background: rgba(56,189,248,0.12); color: var(--text-primary); border: 1px solid rgba(56,189,248,0.3); }

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg-gradient); }
.login-card { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 24px; padding: 40px; width: 100%; max-width: 400px; backdrop-filter: blur(16px); }
.login-card label { display: block; margin-bottom: 16px; font-size: 12px; color: var(--text-secondary); }
.login-card input { width: 100%; padding: 10px 12px; margin-top: 6px; border-radius: 10px; border: 1px solid var(--glass-border); background: var(--input-bg); color: var(--text-primary); }

form.hr-form label,
.glass-card label {
    display: block;
    margin-bottom: 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

form.hr-form label > input:not([type="checkbox"]):not([type="radio"]),
form.hr-form label > select,
form.hr-form label > textarea,
.glass-card label > input:not([type="checkbox"]):not([type="radio"]),
.glass-card label > select,
.glass-card label > textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
}

.form-required { color: var(--danger); font-weight: 700; display: inline-block; margin-left: 2px; }

/* Checkbox / radio rows: control on the left, text beside it on the same line.
   The stacked-label rule above turns every card label into a column, so these
   selectors have to out-specify ".glass-card label". */
.form-check,
form.hr-form .form-check,
.glass-card .form-check {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
    color: var(--text-primary);
    cursor: pointer;
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--accent-color);
    cursor: pointer;
}
.form-check input[type="checkbox"]:focus-visible,
.form-check input[type="radio"]:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
.form-check > span { flex: 1 1 240px; min-width: 0; }
/* Secondary option that depends on the toggle above it */
.form-check--nested { margin-left: 27px; font-size: 12px; color: var(--text-secondary); }
.form-check-list { display: flex; flex-direction: column; gap: 14px; }
.form-check-hint {
    margin: 4px 0 0 27px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-muted);
}
.form-check-hint--nested { margin-left: 54px; }

/* Safety net for legacy markup: a label wrapping its own checkbox stays a row */
form.hr-form label:has(> input[type="checkbox"]),
form.hr-form label:has(> input[type="radio"]),
.glass-card label:has(> input[type="checkbox"]),
.glass-card label:has(> input[type="radio"]) {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

/* Buttons row closing a form, aligned with the fields above it */
.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

/* Responsive field grid: columns collapse automatically on narrow viewports */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px 24px;
}
.form-grid > label { margin-bottom: 0; }

/* Section heading + divider inside a form card */
.form-section {
    margin-top: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--glass-border);
}
.form-section-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}
.form-section-hint {
    margin: 4px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-muted);
}

.leave-balance-summary { margin-bottom: 20px; }
.leave-balance-summary .form-section {
    margin-top: 0;
    margin-bottom: 12px;
}
.leave-request-details {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 20px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: var(--input-bg);
    overflow: hidden;
}
.leave-request-detail {
    min-width: 0;
    padding: 14px 16px;
    border-left: 1px solid var(--glass-border);
}
.leave-request-detail:first-child { border-left: 0; }
.leave-request-detail > span {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.leave-request-detail > strong {
    display: block;
    color: var(--text-primary);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.leave-admin-edit-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
}

/* Dashboard summary stats: 4 per row on desktop for glanceable executive metrics, 
   scaling to 2 on tablets and 1 on mobile screens */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-grid > .glass-card { margin-bottom: 0; }
/* Pairing where the first card carries a wider control, e.g. a search input */
.stat-grid--wide-first { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stat-grid--requests-search { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr); }

/* Side-by-side 2-column layout container for split sections (e.g. Milestones + Compliance) */
.grid-2-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 768px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .leave-request-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .leave-admin-edit-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .leave-request-detail:nth-child(odd) { border-left: 0; }
    .leave-request-detail:nth-child(n+3) { border-top: 1px solid var(--glass-border); }
}

@media (max-width: 480px) {
    .stat-grid,
    .stat-grid--wide-first,
    .stat-grid--requests-search,
    .grid-2-col { grid-template-columns: minmax(0, 1fr); }
    .leave-request-details { grid-template-columns: minmax(0, 1fr); }
    .leave-admin-edit-row { grid-template-columns: minmax(0, 1fr); }
    .leave-request-detail {
        border-top: 1px solid var(--glass-border);
        border-left: 0;
    }
    .leave-request-detail:first-child { border-top: 0; }
}

/* Settings → branding tab -------------------------------------------------- */
.branding-page { width: 100%; max-width: 1150px; margin-left: auto; margin-right: auto; }
.branding-grid {
    display: grid;
    /* min() keeps a single column from forcing horizontal overflow on phones */
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.branding-grid > .glass-card { margin-bottom: 0; }
/* Previews render on white because that is the PDF page background */
.branding-preview {
    background: #ffffff;
    border-radius: 12px;
    padding: 18px;
    text-align: center;
    transition: opacity 0.15s ease;
}
.branding-preview--footer {
    min-height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.branding-preview--tile {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    margin-bottom: 14px;
}
.branding-preview__empty { font-size: 12px; color: var(--text-muted); }
.branding-note { margin: 8px 0 0; font-size: 12px; line-height: 1.5; color: var(--text-secondary); }
.branding-tile { display: flex; flex-direction: column; }
.branding-tile__body { flex: 1 1 auto; }
.branding-tile__title {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
}
.branding-tile__path {
    display: inline-block;
    margin: 6px 0 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--accent-sky);
    background: rgba(56, 189, 248, 0.1);
}
.branding-tile__desc {
    margin: 0 0 14px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
}
.glass-card .branding-field-label,
.branding-field-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}
.branding-hint { margin-top: 6px; font-size: 11px; line-height: 1.5; color: var(--text-muted); }

form.hr-form input[type="text"],
form.hr-form input[type="email"],
form.hr-form input[type="url"],
form.hr-form input[type="tel"],
form.hr-form input[type="number"],
form.hr-form input[type="password"],
form.hr-form input[type="date"],
form.hr-form select,
form.hr-form textarea,
.glass-card input[type="text"],
.glass-card input[type="email"],
.glass-card input[type="url"],
.glass-card input[type="tel"],
.glass-card input[type="number"],
.glass-card input[type="password"],
.glass-card input[type="date"],
.glass-card select,
.glass-card textarea {
    width: 100%;
    padding: 12px 16px;
    margin-top: 2px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] form.hr-form input,
[data-theme="dark"] form.hr-form select,
[data-theme="dark"] form.hr-form textarea,
[data-theme="dark"] .glass-card input,
[data-theme="dark"] .glass-card select,
[data-theme="dark"] .glass-card textarea {
    background: rgba(15, 23, 42, 0.65) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #f8fafc !important;
}

form.hr-form select,
.glass-card select {
    min-height: 48px;
    padding-right: 42px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%2338bdf8" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>');
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 18px;
    cursor: pointer;
    font-weight: 500;
}

select option {
    background-color: #0f172a !important;
    color: #f8fafc !important;
    padding: 12px 16px !important;
    font-size: 15px !important;
}

/* Universal Date Input Styling across all pages, modals, cards and forms */
input[type="date"],
form.hr-form input[type="date"],
.glass-card input[type="date"],
.form-control[type="date"] {
    min-height: 42px;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: var(--input-bg);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    box-sizing: border-box;
    display: inline-block;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input[type="date"]:focus,
form.hr-form input[type="date"]:focus,
.glass-card input[type="date"]:focus,
.form-control[type="date"]:focus {
    border-color: var(--accent-sky, var(--accent-sky));
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
    outline: none;
}

/* Polished calendar picker indicator icon across all WebKit browsers (Safari, iOS Safari, Chrome) */
input[type="date"]::-webkit-calendar-picker-indicator,
form.hr-form input[type="date"]::-webkit-calendar-picker-indicator,
.glass-card input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.85) sepia(1) saturate(5) hue-rotate(175deg);
    cursor: pointer;
    transform: scale(1.25);
    padding: 3px;
    border-radius: 6px;
    margin-right: 2px;
    opacity: 0.9;
    transition: transform 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
form.hr-form input[type="date"]::-webkit-calendar-picker-indicator:hover,
.glass-card input[type="date"]::-webkit-calendar-picker-indicator:hover {
    transform: scale(1.4);
    opacity: 1;
    filter: invert(1) sepia(1) saturate(10) hue-rotate(175deg);
}

/* File Input Styling */
form.hr-form input[type="file"],
.glass-card input[type="file"] {
    padding: 8px 12px !important;
    background: rgba(15, 23, 42, 0.45) !important;
    border: 1px dashed rgba(255, 255, 255, 0.25) !important;
    border-radius: 12px !important;
    color: #cbd5e1 !important;
    font-size: 13px !important;
    cursor: pointer !important;
}

form.hr-form input[type="file"]::file-selector-button,
.glass-card input[type="file"]::file-selector-button {
    background: linear-gradient(90deg, #7c3aed, #a855f7) !important;
    color: #ffffff !important;
    border: none !important;
    padding: 7px 14px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    cursor: pointer !important;
    margin-right: 12px !important;
    transition: opacity 0.2s ease !important;
}

form.hr-form input[type="file"]::file-selector-button:hover,
.glass-card input[type="file"]::file-selector-button:hover {
    opacity: 0.9 !important;
}

/* Placeholders: vendor prefixes and lighter color to clearly distinguish from entered text */
form.hr-form input::-webkit-input-placeholder,
form.hr-form textarea::-webkit-input-placeholder,
.glass-card input::-webkit-input-placeholder,
.glass-card textarea::-webkit-input-placeholder {
    color: var(--text-muted) !important;
    opacity: 0.35 !important;
    font-weight: 400 !important;
}
form.hr-form input::-moz-placeholder,
form.hr-form textarea::-moz-placeholder,
.glass-card input::-moz-placeholder,
.glass-card textarea::-moz-placeholder {
    color: var(--text-muted) !important;
    opacity: 0.35 !important;
    font-weight: 400 !important;
}
form.hr-form input:-ms-input-placeholder,
form.hr-form textarea:-ms-input-placeholder,
.glass-card input:-ms-input-placeholder,
.glass-card textarea:-ms-input-placeholder {
    color: var(--text-muted) !important;
    opacity: 0.35 !important;
    font-weight: 400 !important;
}
form.hr-form input::placeholder,
form.hr-form textarea::placeholder,
.glass-card input::placeholder,
.glass-card textarea::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.35 !important;
    font-weight: 400 !important;
}

form.hr-form textarea,
.glass-card textarea {
    resize: vertical;
}

form.hr-form input:focus,
form.hr-form select:focus,
form.hr-form textarea:focus,
.glass-card input:focus,
.glass-card select:focus,
.glass-card textarea:focus {
    outline: none;
    border-color: var(--accent-sky) !important;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25), inset 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

/* Inline Filter Bar Component */
.filter-bar {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    align-items: center !important;
    margin-bottom: 20px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    padding: 14px 16px !important;
    border-radius: 14px !important;
    border: 1px solid var(--glass-border) !important;
}

.filter-bar input[type="text"],
.filter-bar input[type="search"],
.filter-bar select {
    width: auto !important;
    flex: 1 1 170px !important;
    min-width: 130px !important;
    max-width: 250px !important;
    margin: 0 !important;
    padding: 10px 14px !important;
    min-height: 42px !important;
    font-size: 14px !important;
}

.filter-bar input[type="date"] {
    width: auto !important;
    flex: 1 1 160px !important;
    min-width: 150px !important;
    max-width: 200px !important;
    margin: 0 !important;
    padding: 10px 14px !important;
    min-height: 42px !important;
    font-size: 14px !important;
}

.filter-bar .btn {
    flex-shrink: 0 !important;
    min-height: 42px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px 18px !important;
    margin: 0 !important;
}

/* Flatpickr Modern Glassmorphic Theme Overrides */
.flatpickr-calendar {
    background: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6) !important;
    border-radius: 16px !important;
    color: #f8fafc !important;
    font-family: inherit !important;
    padding: 8px !important;
}
.flatpickr-calendar .flatpickr-day {
    color: #cbd5e1 !important;
    border-radius: 8px !important;
}
.flatpickr-calendar .flatpickr-day.selected,
.flatpickr-calendar .flatpickr-day.startRange,
.flatpickr-calendar .flatpickr-day.endRange {
    background: #0284c7 !important;
    border-color: #0284c7 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
}
.flatpickr-calendar .flatpickr-day:hover {
    background: rgba(56, 189, 248, 0.2) !important;
}
.flatpickr-current-month .numInputWrapper span {
    border: none !important;
}
.flatpickr-current-month input.cur-year {
    font-weight: 700 !important;
    color: var(--accent-sky) !important;
    font-size: 16px !important;
}
.flatpickr-current-month .flatpickr-monthDropdown-months {
    background: #1e293b !important;
    color: #ffffff !important;
    border-radius: 8px !important;
    padding: 4px 8px !important;
    font-weight: 600 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    margin-right: 6px !important;
}
.flatpickr-calendar .flatpickr-weekdays {
    background: transparent !important;
}
.flatpickr-calendar span.flatpickr-weekday,
.flatpickr-calendar .flatpickr-weekday {
    color: var(--accent-sky) !important;
    font-weight: 700 !important;
    font-size: 13px !important;
}
.flatpickr-calendar .flatpickr-day.prevMonthDay,
.flatpickr-calendar .flatpickr-day.nextMonthDay {
    color: var(--text-muted) !important;
    opacity: 0.6 !important;
}

/* Previous / Next Month Arrows Styling */
.flatpickr-prev-month,
.flatpickr-next-month {
    color: var(--accent-sky) !important;
    fill: var(--accent-sky) !important;
    padding: 6px !important;
    border-radius: 6px !important;
}
.flatpickr-prev-month:hover,
.flatpickr-next-month:hover {
    background: rgba(56, 189, 248, 0.25) !important;
    color: var(--accent-sky) !important;
}
.flatpickr-prev-month svg,
.flatpickr-next-month svg,
.flatpickr-prev-month svg path,
.flatpickr-next-month svg path {
    fill: var(--accent-sky) !important;
    stroke: var(--accent-sky) !important;
}



/* Calendar Icon on Right Edge of Date Inputs (CSS Fallback & Direct Display) */
input.flatpickr-input,
input.js-datepicker {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%2338bdf8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>') !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 20px !important;
    padding-right: 44px !important;
    cursor: pointer !important;
}

/* Datepicker Wrapper & Clickable Toggle Button */
.datepicker-wrapper {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
}
.datepicker-wrapper input.flatpickr-input,
.datepicker-wrapper input {
    padding-right: 48px !important;
    cursor: pointer !important;
    width: 100% !important;
}

.datepicker-toggle-btn {
    position: absolute !important;
    right: 8px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    padding: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    transition: background 0.15s ease, transform 0.15s ease !important;
    z-index: 99 !important;
    pointer-events: auto !important;
}
.datepicker-toggle-btn:hover {
    background: rgba(56, 189, 248, 0.25) !important;
    transform: translateY(-50%) scale(1.1) !important;
}
.datepicker-toggle-btn svg {
    pointer-events: none !important;
}


/* Custom Year Select Dropdown in Flatpickr Header */
.flatpickr-current-month .cur-year-select {
    background: #1e293b !important;
    color: var(--accent-sky) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    padding: 4px 8px !important;
    cursor: pointer !important;
    margin-left: 4px !important;
    font-family: inherit !important;
    outline: none !important;
}
.flatpickr-current-month .cur-year-select option {
    background-color: #0f172a !important;
    color: #f8fafc !important;
    padding: 8px !important;
}






/* Sidebar Submenu & Accordion Styles */
.nav-group { margin-bottom: 4px; }
.nav-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: 10px;
    color: inherit;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
    opacity: 0.85;
    transition: all 0.15s ease;
    margin-bottom: 2px;
}
.nav-group-header:hover {
    background: rgba(255, 255, 255, 0.08);
    opacity: 1;
}
.nav-group.open > .nav-group-header {
    color: #ffffff;
    opacity: 1;
    font-weight: 700;
}
.nav-group-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 8px;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.7);
    transition: transform 0.2s ease, color 0.2s ease, opacity 0.2s ease;
    line-height: 1;
    flex-shrink: 0;
}
.nav-group.open .nav-group-chevron {
    color: var(--accent-sky) !important;
    opacity: 1;
}

.nav-submenu {
    display: none;
    margin-bottom: 6px;
    padding-top: 2px;
}
.nav-group.open .nav-submenu {
    display: block !important;
}
.sidebar .nav-submenu a {
    display: block;
    padding: 8px 12px 8px 24px;
    font-size: 12px;
    opacity: 0.75;
    margin-bottom: 3px;
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
    transition: all 0.15s ease;
}
.sidebar .nav-submenu a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #facc15 !important;
    opacity: 1;
}
.sidebar .nav-submenu a.active {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #facc15 !important;
    opacity: 1 !important;
    font-weight: 700 !important;
    border-left: 3px solid #facc15;
    border-radius: 4px 8px 8px 4px;
}

/* Document Table Clickable Rows & Kebab Action Menu */
tr.clickable-row {
    cursor: pointer;
    transition: background 0.15s ease-in-out;
}
tr.clickable-row:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}

/* SweetAlert2 / hrAlert Confirmation Popups - Always on top front */
.swal2-container, 
.swal2-backdrop-show, 
.swal2-popup, 
.swal2-modal, 
div[class*="swal2"] {
    z-index: 999999 !important;
}

.glass-card {
    position: relative;
    overflow: visible !important;
}

/* Fixed Modal Container System - Perfectly Centered in Screen Viewport */
.hr-modal-overlay,
div[id$="Modal"]:not(.glass-card),
div[id$="modal"]:not(.glass-card) {
    box-sizing: border-box !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    padding: 20px !important;
    margin: 0 !important;
    overflow-y: auto !important;
    background: rgba(15, 23, 42, 0.8) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
}

div[id$="Modal"][style*="flex"]:not(.glass-card),
div[id$="modal"][style*="flex"]:not(.glass-card) {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

div[id$="Modal"]:not(.glass-card) > .glass-card,
div[id$="modal"]:not(.glass-card) > .glass-card,
.hr-modal-card {
    position: relative !important;
    overflow: hidden !important;
    max-height: 80vh !important;
    width: 100% !important;
    margin: auto !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    min-height: 0 !important;
    transform: none !important;
}

div[id$="Modal"]:not(.glass-card) form,
div[id$="modal"]:not(.glass-card) form,
.hr-modal-form {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
}

.hr-modal-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding-right: 6px !important;
}

.hr-modal-footer {
    flex-shrink: 0 !important;
    position: sticky !important;
    bottom: 0 !important;
    z-index: 10 !important;
    background: var(--modal-bg, var(--glass-bg, #0f172a)) !important;
    padding-top: 12px !important;
    margin-top: 12px !important;
    border-top: 1px solid var(--glass-border) !important;
}

/* Theme-aware dialog cards: never use --sidebar-bg (always navy) with --text-primary. */
#add-eval-modal > .glass-card,
#view-eval-modal > .glass-card,
.hr-theme-dialog {
    background: var(--modal-bg) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--glass-border) !important;
}
#add-eval-modal h3,
#view-eval-modal h3,
.hr-theme-dialog h3 {
    color: var(--text-primary) !important;
}
#add-eval-modal p,
#view-eval-modal p,
.hr-theme-dialog p {
    color: var(--text-muted) !important;
}
#add-eval-modal button[aria-label="Close"],
#view-eval-modal button[aria-label="Close"] {
    background: var(--surface-muted) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--text-secondary) !important;
}
#view-eval-modal .eval-summary-grid {
    background: var(--surface-muted) !important;
    border: 1px solid var(--glass-border) !important;
}
#view-eval-modal .eval-summary-grid .eval-summary-value {
    color: var(--text-primary) !important;
}
#view-eval-modal .eval-summary-grid .eval-summary-score {
    color: var(--accent-sky) !important;
}
#view-eval-modal .eval-field-box {
    background: var(--input-bg) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--text-primary) !important;
}
#add-eval-modal .btn-secondary,
#view-eval-modal .btn-secondary {
    background: var(--input-bg) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--glass-border) !important;
}

.glass-card:has(.doc-action-menu.active) {
    z-index: 50 !important;
}

.hr-table, 
.hr-table tbody, 
.hr-table tr {
    overflow: visible !important;
}

.hr-table tr:has(.doc-action-menu.active) {
    position: relative !important;
    z-index: 60 !important;
}

.doc-action-menu {
    position: relative;
    display: inline-block;
}

.doc-action-menu.active {
    z-index: 70 !important;
}

.doc-action-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #ffffff);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.2));
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    transition: all 0.15s ease;
    user-select: none;
}

.doc-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.doc-action-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 6px;
    min-width: 195px;
    width: max-content;
    background: #1e1b4b;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.2);
    z-index: 100 !important;
    padding: 6px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    text-align: left;
}

.doc-action-menu.active .doc-action-dropdown {
    display: block;
    animation: fadeInDropdown 0.15s ease-out;
}

@keyframes fadeInDropdown {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.doc-action-dropdown a, 
.doc-action-dropdown button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    color: var(--text-primary, #ffffff);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    box-sizing: border-box;
    font-family: inherit;
    text-align: left;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.doc-action-dropdown a:hover, 
.doc-action-dropdown button:hover {
    background: rgba(255, 255, 255, 0.12);
}

.doc-action-dropdown button.danger-action:hover,
.doc-action-dropdown a.danger-action:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Staff directory rows: the row itself is inert, only the name / email / kebab are interactive. */
table.hr-table tbody tr.staff-row { transition: background 0.15s ease; }
table.hr-table tbody tr.staff-row:hover { background: rgba(56, 189, 248, 0.06); }

.staff-name-link {
    display: inline-block;
    color: var(--accent-sky);
    font-weight: 700;
    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
}

.staff-name-link:hover,
.staff-name-link:focus-visible {
    color: #7dd3fc;
    text-decoration: underline;
}

.staff-name-link:focus-visible { outline: 2px solid var(--accent-sky); outline-offset: 2px; border-radius: 4px; }

/* Restricted rows render the name as a button that opens the contact modal instead of a
   profile link, so it must not look like a form control. */
button.staff-name-link {
    background: none;
    border: 0;
    padding: 0;
    font-family: inherit;
    text-align: left;
}

.staff-phone { font-size: 11px; color: var(--text-secondary); opacity: 0.8; margin-top: 2px; }
.staff-phone a { color: inherit; font-weight: 500; }
.staff-phone a:hover { color: var(--accent-sky); }

.staff-email-link { color: var(--text-secondary); font-size: 12px; }
.staff-email-link:hover { color: var(--accent-sky); }
.staff-muted { color: var(--text-muted); }

.staff-actions-col { width: 44px; text-align: right; white-space: nowrap; }

.staff-kebab {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    width: 30px;
    height: 28px;
    line-height: 1;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.15s ease, background 0.15s ease;
}

tr.staff-row:hover .staff-kebab,
.staff-kebab:hover,
.staff-kebab:focus-visible { opacity: 1; background: rgba(255, 255, 255, 0.2); }
.staff-kebab:focus-visible { outline: 2px solid var(--accent-sky); outline-offset: 2px; }

/* Touch devices never fire hover, so the kebab has to stay visible there. */
@media (hover: none) {
    .staff-kebab { opacity: 1; }
}

/* Shared right-click / kebab menu. Positioned fixed and moved by JS to the pointer or button. */
.context-menu {
    display: none;
    position: fixed;
    z-index: 1200;
    min-width: 210px;
    padding: 6px;
    background: #1e1b4b;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.context-menu.open { display: block; animation: fadeInDropdown 0.12s ease-out; }

.context-menu__header {
    padding: 6px 12px 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

.context-menu__item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.12s ease;
}

.context-menu__item:hover,
.context-menu__item:focus-visible {
    background: rgba(56, 189, 248, 0.18);
    color: var(--text-primary);
    text-decoration: none;
    outline: none;
}

.context-menu__icon { font-size: 12px; line-height: 1; }

.staff-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1300;
    padding: 10px 16px;
    background: var(--dropdown-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
}

/* Theme toggle (Dashboard) ------------------------------------------------ */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 8px;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: var(--header-chip-bg);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.theme-toggle:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.15);
}
.theme-toggle:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
.theme-toggle__track {
    position: relative;
    width: 38px;
    height: 22px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.35);
    flex-shrink: 0;
}
.theme-toggle__thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.25);
    transition: transform 0.2s ease;
}
[data-theme="dark"] .theme-toggle__track { background: rgba(56, 189, 248, 0.35); }
[data-theme="dark"] .theme-toggle__thumb { transform: translateX(16px); }
.theme-toggle__icon { font-size: 12px; line-height: 1; }
[data-theme="dark"] .theme-toggle__icon--sun { display: none; }
[data-theme="light"] .theme-toggle__icon--moon { display: none; }
.theme-toggle__label { min-width: 34px; text-align: left; color: var(--text-secondary); }

.search-dropdown,
#dashboard-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    max-height: 260px;
    overflow-y: auto;
    z-index: 9999;
    background: var(--dropdown-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    color: var(--text-primary);
}
.search-dropdown a,
.search-dropdown .dashboard-search-result,
#dashboard-search-results a {
    display: block;
    padding: 10px 14px;
    border-bottom: 1px solid var(--surface-border);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
}
.search-dropdown a:last-child,
.search-dropdown .dashboard-search-result:last-child,
#dashboard-search-results a:last-child {
    border-bottom: none;
}
.search-dropdown a:hover,
.search-dropdown .dashboard-search-result:hover,
#dashboard-search-results a:hover {
    background: var(--row-hover-bg);
    text-decoration: none;
}

.header-welcome-chip {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--header-chip-bg);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}
.header-welcome-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.header-welcome-icon {
    font-size: 26px;
    line-height: 1;
}
.header-welcome-chip__name,
.header-welcome-name {
    color: #6b21a8;
    font-weight: 700;
}
[data-theme="dark"] .header-welcome-chip__name,
[data-theme="dark"] .header-welcome-name {
    color: #c084fc;
}

/* Light theme overrides --------------------------------------------------- */
[data-theme="light"] select option {
    background-color: #ffffff !important;
    color: #0f172a !important;
}

[data-theme="light"] input[type="number"] {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="14" viewBox="0 0 10 14" fill="none"><path d="M1 5L5 1L9 5" stroke="%231e1b4b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M1 9L5 13L9 9" stroke="%231e1b4b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>') !important;
}

[data-theme="light"] form.hr-form input,
[data-theme="light"] form.hr-form select,
[data-theme="light"] form.hr-form textarea,
[data-theme="light"] .glass-card input,
[data-theme="light"] .glass-card select,
[data-theme="light"] .glass-card textarea {
    border-color: rgba(30, 27, 75, 0.16) !important;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06) !important;
}

[data-theme="light"] form.hr-form input[type="file"],
[data-theme="light"] .glass-card input[type="file"] {
    background: var(--input-bg) !important;
    border: 1px dashed rgba(30, 27, 75, 0.22) !important;
    color: var(--text-primary) !important;
}

[data-theme="light"] .filter-bar {
    background: var(--surface-subtle) !important;
}

[data-theme="light"] tr.clickable-row:hover {
    background: var(--row-hover-bg) !important;
}

[data-theme="light"] table.hr-table tbody tr.clickable-row:hover {
    background: var(--row-hover-bg);
}

[data-theme="light"] .doc-action-btn {
    background: var(--surface-muted);
    border-color: var(--surface-border);
}
[data-theme="light"] .doc-action-btn:hover {
    background: rgba(124, 58, 237, 0.12);
    border-color: rgba(124, 58, 237, 0.25);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .doc-action-dropdown,
[data-theme="light"] .context-menu {
    background: var(--dropdown-bg);
    border-color: var(--glass-border);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(30, 27, 75, 0.06);
}
[data-theme="light"] .context-menu__header {
    border-bottom-color: var(--surface-border);
}

[data-theme="light"] .flatpickr-calendar {
    background: #ffffff !important;
    border: 1px solid rgba(30, 27, 75, 0.14) !important;
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.14) !important;
    color: #0f172a !important;
}
[data-theme="light"] .flatpickr-calendar .flatpickr-day {
    color: #334155 !important;
}
[data-theme="light"] .flatpickr-current-month input.cur-year {
    color: #0284c7 !important;
}
[data-theme="light"] .flatpickr-current-month .flatpickr-monthDropdown-months {
    background: #f8fafc !important;
    color: #0f172a !important;
    border: 1px solid rgba(30, 27, 75, 0.12) !important;
}
[data-theme="light"] .flatpickr-calendar span.flatpickr-weekday,
[data-theme="light"] .flatpickr-calendar .flatpickr-weekday {
    color: #0284c7 !important;
}
[data-theme="light"] .flatpickr-calendar .flatpickr-day.prevMonthDay,
[data-theme="light"] .flatpickr-calendar .flatpickr-day.nextMonthDay {
    color: #94a3b8 !important;
}
[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="light"] form.hr-form input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="light"] .glass-card input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.25) sepia(1) saturate(6) hue-rotate(200deg);
    opacity: 0.85;
}
[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator:hover,
[data-theme="light"] form.hr-form input[type="date"]::-webkit-calendar-picker-indicator:hover,
[data-theme="light"] .glass-card input[type="date"]::-webkit-calendar-picker-indicator:hover {
    filter: invert(0.1) sepia(1) saturate(10) hue-rotate(200deg);
    opacity: 1;
}

[data-theme="light"] .main-content input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]):not(.btn),
[data-theme="light"] .main-content select,
[data-theme="light"] .main-content textarea {
    color: var(--text-primary) !important;
}

[data-theme="light"] .main-content summary {
    color: var(--text-primary);
}

[data-theme="light"] .main-content details[style*="rgba(255,255,255"] > summary,
[data-theme="light"] .main-content details > summary[style*="rgba(255,255,255"] {
    background: var(--surface-muted) !important;
}

[data-theme="light"] .main-content [style*="background:rgba(255,255,255,0.03)"],
[data-theme="light"] .main-content [style*="background:rgba(255,255,255,0.04)"],
[data-theme="light"] .main-content [style*="background:rgba(255,255,255,0.05)"],
[data-theme="light"] .main-content [style*="background: rgba(255,255,255,0.03)"],
[data-theme="light"] .main-content [style*="background: rgba(255,255,255,0.04)"],
[data-theme="light"] .main-content [style*="background: rgba(255,255,255,0.05)"] {
    background: var(--surface-subtle) !important;
}

[data-theme="light"] .main-content input[style*="color:#fff"],
[data-theme="light"] .main-content input[style*="color: #fff"],
[data-theme="light"] .main-content select[style*="color:#fff"],
[data-theme="light"] .main-content select[style*="color: #fff"],
[data-theme="light"] .main-content textarea[style*="color:#fff"],
[data-theme="light"] .main-content th[style*="color:#f8fafc"],
[data-theme="light"] .main-content td[style*="color:#f8fafc"],
[data-theme="light"] .main-content h2[style*="color:#f8fafc"],
[data-theme="light"] .main-content [style*="color:#f8fafc"] {
    color: var(--text-primary) !important;
}

[data-theme="light"] .main-content input[style*="rgba(0,0,0"],
[data-theme="light"] .main-content input[style*="rgba(15,23,42"],
[data-theme="light"] .main-content select[style*="rgba(0,0,0"] {
    background: var(--input-bg) !important;
    border-color: var(--glass-border) !important;
    color: var(--text-primary) !important;
}

[data-theme="light"] .main-content .glass-card[style*="linear-gradient"][style*="15,23,42"],
[data-theme="light"] .main-content .glass-card[style*="linear-gradient"][style*="30,41,59"] {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.08) 0%, var(--card-gradient-end) 100%) !important;
}

[data-theme="light"] .staff-toast {
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .login-card h1 {
    color: var(--text-primary);
}

[data-theme="light"] .modal-overlay .glass-card {
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%) !important;
    border-color: var(--glass-border) !important;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.18) !important;
}

[data-theme="light"] .main-content [style*="color:#e0f2fe"] {
    color: var(--text-secondary) !important;
}

[data-theme="light"] .main-content [style*="border-bottom:1px solid rgba(255,255,255"],
[data-theme="light"] .main-content [style*="border-top:1px solid rgba(255,255,255"],
[data-theme="light"] .main-content [style*="border:1px solid rgba(255,255,255"],
[data-theme="light"] .main-content [style*="border: 1px solid rgba(255,255,255"] {
    border-color: var(--surface-border) !important;
}

[data-theme="light"] .main-content [style*="border-bottom:1px solid rgba(255,255,255,0.08)"],
[data-theme="light"] .main-content [style*="border-bottom: 1px solid rgba(255,255,255,0.08)"] {
    border-bottom-color: var(--surface-border) !important;
}

[data-theme="light"] .search-dropdown,
[data-theme="light"] #dashboard-search-results {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid rgba(30, 27, 75, 0.14) !important;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12) !important;
}
[data-theme="light"] .search-dropdown a,
[data-theme="light"] #dashboard-search-results a,
[data-theme="light"] #dashboard-search-results .hr-table__empty {
    color: #0f172a !important;
}

[data-theme="light"] .swal2-popup {
    background: #ffffff !important;
    color: #0f172a !important;
}
[data-theme="light"] .swal2-title,
[data-theme="light"] .swal2-html-container,
[data-theme="light"] .swal2-content {
    color: #0f172a !important;
}

[data-theme="dark"] .swal2-popup {
    background: #0f172a !important;
    color: #f8fafc !important;
}

/* ==========================================================================
   MOBILE & TOUCH DEVICE OPTIMIZATIONS (< 768px)
   ========================================================================== */
@media (max-width: 768px) {
    /* Touch-friendly horizontal swipe tab bar */
    .hr-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scroll-snap-type: x mandatory;
        padding-bottom: 4px !important;
        margin: 16px 0 !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }
    .hr-tabs::-webkit-scrollbar {
        display: none !important;
    }
    .hr-tabs::after {
        display: none !important;
    }
    .hr-tab {
        flex: 0 0 auto !important;
        scroll-snap-align: start;
        padding: 10px 14px !important;
        font-size: 13px !important;
        border-bottom: 2px solid var(--glass-border);
    }
    .hr-tab.active {
        border-bottom-color: var(--accent-color) !important;
    }

    /* Prevent iOS Safari auto-zoom on input focus */
    input[type="text"],
    input[type="number"],
    input[type="date"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px !important;
    }

    /* Mobile container & card padding */
    .app-container {
        flex-direction: column;
    }
    .main-content {
        padding: 16px 12px !important;
    }
    .glass-card {
        padding: 16px !important;
        border-radius: 16px !important;
        margin-bottom: 16px !important;
    }
    
    /* Touch button hit targets */
    .btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Stack filter bars vertically on small screens */
    .filter-bar {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .filter-bar select,
    .filter-bar input,
    .filter-bar button,
    .filter-bar a.btn {
        width: 100% !important;
        box-sizing: border-box;
    }

    /* Mobile Employee Profile Header centering */
    .employee-profile-card {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
    }
    .employee-avatar-col {
        width: 100% !important;
    }

    /* Universal 1-Column Responsive Grid Collapse for All Forms, Panels & Cards on Mobile */
    [style*="display:grid"],
    [style*="display: grid"] {
        grid-template-columns: 1fr !important;
    }
}

/* Mobile Drawer Sidebar & Overlay Styles */
.mobile-nav-toggle {
    display: none;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    align-items: center;
    gap: 6px;
}
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 998;
}
.sidebar-overlay.active {
    display: block;
}

@media (max-width: 768px) {
    .mobile-nav-toggle {
        display: inline-flex !important;
    }
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -280px !important;
        width: 260px !important;
        height: 100vh !important;
        z-index: 999 !important;
        transition: left 0.3s ease !important;
        overflow-y: auto !important;
        box-shadow: 4px 0 24px rgba(0,0,0,0.5) !important;
    }
    .sidebar.mobile-open {
        left: 0 !important;
    }
}


.nav-group { margin-bottom: 4px; }

/* Unified Top-Level Sidebar Styling for Links & Group Headers */
.sidebar > a,
.nav-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: 10px;
    color: #ffffff;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    opacity: 0.85;
    transition: all 0.15s ease;
    margin-bottom: 4px;
    text-decoration: none;
    box-sizing: border-box;
}

.sidebar > a:hover,
.nav-group-header:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #facc15 !important;
    opacity: 1;
}

.sidebar > a.active,
.nav-group.open > .nav-group-header {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #facc15 !important;
    opacity: 1 !important;
    font-weight: 700 !important;
    border-left: 3px solid #facc15;
    border-radius: 4px 10px 10px 4px;
}

/* Chevron Icon Styling */
.nav-group-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 8px;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.7);
    transition: transform 0.2s ease, color 0.2s ease, opacity 0.2s ease;
    line-height: 1;
    flex-shrink: 0;
    transform: rotate(-90deg);
}
.nav-group-header:hover .nav-group-chevron,
.nav-group.open .nav-group-chevron {
    color: #facc15 !important;
    opacity: 1;
    transform: rotate(0deg);
}

/* Submenu Container & Links Styling */
.nav-submenu {
    display: none;
    margin: 4px 0 8px 0;
    padding: 6px;
    background: var(--sidebar-submenu-bg);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    border: 1px solid var(--sidebar-submenu-border);
    border-radius: 12px;
    backdrop-filter: blur(12px);
}
.nav-group.open .nav-submenu {
    display: block !important;
}
.sidebar .nav-submenu a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px 8px 14px;
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 3px;
    border-radius: 8px;
    color: #ffffff;
    text-decoration: none;
    transition: all 0.15s ease;
}
.sidebar .nav-submenu a:last-child {
    margin-bottom: 0;
}
.sidebar .nav-submenu a:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #facc15 !important;
    opacity: 1;
}
.sidebar .nav-submenu a.active {
    background: rgba(250, 204, 21, 0.22) !important;
    color: #facc15 !important;
    opacity: 1 !important;
    font-weight: 700 !important;
    border-left: 3px solid #facc15;
    border-radius: 4px 8px 8px 4px;
}

/* Auto-extracted utilities */
.hr-input-base { width:100%; margin-top:4px; padding:8px; font-size:13px; border-radius:6px; background:var(--input-bg); color:var(--text-primary); border:1px solid var(--glass-border); }
.hr-label-uppercase { font-size:12px; color:var(--text-secondary); text-transform:uppercase; font-weight:600; }
.hr-label-base { font-size:13px; font-weight:600; margin-bottom:4px; display:block; }
.btn-sm-padding { font-size:12px; padding:6px 12px; }
.hr-subheading-sky { display:block; font-size:11px; font-weight:700; color:var(--accent-sky); margin-bottom:6px; text-transform:uppercase; letter-spacing:0.04em; }
.mb-16 { margin-bottom:16px; }
.mb-24 { margin-bottom:24px; }
.m-0 { margin:0; }
.opacity-70 { opacity:0.7; }

/* Messaging grid responsive styles */
@media (max-width: 768px) {
    .messaging-grid {
        grid-template-columns: 1fr !important;
        min-height: auto !important;
    }
}
