/* Shared editor dialogs & modal forms aligned with Pioneers Brand Guidelines */
.modal-backdrop > .employee-modal {
    width: min(760px, 100%);
    max-height: calc(100dvh - 48px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    padding: 0;
    background: #FCFAF6;
    border: 1px solid #D8D0C4;
    color: #181715;
    border-radius: 16px;
    box-shadow: 0 18px 45px rgba(24, 23, 21, 0.16);
}

.employee-modal > .modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 28px 18px;
    border-bottom: 1px solid #D8D0C4;
    background: #F2EEE6;
}

.employee-modal > .modal-header h2 {
    margin: 4px 0 4px;
    font-size: 20px;
    font-weight: 700;
    color: #181715;
    line-height: 1.35;
}

.employee-modal > .modal-header p {
    margin: 0;
    color: #746F68;
    font-size: 12px;
}

.employee-modal .close-button {
    width: 34px;
    height: 34px;
    flex: none;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid #D8D0C4;
    border-radius: 8px;
    background: #FFFFFF;
    color: #5B534A;
    font: 18px/1 inherit;
    cursor: pointer;
    transition: all 0.15s ease;
}

.employee-modal .close-button:hover {
    border-color: #7C193F;
    color: #7C193F;
    background: #FDF0F3;
}

.employee-modal > form {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 24px 28px 0;
}

.employee-modal .form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
}

.employee-modal .form-grid > label {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.employee-modal .form-grid > label > span {
    display: block;
    color: #181715;
    font-size: 11.5px;
    font-weight: 600;
}

.employee-modal .form-grid input,
.employee-modal .form-grid select,
.employee-modal .form-grid textarea {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    background: #FFFFFF;
    border: 1px solid #D8D0C4;
    border-radius: 8px;
    padding: 8px 12px;
    color: #181715;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.employee-modal .form-grid input:focus,
.employee-modal .form-grid select:focus,
.employee-modal .form-grid textarea:focus {
    border-color: #7C193F;
    box-shadow: 0 0 0 3px rgba(124, 25, 63, 0.08);
}

.employee-modal .validation-summary-errors {
    margin-bottom: 16px;
    padding: 10px 14px;
    border: 1px solid #F3C7D2;
    background: #FDF0F3;
    color: #7C193F;
    border-radius: 8px;
    font-size: 11.5px;
}

.employee-modal .validation-summary-errors ul { margin: 0; }

.employee-modal .modal-actions {
    position: sticky;
    bottom: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin: 24px -28px 0;
    padding: 16px 28px;
    border-top: 1px solid #D8D0C4;
    background: #F2EEE6;
}

/* Company editor: one deliberate scroll surface, with header/actions always visible. */
.company-editor-backdrop {
    overflow: hidden;
    padding: clamp(12px, 2.5vh, 28px);
}

.modal-backdrop > .company-editor-modal {
    width: min(1040px, 100%);
    max-height: calc(100dvh - clamp(24px, 5vh, 56px));
}

.company-editor-modal > .modal-header {
    flex: none;
}

.company-editor-modal > .company-editor-form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding: 0;
}

.company-editor-form > .validation-summary-errors {
    flex: none;
    margin: 16px 28px 0;
}

.company-editor-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding: 22px 28px 8px;
}

.company-editor-modal .modal-actions {
    position: static;
    flex: none;
    margin: 0;
    padding: 16px 28px;
}

@media (max-width: 640px) {
    .modal-backdrop { padding: 8px 8px 0; place-items: end center; }
    .modal-backdrop > .employee-modal {
        width: 100%;
        max-height: calc(100dvh - 8px);
        border-radius: 16px 16px 0 0;
    }
    .employee-modal > .modal-header { padding: 18px 16px 14px; }
    .employee-modal > form { padding: 18px 16px 0; }
    .employee-modal .form-grid { grid-template-columns: 1fr; gap: 14px; }
    .employee-modal .modal-actions { margin-inline: -16px; padding: 12px 16px; }
    .employee-modal .modal-actions > button { flex: 1; }
    .modal-backdrop > .company-editor-modal { max-height: calc(100dvh - 8px); }
    .company-editor-body { padding: 18px 16px 6px; }
    .company-editor-form > .validation-summary-errors { margin: 12px 16px 0; }
    .company-editor-modal .modal-actions { margin: 0; padding: 12px 16px; }
}

/* ==========================================================================
   Pioneers Access Denied & Security Authorization States
   Visual Identity: Royal Burgundy (#7C193F), Warm Gold (#B39A6D), Paper/Cream
   ========================================================================== */

.access-denied {
    min-height: 440px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 48px 28px;
    text-align: center;
    background: var(--brand-surface, #FFFFFF);
    border: 1px solid var(--brand-line-subtle, #EBE5DC);
    border-radius: 12px;
    box-shadow: var(--shadow-sm, 0 2px 10px rgba(24, 23, 21, 0.04));
    margin: 16px 0;
}

.access-denied.company-required {
    border-color: rgba(179, 154, 109, 0.4);
    background: linear-gradient(180deg, #FFFFFF 0%, #FAF7F2 100%);
}

.access-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(124, 25, 63, 0.06);
    border: 1px solid rgba(124, 25, 63, 0.14);
    color: var(--brand-burgundy, #7C193F);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.access-kicker .pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--brand-burgundy, #7C193F);
    box-shadow: 0 0 0 2px rgba(124, 25, 63, 0.2);
    animation: kickerPulse 2s infinite ease-in-out;
}

@keyframes kickerPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

.access-denied > .access-state-icon {
    width: 68px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--brand-burgundy, #7C193F);
    background: linear-gradient(135deg, rgba(124, 25, 63, 0.07) 0%, rgba(179, 154, 109, 0.12) 100%);
    border: 2px solid rgba(179, 154, 109, 0.35);
    box-shadow: 0 8px 20px rgba(124, 25, 63, 0.08);
}

.access-state-icon svg {
    width: 34px;
    height: 34px;
}

.access-denied h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: var(--brand-ink, #181715);
    font-family: 'IBM Plex Sans Arabic', 'Tajawal', 'Cairo', 'Manrope', sans-serif;
}

.access-denied p {
    max-width: 580px;
    margin: 0;
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--brand-muted, #746F68);
    font-family: 'IBM Plex Sans Arabic', 'Tajawal', 'Cairo', 'Manrope', sans-serif;
}

.access-context-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 16px 24px;
    padding: 12px 20px;
    background: var(--brand-paper, #FCFAF6);
    border: 1px solid var(--brand-line-subtle, #EBE5DC);
    border-radius: 8px;
    font-size: 12.5px;
    margin: 6px 0 10px;
}

.context-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.context-label {
    color: var(--brand-muted, #746F68);
    font-weight: 500;
}

.context-value {
    color: var(--brand-ink, #181715);
    font-weight: 700;
}

.access-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
}

.access-actions .primary-button {
    background: linear-gradient(135deg, #7C193F 0%, #5B112D 100%);
    color: #FFFFFF !important;
    border: 1px solid #651331;
    box-shadow: 0 4px 12px rgba(124, 25, 63, 0.2);
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 6px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.access-actions .primary-button:hover {
    background: linear-gradient(135deg, #8E1D48 0%, #6D1436 100%);
    box-shadow: 0 6px 16px rgba(124, 25, 63, 0.3);
    transform: translateY(-1px);
}

.access-actions .btn-soft {
    border: 1px solid var(--brand-line, #D8D0C4);
    background: var(--brand-surface, #FFFFFF);
    color: var(--brand-charcoal, #322E29);
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.access-actions .btn-soft:hover {
    background: var(--brand-cream, #F2EEE6);
    border-color: var(--brand-gold, #B39A6D);
    color: var(--brand-burgundy, #7C193F);
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid var(--brand-gold, #B39A6D);
    outline-offset: 2px;
}
