/* Keep native date/time controls legible in the Unfold dark theme. */
html.dark input[type="date"],
html.dark input[type="datetime-local"],
html.dark input[type="month"],
html.dark input[type="time"] {
    color-scheme: dark;
}

/* Native option popups are rendered on a light surface by Chromium even when
   the closed admin select is dark. Keep enabled choices dark and readable;
   reserve the muted color exclusively for choices disabled by workflow rules. */
html.dark select option,
html.dark select optgroup {
    background-color: #ffffff;
    color: #111827;
    color-scheme: light;
    opacity: 1;
}

html.dark select option:disabled {
    background-color: #ffffff;
    color: #cbd5e1;
    opacity: 1;
}

html.dark select option:checked {
    background-color: #2563eb;
    color: #ffffff;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.85;
}

/* Work permit date controls should not stretch their native picker to the row edge. */
input.work-permit-issue-date-input {
    max-width: 16rem;
}

/* Leave request dates use the same compact native picker as work permits. */
input.leave-request-date-input {
    max-width: 16rem;
}

input.work-permit-datetime-input {
    max-width: 20rem;
}

/* Keep invitation rows compact while retaining job-title and role context. */
.account-invitation-table th,
.account-invitation-table td {
    vertical-align: middle;
}

.account-invitation-role-column {
    max-width: 18rem;
    min-width: 18rem;
    width: 18rem;
}

.account-invitation-job-title {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-invitation-role-details,
.account-invitation-role-empty {
    color: #64748b;
    font-size: 0.75rem;
    line-height: 1rem;
    margin-top: 0.25rem;
}

.account-invitation-role-details summary {
    cursor: pointer;
    display: inline-flex;
    list-style: none;
    user-select: none;
}

.account-invitation-role-details summary::-webkit-details-marker {
    display: none;
}

.account-invitation-role-details summary::before {
    content: "+";
    font-weight: 700;
    margin-right: 0.25rem;
}

.account-invitation-role-details[open] summary::before {
    content: "−";
}

.account-invitation-role-list {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    color: #334155;
    margin-top: 0.375rem;
    padding: 0.5rem;
}

.account-invitation-role-list > div + div {
    border-top: 1px solid #e2e8f0;
    margin-top: 0.375rem;
    padding-top: 0.375rem;
}

html.dark .account-invitation-role-details,
html.dark .account-invitation-role-empty {
    color: #94a3b8;
}

html.dark .account-invitation-role-list {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

html.dark .account-invitation-role-list > div + div {
    border-color: #334155;
}

/* Work permit statuses stay on one line and retain contrast in both themes. */
.work-permit-status {
    align-items: center;
    background-color: var(--work-permit-status-bg, #f3f4f6);
    border-radius: 9999px;
    color: var(--work-permit-status-text, #1f2937);
    display: inline-flex;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25rem;
    padding: 0.125rem 0.5rem;
    white-space: nowrap;
}

.work-permit-status-draft {
    --work-permit-status-bg: #f3f4f6;
    --work-permit-status-text: #1f2937;
}

.work-permit-status-ready-for-review {
    --work-permit-status-bg: #fef9c3;
    --work-permit-status-text: #713f12;
}

.work-permit-status-signature-pending {
    --work-permit-status-bg: #fef3c7;
    --work-permit-status-text: #78350f;
}

.work-permit-status-active {
    --work-permit-status-bg: #d1fae5;
    --work-permit-status-text: #065f46;
}

.work-permit-status-suspended {
    --work-permit-status-bg: #ffedd5;
    --work-permit-status-text: #9a3412;
}

.work-permit-status-closed {
    --work-permit-status-bg: #dbeafe;
    --work-permit-status-text: #1e40af;
}

.work-permit-status-cancelled {
    --work-permit-status-bg: #fee2e2;
    --work-permit-status-text: #991b1b;
}

html.dark .work-permit-status-draft {
    --work-permit-status-bg: #374151;
    --work-permit-status-text: #f3f4f6;
}

html.dark .work-permit-status-ready-for-review {
    --work-permit-status-bg: #713f12;
    --work-permit-status-text: #fef08a;
}

html.dark .work-permit-status-signature-pending {
    --work-permit-status-bg: #78350f;
    --work-permit-status-text: #fde68a;
}

html.dark .work-permit-status-active {
    --work-permit-status-bg: #064e3b;
    --work-permit-status-text: #a7f3d0;
}

html.dark .work-permit-status-suspended {
    --work-permit-status-bg: #7c2d12;
    --work-permit-status-text: #fed7aa;
}

html.dark .work-permit-status-closed {
    --work-permit-status-bg: #1e3a8a;
    --work-permit-status-text: #dbeafe;
}

html.dark .work-permit-status-cancelled {
    --work-permit-status-bg: #7f1d1d;
    --work-permit-status-text: #fecaca;
}

/* Temporary assignment statuses use explicit colors because generated utility
   classes may not include dark variants in the compiled Unfold stylesheet. */
.temporary-assignment-status {
    align-items: center;
    background-color: var(--temporary-assignment-status-bg, #f3f4f6);
    border-radius: 9999px;
    color: var(--temporary-assignment-status-text, #1f2937);
    display: inline-flex;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25rem;
    padding: 0.125rem 0.5rem;
    white-space: nowrap;
}

.temporary-assignment-status-draft {
    --temporary-assignment-status-bg: #f3f4f6;
    --temporary-assignment-status-text: #1f2937;
}

.temporary-assignment-status-pending-hr {
    --temporary-assignment-status-bg: #ffedd5;
    --temporary-assignment-status-text: #9a3412;
}

.temporary-assignment-status-ready-to-print {
    --temporary-assignment-status-bg: #e0f2fe;
    --temporary-assignment-status-text: #075985;
}

.temporary-assignment-status-signature-pending {
    --temporary-assignment-status-bg: #fef3c7;
    --temporary-assignment-status-text: #78350f;
}

.temporary-assignment-status-active {
    --temporary-assignment-status-bg: #d1fae5;
    --temporary-assignment-status-text: #065f46;
}

.temporary-assignment-status-completed {
    --temporary-assignment-status-bg: #dbeafe;
    --temporary-assignment-status-text: #1e40af;
}

.temporary-assignment-status-cancelled {
    --temporary-assignment-status-bg: #fee2e2;
    --temporary-assignment-status-text: #991b1b;
}

html.dark .temporary-assignment-status-draft {
    --temporary-assignment-status-bg: #374151;
    --temporary-assignment-status-text: #f3f4f6;
}

html.dark .temporary-assignment-status-pending-hr {
    --temporary-assignment-status-bg: #7c2d12;
    --temporary-assignment-status-text: #fed7aa;
}

html.dark .temporary-assignment-status-ready-to-print {
    --temporary-assignment-status-bg: #0c4a6e;
    --temporary-assignment-status-text: #bae6fd;
}

html.dark .temporary-assignment-status-signature-pending {
    --temporary-assignment-status-bg: #78350f;
    --temporary-assignment-status-text: #fde68a;
}

html.dark .temporary-assignment-status-active {
    --temporary-assignment-status-bg: #064e3b;
    --temporary-assignment-status-text: #a7f3d0;
}

html.dark .temporary-assignment-status-completed {
    --temporary-assignment-status-bg: #1e3a8a;
    --temporary-assignment-status-text: #dbeafe;
}

html.dark .temporary-assignment-status-cancelled {
    --temporary-assignment-status-bg: #7f1d1d;
    --temporary-assignment-status-text: #fecaca;
}
