/* Admin page — inherits dark vars from app.css */

.admin-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    align-items: start;
    max-width: 1400px;
    margin: 24px auto;
    padding: 0 24px;
}

.employee-list-panel {
    position: sticky;
    top: 76px;
    max-height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
}

.employee-search {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.employee-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text);
}

.employee-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary), 0 0 8px var(--primary-glow);
}

.employee-items {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.employee-item {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.employee-item:hover { background: var(--surface-hover); }
.employee-item.active { background: var(--primary-glow); border-left: 3px solid var(--primary); }

.emp-info { min-width: 0; }

.emp-name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.emp-email {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.emp-right {
    flex-shrink: 0;
    text-align: right;
}

.emp-status {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.emp-status-enabled {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.emp-status-disabled {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.emp-status-none {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-muted);
    font-weight: 400;
    border: 1px solid transparent;
}

/* Permission editor */
.perm-editor { padding: 20px; }

.perm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.perm-header h3 { font-size: 16px; color: var(--text); }

.perm-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.switch-slider {
    position: absolute;
    inset: 0;
    background: var(--border-dark);
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.2s;
}

.switch-slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--text);
    border-radius: 50%;
    transition: transform 0.2s;
}

.switch input:checked + .switch-slider { background: var(--success); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); background: white; }

.perm-field {
    margin-bottom: 16px;
}

.perm-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-light);
}

.perm-field select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text);
}

.perm-field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary), 0 0 8px var(--primary-glow);
}

.restriction-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
}

.restriction-header {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text);
    transition: background 0.15s;
}

.restriction-header:hover { background: var(--surface-hover); }

.restriction-header .badge {
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.restriction-header .badge.empty {
    background: var(--surface-alt);
    color: var(--text-muted);
}

.restriction-body { padding: 10px 14px; }

.restriction-body.collapsed { display: none; }

.os-type-checks {
    display: flex;
    gap: 16px;
}

.os-type-checks label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    color: var(--text);
}

.os-type-checks input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* Tags */
.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--primary-glow);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 12px;
    font-size: 12px;
    color: #93bbfd;
}

.tag-remove {
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    color: var(--text-muted);
    border: none;
    background: none;
    padding: 0;
}

.tag-remove:hover { color: var(--danger); }

/* Restriction dropdown */
.restr-dropdown-wrap {
    margin-bottom: 4px;
}

.restr-search-wrap {
    margin-bottom: 6px;
}

.restr-search {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
    background: var(--input-bg);
    color: var(--text);
}

.restr-search:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary), 0 0 8px var(--primary-glow);
}

.restr-dropdown-list {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}

.restr-dropdown-list:empty {
    display: none;
}

.restr-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.1s;
    color: var(--text);
}

.restr-option:hover {
    background: var(--surface-hover);
}

.restr-option.selected {
    background: var(--primary-glow);
    color: #93bbfd;
}

.restr-option-check {
    width: 16px;
    flex-shrink: 0;
    text-align: center;
    font-size: 12px;
    color: var(--primary);
    font-weight: 700;
}

.restr-option-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.restr-dropdown-loading,
.restr-dropdown-hint {
    padding: 12px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

.restr-dropdown-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.restr-dropdown-loading .spinner-sm {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

/* Actions */
.perm-actions {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.perm-actions-left { display: flex; gap: 8px; }

.no-selection {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--text-muted);
    font-size: 14px;
}

@media (max-width: 900px) {
    .admin-layout { grid-template-columns: 1fr; }
    .employee-list-panel {
        position: static;
        max-height: 300px;
    }
}
