/* Admin-specific styles */

/* Settings mode: hide admin-only elements, show only settings tabs */
.admin-header.settings-mode .admin-stats-row { display: none; }
.admin-header.settings-mode .admin-tab { display: none !important; }
.admin-header.settings-mode .admin-tab.settings-tab { display: inline-flex !important; }

/* Hide settings-only tabs when NOT in settings mode */
.admin-tab.settings-tab { display: none; }

/* Admin sidebar (standalone admin page) */
.admin-sidebar {
    width: 260px;
    height: 100%;
    background: #0f1724;
    border-right: 2px solid #1e293b;
    display: flex;
    flex-direction: column;
    padding: 25px 20px;
    flex-shrink: 0;
}

.admin-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.admin-logo .logo-icon {
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
}

.admin-logo .logo-text strong {
    color: #e2e8f0;
}

.admin-logo .logo-text span {
    color: #94a3b8;
}

.admin-nav-links {
    list-style: none;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.admin-nav-links li {
    padding: 12px 15px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    color: #94a3b8;
    font-weight: 600;
    transition: 0.2s;
}

.admin-nav-links li:hover,
.admin-nav-links li.active {
    background: #1e293b;
    color: #3b82f6;
    font-weight: 700;
}

.admin-nav-links li:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.admin-nav-links li i {
    width: 20px;
    text-align: center;
}

.admin-sidebar-footer {
    padding-top: 20px;
    border-top: 2px solid #1e293b;
}

.btn-back-dashboard {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #94a3b8;
    text-decoration: none;
    font-weight: 600;
    padding: 10px;
    border-radius: 8px;
    transition: 0.2s;
}

.btn-back-dashboard:hover {
    background: #1e293b;
    color: #e2e8f0;
}

/* Action buttons in tables */
.btn-action {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: 0.2s;
}

.btn-action-approve {
    background: #dcfce7;
    color: #15803d;
}
.btn-action-approve:hover {
    background: #bbf7d0;
}

.btn-action-refuse {
    background: #fee2e2;
    color: #b91c1c;
}
.btn-action-refuse:hover {
    background: #fecaca;
}

.btn-action-disable {
    background: #f1f5f9;
    color: #64748b;
}
.btn-action-disable:hover {
    background: #e2e8f0;
}

.btn-action-enable {
    background: #dbeafe;
    color: #1d4ed8;
}
.btn-action-enable:hover {
    background: #bfdbfe;
}

/* User avatar in tables */
.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-cell img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

.user-cell .user-meta {
    display: flex;
    flex-direction: column;
}

.user-cell .user-meta strong {
    font-weight: 700;
    font-size: 0.95rem;
}

.user-cell .user-meta span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.user-detail-link:hover strong {
    color: var(--primary);
    text-decoration: underline;
}

/* Role permission tags (legacy) */
.permission-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}

.permission-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Role Cards */
.role-card {
    background: var(--glass-bg, white);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    transition: border-color 0.2s;
}

.role-card:hover {
    border-color: var(--primary);
}

.role-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 8px;
}

.role-card-title h4 {
    margin: 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-card-actions {
    display: flex;
    gap: 4px;
}

.role-card-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.role-card-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.role-card-meta i {
    margin-right: 4px;
}

.role-card-permissions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* Permission Matrix */
.permission-group-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 16px 0 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

.permission-matrix {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.permission-matrix-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
    line-height: 1;
}

.permission-matrix-item:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.permission-matrix-item.checked,
.permission-matrix-item:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
}

.permission-matrix-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    flex-shrink: 0;
    accent-color: var(--primary);
    margin: 0;
    vertical-align: middle;
    cursor: pointer;
}

.permission-matrix-item label {
    cursor: pointer;
    margin: 0 !important;
    padding: 0;
    font-weight: 500;
    display: inline-flex !important;
    align-items: center;
    line-height: 1;
    white-space: nowrap;
}

/* Badge info */
.badge-info {
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

/* Logo upload area */
.logo-upload-area {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 6px;
}

.logo-preview {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), #60a5fa);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.logo-preview.has-logo {
    background: none;
    border: 2px solid var(--border);
}

.logo-preview-icon {
    color: #fff;
    font-size: 1.5rem;
}

.logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.logo-upload-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
}

.logo-upload-actions .btn-outline-small {
    cursor: pointer;
}

/* Character counter */
.char-counter {
    display: block;
    text-align: right;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 600;
}

/* Label with toggle */
.label-with-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.switch-small .slider {
    width: 36px;
    height: 20px;
}
.switch-small .slider:before {
    width: 16px;
    height: 16px;
}
.switch-small input:checked + .slider:before {
    transform: translateX(16px);
}

/* Branding preview */
.branding-preview-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--glass-bg);
}

.branding-preview-box .logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #60a5fa);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
    overflow: hidden;
}
.branding-preview-box .logo-icon.has-logo {
    background: none;
}

.branding-preview-box .logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.branding-preview-box .logo-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.branding-preview-box .logo-text strong {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.branding-preview-box .logo-text span {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Outline small button */
.btn-outline-small {
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    font-size: 0.82rem;
    font-weight: 700;
    font-family: inherit;
    color: var(--text-secondary);
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-outline-small:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.btn-outline-small.danger-action {
    color: var(--danger);
}
.btn-outline-small.danger-action:hover {
    border-color: var(--danger);
    background: #fef2f2;
}

/* Role select in user table */
.role-select {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--glass-bg);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    min-width: 140px;
}
.role-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

/* Groups button */
.btn-action-groups {
    background: var(--primary-light, #eff6ff);
    color: var(--primary, #1d4ed8);
}
.btn-action-groups:hover {
    background: var(--primary-light, #dbeafe);
}
.btn-action-groups i {
    margin-right: 3px;
}

/* Actions cell */
.actions-cell {
    white-space: nowrap;
    vertical-align: middle;
}
.actions-cell > * {
    vertical-align: middle;
}
.actions-cell > * + * {
    margin-left: 4px;
}

/* Group checkboxes in modal */
.group-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

.checkbox-item:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    flex-shrink: 0;
    accent-color: var(--primary);
    cursor: pointer;
    margin: 0;
    vertical-align: middle;
}

.checkbox-item label {
    cursor: pointer;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.2;
}

.checkbox-item .text-muted {
    font-weight: 400;
    font-size: 0.85rem;
}

/* Global checkbox alignment fix */
input[type="checkbox"] {
    vertical-align: middle;
    margin: 0;
    flex-shrink: 0;
}

/* System role indicator */
.system-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Auth methods card */
.auth-methods-card {
    max-width: 100%;
}

.auth-methods-card > p {
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.auth-method-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.auth-method-item:hover {
    border-color: var(--primary);
}

.auth-method-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    gap: 12px;
}

.auth-method-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.auth-method-info > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.auth-method-info strong {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
}

.auth-method-info .text-muted {
    font-size: 0.82rem;
}

.auth-method-icon {
    font-size: 1.3rem;
    width: 24px;
    text-align: center;
    color: var(--primary);
    flex-shrink: 0;
}

.auth-method-icon.sso-icon {
    width: 22px;
    height: 22px;
}

.auth-method-config {
    padding: 0 18px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.auth-method-config .form-group:first-child,
.auth-method-config .auth-config-subtitle:first-child {
    margin-top: 14px;
}

.auth-config-subtitle {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-config-subtitle i {
    color: var(--primary);
    font-size: 0.9rem;
}

.auth-method-config .switch-group {
    padding: 8px 0;
}

/* SSO icon on login page */
.sso-icon {
    flex-shrink: 0;
}

.btn-sso .sso-icon {
    width: 20px;
    height: 20px;
}

/* Group card clickable */
.group-card-clickable {
    cursor: pointer;
}

.group-card-clickable:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Group detail modal */
.group-detail-add {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
}

.group-detail-add .btn-sm {
    white-space: nowrap;
    padding: 7px 14px;
    font-size: 0.85rem;
}

/* Group edit fields in modal */
.group-edit-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.group-edit-fields .form-group {
    margin-bottom: 0;
}

.group-edit-fields .btn-outline-small {
    align-self: flex-start;
    transition: 0.2s;
}

.group-edit-fields .btn-outline-small.has-changes {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.group-detail-separator {
    height: 1px;
    background: var(--border, #e2e8f0);
    margin: 18px 0;
}

.group-detail-section-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary, #0f172a);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.group-detail-section-title i {
    color: var(--primary, #1d4ed8);
    font-size: 0.9rem;
}

.group-members-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.group-member-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 8px;
    transition: background 0.15s;
}

.group-member-item:hover {
    background: var(--surface, #f8fafc);
}

.group-member-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.group-member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--primary-light, #eff6ff);
    display: flex;
    align-items: center;
    justify-content: center;
}

.group-member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.member-avatar-initials {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--primary, #1d4ed8);
}

.group-member-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.group-member-meta strong {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-primary, #0f172a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-member-meta span {
    font-size: 0.8rem;
    color: var(--text-muted, #94a3b8);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Margin utility */
.mt-3 {
    margin-top: 16px;
}

.mb-3 {
    margin-bottom: 16px;
}

/* Admin Header */
.admin-header-top {
    margin-bottom: 24px;
}

.admin-header-top h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.admin-header-top h2 i {
    margin-right: 8px;
}

/* Stats Cards Row */
.admin-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.admin-stat-card {
    background: var(--glass-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: border-color 0.2s;
}

.admin-stat-card:hover {
    border-color: var(--primary);
}

.admin-stat-card-active {
    border-color: var(--border);
}

.admin-stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 4px;
}

.admin-stat-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 4px;
}

/* Admin Card Header */
.admin-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.admin-card-header h3 {
    margin: 0;
}

/* Admin toolbar right */
.admin-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Invite info box */
.invite-info {
    background: var(--primary-light);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    color: var(--primary);
    font-size: 0.9rem;
}

.invite-info i {
    margin-right: 8px;
}

/* Button small variant */
.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
}

/* Settings Form Grid */
.settings-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 24px;
}

/* Admin Tabs - add icons */
.admin-tab i {
    margin-right: 6px;
    font-size: 0.85rem;
}

/* Preview sidebar mini */
.preview-sidebar-mini {
    background: var(--glass-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    max-width: 220px;
}

.preview-nav-items {
    margin-top: 16px;
}

.preview-nav-item {
    padding: 6px 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-radius: 6px;
    margin-bottom: 2px;
}

.preview-nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.preview-nav-item i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
}

.preview-user-area {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.preview-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--border);
}

.preview-user-text strong {
    display: block;
    font-size: 0.75rem;
}

.preview-user-text span {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .admin-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .settings-form-grid {
        grid-template-columns: 1fr;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .auth-method-header {
        padding: 12px 14px;
    }

    .auth-method-info strong {
        font-size: 0.88rem;
    }

    .auth-method-info .text-muted {
        font-size: 0.78rem;
    }

    .auth-header-right {
        gap: 8px;
    }

    .auth-status-badge {
        font-size: 0.65rem;
        padding: 1px 6px;
        max-width: 140px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .auth-missing-fields {
        display: none;
    }

    .group-detail-add {
        flex-direction: column;
    }

    .group-detail-add select {
        width: 100%;
    }

    .group-detail-add .btn-sm {
        width: 100%;
        justify-content: center;
    }
}

/* Icon Picker */
.icon-picker-field {
    display: flex; align-items: center; gap: 10px;
}
.icon-picker-preview {
    width: 42px; height: 42px; border: 2px solid var(--border); border-radius: 8px;
    display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
    color: var(--text-primary); background: var(--surface); flex-shrink: 0;
}
.icon-picker-btn {
    padding: 8px 14px; border: 2px solid var(--border); border-radius: 8px;
    background: var(--surface, white); color: var(--primary); font-weight: 600; font-size: 0.85rem;
    cursor: pointer; transition: 0.2s;
}
.icon-picker-btn:hover { border-color: var(--primary); background: var(--primary-light, #f0f4ff); }
.icon-picker-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.icon-picker-dropdown {
    background: var(--surface, white); border: 2px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15); padding: 12px;
    max-height: 280px; overflow-y: auto; margin-top: 6px;
}
.icon-picker-search {
    width: 100%; padding: 8px 12px; border: 2px solid var(--border); border-radius: 8px;
    font-size: 0.9rem; margin-bottom: 10px; font-family: inherit;
}
.icon-picker-search:focus { outline: none; border-color: var(--primary); }
.icon-picker-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 4px;
}
.icon-picker-item {
    width: 42px; height: 42px; border: 2px solid transparent; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    font-size: 1.1rem; color: var(--text-secondary); transition: 0.15s; background: none;
    padding: 0;
}
.icon-picker-item:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light, #f0f4ff); }
.icon-picker-item.active { border-color: var(--primary); color: var(--primary); background: var(--primary-light, #dbeafe); }
.icon-picker-item:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

/* ---- Custom Fields Editor ---- */
.custom-fields-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.custom-field-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--surface, #f8fafc);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
}
.custom-field-row-grip {
    cursor: grab;
    color: var(--text-secondary, #94a3b8);
    padding: 4px;
    flex-shrink: 0;
}
.custom-field-row-fields {
    display: flex;
    flex: 1;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.custom-field-row-fields .cf-name {
    flex: 1;
    min-width: 120px;
    padding: 6px 10px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    font-size: 0.9rem;
    background: var(--bg, #fff);
    color: var(--text);
}
.custom-field-row-fields .cf-type {
    width: 150px;
    padding: 6px 10px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    font-size: 0.9rem;
    background: var(--bg, #fff);
    color: var(--text);
}
.cf-required-label, .cf-booking-label {
    font-size: 0.85rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}
.cf-dragging {
    opacity: 0.4;
}
.cf-drag-over {
    border-color: var(--primary, #1d4ed8);
    box-shadow: 0 0 0 2px rgba(29,78,216,0.2);
}
.emplacement-header td {
    background: var(--surface, #f1f5f9);
    padding: 10px 16px !important;
    border-top: 2px solid var(--border, #e2e8f0);
    font-size: 0.9rem;
}
.emplacement-header i {
    color: var(--primary, #1d4ed8);
    margin-right: 4px;
}
.btn-icon-small {
    background: none;
    border: none;
    color: var(--text-secondary, #94a3b8);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: 0.15s;
}
.btn-icon-small:hover {
    color: var(--danger, #ef4444);
    background: rgba(239, 68, 68, 0.1);
}
.cf-file-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.cf-file-name {
    font-size: 0.85rem;
    color: var(--text-secondary, #64748b);
    word-break: break-all;
}
.cf-image-preview {
    max-width: 100px;
    max-height: 60px;
    border-radius: 4px;
    border: 1px solid var(--border, #e2e8f0);
    margin-top: 5px;
}
.cf-value-item {
    font-size: 0.85rem;
    margin-top: 4px;
}
.cf-value-item a {
    color: var(--primary);
    text-decoration: underline;
}
@media (max-width: 600px) {
    .custom-field-row-fields {
        flex-direction: column;
        align-items: stretch;
    }
    .custom-field-row-fields .cf-type {
        width: 100%;
    }
}

/* ---- Notifications ---- */
.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 0;
}
.form-row .form-group {
    flex: 1;
}

/* Webhook items */
.webhook-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    margin-bottom: 8px;
    background: var(--surface, #f8fafc);
    transition: opacity 0.2s;
}
.webhook-item-info {
    flex: 1;
    min-width: 0;
}
.webhook-item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.btn-outline-small {
    padding: 6px 10px;
    font-size: 0.8rem;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    background: transparent;
    color: var(--text, #0f172a);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.btn-outline-small:hover {
    background: var(--primary, #3b82f6);
    color: #fff;
    border-color: var(--primary, #3b82f6);
}
.btn-danger-outline:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

/* Webhook type badges */
.webhook-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
    margin-left: 6px;
}
.webhook-badge-slack { background: #e8d5f5; color: #611f8e; }
.webhook-badge-teams { background: #dbeafe; color: #1e40af; }
.webhook-badge-discord { background: #e0e7ff; color: #3730a3; }
.webhook-badge-custom { background: #f1f5f9; color: #475569; }

/* Event triggers matrix */
.event-matrix-table {
    width: 100%;
}
.event-matrix-table th,
.event-matrix-table td {
    padding: 10px 14px;
}
.event-matrix-table td.text-center,
.event-matrix-table th.text-center {
    text-align: center;
}
.event-matrix-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary, #3b82f6);
}
.table-responsive {
    overflow-x: auto;
}

/* Responsive notifications */
@media (max-width: 700px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    .webhook-item {
        flex-direction: column;
        align-items: flex-start;
    }
    .webhook-item-actions {
        margin-top: 8px;
    }
}

/* Provider info box (OAuth redirect URI) */
.provider-info-box {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 18px;
}

.provider-info-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    color: #0369a1;
    font-size: 0.92rem;
}

.provider-info-header i {
    font-size: 1rem;
}

.provider-info-field {
    margin-top: 10px;
}

.provider-info-field > label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #0c4a6e;
    margin-bottom: 4px;
}

.copyable-field {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--glass-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
}

.copyable-field code {
    flex: 1;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
    color: #0f172a;
    word-break: break-all;
    user-select: all;
}

.btn-copy {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.btn-copy:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.btn-copy.copied {
    color: #16a34a;
}

/* Dark theme overrides for provider info box */
body.theme-dark .provider-info-box {
    background: #1e293b;
    border-color: #334155;
}

body.theme-dark .provider-info-header {
    color: #7dd3fc;
}

body.theme-dark .provider-info-field > label {
    color: #bae6fd;
}

body.theme-dark .copyable-field {
    background: #0f172a;
    border-color: #475569;
}

body.theme-dark .copyable-field code {
    color: #e2e8f0;
}

body.theme-dark .btn-copy {
    color: #94a3b8;
}

body.theme-dark .btn-copy:hover {
    background: #334155;
    color: #e2e8f0;
}

/* Auth header right: badge + missing stacked, toggle on the side */
.auth-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.auth-header-right .auth-status-indicator {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

/* Auth status badges — only shown for incomplete/configured/active */
.auth-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    vertical-align: middle;
    margin-left: 6px;
    white-space: nowrap;
}

.auth-status-badge:empty {
    display: none;
}

.auth-status-badge.status-incomplete {
    background: #fef3c7;
    color: #92400e;
}

.auth-status-badge.status-configured {
    background: #dbeafe;
    color: #1e40af;
}

.auth-status-badge.status-active {
    background: #dcfce7;
    color: #166534;
}

/* Missing fields — under badge, right-aligned */
.auth-missing-fields {
    font-size: 0.72rem;
    color: #b45309;
    font-weight: 400;
    white-space: nowrap;
    text-align: right;
}

/* Toggle tooltip on incomplete */
.switch[title] {
    cursor: help;
}

/* Dark theme */
body.theme-dark .auth-status-badge.status-incomplete {
    background: #451a03;
    color: #fcd34d;
}

body.theme-dark .auth-status-badge.status-configured {
    background: #1e3a5f;
    color: #93c5fd;
}

body.theme-dark .auth-status-badge.status-active {
    background: #14532d;
    color: #86efac;
}

body.theme-dark .auth-missing-fields {
    color: #fbbf24;
}



/* Auth test button & result */
.auth-test-btn {
    margin-top: 12px;
}

.auth-test-result {
    display: inline-block;
    margin-left: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    vertical-align: middle;
}

.auth-test-result:empty {
    display: none;
}

.auth-test-success {
    color: #16a34a;
}

.auth-test-error {
    color: #dc2626;
}

body.theme-dark .auth-test-success {
    color: #4ade80;
}

body.theme-dark .auth-test-error {
    color: #f87171;
}

/* =============================================
   UX POLISH - ADMIN (DSFR / MySondage style)
   ============================================= */

/* Admin container - full width like other pages */
.admin-container {
    padding: 0;
    width: 100%;
}

/* =============================================
   SETTINGS 2-COLUMN LAYOUT (like MySondage)
   ============================================= */
.settings-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    align-items: start;
}

@media (max-width: 1024px) {
    .settings-layout {
        grid-template-columns: 1fr;
    }
}

/* =============================================
   LOGO UPLOAD - DRAG-DROP ZONE (like MySondage)
   ============================================= */
.logo-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg, 12px);
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--surface);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.logo-upload-area:hover,
.logo-upload-area.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.logo-upload-area.dragover {
    border-style: solid;
}

.logo-upload-area:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.logo-upload-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.logo-upload-preview i {
    font-size: 2rem;
    color: var(--text-muted);
    opacity: 0.5;
}

.logo-upload-preview p {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.logo-upload-preview img {
    max-width: 120px;
    max-height: 80px;
    object-fit: contain;
    border-radius: var(--radius, 8px);
    border: 2px solid var(--border);
    background: var(--glass-bg);
    padding: 8px;
}

.logo-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* =============================================
   STORAGE TAB
   ============================================= */
.storage-mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.storage-mode-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--surface);
}

.storage-mode-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.storage-mode-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 1px var(--primary);
}

.storage-mode-icon {
    font-size: 1.8rem;
    color: var(--text-muted);
    width: 48px;
    text-align: center;
}

.storage-mode-card.selected .storage-mode-icon {
    color: var(--primary);
}

.storage-mode-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.storage-mode-info strong {
    font-size: 0.95rem;
}

.storage-mode-info .text-muted {
    font-size: 0.78rem;
}

.storage-config-section {
    padding-top: 8px;
}

.file-type-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.file-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    cursor: pointer;
    transition: all 0.2s;
    min-width: 110px;
    text-align: center;
    background: var(--surface);
}

.file-type-card:hover {
    border-color: var(--primary);
}

.file-type-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-type-card i {
    font-size: 1.5rem;
}

.file-type-card strong {
    font-size: 0.82rem;
}

/* =============================================
   COLOR PICKER GROUP (like MySondage)
   ============================================= */
.color-picker-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-picker-input,
.color-picker-group input[type="color"] {
    width: 44px !important;
    height: 44px;
    padding: 2px;
    border: 2px solid var(--border);
    border-radius: var(--radius, 8px);
    cursor: pointer;
    background: none;
    flex-shrink: 0;
}

.color-picker-input::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-picker-input::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-hex-input {
    width: 110px !important;
    max-width: 110px;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius, 8px);
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.88rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-primary);
    background: var(--glass-bg);
    transition: border-color 0.2s;
}

.color-hex-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 29, 78, 216), 0.1);
}

/* =============================================
   PREVIEW SIDEBAR (like MySondage)
   ============================================= */
.branding-preview {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    background: var(--glass-bg);
    margin-top: 16px;
}

.preview-sidebar {
    display: flex;
    flex-direction: column;
    min-height: 360px;
    background: var(--glass-bg);
    padding: 16px 12px;
}

.preview-logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    margin-bottom: 20px;
}

.preview-logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.95rem;
    flex-shrink: 0;
    overflow: hidden;
}

.preview-logo-icon.has-logo {
    background: none;
}

.preview-logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-logo-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.preview-logo-text strong {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-primary);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-logo-text span {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.preview-nav-item {
    padding: 8px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 6px;
}

.preview-nav-item i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
}

.preview-nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.preview-user-area {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.preview-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
}

.preview-user-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.preview-user-text strong {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.preview-user-text span {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* Admin header refinement */
.admin-header {
    margin-bottom: 0;
    gap: 0;
}

.admin-header-top h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-header-top p {
    margin-top: 2px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Stats cards - hover animation */
.admin-stat-card {
    transition: border-color 0.2s;
}

.admin-stat-card:hover {
    border-color: var(--primary);
}

/* Tabs refinement */
.admin-tabs {
    display: flex;
    gap: 4px;
    border: none;
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    margin-top: 0;
    margin-bottom: 0;
    background: none;
    padding: 0 0 4px 0;
    border-radius: 0;
    flex-wrap: nowrap;
}

.admin-tabs::-webkit-scrollbar {
    height: 4px;
}
.admin-tabs::-webkit-scrollbar-track {
    background: transparent;
}
.admin-tabs::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.admin-tab {
    padding: 10px 16px;
    border: none;
    border-radius: 0;
    background: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    margin-bottom: 0;
    transition: 0.2s;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: none;
}

.admin-tab i {
    font-size: 0.85rem;
    margin-right: 2px;
}

.admin-tab:hover {
    color: var(--primary);
    background: none;
}

.admin-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: none;
    box-shadow: none;
    border-radius: 0;
}

.admin-tab:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

/* Panel spacing */
.admin-panel {
    padding-top: 0;
}

/* Cards refinement */
.admin-card {
    background: var(--glass-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: none;
}

.admin-card:hover {
    border-color: var(--border-hover);
}

.admin-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-card h3 i {
    color: var(--primary);
    font-size: 1rem;
}

/* Table refinement */
.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.88rem;
}

.admin-table thead th {
    background: var(--surface);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 14px;
    border-bottom: 2px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.admin-table thead th:first-child {
    border-radius: 8px 0 0 0;
}

.admin-table thead th:last-child {
    border-radius: 0 8px 0 0;
}

.admin-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.admin-table tbody tr:hover {
    background: var(--surface);
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

/* Search bar refinement */
.search-bar {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

.search-bar i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.search-bar input {
    padding-left: 36px;
    width: 100%;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding-top: 9px;
    padding-bottom: 9px;
    font-size: 0.88rem;
    transition: border-color 0.2s;
}

.search-bar input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(29,78,216,0.1);
}

/* Filter select refinement */
.admin-toolbar select,
.admin-toolbar input[type="date"],
.filter-group select {
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--glass-bg);
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.2s;
    font-family: inherit;
}

.admin-toolbar select:focus,
.admin-toolbar input[type="date"]:focus,
.filter-group select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(29,78,216,0.1);
}

/* Button refinements */
.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-primary:active {
    transform: scale(0.97);
}

/* Action buttons in tables - refined */
.btn-action {
    padding: 5px 12px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-action-approve { border-color: #bbf7d0; }
.btn-action-refuse { border-color: #fecaca; }
.btn-action-disable { border-color: #e2e8f0; }
.btn-action-enable { border-color: #bfdbfe; }

.btn-action-profile { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.btn-action-profile:hover { background: #bfdbfe; }

/* Badge refinement */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: var(--success-light, #dcfce7); color: var(--success, #15803d); }
.badge-warning { background: var(--warning-light, #fef3c7); color: var(--warning, #b45309); }
.badge-danger { background: var(--danger-light, #fee2e2); color: var(--danger, #b91c1c); }
.badge-muted { background: var(--surface, #f1f5f9); color: var(--text-muted, #64748b); }

/* Groups grid */
.groups-grid, .roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* Group card */
.group-card {
    background: var(--glass-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.group-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.group-card h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.group-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.group-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.group-actions {
    display: flex;
    gap: 6px;
}

/* Switch toggle refinement */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 24px;
}

.switch .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--glass-bg, white);
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.switch input:checked + .slider {
    background-color: var(--primary);
}

.switch input:checked + .slider:before {
    transform: translateX(20px);
}

.switch input:focus + .slider {
    box-shadow: 0 0 0 3px rgba(29,78,216,0.15);
}

/* Switch group */
.switch-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.switch-group:last-child {
    border-bottom: none;
}

.switch-group label:first-child {
    font-weight: 500;
    font-size: 0.88rem;
    color: var(--text-primary);
}

/* Form inputs refinement */
.form-group input[type="text"]:not(.color-hex-input),
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--glass-bg);
    transition: border-color 0.2s;
    font-family: inherit;
}

/* Date inputs styling (DSFR) */
.form-group input[type="date"] {
    appearance: none;
    -webkit-appearance: none;
    min-height: 42px;
    font-family: inherit;
    color-scheme: light;
}

body.theme-dark .form-group input[type="date"] {
    color-scheme: dark;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(29,78,216,0.1);
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-group label i {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.form-group {
    margin-bottom: 20px;
}

/* Notification event */
.notification-event {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.notification-event:last-child {
    border-bottom: none;
}

/* Export dropdown */
.export-dropdown {
    position: relative;
    display: inline-block;
}
.export-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: var(--glass-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 50;
    min-width: 140px;
    padding: 4px 0;
}
.export-dropdown-menu.open {
    display: block;
}
.export-dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: none;
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}
.export-dropdown-menu button:hover {
    background: var(--primary-light);
}
.export-dropdown-menu .fa-file-csv { color: #15803d; }
.export-dropdown-menu .fa-file-excel { color: #166534; }
.export-dropdown-menu .fa-file-pdf { color: #b91c1c; }

/* Access mode radio cards (visitor settings) */
.access-mode-option {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    margin: 0;
}
.access-mode-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}
.access-mode-option .access-mode-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    width: 100%;
    background: var(--glass-bg, #fff);
    border: 1.5px solid var(--border, #e2e8f0);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.access-mode-option .access-mode-label i { font-size: 1.05rem; color: var(--text-muted, #64748b); }
.access-mode-option:hover .access-mode-label { border-color: var(--primary, #1e3a5f); }
.access-mode-option input[type="radio"]:checked + .access-mode-label {
    border-color: var(--primary, #1e3a5f);
    background: var(--primary-light, #eff6ff);
    color: var(--primary, #1e3a5f);
}
.access-mode-option input[type="radio"]:checked + .access-mode-label i { color: var(--primary, #1e3a5f); }
.access-mode-option input[type="radio"]:focus-visible + .access-mode-label {
    outline: 3px solid var(--primary, #1e3a5f);
    outline-offset: 2px;
}

/* Filter date group */
.filter-date-group {
    display: flex;
    align-items: center;
    gap: 6px;
}
.filter-date-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Scrollbar for table container */
.admin-table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 70vh;
    border-radius: 8px;
    border: 1px solid var(--border);
    -webkit-overflow-scrolling: touch;
}

.admin-card > .admin-table-container {
    border: none;
    border-top: 1px solid var(--border);
    border-radius: 0;
    margin: 0 -20px -20px;
    padding: 0;
}

.admin-table-container .admin-table {
    margin-bottom: 0;
}

/* Journal */
.user-cell-mini {
    display: flex;
    align-items: center;
    gap: 8px;
}

.avatar-xs {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.text-nowrap {
    white-space: nowrap;
}

.text-sm {
    font-size: 0.82rem;
}

.badge-info { background: var(--primary-light, #dbeafe); color: var(--primary, #1d4ed8); }
.badge-warning { background: var(--warning-light, #fef3c7); color: var(--warning, #b45309); }
.badge-muted { background: var(--surface, #f1f5f9); color: var(--text-muted, #64748b); }

.journal-pagination .btn-outline-small.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* =============================================
   AUDIT TOOLBAR (MySondage-style)
   ============================================= */

.audit-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 0;
    background: transparent;
    border-bottom: none;
    flex-wrap: wrap;
}

.audit-toolbar-search {
    position: relative;
    flex: 1;
    min-width: 160px;
    max-width: 260px;
}

.audit-toolbar-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.audit-toolbar-search input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    border: 2px solid var(--border, #e2e8f0);
    border-radius: 10px;
    background: var(--glass-bg, #fff);
    color: var(--text-primary);
    font-size: 0.86rem;
    font-family: inherit;
    height: 40px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.audit-toolbar-search input:focus {
    outline: none;
    border-color: var(--primary, #1e3a5f);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.08);
}

.audit-toolbar-select {
    padding: 8px 14px;
    border: 2px solid var(--border, #e2e8f0);
    border-radius: 10px;
    background: var(--glass-bg, #fff);
    color: var(--text-secondary, #334155);
    font-size: 0.86rem;
    font-family: inherit;
    height: 40px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-width: 140px;
    cursor: pointer;
}

.audit-toolbar-select:focus {
    outline: none;
    border-color: var(--primary, #1e3a5f);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.08);
}

.audit-toolbar-dates {
    display: flex;
    align-items: center;
    gap: 8px;
}

.audit-toolbar-date {
    padding: 8px 12px;
    border: 2px solid var(--border, #e2e8f0);
    border-radius: 10px;
    background: var(--glass-bg, #fff);
    color: var(--text-primary);
    font-size: 0.86rem;
    font-family: inherit;
    height: 40px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.audit-toolbar-date:focus {
    outline: none;
    border-color: var(--primary, #1e3a5f);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.08);
}

.audit-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.86rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    height: 40px;
    box-sizing: border-box;
}

.audit-toolbar-btn-export {
    border: 2px solid var(--border, #e2e8f0);
    background: var(--glass-bg, #fff);
    color: var(--text-secondary, #334155);
}

.audit-toolbar-btn-export:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(30, 58, 95, 0.04);
}

.audit-toolbar-btn-delete {
    border: 2px solid #dc2626;
    background: #dc2626;
    color: #fff;
}

.audit-toolbar-btn-delete:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

/* Audit table — clean style matching visitor tables */
.audit-table {
    border-collapse: separate;
    border-spacing: 0;
}

.audit-table thead th {
    background: transparent;
    color: var(--text-muted, #64748b);
    font-weight: 700;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border, #e2e8f0);
    border-top: none;
}

.audit-table tbody td {
    padding: 14px 14px;
    border-bottom: 1px solid var(--border, #e2e8f0);
    font-size: 0.88rem;
    vertical-align: middle;
}

.audit-table tbody tr:hover {
    background: var(--surface, #f8fafc);
}

.audit-table tbody tr:last-child td {
    border-bottom: none;
}

.audit-table th:first-child,
.audit-table td:first-child {
    width: 30px;
    text-align: center;
    padding-left: 12px;
    padding-right: 4px;
}

.audit-table td:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.audit-table input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

/* Journal card — elevated like visitor cards */
#admin-tab-journal .admin-card {
    border-radius: 18px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.03);
    border: none;
}

#admin-tab-journal .admin-table-container {
    border: none;
    border-top: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .audit-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .audit-toolbar-search {
        max-width: 100%;
    }
    .audit-toolbar-dates {
        flex-direction: column;
    }
    .audit-toolbar-date {
        width: 100%;
    }
}

body.theme-dark .badge-info { background: #1e3a5f; color: #93c5fd; }
body.theme-dark .badge-warning { background: #451a03; color: #fcd34d; }
body.theme-dark .badge-muted { background: #1e293b; color: #94a3b8; }
body.theme-dark .badge-success { background: #14532d; color: #86efac; }
body.theme-dark .badge-danger { background: #7f1d1d; color: #fca5a5; }

/* =============================================
   RESPONSIVE - TABLET (max-width: 1024px)
   ============================================= */
@media (max-width: 1024px) {
    .settings-layout {
        grid-template-columns: 1fr;
    }
    .settings-form-grid {
        grid-template-columns: 1fr;
    }
    .permission-matrix {
        gap: 4px;
    }
    .permission-matrix-item {
        font-size: 0.78rem;
        padding: 5px 10px;
    }
}

/* =============================================
   RESPONSIVE - MOBILE (max-width: 768px)
   ============================================= */
@media (max-width: 768px) {
    .admin-container {
        padding: 16px 12px;
    }

    .admin-header-top h2 {
        font-size: 1.2rem;
    }

    /* Stats cards: 2 colonnes sur mobile */
    .admin-stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 16px;
    }

    .admin-stat-card {
        padding: 14px 10px;
    }

    .admin-stat-number {
        font-size: 1.5rem;
    }

    .admin-stat-label {
        font-size: 0.7rem;
    }

    /* Tabs: scroll horizontal sur mobile */
    .admin-tabs {
        margin-top: 16px;
        gap: 0;
        -webkit-overflow-scrolling: touch;
    }

    .admin-tab {
        padding: 10px 14px;
        font-size: 0.8rem;
    }

    .admin-tab span {
        display: none;
    }

    .admin-tab i {
        display: inline;
        margin-right: 0;
        font-size: 1rem;
    }

    /* Toolbar */
    .admin-toolbar {
        flex-direction: column;
        gap: 10px;
    }

    .admin-toolbar-right {
        width: 100%;
        flex-wrap: wrap;
    }

    .admin-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* Search bar full width */
    .search-bar {
        max-width: none;
        min-width: 0;
        width: 100%;
    }

    /* Table: scroll horizontal */
    .admin-table-container {
        margin: 0 -12px;
        padding: 0 12px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .admin-table {
        font-size: 0.82rem;
    }

    .admin-table thead th {
        padding: 8px 10px;
        font-size: 0.72rem;
    }

    .admin-table tbody td {
        padding: 10px;
    }

    /* Actions cell: stack on mobile */
    .actions-cell {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    .actions-cell > * + * {
        margin-left: 0;
    }

    .btn-action {
        font-size: 0.72rem;
        padding: 4px 8px;
        width: 100%;
        justify-content: center;
    }

    /* Cards: grids single column */
    .admin-card {
        padding: 16px;
        margin-bottom: 12px;
    }

    .groups-grid, .roles-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .role-card, .group-card {
        padding: 16px;
    }

    /* Auth methods */
    .auth-method-header {
        flex-wrap: wrap;
        padding: 12px;
        gap: 8px;
    }

    .auth-header-right {
        width: 100%;
        justify-content: space-between;
        margin-top: 4px;
    }

    .auth-method-config {
        padding: 0 12px 12px;
    }

    /* Forms */
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .settings-form-grid {
        grid-template-columns: 1fr;
    }

    /* Logo upload */
    .logo-upload-area {
        flex-direction: column;
        text-align: center;
    }

    /* Webhook items */
    .webhook-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .webhook-item-actions {
        width: 100%;
        margin-top: 8px;
    }

    /* Filters */
    .admin-filters {
        flex-direction: column;
    }

    .admin-filters .search-input {
        min-width: 0;
        width: 100%;
    }

    .admin-filter-select {
        width: 100%;
        min-width: 0;
    }

    /* Pagination */
    .admin-pagination button {
        width: 32px;
        height: 32px;
        font-size: 0.78rem;
    }

    .admin-pagination .pagination-info {
        font-size: 0.75rem;
        margin: 0 6px;
    }

    /* Branding preview */
    .branding-preview-box {
        padding: 10px;
    }

    /* Custom fields */
    .custom-field-row {
        flex-direction: column;
        align-items: stretch;
    }

    .custom-field-row-fields {
        flex-direction: column;
    }

    .custom-field-row-fields .cf-type {
        width: 100%;
    }

    /* Modal full width on mobile */
    .modal-box {
        width: 95%;
        max-width: none;
        max-height: 90vh;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-header {
        padding: 14px 16px;
    }

    .modal-footer {
        padding: 12px 16px;
    }

    /* Group detail modal */
    .group-detail-add {
        flex-direction: column;
    }

    .group-detail-add select {
        width: 100%;
    }

    .group-detail-add .btn-sm {
        width: 100%;
        justify-content: center;
    }
}

/* =============================================
   RESPONSIVE - SMALL MOBILE (max-width: 480px)
   ============================================= */
@media (max-width: 480px) {
    .admin-stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .admin-stat-card {
        padding: 12px 8px;
    }

    .admin-stat-number {
        font-size: 1.3rem;
    }

    .admin-tab {
        padding: 8px 10px;
        font-size: 0.75rem;
    }

    .btn-primary {
        padding: 8px 14px;
        font-size: 0.82rem;
        width: 100%;
        justify-content: center;
    }

    .role-select {
        min-width: 110px;
        font-size: 0.8rem;
    }

    /* Hide less important columns on very small screens */
    .admin-table .hide-mobile {
        display: none;
    }

    .user-cell .user-meta span {
        display: none;
    }

    .confirm-box {
        padding: 20px 16px 16px;
    }

    .confirm-actions {
        flex-direction: column;
    }

    .confirm-actions .btn {
        width: 100%;
    }
}

/* ========== VISITOR UI REDESIGN ========== */

/* KPI stat cards — security desk style */
.kpi-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.kpi-card {
    background: var(--glass-bg, #fff);
    border: none;
    border-radius: 18px;
    padding: 24px 26px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.03);
    transition: box-shadow 0.2s, transform 0.15s;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kpi-card:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.kpi-card-primary {
    background: var(--primary, #1e3a5f);
    color: #fff;
}

.kpi-card-green {
    border: 2px solid #22c55e;
}

.kpi-card-primary .kpi-label {
    color: rgba(255, 255, 255, 0.75);
}

.kpi-card-primary .kpi-number {
    color: #fff;
}

.kpi-card-primary .kpi-sub {
    color: rgba(255, 255, 255, 0.6);
}

.kpi-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-number {
    font-size: 2.6rem;
    font-weight: 800;
    color: var(--text-primary, #0f172a);
    line-height: 1.1;
    letter-spacing: -1px;
    margin: 4px 0;
}

.kpi-sub {
    font-size: 0.78rem;
    color: var(--text-muted, #64748b);
    display: flex;
    align-items: center;
    gap: 5px;
}

.kpi-badge-up {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #15803d;
    background: rgba(34, 197, 94, 0.15);
    padding: 2px 8px;
    border-radius: 10px;
}

.kpi-card-primary .kpi-badge-up {
    color: #86efac;
    background: rgba(134, 239, 172, 0.15);
}

@media (max-width: 900px) {
    .kpi-stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
}

@media (max-width: 600px) {
    .kpi-stats-row {
        grid-template-columns: 1fr 1fr;
    }
    .kpi-number {
        font-size: 1.8rem;
    }
    .kpi-card {
        padding: 18px 20px;
    }
}

/* Visitor stat cards — elevated with icon bubble */
.visitor-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.visitor-stat-card {
    background: var(--glass-bg, #fff);
    border: none;
    border-radius: 18px;
    padding: 24px 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.03);
    transition: box-shadow 0.2s, transform 0.15s;
}

.visitor-stat-card:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
    transform: translateY(-2px);
}

.visitor-stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.visitor-stat-icon.blue { background: #dbeafe; color: #1e40af; }
.visitor-stat-icon.orange { background: #ffedd5; color: #c2410c; }
.visitor-stat-icon.green { background: #dcfce7; color: #15803d; }
.visitor-stat-icon.gray { background: #f1f5f9; color: #475569; }

.visitor-stat-info {
    flex: 1;
    min-width: 0;
}

.visitor-stat-number {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary, #0f172a);
    line-height: 1;
    letter-spacing: -0.5px;
}

.visitor-stat-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-top: 6px;
}

/* Quick actions tools over history table */
.visitor-top-widgets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 18px;
    align-items: stretch;
}

.visitor-history-wrapper {
    width: 100%;
    overflow-x: auto;
    /* hide scrollbar superficially but keep scrollable */
    scrollbar-width: thin;
}

.visitor-sidebar-card {
    background: var(--glass-bg, #fff);
    border-radius: 18px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.03);
    overflow: hidden;
}

.visitor-sidebar-card-inner {
    padding: 0;
}

.secdesk-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1.5px solid var(--border, #e2e8f0);
    border-radius: 20px;
    background: var(--glass-bg, #fff);
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.secdesk-filter-btn:hover {
    border-color: var(--primary, #1e3a5f);
    color: var(--primary, #1e3a5f);
    background: #f1f5f9;
}
.secdesk-filter-btn:focus-visible {
    outline: 2px solid var(--primary, #1e3a5f);
    outline-offset: 2px;
}
/* Default active = primary */
.secdesk-filter-btn.active {
    background: var(--primary, #1e3a5f);
    color: #fff;
    border-color: var(--primary, #1e3a5f);
}
.secdesk-filter-btn.active:hover {
    background: var(--primary-dark, #162d4a);
    color: #fff;
}
/* Attendu = bleu info */
.secdesk-filter-btn.filter-expected {
    color: #92400e; border-color: #fde68a;
}
.secdesk-filter-btn.filter-expected:hover {
    background: #fffbeb; border-color: #f59e0b;
}
.secdesk-filter-btn.filter-expected.active {
    background: #f59e0b; color: #fff; border-color: #f59e0b;
}
/* Present = vert */
.secdesk-filter-btn.filter-checked_in {
    color: #15803d; border-color: #bbf7d0;
}
.secdesk-filter-btn.filter-checked_in:hover {
    background: #f0fdf4; border-color: #15803d;
}
.secdesk-filter-btn.filter-checked_in.active {
    background: #15803d; color: #fff; border-color: #15803d;
}
/* Parti = gris */
.secdesk-filter-btn.filter-checked_out {
    color: #64748b; border-color: #e2e8f0;
}
.secdesk-filter-btn.filter-checked_out:hover {
    background: #f1f5f9; border-color: #64748b;
}
.secdesk-filter-btn.filter-checked_out.active {
    background: #64748b; color: #fff; border-color: #64748b;
}
/* Annule = rouge */
.secdesk-filter-btn.filter-cancelled {
    color: #b91c1c; border-color: #fecaca;
}
.secdesk-filter-btn.filter-cancelled:hover {
    background: #fef2f2; border-color: #b91c1c;
}
.secdesk-filter-btn.filter-cancelled.active {
    background: #b91c1c; color: #fff; border-color: #b91c1c;
}

.visitor-history-card {
    border-radius: 18px !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.03) !important;
    border: none;
}

.visitor-history-card > .admin-table {
    width: 100%;
    font-size: 0.86rem;
}

/* Compact table cells to prevent overflow */
.visitor-history-card .admin-table th,
.visitor-history-card .admin-table td {
    padding: 12px 10px;
    white-space: normal;
    word-break: break-word;
}

.visitor-history-card .admin-table th:last-child,
.visitor-history-card .admin-table td:last-child {
    text-align: right;
}

/* Clickable rows */
.visitor-history-card .admin-table tr[role="button"]:hover {
    background: var(--primary-light, #eff6ff);
}

.visitor-history-card .admin-table tr[role="button"]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.visitor-history-card.border-green {
    border: 2px solid #22c55e !important;
}

.visitor-history-card .admin-table {
    border-collapse: separate;
    border-spacing: 0;
}

.visitor-history-card .admin-table thead th {
    background: transparent;
    border-top: none;
}

.visitor-history-card .admin-table thead th:first-child {
    border-radius: 0;
}

.visitor-history-card .admin-table thead th:last-child {
    border-radius: 0;
}

/* Visitor history filters — uniform style matching search bar */
.visitor-history-card select,
.visitor-history-card input[type="date"] {
    border: 2px solid var(--border, #e2e8f0);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 0.86rem;
    color: var(--text-secondary, #334155);
    background: var(--glass-bg, #fff);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    height: 40px;
    box-sizing: border-box;
}

.visitor-history-card select:focus,
.visitor-history-card input[type="date"]:focus {
    border-color: var(--primary, #1e3a5f);
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.08);
}

.visitor-history-card .search-bar input {
    height: 40px;
    border-radius: 10px;
    box-sizing: border-box;
}

.visitor-history-card .filter-date-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
}

/* Weekly chart bars */
.visitor-weekly-bar {
    flex: 1;
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: height 0.3s ease;
    background: #c7d2fe;
}

.visitor-weekly-bar.today {
    background: var(--primary, #1e3a5f);
}

/* Pagination numerotee */
.visitor-pagination {
    display: flex;
    align-items: center;
    gap: 2px;
}

.visitor-pagination button,
.visitor-pagination span {
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted, #64748b);
    transition: background 0.15s, color 0.15s;
}

.visitor-pagination button:hover {
    background: var(--surface, #f1f5f9);
}

.visitor-pagination button.active {
    background: var(--primary, #1e3a5f);
    color: #fff;
}

/* Old grid — keep for backwards compat but unused */
.visitor-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    align-items: start;
}

/* Badge "En direct" — green pulse */
.badge-live {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #15803d;
    background: #f0fdf4;
    border: 1px solid #86efac;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.badge-live::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    animation: live-pulse 1.5s ease-in-out infinite;
}

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

/* Visitor card list */
.visitor-card-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 68vh;
    overflow-y: auto;
}

.visitor-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 4px;
    border-bottom: 1px solid var(--border, #e2e8f0);
    transition: background 0.12s;
}

.visitor-card:last-child {
    border-bottom: none;
}

.visitor-card:hover {
    background: var(--surface, #f8fafc);
}

.visitor-card.status-checked-out {
    opacity: 0.5;
}

.visitor-card.status-cancelled {
    opacity: 0.35;
}

/* Visitor avatar — round with status dot */
.visitor-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
    color: #1e3a5f;
    background: #e0e7ff;
    position: relative;
    letter-spacing: 0.5px;
}

.visitor-avatar .status-indicator {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2.5px solid #fff;
}

.visitor-avatar .status-indicator.expected { background: #f59e0b; }
.visitor-avatar .status-indicator.checked_in { background: #22c55e; }
.visitor-avatar .status-indicator.checked_out { background: #94a3b8; }
.visitor-avatar .status-indicator.cancelled { background: #ef4444; }

.visitor-card-info {
    flex: 1;
    min-width: 0;
}

.visitor-card-name {
    font-weight: 700;
    font-size: 0.94rem;
    color: var(--text-primary, #0f172a);
    line-height: 1.3;
}

.visitor-card-meta {
    font-size: 0.8rem;
    color: var(--text-muted, #64748b);
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    line-height: 1.4;
}

.visitor-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.visitor-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.visitor-card:hover .visitor-card-actions {
    opacity: 1;
}

/* Visitor empty state */
.visitor-empty {
    text-align: center;
    padding: 56px 24px;
    color: var(--text-muted, #64748b);
}

.visitor-empty-icon {
    font-size: 3.5rem;
    color: var(--text-muted, #cbd5e1);
    margin-bottom: 16px;
}

.visitor-empty h4 {
    font-weight: 700;
    font-size: 1rem;
    margin: 0 0 8px;
    color: var(--text-primary, #0f172a);
}

.visitor-empty p {
    font-size: 0.88rem;
    margin: 0;
    line-height: 1.5;
}

/* Security desk code input — centered, prominent */
.secdesk-code-zone {
    text-align: center;
    padding: 32px 24px;
}

.secdesk-code-input {
    text-transform: uppercase;
    letter-spacing: 8px;
    font-weight: 800;
    font-size: 1.6rem;
    text-align: center;
    width: 100%;
    max-width: 340px;
    margin: 0 auto;
    border: 2px solid var(--border, #e2e8f0);
    border-radius: 14px;
    padding: 16px 24px;
    background: var(--surface, #f8fafc);
    color: var(--text-primary, #0f172a);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.secdesk-code-input::placeholder {
    letter-spacing: 12px;
    color: var(--text-muted, #cbd5e1);
}

.secdesk-code-input:focus {
    border-color: var(--primary, #1e3a5f);
    box-shadow: 0 0 0 4px rgba(30, 58, 95, 0.08);
    background: var(--glass-bg, #fff);
}

/* FAB - Floating Action Button (pill with text) */
.visitor-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    border-radius: 16px;
    background: var(--primary, #1e3a5f);
    color: #fff;
    border: none;
    box-shadow: 0 6px 24px rgba(30, 58, 95, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.92rem;
    font-weight: 700;
    padding: 16px 24px;
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 50;
    white-space: nowrap;
}

.visitor-fab:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(30, 58, 95, 0.45);
}

.visitor-fab:focus-visible {
    outline: 3px solid var(--primary, #1e3a5f);
    outline-offset: 4px;
}

/* Security desk table — visitor cell with avatar */
.secdesk-visitor-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Security desk table — compact columns */
#secdesk-table {
    font-size: 0.84rem;
}

#secdesk-table th,
#secdesk-table td {
    padding: 10px 10px;
    white-space: nowrap;
}

#secdesk-table .secdesk-visitor-cell {
    white-space: normal;
    min-width: 180px;
}

/* History card in visitor-grid needs elevated look too */
.visitor-grid > .admin-card {
    border-radius: 18px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.03);
    border: none;
}

@media (max-width: 1100px) {
    .visitor-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .visitor-top-widgets {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .visitor-stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
}

@media (max-width: 600px) {
    .visitor-stats-row {
        grid-template-columns: 1fr;
    }
    .visitor-stat-card {
        padding: 18px 16px;
    }
    .visitor-stat-number {
        font-size: 1.6rem;
    }
    .visitor-stat-icon {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }
    .visitor-fab {
        bottom: 16px;
        right: 16px;
        width: 52px;
        height: 52px;
    }
}

/* =============================================
   DARK THEME - ADMIN OVERRIDES
   ============================================= */
body.theme-dark .btn-action-groups { background: var(--primary-light); color: #93c5fd; }
body.theme-dark .btn-action-groups:hover { background: #1e3a5f; }
body.theme-dark .btn-outline-small.danger-action:hover { background: rgba(239,68,68,0.15); }
body.theme-dark .webhook-badge-slack { background: #2e1065; color: #d8b4fe; }
body.theme-dark .webhook-badge-teams { background: #1e3a5f; color: #93c5fd; }
body.theme-dark .webhook-badge-discord { background: #1e1b4b; color: #a5b4fc; }
body.theme-dark .webhook-badge-custom { background: var(--surface); color: var(--text-secondary); }
body.theme-dark .switch .slider { background-color: #475569; }
body.theme-dark .switch .slider:before { background-color: #e2e8f0; }
body.theme-dark .switch-small .slider { background-color: #475569; }
body.theme-dark .switch-small .slider:before { background-color: #e2e8f0; }
body.theme-dark .icon-picker-btn:hover { background: var(--primary-light); }
body.theme-dark .icon-picker-item:hover { background: var(--primary-light); }
body.theme-dark .icon-picker-item.active { background: #1e3a5f; }
body.theme-dark .btn-action-profile { background: var(--primary-light); color: #93c5fd; }
body.theme-dark .btn-action-profile:hover { background: var(--primary); color: #fff; }
body.theme-dark .auth-method-item { border-color: var(--border); }
body.theme-dark .auth-method-config { background: var(--surface); border-color: var(--border); }
body.theme-dark .visitor-stat-card { background: var(--glass-bg); box-shadow: 0 2px 12px rgba(0,0,0,0.2); }
body.theme-dark .visitor-stat-icon.blue { background: #1e3a5f; color: #93c5fd; }
body.theme-dark .visitor-stat-icon.orange { background: #7c2d12; color: #fdba74; }
body.theme-dark .visitor-stat-icon.green { background: #14532d; color: #86efac; }
body.theme-dark .visitor-stat-icon.gray { background: var(--surface); color: var(--text-secondary); }
body.theme-dark .visitor-sidebar-card { background: var(--glass-bg); }
body.theme-dark .kpi-card { background: var(--glass-bg); }
body.theme-dark .secdesk-filter-btn:hover { background: var(--surface); }
body.theme-dark .secdesk-filter-btn.filter-expected { color: #fcd34d; border-color: #78350f; }
body.theme-dark .secdesk-filter-btn.filter-expected:hover { background: #451a03; border-color: #f59e0b; }
body.theme-dark .secdesk-filter-btn.filter-checked_in { color: #86efac; border-color: #14532d; }
body.theme-dark .secdesk-filter-btn.filter-checked_in:hover { background: #052e16; border-color: #22c55e; }
body.theme-dark .secdesk-filter-btn.filter-checked_out { color: var(--text-secondary); border-color: var(--border); }
body.theme-dark .secdesk-filter-btn.filter-checked_out:hover { background: var(--surface); border-color: var(--text-secondary); }
body.theme-dark .secdesk-filter-btn.filter-cancelled { color: #fca5a5; border-color: #7f1d1d; }
body.theme-dark .secdesk-filter-btn.filter-cancelled:hover { background: #450a0a; border-color: #ef4444; }
body.theme-dark .secdesk-code-input { background: var(--surface); border-color: var(--border); color: var(--text-primary); }
body.theme-dark .secdesk-code-input:focus { background: var(--surface); }
body.theme-dark .visitor-history-card { background: var(--glass-bg); }
