:root {
    --bg-app: #0d0a0a;
    --bg-gradient: linear-gradient(145deg, #121010 0%, #0d0a0a 100%);
    --bg-sidebar: #1a1616;
    --bg-card: #1a1616;
    --bg-hover: #211c1c;
    --bg-active: #2a2323;
    --surface: #1a1616;
    --surface-active: #211c1c;
    --surface-hover: #2A2523;
    --text-primary: #f5eded;
    --text-secondary: #a89a9a;
    --text-tertiary: #6b6060;
    --text-muted: #4a4343;
    --border: rgba(255, 255, 255, 0.08);
    --brand-main: #c46a6a;
    --brand-light: #d47a7a;
    --brand-dark: #a65050;
    --brand-soft: rgba(196, 106, 106, 0.12);
    --accent: #c46a6a;
    --accent-soft: rgba(196, 106, 106, 0.12);
    --success: #6BCB77;
    --success-soft: rgba(107, 203, 119, 0.15);
    --warning: #FFB347;
    --warning-soft: rgba(255, 179, 71, 0.15);
    --error: #FF6B6B;
    --error-soft: rgba(255, 107, 107, 0.15);
    --radius-xl: 20px;
    --radius-lg: 14px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --sidebar-w: 260px;
    --header-h: 70px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    /* === OVERLAY & TRANSPARENT COLORS === */
    --overlay-light-4: rgba(255, 255, 255, 0.04);
    --overlay-light-3: rgba(255, 255, 255, 0.03);
    --overlay-light-8: rgba(255, 255, 255, 0.08);
    --overlay-light-9: rgba(255, 255, 255, 0.09);
    --overlay-light-10: rgba(255, 255, 255, 0.1);
    --overlay-light-70: rgba(255, 255, 255, 0.7);
    --overlay-light-90: rgba(255, 255, 255, 0.9);
    --overlay-dark-50: rgba(0, 0, 0, 0.5);

    /* === ACCENT RANGES === */
    --accent-border-light: rgba(196, 106, 106, 0.2);
    --accent-border-medium: rgba(196, 106, 106, 0.3);

    /* === SKIN COLORS === */
    --skin-head: linear-gradient(135deg, #B8956E 0%, #9A7B58 100%);
    --skin-head-dark: #2A2018;
    --skin-head-mouth: #7A5F45;
    --skin-body: linear-gradient(135deg, #4A7C59 0%, #3D6B4A 100%);
    --skin-arms: linear-gradient(135deg, #B8956E 0%, #9A7B58 100%);
    --skin-legs: linear-gradient(135deg, #4A6A94 0%, #3D5A80 100%);

    /* === UI ELEMENT COLORS === */
    --toggle-knob: #FFFFFF;
    --success-glow: rgba(107, 203, 119, 0.3);
}
[data-theme="light"] {
    --bg-app: #f5f1f1;
    --bg-gradient: linear-gradient(145deg, #faf7f7 0%, #f0eaea 100%);
    --bg-sidebar: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-hover: #FAFAFA;
    --bg-active: #f0eaea;
    --surface: #FFFFFF;
    --surface-active: #f0eaea;
    --surface-hover: #FAFAFA;
    --text-primary: #1a1414;
    --text-secondary: #6b5a5a;
    --text-tertiary: #a69797;
    --border: rgba(0, 0, 0, 0.08);
    --brand-main: #8b3c3c;
    --brand-dark: #6b3030;
    --brand-soft: rgba(139, 60, 60, 0.08);
    --accent: #8b3c3c;
    --accent-soft: rgba(139, 60, 60, 0.08);

    /* === OVERLAY & TRANSPARENT COLORS (Light Mode) === */
    --overlay-light-4: rgba(0, 0, 0, 0.04);
    --overlay-light-3: rgba(0, 0, 0, 0.03);
    --overlay-light-8: rgba(0, 0, 0, 0.08);
    --overlay-light-9: rgba(0, 0, 0, 0.09);
    --overlay-light-10: rgba(0, 0, 0, 0.1);
    --overlay-light-70: rgba(0, 0, 0, 0.7);
    --overlay-light-90: rgba(0, 0, 0, 0.9);
    --overlay-dark-50: rgba(255, 255, 255, 0.5);

    /* === ACCENT RANGES (Light Mode) === */
    --accent-border-light: rgba(139, 90, 60, 0.2);
    --accent-border-medium: rgba(139, 90, 60, 0.3);

    /* === SKIN COLORS (Light Mode) === */
    --skin-head: linear-gradient(135deg, #B8956E 0%, #9A7B58 100%);
    --skin-head-dark: #2A2018;
    --skin-head-mouth: #7A5F45;
    --skin-body: linear-gradient(135deg, #4A7C59 0%, #3D6B4A 100%);
    --skin-arms: linear-gradient(135deg, #B8956E 0%, #9A7B58 100%);
    --skin-legs: linear-gradient(135deg, #4A6A94 0%, #3D5A80 100%);

    /* === UI ELEMENT COLORS (Light Mode) === */
    --toggle-knob: #FFFFFF;
    --success-glow: rgba(76, 175, 80, 0.3);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Manrope', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    overflow: hidden;
    transition: var(--transition);
    touch-action: pan-y; 
    overscroll-behavior-x: none;
}
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    padding: 24px;
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
}
.login-title { font-size: 20px; font-weight: 800; margin-bottom: 20px; }
.login-form input {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 12px;
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
}
.login-form input:focus { outline: none; border-color: var(--brand-main); }
.login-error { color: var(--error); font-size: 12px; margin-bottom: 8px; min-height: 18px; }
.app-wrapper { display: flex; width: 100%; height: 100vh; overflow: hidden; }
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 12px; margin-bottom: 32px; }
.brand svg { width: 32px; height: 32px; color: var(--brand-main); }
.brand-text { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; }
.brand-badge { font-size: 9px; font-weight: 700; background: var(--brand-soft); color: var(--brand-main); padding: 2px 6px; border-radius: 4px; text-transform: uppercase; margin-left: auto; }
.nav-list { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-main); }
.nav-divider { height: 1px; background: var(--border); margin: 12px 0; }
.user-profile { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--bg-active); border-radius: var(--radius-md); border: 1px solid var(--border); margin-top: auto; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-main); }
.user-info { flex: 1; min-width: 0; }
.user-name { display: block; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: inline-block; font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 4px; color: white; opacity: 0.9; text-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.main-wrapper { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.header { height: var(--header-h); background: var(--bg-sidebar); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 32px; }
.page-title { font-size: 18px; font-weight: 800; }
.header-actions { display: flex; align-items: center; gap: 16px; }
.action-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-app); color: var(--text-secondary); cursor: pointer; transition: var(--transition); }
.action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.content { flex: 1; padding: 32px; overflow-y: auto; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; display: flex; flex-direction: column; }
.stat-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.stat-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--bg-active); display: flex; align-items: center; justify-content: center; color: var(--text-secondary); }
.stat-value { font-size: 28px; font-weight: 800; margin-bottom: 4px; }
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.panel-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 24px; }
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.panel-title { font-size: 16px; font-weight: 700; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 12px 16px; font-size: 11px; text-transform: uppercase; color: var(--text-tertiary); border-bottom: 1px solid var(--border); }
.data-table td { padding: 16px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-secondary); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); color: var(--text-primary); }
.status-badge { padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.status-success { background: var(--success-soft); color: var(--success); }
.status-warning { background: var(--warning-soft); color: var(--warning); }
.status-error { background: var(--error-soft); color: var(--error); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.server-item { display: flex; align-items: center; justify-content: space-between; padding: 16px; background: var(--bg-active); border-radius: var(--radius-md); margin-bottom: 12px; border: 1px solid var(--border); }
.server-info { display: flex; align-items: center; gap: 12px; }
.server-icon-mini { width: 36px; height: 36px; background: var(--bg-app); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; color: var(--brand-main); border: 1px solid var(--border); }
.load-bar { width: 120px; height: 6px; background: var(--bg-app); border-radius: 4px; overflow: hidden; }
.load-fill { height: 100%; background: var(--brand-main); border-radius: 4px; }
.btn-primary { padding: 8px 16px; background: var(--brand-main); color: white; border: none; border-radius: var(--radius-sm); font-size: 12px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; transition: var(--transition); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { padding: 8px 16px; background: var(--bg-active); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: var(--transition); }
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--brand-main); }
.btn-danger { padding: 8px 16px; background: var(--error-soft); color: var(--error); border: 1px solid var(--error); border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: var(--transition); }
.btn-danger:hover { background: var(--error); color: white; }
.btn-icon { width: 36px; height: 36px; padding: 0; background: var(--bg-active); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--transition); }
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon.btn-danger { background: var(--error-soft); color: var(--error); border-color: var(--error); }
.btn-icon.btn-danger:hover { background: var(--error); color: white; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }
.form-input, .form-textarea, .form-select { width: 100%; padding: 8px 12px; background: var(--bg-app); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-primary); font-family: inherit; font-size: 13px; transition: var(--transition); }
.form-input:focus, .form-textarea:focus, .form-select:focus { outline: none; border-color: var(--brand-main); box-shadow: 0 0 0 2px rgba(196, 149, 106, 0.1); }
.form-textarea { resize: vertical; }
/* Стили для file input */
input[type="file"] { display: block; width: 100%; padding: 8px 12px; background: var(--bg-app); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-primary); font-family: inherit; font-size: 13px; cursor: pointer; transition: var(--transition); }
input[type="file"]::-webkit-file-upload-button { display: none; }
input[type="file"]::file-selector-button { padding: 6px 12px; background: var(--bg-active); color: var(--text-primary); border: none; border-radius: var(--radius-sm); font-weight: 600; font-size: 12px; cursor: pointer; margin-right: 8px; transition: var(--transition); }
input[type="file"]::file-selector-button:hover { background: var(--bg-hover); }
/* Стили для checkbox */
input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; min-width: 18px; min-height: 18px; background: var(--bg-app); border: 1px solid var(--border); border-radius: 4px; cursor: pointer; transition: var(--transition); display: inline-flex; align-items: center; justify-content: center; position: relative; }
input[type="checkbox"]:hover { border-color: var(--brand-main); }
input[type="checkbox"]:checked { background: var(--brand-main); border-color: var(--brand-main); }
input[type="checkbox"]:checked::after { content: '✓'; color: white; font-size: 12px; font-weight: 700; position: absolute; }
input[type="checkbox"]:focus { outline: none; box-shadow: 0 0 0 2px rgba(196, 149, 106, 0.1); }
.err-msg { color: var(--error); font-size: 13px; margin-top: 8px; }
.feed-url { font-size: 12px; color: var(--text-tertiary); word-break: break-all; margin-top: 8px; }
pre.feed-preview { font-size: 11px; background: var(--bg-app); padding: 12px; border-radius: var(--radius-sm); overflow: auto; max-height: 280px; }

/* Additional styles for theme and localization pages */
.page-content { padding: 0; }
.tabs-header { display: flex; gap: 8px; border-bottom: 1px solid var(--border); margin-bottom: 24px; padding: 0; overflow-x: auto; }
.tab-btn { padding: 12px 20px; background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-secondary); cursor: pointer; font-weight: 600; font-size: 13px; transition: all 0.2s; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-pane { display: none; animation: fadeIn 0.2s ease-in; padding: 20px 0; }
.tab-pane.active { display: block; }
.tab-pane.hidden { display: none; }
.hidden { display: none !important; }
.content-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; padding: 20px; background: var(--surface); border-radius: 8px; border: 1px solid var(--border); flex-wrap: wrap; gap: 16px; }
.content-header .info h3 { margin: 0 0 4px 0; font-size: 18px; font-weight: 700; color: var(--text-primary); }
.content-header .info p { margin: 0; font-size: 13px; color: var(--text-secondary); }
.content-header .actions { display: flex; gap: 12px; }
.btn { padding: 8px 16px; border: none; border-radius: 4px; color: var(--text-primary); font-weight: 600; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: all 0.2s; text-decoration: none; }
.btn.btn-primary { background: var(--brand-main); color: white; border: 1px solid var(--brand-main); }
.btn.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.btn-secondary { background: var(--surface-active); color: var(--text-secondary); border: 1px solid var(--border); }
.btn.btn-secondary:hover { background: var(--surface-hover); color: var(--text-primary); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; color: var(--text-primary); }
.checkbox-label input[type="checkbox"] { margin: 0; }
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal.hidden { display: none; }
.modal-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.5); cursor: pointer; }
.modal-content { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 24px; max-width: 500px; width: 90%; max-height: 90vh; overflow-y: auto; z-index: 1001; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h3 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-tertiary); cursor: pointer; font-size: 20px; padding: 0; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { margin-bottom: 20px; }
.modal-footer { display: flex; gap: 12px; justify-content: flex-end; }
.variables-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.form-textarea { resize: vertical; min-height: 100px; }
.json-editor { width: 100%; background: var(--bg-app); border: 1px solid var(--border); border-radius: 4px; padding: 12px; color: var(--text-primary); font-family: monospace; font-size: 12px; }
.json-editor:focus { outline: none; border-color: var(--accent); }
.json-actions { display: flex; gap: 12px; margin-top: 12px; justify-content: flex-end; }
.logo-preview-box { width: 100%; height: 120px; background: var(--surface-active); border: 1px solid var(--border); border-radius: 8px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; position: relative; overflow: hidden; }
.logo-preview { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-placeholder { color: var(--text-tertiary); font-size: 13px; }
.logo-section { margin-bottom: 20px; }
.logo-section h4 { margin: 0 0 12px 0; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.project-info { display: grid; grid-template-columns: 1fr; gap: 16px; max-width: 600px; }
.presets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.preset-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; cursor: pointer; transition: all 0.2s; }
.preset-card:hover { border-color: var(--accent); box-shadow: 0 0 12px rgba(196, 149, 106, 0.2); }
.preset-card h4 { margin: 0 0 12px 0; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.preset-card .preset-name { font-weight: 600; color: var(--text-primary); margin-bottom: 12px; font-size: 14px; }
.preset-colors { display: flex; gap: 8px; margin-bottom: 12px; }
.preset-color { width: 40px; height: 40px; border-radius: 4px; border: 1px solid var(--border); }
.presetsContainer { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.variablesContainer { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 20px; }
.variables-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 20px; }
.variable-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; transition: all 0.2s; }
.variable-card:hover { border-color: var(--accent); box-shadow: 0 0 12px rgba(196, 149, 106, 0.2); }
.variable-card-name { font-size: 12px; font-weight: 700; color: var(--text-tertiary); margin-bottom: 8px; font-family: monospace; }
.variable-card-preview { width: 100%; height: 40px; border-radius: 4px; border: 1px solid var(--border); margin-bottom: 8px; }
.variable-card-input { width: 100%; padding: 6px; background: var(--bg-app); border: 1px solid var(--border); border-radius: 4px; color: var(--text-primary); font-size: 12px; }
.logo-management { display: flex; flex-direction: column; gap: 20px; max-width: 600px; }
.logo-section { display: flex; flex-direction: column; gap: 12px; }
.logo-section h4 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.localization-tree { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; max-height: 800px; overflow-y: auto; margin-top: 20px; }
.tree-group { margin-bottom: 12px; }
.tree-group-title { font-weight: 700; color: var(--accent); padding: 8px 12px; background: var(--surface-active); border-radius: 4px; margin-bottom: 8px; font-size: 13px; }
.tree-item { padding: 8px 12px; margin-bottom: 4px; background: var(--surface-active); border-radius: 4px; border: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-size: 13px; transition: all 0.2s; }
.tree-item:hover { border-color: var(--accent); box-shadow: 0 0 8px var(--accent-soft); }
.tree-item-key { color: var(--text-tertiary); font-weight: 600; font-family: monospace; font-size: 12px; flex: 0 0 auto; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.tree-item-value { color: var(--text-secondary); flex: 1; margin: 0 16px; overflow: hidden; text-overflow: ellipsis; max-width: 400px; font-size: 12px; }
.tree-item-actions { display: flex; gap: 4px; flex: 0 0 auto; }
.tree-item-btn { padding: 4px 8px; background: var(--accent-soft); border: none; border-radius: 4px; color: var(--accent); cursor: pointer; font-size: 11px; font-weight: 600; transition: all 0.2s; }
.tree-item-btn:hover { background: var(--accent); color: white; }
.json-editor-wrapper { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.json-editor { width: 100%; height: 600px; background: var(--bg-app); border: 1px solid var(--border); border-radius: 4px; padding: 12px; color: var(--text-primary); font-family: monospace; font-size: 12px; resize: vertical; }
.json-editor:focus { outline: none; border-color: var(--accent); }
.json-actions { display: flex; gap: 12px; margin-top: 12px; justify-content: flex-end; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Custom color picker styling */
input[type="color"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 48px;
    height: 48px;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
}

input[type="color"]:hover {
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(196, 149, 106, 0.2);
    transform: scale(1.05);
}

input[type="color"]:active {
    transform: scale(0.98);
}

/* Chrome/Edge color picker button */
input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

/* Firefox color picker */
input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 4px;
}

/* --- FILE MANAGER STYLES --- */
.file-manager {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    min-height: 500px;
    position: relative;
    overflow: hidden;
}

/* Toolbar */
.fm-toolbar {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-active);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* Breadcrumbs */
.fm-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-tertiary);
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none; /* Hide scrollbar */
}

.fm-crumb {
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.fm-crumb:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.fm-crumb.active {
    background: var(--brand-soft);
    color: var(--brand-main);
    cursor: default;
    pointer-events: none;
}

.fm-separator {
    color: var(--text-tertiary);
    opacity: 0.5;
}

/* Table Area */
.fm-table-container {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-app);
}

.fm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.fm-table th {
    text-align: left;
    padding: 12px 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 10;
}

.fm-row {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
    cursor: default;
}

.fm-row:last-child {
    border-bottom: none;
}

.fm-row:hover {
    background: var(--bg-hover);
}

/* Cells */
.fm-cell {
    padding: 10px 20px;
    color: var(--text-secondary);
    vertical-align: middle;
}

.fm-name-cell {
    color: var(--text-primary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

/* Icons */
.fm-icon-box {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--surface-active);
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: var(--transition);
}

.fm-row:hover .fm-icon-box {
    background: var(--surface);
    color: var(--brand-main);
    transform: scale(1.05);
}

/* File Types Colors */
.type-folder .fm-icon-box { color: var(--brand-light); background: rgba(212, 168, 122, 0.1); }
.type-archive .fm-icon-box { color: #A78BFA; background: rgba(167, 139, 250, 0.1); } /* Zip/Jar */
.type-code .fm-icon-box { color: #60A5FA; background: rgba(96, 165, 250, 0.1); } /* Json/Config */
.type-image .fm-icon-box { color: #F472B6; background: rgba(244, 114, 182, 0.1); } /* Png */

/* Actions */
.fm-actions-cell {
    text-align: right;
    white-space: nowrap;
}

.fm-row-actions {
    display: inline-flex;
    gap: 6px;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.2s ease;
}

.fm-row:hover .fm-row-actions {
    opacity: 1;
    transform: translateX(0);
}

.fm-action-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
}

.fm-action-btn:hover {
    color: var(--text-primary);
    border-color: var(--brand-main);
}

.fm-action-btn.danger:hover {
    color: var(--error);
    border-color: var(--error);
    background: var(--error-soft);
}

/* Drag & Drop Overlay */
.fm-drop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 11, 10, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    border: 2px dashed var(--brand-main);
    margin: 8px;
    border-radius: var(--radius-md);
}

.fm-dropzone.dragover .fm-drop-overlay {
    opacity: 1;
    pointer-events: all;
}

.drop-icon {
    color: var(--brand-main);
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Empty State */
.fm-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 0;
    color: var(--text-tertiary);
}

/* Скрываем кнопку меню на десктопе по умолчанию */
.mobile-menu-btn {
    display: none;
}

/* ==========================================================================
   МЕДИАЗАПРОСЫ (АДАПТИВНОСТЬ ДЛЯ ПЛАНШЕТОВ И ТЕЛЕФОНОВ)
   ========================================================================== */

/* Планшеты и небольшие экраны (до 1024px) */
@media (max-width: 1024px) {
    .content {
        padding: 20px;
    }
    
    .grid-4 {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 16px;
    }

    .panel-card {
        padding: 20px;
    }
}

/* Телефоны и вертикальные планшеты (до 768px) */
@media (max-width: 768px) {
    /* --- Сайдбар (Делаем выдвижным) --- */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 9999;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    /* Класс для открытого сайдбара (переключается через JS) */
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    /* Затенение фона при открытом меню */
    .mobile-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 9998;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
        backdrop-filter: blur(3px);
    }

    body.sidebar-open .mobile-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    /* --- Шапка и основной контент --- */
    .header {
        padding: 0 16px;
        gap: 12px;
    }
    
    .page-title {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .content {
        padding: 16px;
    }

    /* --- Кнопка меню (бургер) --- */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: var(--text-primary);
        cursor: pointer;
        padding: 8px;
        margin-right: 8px;
        min-width: 40px;
        min-height: 40px;
    }

    /* --- Таблицы (Горизонтальный скролл) --- */
    .data-table, .fm-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch; /* Плавный скролл на iOS */
    }

    /* --- Переопределение инлайн-сеток (Grids) в формах --- */
    form > div[style*="grid-template-columns"],
    .modal-body > div[style*="grid-template-columns"],
    .theme-pane > div[style*="grid-template-columns"],
    .user-tab-content > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* --- Панели и Заголовки --- */
    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .panel-header > div,
    .panel-header button {
        width: 100%;
    }
    
    .panel-header button {
        justify-content: center;
    }

    /* --- Файловый менеджер --- */
    .fm-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .fm-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .fm-actions button {
        flex: 1;
        justify-content: center;
    }

    .fm-row-actions {
        opacity: 1; /* Кнопки действий всегда видны на мобилках */
        transform: none;
    }

    /* --- Вкладки (Tabs) --- */
    .tabs-header, .localization-tabs {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    /* --- Модальные окна --- */
    .modal-content {
        width: 95%;
        max-height: 90vh;
        padding: 16px;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-footer button {
        width: 100%;
    }

    /* --- Серверы --- */
    .server-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .server-item > div:last-child {
        width: 100%;
        justify-content: space-between;
    }

    /* --- Тикеты --- */
    #ticketViewPanel > div {
        grid-template-columns: 1fr !important; /* Ставим в одну колонку */
    }
}

/* Маленькие телефоны (до 480px) */
@media (max-width: 480px) {
    .stat-card {
        padding: 16px;
    }
    
    .stat-value {
        font-size: 24px;
    }

    .login-card {
        padding: 24px 16px;
    }
    
    .btn-primary, .btn-secondary {
        font-size: 13px;
        padding: 10px;
    }
}

