/* ============================================
   ImportPanel v5.0 - Settings Page (Expanded)
   ============================================ */

/* ---- Settings Search ---- */
.settings-search-wrap {
    margin-bottom: 16px;
}

.settings-search-box {
    position: relative;
    max-width: 400px;
}

.settings-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
    pointer-events: none;
}

input.settings-search-input {
    width: 100%;
    padding: 10px 36px 10px 44px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-surface);
    color: var(--color-text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    box-sizing: border-box;
}

.settings-search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.settings-search-input::placeholder {
    color: var(--color-text-secondary);
}

.settings-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast), background-color var(--transition-fast);
}

.settings-search-clear:hover {
    color: var(--color-text);
    background-color: var(--color-border-light);
}

/* ---- Settings Tabs ---- */
.settings-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px;
    background: var(--color-border-light, #f1f5f9);
    border-radius: 12px;
    margin-bottom: 4px;
    /* Ensure scrollbar is accessible */
    scrollbar-width: thin;
    scrollbar-color: var(--color-border, #cbd5e1) transparent;
    -ms-overflow-style: auto;
    /* Right-edge fade to hint more content */
    mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent 100%);
}

/* Remove fade mask when scrolled to end or not overflowing */
.settings-tabs:not(.is-overflowing) {
    mask-image: none;
    -webkit-mask-image: none;
}

.settings-tabs.scrolled-end {
    mask-image: linear-gradient(to left, #000 calc(100% - 24px), transparent 100%);
    -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 24px), transparent 100%);
}

.settings-tabs.scrolled-middle {
    mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 24px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 24px), transparent 100%);
}

/* WebKit custom scrollbar */
.settings-tabs::-webkit-scrollbar {
    height: 4px;
}

.settings-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.settings-tabs::-webkit-scrollbar-thumb {
    background-color: var(--color-border, #cbd5e1);
    border-radius: 4px;
}

.settings-tabs::-webkit-scrollbar-thumb:hover {
    background-color: var(--color-text-secondary, #94a3b8);
}

.settings-tab {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    white-space: nowrap;
    transition: color 200ms ease, background-color 200ms ease, box-shadow 200ms ease;
    position: relative;
    border-radius: 8px;
}

.settings-tab:hover {
    color: var(--color-text);
    background-color: rgba(0, 0, 0, 0.04);
}

.settings-tab:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
    border-radius: 8px;
}

.settings-tab.active {
    color: var(--color-primary);
    background-color: var(--color-surface, #fff);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    font-weight: 600;
}

.settings-tab.active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2.5px;
    border-radius: 2px;
    background-color: var(--color-primary);
}

.settings-tab.search-highlight {
    background-color: rgba(59, 130, 246, 0.08);
}

.settings-tab-icon {
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 200ms ease;
}

.settings-tab.active .settings-tab-icon {
    opacity: 1;
}

/* ---- Unsaved Changes Dot on Tab ---- */
.settings-tab-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--color-warning, #f59e0b);
    margin-left: 4px;
    vertical-align: middle;
    animation: settingsDotPulse 1.5s ease-in-out infinite;
}

@keyframes settingsDotPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ---- Settings Content ---- */
.settings-content {
    padding: 24px 0;
}

/* ---- Tab Content Transition ---- */
.settings-tab-content {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 200ms ease, transform 200ms ease;
}

.settings-tab-content.entering {
    animation: settingsTabEnter 200ms ease forwards;
}

.settings-tab-content.exiting {
    opacity: 0;
    transform: translateY(6px);
}

@keyframes settingsTabEnter {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Settings Search Highlight ---- */
.settings-search-highlight {
    background-color: #fef08a;
    color: #854d0e;
    padding: 1px 2px;
    border-radius: 2px;
    font-weight: 500;
}

/* ---- Settings Section ---- */
.settings-section {
    max-width: 1100px;
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border-light, #ebeef3);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    border-left: 3px solid transparent;
    transition: border-color 400ms ease, background-color 400ms ease, box-shadow 200ms ease;
}

.settings-section:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.settings-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 4px;
}

/* ---- Save Success Flash ---- */
.settings-section.save-success {
    border-left-color: var(--color-success, #22c55e);
    background-color: rgba(34, 197, 94, 0.04);
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.12);
}

.settings-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-section-icon {
    font-size: 20px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.settings-section-desc {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin: 0 0 20px 0;
    line-height: 1.5;
}

.settings-subsection-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 16px 0;
}

/* ---- Setting Row ---- */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0;
    border-bottom: 1px solid var(--color-border-light, #ebeef3);
    gap: 16px;
}

.setting-row:first-child {
    padding-top: 4px;
}

.setting-row:last-child {
    border-bottom: none;
    padding-bottom: 4px;
}

.setting-row-stacked {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

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

.setting-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 2px;
}

.setting-desc {
    font-size: 13px;
    color: var(--color-text-secondary);
    line-height: 1.4;
}

.setting-control {
    flex-shrink: 0;
}

.setting-control-wide {
    width: 100%;
}

.setting-control select {
    padding: 9px 32px 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background-color: var(--color-surface);
    color: var(--color-text);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    min-width: 160px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 200ms ease, box-shadow 200ms ease;
}

.setting-control select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

/* ---- Text Input in Settings ---- */
.settings-text-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background-color: var(--color-surface);
    color: var(--color-text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 200ms ease, box-shadow 200ms ease;
    box-sizing: border-box;
}

.settings-text-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.settings-text-input::placeholder {
    color: var(--color-text-muted);
}

/* ---- Toggle Switch ---- */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-border, #dfe3ea);
    border-radius: 26px;
    transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    border-radius: 50%;
    transition: transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.06);
}

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

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

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.toggle-switch:hover .toggle-slider {
    background-color: var(--color-border-dark, #c8cdd5);
}

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

/* ---- Theme Mode Selector ---- */
.theme-mode-selector {
    display: flex;
    gap: 4px;
    background: var(--color-border-light, #f1f5f9);
    border-radius: 10px;
    padding: 4px;
}

.theme-mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 16px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: none;
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 200ms ease;
    min-width: 64px;
}

.theme-mode-btn:hover {
    color: var(--color-text);
    background-color: rgba(255, 255, 255, 0.6);
}

.theme-mode-btn.active {
    color: var(--color-primary);
    background-color: var(--color-surface);
    border-color: var(--color-primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    font-weight: 600;
}

/* ---- Accent Color Picker ---- */
.accent-color-picker {
    display: flex;
    gap: 10px;
    align-items: center;
}

.accent-color-swatch {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1), border-color 200ms ease, box-shadow 200ms ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    position: relative;
}

.accent-color-swatch::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: border-color 200ms ease, opacity 200ms ease;
    opacity: 0;
}

.accent-color-swatch:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}

.accent-color-swatch:hover::after {
    border-color: var(--color-border);
    opacity: 1;
}

.accent-color-swatch.active {
    border-color: var(--color-text);
    box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-primary);
    transform: scale(1.1);
}

.accent-color-swatch.active::after {
    border-color: var(--color-primary);
    opacity: 0.5;
}

/* ---- Profile Avatar Section ---- */
.profile-avatar-section {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.profile-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.profile-avatar:hover::after {
    content: 'Zmien kolor';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    background: var(--color-text);
    color: var(--color-bg, #fff);
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1;
}

.profile-avatar-initial {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
    line-height: 1;
}

.profile-avatar-info {
    flex: 1;
    min-width: 0;
}

.profile-avatar-info .setting-label {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.profile-avatar-info .setting-desc {
    font-size: 13px;
}

/* ---- Profile Color Picker ---- */
.profile-color-picker {
    padding: 12px 0;
    margin-bottom: 4px;
}

.profile-color-picker-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: 10px;
}

.profile-color-swatches {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.profile-color-swatch {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1), border-color 200ms ease, box-shadow 200ms ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    position: relative;
}

.profile-color-swatch::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: border-color 200ms ease, opacity 200ms ease;
    opacity: 0;
}

.profile-color-swatch:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}

.profile-color-swatch:hover::after {
    border-color: var(--color-border);
    opacity: 1;
}

.profile-color-swatch.active {
    border-color: var(--color-text);
    box-shadow: 0 0 0 2px var(--color-surface, #fff), 0 0 0 4px var(--color-primary);
    transform: scale(1.1);
}

.profile-color-swatch.active::after {
    border-color: var(--color-primary);
    opacity: 0.5;
}

/* ---- Profile Badge ---- */
.profile-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

.profile-badge.admin {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.profile-badge.manager {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
}

.profile-badge.user {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

/* ---- Profile Fields ---- */
.profile-field {
    margin-bottom: 16px;
}

.profile-field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    display: block;
    margin-bottom: 4px;
}

.profile-field input {
    width: 100%;
    height: 42px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 0 14px;
    font-size: 14px;
    font-family: inherit;
    background-color: var(--color-surface);
    color: var(--color-text);
    box-sizing: border-box;
    transition: border-color 200ms ease, box-shadow 200ms ease;
}

.profile-field input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.profile-field input:read-only {
    background: var(--color-bg, #f5f7fa);
    color: var(--color-text-muted, #94a3b8);
    cursor: not-allowed;
}

.profile-field-value {
    font-size: 14px;
    color: var(--color-text);
    padding-top: 4px;
}

/* ---- Profile Section Title (password divider) ---- */
.profile-section-title {
    font-size: 15px;
    font-weight: 600;
    margin-top: 28px;
    margin-bottom: 16px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border-light, #ebeef3);
    color: var(--color-text);
}

/* ---- Password Change Form ---- */
.password-change-form {
    max-width: 400px;
}

.password-change-form .profile-field input {
    height: 40px;
}

/* ---- Password Strength Indicator ---- */
.password-strength {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.password-strength-bar {
    flex: 1;
    height: 4px;
    background-color: var(--color-border-light, #e2e8f0);
    border-radius: 2px;
    overflow: hidden;
}

.password-strength-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 300ms ease, background-color 300ms ease;
    width: 0;
}

.password-strength-fill.strength-weak {
    background-color: #ef4444;
}

.password-strength-fill.strength-fair {
    background-color: #f59e0b;
}

.password-strength-fill.strength-good {
    background-color: #eab308;
}

.password-strength-fill.strength-strong {
    background-color: #22c55e;
}

.password-strength-fill.strength-very-strong {
    background-color: #10b981;
}

.password-strength-text {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    min-width: 80px;
}

.password-strength-text.strength-weak {
    color: #ef4444;
}

.password-strength-text.strength-fair {
    color: #f59e0b;
}

.password-strength-text.strength-good {
    color: #eab308;
}

.password-strength-text.strength-strong {
    color: #22c55e;
}

.password-strength-text.strength-very-strong {
    color: #10b981;
}

/* ---- Password Form ---- */
.password-form {
    max-width: 400px;
}

.password-form .form-group {
    margin-bottom: 16px;
}

.password-form label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 6px;
}

.password-form input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background-color: var(--color-surface);
    color: var(--color-text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 200ms ease, box-shadow 200ms ease;
    box-sizing: border-box;
}

.password-form input[type="password"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.password-form .btn {
    margin-top: 8px;
}

/* ---- Settings Save Button ---- */
.settings-save-row {
    padding-top: 24px;
    border-top: 1px solid var(--color-border-light, #ebeef3);
    margin-top: 12px;
}

/* ---- Reset Defaults Button ---- */
.settings-reset-row {
    padding-top: 12px;
    margin-top: 4px;
}

.settings-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 400;
    padding: 6px 12px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    background: none;
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast);
}

.settings-reset-btn:hover {
    color: var(--color-text);
    border-color: var(--color-border);
    background-color: var(--color-border-light);
}

.settings-reset-btn svg {
    flex-shrink: 0;
}

/* ---- Import/Export Section ---- */
.ie-section {
    margin-bottom: 0;
}

.ie-card {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.ie-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ie-card-icon-export {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--color-primary);
}

.ie-card-icon-import {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.ie-card-body {
    flex: 1;
    min-width: 0;
}

.ie-card-body h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 6px 0;
}

.ie-card-body p {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin: 0 0 14px 0;
    line-height: 1.5;
}

.ie-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 16px;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
    margin-bottom: 12px;
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 13px;
}

.ie-upload-area:hover {
    border-color: var(--color-primary);
    background-color: rgba(59, 130, 246, 0.04);
}

.ie-upload-area.drag-over {
    border-color: var(--color-primary);
    background-color: rgba(59, 130, 246, 0.08);
}

.ie-file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background-color: var(--color-border-light);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.ie-file-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ie-file-remove {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color var(--transition-fast);
}

.ie-file-remove:hover {
    color: var(--color-danger, #ef4444);
}

/* ---- Save Button Loading State ---- */
.settings-btn-saving {
    pointer-events: none;
    opacity: 0.8;
    position: relative;
}

.settings-btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: settingsBtnSpin 600ms linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes settingsBtnSpin {
    to { transform: rotate(360deg); }
}

/* ---- Unsaved Changes Bar ---- */
.settings-unsaved-bar {
    position: fixed;
    bottom: -80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    background-color: var(--color-surface, #fff);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 100;
    transition: bottom 300ms cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.settings-unsaved-bar.visible {
    bottom: 24px;
}

.settings-unsaved-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
}

.settings-unsaved-text::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-warning, #f59e0b);
    margin-right: 8px;
    vertical-align: middle;
}

.settings-unsaved-actions {
    display: flex;
    gap: 8px;
}

.settings-unsaved-actions .btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

/* ---- Preferences Tab ---- */
.pref-storage-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    background: var(--color-border-light, #f8f9fa);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}

.pref-storage-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.2));
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pref-storage-body {
    flex: 1;
    min-width: 0;
}

.pref-storage-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}

.pref-storage-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
}

.pref-storage-bar {
    height: 8px;
    background: var(--color-border-light, #e2e8f0);
    border-radius: 4px;
    overflow: hidden;
}

.pref-storage-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 400ms ease, background-color 400ms ease;
}

.pref-storage-fill.pref-storage-success {
    background: linear-gradient(90deg, #22c55e, #10b981);
}

.pref-storage-fill.pref-storage-warning {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.pref-storage-fill.pref-storage-danger {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.pref-section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 8px 0;
}

.pref-danger-title {
    color: var(--color-danger, #ef4444);
}

.pref-section-desc {
    font-size: 13px;
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin: 0 0 16px 0;
}

.pref-category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.pref-category-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.pref-category-item:hover:not(.pref-category-disabled) {
    background-color: var(--color-border-light);
    border-color: var(--color-primary);
}

.pref-category-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pref-category-checkbox {
    margin-top: 2px;
    cursor: pointer;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.pref-category-checkbox:disabled {
    cursor: not-allowed;
}

.pref-category-info {
    flex: 1;
    min-width: 0;
}

.pref-category-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 2px;
}

.pref-category-desc {
    font-size: 12px;
    color: var(--color-text-secondary);
    line-height: 1.4;
}

.pref-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 40px 20px;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 14px;
}

.pref-upload-area:hover {
    border-color: var(--color-primary);
    background-color: rgba(59, 130, 246, 0.04);
}

.pref-upload-area.pref-drag-over {
    border-color: var(--color-primary);
    background-color: rgba(59, 130, 246, 0.08);
}

.pref-file-preview {
    margin-top: 16px;
}

.pref-preview-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.pref-preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--color-border-light);
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
}

.pref-preview-body {
    padding: 16px;
}

.pref-preview-meta {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
}

.pref-preview-list {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
    color: var(--color-text);
}

.pref-preview-list li {
    margin-bottom: 4px;
}

.pref-reset-confirm {
    max-width: 400px;
}

.pref-reset-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-surface);
    color: var(--color-text);
    font-size: 14px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: border-color var(--transition-fast);
    box-sizing: border-box;
}

.pref-reset-input:focus {
    outline: none;
    border-color: var(--color-danger, #ef4444);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* ---- Danger Zone ---- */
.settings-danger-zone {
    border-left-color: var(--color-danger, #ef4444);
    border: 2px solid var(--color-danger, #ef4444);
    background: rgba(239, 68, 68, 0.03);
}

.settings-danger-zone:hover {
    box-shadow: 0 2px 12px rgba(239, 68, 68, 0.15);
}

.settings-danger-title {
    color: var(--color-danger, #ef4444);
}

/* ---- Export Preview Modal ---- */
.settings-export-preview-intro {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin: 0 0 20px 0;
    line-height: 1.5;
}

.settings-export-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.settings-export-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: var(--color-bg, #f5f7fa);
    border-radius: var(--radius-md, 8px);
    border: 1px solid var(--color-border-light, #ebeef3);
}

.settings-export-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-export-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1;
}

.settings-export-stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.settings-export-preview-tree {
    max-height: 400px;
    overflow: auto;
    background: var(--color-bg, #f5f7fa);
    border: 1px solid var(--color-border, #dfe3ea);
    border-radius: var(--radius-md, 8px);
    padding: 16px;
}

.settings-export-json {
    margin: 0;
    padding: 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    line-height: 1.6;
    color: var(--color-text);
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .settings-tabs {
        gap: 2px;
        padding: 3px;
        border-radius: 10px;
    }

    .settings-tab {
        padding: 8px 12px;
        font-size: 12px;
        gap: 4px;
        border-radius: 7px;
    }

    .settings-tab-icon {
        display: none;
    }

    .settings-section {
        padding: 16px;
        border-radius: 10px;
    }

    .setting-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .setting-control {
        width: 100%;
    }

    .setting-control select {
        width: 100%;
        min-width: unset;
    }

    .password-form {
        max-width: 100%;
    }

    .settings-search-box {
        max-width: 100%;
    }

    .theme-mode-selector {
        width: 100%;
    }

    .theme-mode-btn {
        flex: 1;
    }

    .ie-card {
        flex-direction: column;
        gap: 12px;
    }

    .profile-avatar-section {
        flex-direction: column;
        text-align: center;
    }

    .profile-avatar {
        width: 64px;
        height: 64px;
    }

    .profile-avatar-initial {
        font-size: 24px;
    }

    .profile-color-swatches {
        justify-content: center;
    }

    .password-change-form {
        max-width: 100%;
    }

    /* Unsaved bar full-width on mobile */
    .settings-unsaved-bar {
        left: 16px;
        right: 16px;
        transform: none;
        border-radius: var(--radius-md, 8px);
    }

    .settings-unsaved-bar.visible {
        bottom: 72px; /* Above bottom nav on mobile */
    }
}

@media (max-width: 640px) {
    .settings-tab {
        padding: 7px 10px;
        font-size: 11px;
    }

    .settings-content {
        padding: 16px 0;
    }

    .settings-section {
        padding: 14px;
        border-radius: 8px;
    }

    .settings-unsaved-bar {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        padding: 10px 16px;
    }

    .accent-color-swatch {
        width: 28px;
        height: 28px;
    }

    .theme-presets {
        gap: 8px;
    }

    .theme-preset-card {
        min-width: 90px;
        padding: 10px 12px;
    }

    .theme-custom-colors {
        flex-direction: column;
        gap: 12px;
    }

    .theme-preview-panel {
        padding: 16px;
    }
}

/* ---- Dark Mode Support ---- */
[data-theme="dark"] .settings-tabs {
    background: var(--color-border, #2a2a42);
}

[data-theme="dark"] .settings-tab:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .settings-tab.active {
    background-color: var(--color-surface, #1a1a2e);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .settings-tab.search-highlight {
    background-color: rgba(79, 143, 247, 0.15);
}

[data-theme="dark"] .settings-section {
    background: var(--color-surface, #1a1a2e);
    border-color: var(--color-border, #2a2a42);
}

[data-theme="dark"] .settings-section:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .settings-search-input {
    background-color: var(--color-bg-secondary, #151528);
    border-color: var(--color-border, #2a2a42);
    color: var(--color-text);
}

[data-theme="dark"] .settings-search-clear:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .settings-unsaved-bar {
    background-color: var(--color-surface, #1a1a2e);
    border-color: var(--color-border, #2a2a42);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .settings-btn-spinner {
    border-color: rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
}

[data-theme="dark"] .settings-section.save-success {
    background-color: rgba(5, 150, 105, 0.06);
    box-shadow: 0 0 0 1px rgba(5, 150, 105, 0.15);
}

[data-theme="dark"] .settings-text-input {
    background-color: var(--color-bg-secondary, #151528);
    border-color: var(--color-border, #2a2a42);
}

[data-theme="dark"] .theme-mode-selector {
    background: var(--color-border, #2a2a42);
}

[data-theme="dark"] .theme-mode-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .theme-mode-btn.active {
    background-color: var(--color-surface, #1a1a2e);
    border-color: var(--color-primary);
}

[data-theme="dark"] .accent-color-swatch.active {
    border-color: #e2e8f0;
    box-shadow: 0 0 0 2px var(--color-surface, #1a1a2e), 0 0 0 4px var(--color-primary);
}

[data-theme="dark"] .accent-color-swatch:hover::after {
    border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .profile-avatar {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .profile-avatar:hover::after {
    background: #e2e8f0;
    color: #0f172a;
}

[data-theme="dark"] .profile-color-swatch.active {
    border-color: #e2e8f0;
    box-shadow: 0 0 0 2px var(--color-surface, #1a1a2e), 0 0 0 4px var(--color-primary);
}

[data-theme="dark"] .profile-color-swatch:hover::after {
    border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .profile-field input {
    background-color: var(--color-bg-secondary, #151528);
    border-color: var(--color-border, #2a2a42);
}

[data-theme="dark"] .profile-field input:read-only {
    background: var(--color-bg, #0f0f1a);
    color: var(--color-text-muted, #636b7e);
}

[data-theme="dark"] .profile-badge.admin {
    background: rgba(79, 143, 247, 0.15);
    color: #60a5fa;
}

[data-theme="dark"] .profile-badge.manager {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

[data-theme="dark"] .profile-badge.user {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

[data-theme="dark"] .password-strength-bar {
    background-color: var(--color-border, #2a2a42);
}

[data-theme="dark"] .profile-section-title {
    border-top-color: var(--color-border, #2a2a42);
}

[data-theme="dark"] .setting-row {
    border-bottom-color: var(--color-border, #2a2a42);
}

[data-theme="dark"] .settings-save-row {
    border-top-color: var(--color-border, #2a2a42);
}

[data-theme="dark"] .settings-reset-btn {
    border-color: var(--color-border, #2a2a42);
}

[data-theme="dark"] .settings-reset-btn:hover {
    background-color: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .ie-upload-area {
    border-color: var(--color-border, #2a2a42);
}

[data-theme="dark"] .ie-upload-area:hover {
    border-color: var(--color-primary);
    background-color: rgba(79, 143, 247, 0.06);
}

[data-theme="dark"] .ie-upload-area.drag-over {
    background-color: rgba(79, 143, 247, 0.1);
}

[data-theme="dark"] .ie-file-info {
    background-color: var(--color-border, #2a2a42);
}

[data-theme="dark"] .ie-card-icon-export {
    background-color: rgba(79, 143, 247, 0.12);
}

[data-theme="dark"] .ie-card-icon-import {
    background-color: rgba(16, 185, 129, 0.12);
}

[data-theme="dark"] .password-form input[type="password"] {
    background-color: var(--color-bg-secondary, #151528);
    border-color: var(--color-border, #2a2a42);
}

[data-theme="dark"] .toggle-switch:hover .toggle-slider {
    background-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .toggle-switch:hover input:checked + .toggle-slider {
    background-color: var(--color-primary-hover, #6ba3fa);
}

/* ---- Theme Customizer ---- */
.theme-presets {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.theme-preset-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border: 2px solid var(--color-border-light, #ebeef3);
    border-radius: 12px;
    background: var(--color-surface);
    cursor: pointer;
    transition: all 200ms ease;
    position: relative;
    min-width: 110px;
}

.theme-preset-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.theme-preset-card.active {
    border-color: var(--color-primary);
    background: rgba(59, 130, 246, 0.04);
    box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-primary);
}

.theme-preset-swatches {
    display: flex;
    gap: 6px;
}

.theme-preset-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.theme-preset-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
}

.theme-preset-check {
    position: absolute;
    top: 6px;
    right: 6px;
    color: var(--color-primary);
}

.theme-custom-colors {
    display: flex;
    gap: 16px;
    width: 100%;
}

.theme-color-input {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.theme-color-input label {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.theme-color-input input[type="color"] {
    width: 100%;
    height: 48px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    background: var(--color-surface);
    padding: 4px;
    box-sizing: border-box;
}

.theme-color-input input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.theme-color-input input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: calc(var(--radius-md) - 4px);
}

.theme-color-value {
    font-size: 12px;
    font-family: 'Courier New', monospace;
    color: var(--color-text-secondary);
    text-align: center;
}

.theme-preview-panel {
    width: 100%;
    padding: 20px;
    background: var(--color-bg, #f5f7fa);
    border-radius: var(--radius-md);
}

.theme-preview-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    max-width: 400px;
}

.theme-preview-header {
    padding: 16px;
    background: var(--color-primary);
    color: #ffffff;
    font-weight: 600;
    font-size: 15px;
}

.theme-preview-body {
    padding: 20px;
}

.theme-preview-body p {
    margin: 0 0 16px 0;
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.5;
}

.theme-preview-btn {
    padding: 10px 20px;
    background: var(--color-primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

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

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
    .settings-tab-content,
    .settings-tab-content.entering,
    .settings-tab-content.exiting {
        animation: none;
        transition: none;
        opacity: 1;
        transform: none;
    }

    .settings-tab-dot {
        animation: none;
    }

    .settings-unsaved-bar {
        transition: none;
    }

    .settings-section {
        transition: none;
    }

    .accent-color-swatch,
    .accent-color-swatch::after {
        transition: none;
    }

    .theme-mode-btn {
        transition: none;
    }

    .profile-avatar {
        transition: none;
    }

    .profile-color-swatch,
    .profile-color-swatch::after {
        transition: none;
    }

    .password-strength-fill {
        transition: none;
    }

    .theme-preset-card {
        transition: none;
    }

    .toggle-slider,
    .toggle-slider::before {
        transition: none;
    }
}
