.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 18px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: calc(14px * var(--text-scale, 1));
    font-weight: 500;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    cursor: pointer;
    pointer-events: auto;
}

.btn:hover { background: var(--bg-quaternary); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--accent);
    color: white;
    padding: 11px 22px;
    border-radius: 27px;
    font-size: calc(14px * var(--text-scale, 1));
    font-weight: 600;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--accent);
    cursor: pointer;
    pointer-events: auto;
}

.btn-primary:hover { background: var(--accent-hover); transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--accent-hover); }
.btn-primary:active { transform: scale(0.97); }

.btn-danger { background: var(--danger-light); color: var(--danger); border: 1px solid transparent; cursor: pointer; }
.btn-danger:hover { background: var(--danger); color: white; border-color: var(--danger); }
.btn-block { width: 100%; display: flex; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 7px; color: var(--text-secondary); font-size: calc(13px * var(--text-scale, 1)); font-weight: 500; }

.form-control {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: calc(14px * var(--text-scale, 1));
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: var(--font-family);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    pointer-events: auto;
}

.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); outline: none; }
.form-control::placeholder { color: var(--text-placeholder); }
textarea.form-control { resize: vertical; min-height: 72px; line-height: 1.5; }

select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999999' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

input:focus, textarea:focus, select:focus { outline: none !important; border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-light) !important; }

.input-icon {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    pointer-events: auto;
}

.input-icon:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.input-icon i { color: var(--text-muted); margin-right: 11px; font-size: 14px; flex-shrink: 0; }

.input-icon input {
    flex: 1;
    padding: 13px 0;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: calc(14px * var(--text-scale, 1));
    outline: none;
    font-family: var(--font-family);
    pointer-events: auto;
}

.input-icon input:focus { outline: none; box-shadow: none; }

.input-icon .toggle-password {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 13px 11px;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 16px;
    pointer-events: auto;
}

.input-icon .toggle-password:hover { color: var(--text-primary); }

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    color: var(--text-secondary);
    pointer-events: auto;
    font-size: calc(14px * var(--text-scale, 1));
}

.checkbox-group input[type="checkbox"] { width: 18px; height: 18px; margin: 0; cursor: pointer; accent-color: var(--accent); pointer-events: auto; }

.switch { position: relative; display: inline-block; width: 45px; height: 23px; flex-shrink: 0; pointer-events: auto; }
.switch input { opacity: 0; width: 0; height: 0; }

.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-quaternary);
    transition: .3s;
    border-radius: 23px;
}

.switch .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.switch input:checked + .slider { background-color: var(--accent); }
.switch input:checked + .slider:before { transform: translateX(22px); }

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    pointer-events: auto;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

input[type="range"]:hover { opacity: 1; }

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text-muted);
    cursor: pointer;
    border: 2px solid var(--bg-secondary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover { background: var(--text-primary); transform: scale(1.1); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--text-muted); cursor: pointer; border: 2px solid var(--bg-secondary); }
input[type="range"]::-moz-range-thumb:hover { background: var(--text-primary); }

.badge { display: inline-block; padding: 4px 9px; border-radius: 11px; font-size: 11px; font-weight: 500; }
.badge-success { background: var(--success); color: white; }
.badge-danger { background: var(--danger); color: white; }
.badge-warning { background: var(--warning); color: black; }
.badge-info { background: var(--accent); color: white; }
.badge-secondary { background: #404040; color: #fff; }

.toast-container { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; gap: 7px; pointer-events: none; }

.toast {
    padding: 11px 18px;
    border-radius: var(--border-radius);
    color: white;
    font-size: 13px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 9px;
    pointer-events: auto;
    min-width: 180px;
    max-width: 360px;
    animation: slideInUp 0.3s ease;
    cursor: pointer;
}

.toast.info { background: var(--info); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); color: black; }

.color-presets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; padding: 8px 0; }

.color-preset {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.color-preset:hover { transform: scale(1.1); border-color: var(--text-primary); }
.color-preset.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.color-preset.active::after { content: '✓'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #fff; font-weight: 700; font-size: 18px; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }

.slider-with-value { display: flex; align-items: center; gap: 12px; }
.slider-with-value input[type="range"] { flex: 1; }
.slider-with-value .slider-value { min-width: 40px; text-align: center; font-size: 13px; color: var(--text-secondary); font-weight: 500; }

.progress-bar { height: 6px; background: var(--bg-tertiary); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }

.settings-separator { height: 1px; background: var(--border-color); margin: 8px 0; }

.action-btn {
    padding: 7px 12px;
    background: var(--bg-tertiary);
    border: 0;
    border-radius: 7px;
    color: #fff;
    cursor: pointer;
    margin-right: 4px;
    margin-bottom: 3px;
    font-size: 12px;
    transition: all .2s;
    white-space: nowrap;
}

.action-btn:hover { background: #404040; }
.action-btn.danger { background: var(--danger); }
.action-btn.success { background: var(--success); }
.action-btn.warning { background: var(--warning); color: #000; }
.action-btn.info { background: var(--accent); }