.ap-staff-dashboard {
    --ap-sidebar-width: 260px;
    align-items: start;
    display: grid;
    gap: 1.25rem;
    grid-template-columns: var(--ap-sidebar-width) minmax(0, 1fr);
    max-width: 1440px;
    transition: grid-template-columns 180ms ease;
}

.ap-staff-dashboard.is-sidebar-collapsed {
    --ap-sidebar-width: 88px;
}

.ap-staff-sidebar {
    align-self: start;
    background: var(--ap-primary);
    border: 1px solid #1e293b;
    border-radius: var(--ap-radius);
    box-shadow: var(--ap-shadow-md);
    color: var(--ap-primary-foreground);
    display: grid;
    gap: 1rem;
    padding: 1rem;
    position: -webkit-sticky;
    position: sticky;
    top: calc(20pt + var(--wp-admin--admin-bar--height, 0px)) !important;
}

.ap-staff-sidebar-header {
    align-items: start;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
}

.ap-staff-brand {
    align-items: center;
    border-bottom: 1px solid rgba(248, 250, 252, 0.12);
    display: flex;
    flex: 1 1 auto;
    gap: 0.75rem;
    min-width: 0;
    padding: 0.5rem 0.25rem 1rem;
}

.ap-staff-brand-mark {
    align-items: center;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.32), rgba(37, 99, 235, 0.12));
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 16px;
    color: #ffffff;
    display: inline-flex;
    font-size: 0.92rem;
    font-weight: 800;
    height: 44px;
    justify-content: center;
    letter-spacing: 0.08em;
    min-width: 44px;
    text-transform: uppercase;
}

.ap-staff-brand-copy {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
}

.ap-staff-brand span {
    color: #cbd5e1;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.ap-staff-brand strong {
    color: #ffffff;
    font-size: 1.2rem;
    letter-spacing: -0.03em;
}

.ap-staff-brand em {
    color: #94a3b8;
    font-size: 0.85rem;
    font-style: normal;
    font-weight: 600;
    line-height: 1.35;
}

.ap-staff-sidebar-toggle {
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 12px;
    color: #cbd5e1;
    display: inline-flex;
    flex: 0 0 auto;
    height: 40px;
    justify-content: center;
    margin-top: 0.25rem;
    min-width: 40px;
    padding: 0;
}

.ap-staff-sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.ap-staff-sidebar-toggle-icon,
.ap-nav-icon {
    align-items: center;
    display: inline-flex;
    justify-content: center;
}

.ap-staff-sidebar-toggle-icon svg,
.ap-nav-icon svg {
    height: 18px;
    width: 18px;
}

.ap-staff-nav {
    display: grid;
    gap: 0.35rem;
}

.ap-staff-nav a,
.ap-staff-logout {
    align-items: center;
    border-radius: var(--ap-radius-sm);
    color: #cbd5e1 !important;
    display: flex;
    gap: 0.75rem;
    font-size: 0.95rem;
    font-weight: 650;
    min-height: 40px;
    padding: 0.65rem 0.75rem;
    text-decoration: none;
    transition: background 140ms ease, color 140ms ease;
}

.ap-staff-nav a:hover,
.ap-staff-logout:hover {
    background: rgba(248, 250, 252, 0.08);
    color: #ffffff !important;
}

.ap-staff-nav a.is-active {
    background: #ffffff;
    color: var(--ap-primary) !important;
}

.ap-staff-nav a.is-active .ap-nav-icon,
.ap-staff-nav a.is-active .ap-nav-label {
    color: inherit;
}

.ap-nav-label {
    min-width: 0;
    white-space: nowrap;
}

.ap-staff-logout {
    border-top: 1px solid rgba(248, 250, 252, 0.12);
    margin-top: 0.5rem;
}

.ap-staff-dashboard.is-sidebar-collapsed .ap-staff-brand-copy,
.ap-staff-dashboard.is-sidebar-collapsed .ap-nav-label {
    display: none;
}

.ap-staff-dashboard.is-sidebar-collapsed .ap-staff-sidebar {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.ap-staff-dashboard.is-sidebar-collapsed .ap-staff-sidebar-header {
    flex-direction: column;
}

.ap-staff-dashboard.is-sidebar-collapsed .ap-staff-brand {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.ap-staff-dashboard.is-sidebar-collapsed .ap-staff-sidebar-toggle {
    align-self: center;
    margin-top: 0;
}

.ap-staff-dashboard.is-sidebar-collapsed .ap-staff-nav a,
.ap-staff-dashboard.is-sidebar-collapsed .ap-staff-logout {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.ap-staff-main {
    min-width: 0;
}

.ap-mobile-bottom-nav {
    display: none;
}

.ap-mobile-bottom-nav-label {
    min-width: 0;
    white-space: nowrap;
}

.ap-staff-main > .ap-wrap {
    margin: 0;
    max-width: none;
}

.ap-staff-main .ap-card {
    margin-bottom: 1rem;
}

.ap-staff-main .ap-form,
.ap-staff-main .ap-machine-form,
.ap-staff-main .ap-assign-form {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

.ap-staff-main .ap-form > .ap-grid,
.ap-staff-main .ap-machine-form > .ap-grid,
.ap-staff-main .ap-assign-form > .ap-grid {
    align-items: start;
    display: grid;
    gap: 1rem;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    width: 100%;
}

.ap-staff-main .ap-machine-grid {
    grid-template-columns: repeat(4, minmax(160px, 1fr)) !important;
}

.ap-staff-main .ap-form-actions,
.ap-staff-main .ap-form > .ap-button,
.ap-staff-main .ap-machine-form > .ap-form-actions,
.ap-staff-main .ap-assign-form > .ap-button,
.ap-staff-main .ap-assign-form > .ap-notice {
    grid-column: 1 / -1;
}

.ap-staff-main .ap-form .ap-button,
.ap-staff-main .ap-machine-form .ap-button,
.ap-staff-main .ap-assign-form .ap-button {
    min-width: 160px;
}

.ap-staff-main .ap-field-wide {
    grid-column: span 2;
}

.ap-staff-main .ap-field-status {
    grid-column: span 1;
}

.ap-staff-main .ap-settings-stack {
    display: grid;
    gap: 1.25rem;
    grid-column: 1 / -1;
}

.ap-staff-main .ap-settings-import-group {
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius-sm);
    padding: 1rem;
}

.ap-staff-main .ap-settings-import-header {
    margin-bottom: 0.9rem;
}

.ap-staff-main .ap-settings-import-header h4 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 0.2rem;
}

.ap-staff-main .ap-settings-import-header p {
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

.ap-staff-main .ap-settings-import-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ap-staff-main .ap-settings-tool {
    align-content: start;
    background: var(--ap-muted);
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius-sm);
    display: grid;
    gap: 0.8rem;
    padding: 1rem;
}

.ap-staff-main .ap-settings-tool label {
    gap: 0.4rem;
}

.ap-staff-main .ap-settings-columns {
    color: var(--ap-muted-foreground);
    font-size: 0.82rem;
    line-height: 1.45;
    margin: 0;
    overflow-wrap: anywhere;
}

.ap-staff-main .ap-settings-columns code {
    font-size: 0.78rem;
    white-space: normal;
    word-break: break-word;
}

.ap-staff-main .ap-settings-columns span {
    color: var(--ap-muted-foreground);
    display: inline-block;
    font-size: 0.78rem;
    margin-top: 0.25rem;
}

.ap-staff-main .ap-settings-tool .ap-button {
    align-self: start;
}

@media (max-width: 1100px) {
    .ap-staff-dashboard {
        grid-template-columns: 220px minmax(0, 1fr);
    }

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

    .ap-staff-main .ap-form > .ap-grid,
    .ap-staff-main .ap-machine-form > .ap-grid,
    .ap-staff-main .ap-assign-form > .ap-grid,
    .ap-staff-main .ap-machine-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr)) !important;
    }

    .ap-staff-main .ap-settings-import-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .ap-staff-dashboard {
        grid-template-columns: 1fr;
    }

    .ap-staff-dashboard.is-sidebar-collapsed {
        --ap-sidebar-width: 1fr;
    }

    .ap-staff-sidebar {
        position: static;
    }

    .ap-staff-dashboard-technician {
        gap: 0.85rem;
        padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    }

    .ap-staff-dashboard-technician .ap-staff-sidebar {
        gap: 0.75rem;
        padding: 0.85rem 1rem;
    }

    .ap-staff-sidebar-header {
        flex-direction: row;
    }

    .ap-staff-dashboard-technician .ap-staff-sidebar-header {
        align-items: center;
    }

    .ap-staff-dashboard-technician .ap-staff-brand {
        border-bottom: 0;
        padding: 0;
    }

    .ap-staff-dashboard-technician .ap-staff-brand-mark {
        height: 40px;
        min-width: 40px;
    }

    .ap-staff-dashboard-technician .ap-staff-brand strong {
        font-size: 1rem;
    }

    .ap-staff-dashboard-technician .ap-staff-brand em {
        font-size: 0.78rem;
    }

    .ap-staff-dashboard-technician .ap-staff-sidebar-toggle,
    .ap-staff-dashboard-technician .ap-staff-nav,
    .ap-staff-dashboard-technician .ap-staff-logout {
        display: none;
    }

    .ap-staff-dashboard.is-sidebar-collapsed .ap-staff-brand-copy,
    .ap-staff-dashboard.is-sidebar-collapsed .ap-nav-label {
        display: initial;
    }

    .ap-staff-dashboard.is-sidebar-collapsed .ap-staff-brand {
        justify-content: flex-start;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }

    .ap-staff-dashboard.is-sidebar-collapsed .ap-staff-nav a,
    .ap-staff-dashboard.is-sidebar-collapsed .ap-staff-logout {
        justify-content: flex-start;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

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

    .ap-staff-main .ap-form > .ap-grid,
    .ap-staff-main .ap-machine-form > .ap-grid,
    .ap-staff-main .ap-assign-form > .ap-grid,
    .ap-staff-main .ap-machine-grid {
        grid-template-columns: 1fr !important;
    }

    .ap-staff-main .ap-field-wide,
    .ap-staff-main .ap-field-status {
        grid-column: auto;
    }

    .ap-staff-dashboard-technician .ap-staff-main > .ap-wrap > h2:first-child {
        font-size: 1.9rem;
        line-height: 1.1;
        margin-bottom: 0.9rem;
    }

    .ap-staff-dashboard-technician .ap-staff-main .ap-card {
        margin-bottom: 0.85rem;
    }

    .ap-staff-dashboard-technician .ap-mobile-bottom-nav {
        align-items: stretch;
        backdrop-filter: blur(16px);
        background: rgba(15, 23, 42, 0.94);
        border: 1px solid rgba(148, 163, 184, 0.18);
        border-radius: 18px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 18px 38px rgba(15, 23, 42, 0.3);
        display: grid;
        gap: 0.45rem;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        left: 12px;
        padding: 0.55rem;
        position: fixed;
        right: 12px;
        z-index: 40;
    }

    .ap-staff-dashboard-technician .ap-mobile-bottom-nav a {
        align-items: center;
        border-radius: 14px;
        color: #cbd5e1 !important;
        display: grid;
        gap: 0.28rem;
        justify-items: center;
        min-height: 56px;
        padding: 0.45rem 0.35rem;
        text-align: center;
        text-decoration: none;
        transition: background 140ms ease, color 140ms ease, transform 140ms ease;
    }

    .ap-staff-dashboard-technician .ap-mobile-bottom-nav a .ap-nav-icon {
        color: inherit;
    }

    .ap-staff-dashboard-technician .ap-mobile-bottom-nav a .ap-nav-icon svg {
        height: 18px;
        width: 18px;
    }

    .ap-staff-dashboard-technician .ap-mobile-bottom-nav-label {
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 0.01em;
        line-height: 1.15;
        white-space: normal;
    }

    .ap-staff-dashboard-technician .ap-mobile-bottom-nav a.is-active {
        background: #ffffff;
        color: var(--ap-primary) !important;
        box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2);
    }

    .ap-staff-dashboard-technician .ap-mobile-bottom-nav-logout {
        background: rgba(248, 250, 252, 0.06);
    }
}
