/* ============================================
   CMS Builder - Admin Panel Styles
   ============================================ */

/* Light Theme (Default) */
:root {
    /* Colors - Light Theme */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-elevated: #e2e8f0;
    --bg-hover: #e2e8f0;
    
    --border-color: #e2e8f0;
    --border-light: #cbd5e1;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --accent-primary: #0891b2;
    --accent-primary-hover: #0e7490;
    --accent-secondary: #06b6d4;
    --accent-primary-rgb: 8, 145, 178;
    --accent-success: #22c55e;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-danger-hover: #dc2626;
    
    /* Spacing */
    --sidebar-width: 260px;
    --header-height: 64px;
    
    /* Typography */
    --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-tertiary: #18181b;
    --bg-elevated: #1f1f23;
    --bg-hover: #27272a;
    
    --border-color: #27272a;
    --border-light: #3f3f46;
    
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    --accent-primary: #06b6d4;
    --accent-primary-hover: #22d3ee;
    --accent-secondary: #0891b2;
    --accent-primary-rgb: 6, 182, 212;
    --accent-success: #22c55e;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-danger-hover: #f87171;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-primary-hover);
}

/* ============================================
   Theme Toggle
   ============================================ */

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 8px;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.theme-toggle-icon {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

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

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.25s ease, background-color var(--transition-normal), border-color var(--transition-normal);
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    display: flex;
    align-items: center;
    color: var(--accent-primary);
}

.logo-icon svg {
    flex-shrink: 0;
}

.logo-icon.large {
    font-size: 48px;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-primary);
    color: white;
}

.nav-item svg {
    flex-shrink: 0;
}

.nav-item {
    position: relative;
}

.nav-alert-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-danger);
    margin-left: auto;
    flex-shrink: 0;
    animation: nav-pulse 1.5s ease-in-out infinite;
}
.nav-item.active .nav-alert-dot {
    background: #fff;
    animation: nav-pulse-white 1.5s ease-in-out infinite;
}
@keyframes nav-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
    50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}
@keyframes nav-pulse-white {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5); }
    50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(255, 255, 255, 0); }
}

/* Nav group with submenu */
.nav-group {
    position: relative;
}
.nav-item-parent {
    cursor: pointer;
}
.nav-item-parent.active {
    background: rgba(6, 182, 212, 0.12);
    color: var(--accent-primary);
}
.nav-group-arrow {
    margin-left: auto;
    opacity: 0.4;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0;
}
.nav-group:hover .nav-group-arrow,
.nav-group.open .nav-group-arrow {
    opacity: 0.7;
}
.nav-group.open .nav-group-arrow {
    transform: rotate(90deg);
}
.nav-submenu {
    display: none;
    flex-direction: column;
    gap: 1px;
    padding: 2px 0 2px 20px;
}
.nav-group.open .nav-submenu {
    display: flex;
}
.nav-sub-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: background 0.15s, color 0.15s;
}
.nav-sub-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.nav-sub-item.active {
    color: var(--accent-primary);
    font-weight: 600;
    background: rgba(6, 182, 212, 0.08);
}
.nav-sub-item svg {
    flex-shrink: 0;
    opacity: 0.6;
}
.nav-sub-item.active svg {
    opacity: 1;
}
.nav-sub-alert-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ef4444;
    margin-left: auto;
    flex-shrink: 0;
    animation: nav-pulse 1.5s ease-in-out infinite;
}

.nav-separator {
    height: 1px;
    background: var(--border-color);
    margin: 8px 4px;
    opacity: 0.6;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: white;
}

.user-name {
    font-weight: 500;
    color: var(--text-primary);
}

.logout-btn {
    padding: 8px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.logout-btn:hover {
    background: var(--bg-hover);
    color: var(--accent-danger);
}

/* Sidebar collapse button */
.sidebar-collapse-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    width: 100%;
}

.sidebar-collapse-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Floating open sidebar button */
.sidebar-open-btn {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 101;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
}

.sidebar-open-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
}

/* ============================================
   Main Content
   ============================================ */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 32px 40px;
    transition: margin-left 0.25s ease, background-color var(--transition-normal);
}

.main-content.sidebar-collapsed {
    margin-left: 0;
}

.main-content.full-width {
    margin-left: 0;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    gap: 24px;
}

.page-header-content h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-description {
    color: var(--text-secondary);
    font-size: 14px;
}

.header-cf-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: opacity .15s;
}
.header-cf-link:hover { opacity: .75; }

.deploy-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
}
.deploy-status--ok { color: var(--success, #22c55e); }
.deploy-status--changed { color: var(--warning, #f59e0b); }
.deploy-status--none { color: var(--text-muted); }

.page-header-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.back-link:hover {
    color: var(--text-primary);
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

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

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover:not(:disabled) {
    background: var(--bg-elevated);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--accent-danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: var(--accent-danger-hover);
}

.btn-warning {
    background: #e67e22;
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background: #d35400;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 8px;
}

.inline-form {
    display: inline;
}

/* ============================================
   Forms
   ============================================ */

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

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-textarea.code {
    font-family: var(--font-mono);
    font-size: 13px;
}

.form-select {
    cursor: pointer;
}

.form-row {
    display: flex;
    gap: 16px;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.flex-3 { flex: 3; }

.input-with-prefix {
    display: flex;
    align-items: stretch;
}

.input-prefix {
    padding: 10px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    color: var(--text-muted);
    font-size: 14px;
    display: flex;
    align-items: center;
    white-space: nowrap;
    user-select: none;
    font-family: var(--font-mono);
}

.input-with-prefix .form-input {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 400;
    color: var(--text-primary);
}

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

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Color Input */
.color-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.color-input {
    width: 48px;
    height: 40px;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    cursor: pointer;
}

.color-text {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
}

/* Datetime Picker (date_published и т.п.) */
.datetime-picker-wrap {
    display: flex;
    gap: 10px;
    align-items: center;
}
.datetime-picker-wrap .form-input {
    flex: 1;
    min-width: 0;
}
.datetime-picker-wrap input[type="datetime-local"] {
    font-family: var(--font-mono);
    font-size: 14px;
}
.datetime-picker-wrap .btn {
    flex-shrink: 0;
}

/* Number Input */
.number-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.number-input-wrapper .form-input {
    width: 100px;
}

.input-unit {
    color: var(--text-muted);
    font-size: 13px;
}

/* ============================================
   Cards
   ============================================ */

.projects-grid,
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.project-card,
.template-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.project-card:hover,
.template-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.project-card-preview,
.template-card-preview {
    height: 160px;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-elevated) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-preview-placeholder,
.template-preview-placeholder {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: white;
}

.project-card-body,
.template-card-body {
    padding: 20px;
}

.project-name,
.template-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.project-meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.project-domain {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    font-family: var(--font-mono);
}

.template-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.template-features {
    display: flex;
    gap: 8px;
}

.feature-tag {
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-muted);
}

.project-card-actions,
.template-card-actions {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ============================================
   List Table (Row View)
   ============================================ */

.list-table {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.list-table-header {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    gap: 16px;
}

.list-table-row {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    gap: 16px;
    transition: background-color var(--transition-fast);
}

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

.list-table-row:hover {
    background: var(--bg-tertiary);
}
.tpl-row-disabled {
    opacity: 0.5;
}
.tpl-row-disabled:hover {
    opacity: 0.75;
}
.tpl-badge-disabled {
    background: rgba(239,68,68,0.15);
    color: #ef4444;
    margin-left: 8px;
}
.tpl-toggle-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    transition: all 0.2s;
}
.tpl-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.list-col {
    display: flex;
    align-items: center;
    min-width: 0;
}

.list-col-name {
    flex: 2 1 0;
    gap: 12px;
    min-width: 120px;
}

.list-col-domain {
    flex: 2 1 0;
    min-width: 100px;
    gap: 6px;
}

.list-col-desc {
    flex: 3 1 0;
    min-width: 100px;
}

.list-col-template {
    flex: 1 1 0;
    min-width: 70px;
}

.list-col-pages {
    flex: 0 0 60px;
    text-align: center;
    justify-content: center;
}

.list-col-group {
    flex: 1 1 0;
    min-width: 60px;
}

.list-col-settings {
    flex: 1 1 0;
    min-width: 70px;
}

.list-col-date {
    flex: 0 0 90px;
    font-size: 13px;
    color: var(--text-muted);
}

.list-col-actions {
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: 4px;
}

/* Domain external link icon */
.domain-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
    transition: var(--transition-fast);
}
.domain-link:hover {
    color: var(--accent-primary);
}
.domain-link .domain-ext-icon {
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.list-table-row:hover .domain-link .domain-ext-icon {
    opacity: 0.6;
}
.domain-link:hover .domain-ext-icon {
    opacity: 1;
}

.list-item-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
}

.list-item-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-item-name:hover {
    color: var(--accent-primary);
}

.list-item-domain {
    font-size: 13px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-item-description {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================
   Cloudflare — таблицы (domains, all_sites, accounts)
   ============================================ */

/* Cloudflare: домены в аккаунте */
.cf-domains-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.cf-domains-table col.col-name { width: 22%; }
.cf-domains-table col.col-ip { width: 130px; }
.cf-domains-table col.col-ns { width: 150px; }
.cf-domains-table col.col-status { width: 90px; }
.cf-domains-table col.col-date { width: 95px; }
.cf-domains-table col.col-actions { width: 60px; }
.cf-domains-table th { padding: 12px 16px; }
.cf-domains-table td { padding: 16px 16px; }
.cf-domains-table th, .cf-domains-table td {
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    text-overflow: ellipsis;
}
.cf-domains-table thead th {
    background: var(--bg-tertiary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-align: left;
}
.cf-domains-table thead th:last-child,
.cf-domains-table td.list-col-actions { text-align: right; }
.cf-domains-table tbody tr:hover { background: var(--bg-tertiary); }
.cf-domains-table tbody tr:last-child td { border-bottom: none; }
.cf-domains-table td.list-col-name > div {
    display: flex;
    align-items: center;
    gap: 12px;
}
.cf-domains-table .list-col-ip { font-family: var(--font-mono); font-size: 13px; }

/* Cloudflare: все сайты */
.cf-sites-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.cf-sites-table col.col-check { width: 32px; }
.cf-sites-table col.col-domain { width: 22%; }
.cf-sites-table col.col-ip { width: 130px; }
.cf-sites-table col.col-ns { width: 150px; }
.cf-sites-table col.col-account { width: 18%; }
.cf-sites-table col.col-status { width: 90px; }
.cf-sites-table col.col-actions { width: 60px; }
.cf-sites-table th { padding: 12px 16px; }
.cf-sites-table td { padding: 16px 16px; }
.cf-sites-table th, .cf-sites-table td {
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    text-overflow: ellipsis;
}
.cf-sites-table thead th {
    background: var(--bg-tertiary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-align: left;
}
.cf-sites-table thead th.col-check,
.cf-sites-table td.col-check { text-align: center; }
.cf-sites-table thead th:last-child,
.cf-sites-table td.list-col-actions { text-align: right; }
.cf-sites-table tbody tr:hover { background: var(--bg-tertiary); }
.cf-sites-table tbody tr:last-child td { border-bottom: none; }
.cf-sites-table .list-col-domain { display: flex; align-items: center; gap: 12px; }
.cf-sites-table .list-col-ip { font-family: var(--font-mono); font-size: 13px; }
.cf-sites-table .cf-account-value { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.cf-sites-table .cf-site-row.cf-row-selected { background: rgba(6, 182, 212, 0.08); }
.cf-sites-table .col-check .cf-check-all,
.cf-sites-table .col-check .cf-row-check { padding: 2px; }
.cf-sites-table .col-check .cf-check-all input,
.cf-sites-table .col-check .cf-row-check input { width: 14px; height: 14px; }

/* Cloudflare: аккаунты */
.cf-accounts-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.cf-accounts-table col.col-name { width: 22%; }
.cf-accounts-table col.col-email { width: 20%; }
.cf-accounts-table col.col-count { width: 75px; }
.cf-accounts-table col.col-status { width: 100px; }
.cf-accounts-table col.col-date { width: 95px; }
.cf-accounts-table col.col-actions { width: 140px; }
.cf-accounts-table th { padding: 12px 16px; }
.cf-accounts-table td { padding: 16px 16px; }
.cf-accounts-table th, .cf-accounts-table td {
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    text-overflow: ellipsis;
}
.cf-accounts-table thead th {
    background: var(--bg-tertiary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-align: left;
}
.cf-accounts-table thead th:nth-child(3),
.cf-accounts-table td.list-col-count { text-align: center; }
.cf-accounts-table thead th:last-child,
.cf-accounts-table td.list-col-actions { text-align: right; }
.cf-accounts-table tbody tr:hover { background: var(--bg-tertiary); }
.cf-accounts-table tbody tr:last-child td { border-bottom: none; }
.cf-accounts-table .list-col-name { display: flex; align-items: center; gap: 12px; }
.cf-accounts-table td.list-col-actions .btn-icon,
.cf-accounts-table td.list-col-actions .inline-form { display: inline-block; }

/* ============================================
   Projects & Vibe Git — выравнивание таблиц
   ============================================ */

.projects-list-table,
.vibegit-list-table,
.servers-list-table {
    overflow-x: auto;
}

.vibegit-list-table .list-table-header,
.vibegit-list-table .list-table-row,
.servers-list-table .list-table-header,
.servers-list-table .list-table-row {
    gap: 16px;
}

.projects-list-table .list-col-name,
.vibegit-list-table .list-col-name,
.servers-list-table .list-col-name {
    flex: 1 1 180px;
    max-width: none;
    min-width: 0;
    gap: 12px;
    justify-content: flex-start;
}

.projects-list-table .list-col-name-inner > *:not(.list-item-avatar),
.vibegit-list-table .list-col-name > *:not(.list-item-avatar),
.servers-list-table .list-col-name > *:not(.list-item-avatar) {
    min-width: 0;
    overflow: hidden;
}

.projects-list-table .list-col-domain,
.vibegit-list-table .list-col-domain,
.servers-list-table .list-col-domain {
    flex: 1 1 120px;
    min-width: 0;
    overflow: hidden;
}

.projects-list-table .list-col-domain .domain-link,
.projects-list-table .list-col-domain .text-muted,
.vibegit-list-table .list-col-domain .domain-link,
.vibegit-list-table .list-col-domain .text-muted,
.servers-list-table .list-col-domain .domain-link {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.projects-list-table .list-col-template,
.vibegit-list-table .list-col-template,
.servers-list-table .list-col-template {
    flex: 0 1 100px;
    min-width: 70px;
    justify-content: flex-start;
}

.projects-list-table .list-col-group {
    flex: 0 1 100px;
    min-width: 60px;
    overflow: hidden;
    justify-content: flex-start;
}

.projects-list-table .list-col-pages,
.servers-list-table .list-col-pages {
    flex: 0 0 50px;
    min-width: 40px;
    justify-content: center;
}

.projects-list-table .list-col-date,
.vibegit-list-table .list-col-date,
.servers-list-table .list-col-date {
    flex: 0 0 90px;
    min-width: 80px;
    justify-content: flex-start;
}

.projects-list-table .list-col-actions,
.vibegit-list-table .list-col-actions,
.servers-list-table .list-col-actions {
    flex: 0 0 auto;
    min-width: auto;
}

/* Projects table — нативная table (авто и ручные) */
.projects-list-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.projects-list-table col.col-num { width: 50px; }
.projects-list-table col.col-name { width: 20%; }
.projects-list-table col.col-domain { width: 18%; }
.projects-list-table col.col-template { width: 110px; }
.projects-list-table col.col-server { width: 120px; }
.projects-list-table col.col-group { width: 100px; }
.projects-list-table col.col-pages { width: 55px; }
.projects-list-table col.col-date { width: 95px; }
.projects-list-table col.col-actions { width: 140px; }
.projects-list-table th { padding: 12px 16px; }
.projects-list-table td { padding: 16px 16px; }
.projects-list-table th,
.projects-list-table td {
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    text-overflow: ellipsis;
}
.projects-list-table thead th {
    background: var(--bg-tertiary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-align: left;
}
.projects-list-table thead th:first-child,
.projects-list-table td.list-col-num { text-align: center; }
.projects-list-table thead th.col-pages,
.projects-list-table td.list-col-pages { text-align: center; }
.projects-list-table thead th:last-child,
.projects-list-table td.list-col-actions { text-align: right; }
.projects-list-table tbody tr:hover { background: var(--bg-tertiary); }
.projects-list-table tbody tr:last-child td { border-bottom: none; }
.projects-list-table .list-col-name-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}
.projects-list-table td.list-col-actions .btn-icon,
.projects-list-table td.list-col-actions .inline-form { display: inline-block; }
.projects-list-table td.list-col-actions { white-space: nowrap; }

/* Servers table — нативная table для точного совпадения колонок */
.list-table-wrap {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: auto;
}
.servers-list-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    table-layout: fixed;
}
.servers-list-table col.col-name { width: 22%; }
.servers-list-table col.col-domain { width: 18%; }
.servers-list-table col.col-panel { width: 120px; }
.servers-list-table col.col-num { width: 75px; }
.servers-list-table col.col-date { width: 95px; }
.servers-list-table col.col-actions { width: 140px; }
.servers-list-table th,
.servers-list-table td {
    padding: 14px 16px;
}
.servers-list-table th,
.servers-list-table td {
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    text-overflow: ellipsis;
}
.servers-list-table thead th {
    background: var(--bg-tertiary);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-align: left;
}
.servers-list-table td {
    line-height: 1.4;
}
.servers-list-table thead th:nth-child(4),
.servers-list-table thead th:nth-child(5),
.servers-list-table thead th:nth-child(6) {
    text-align: center;
}
.servers-list-table thead th:last-child {
    text-align: right;
}
.servers-list-table tbody tr:hover {
    background: var(--bg-tertiary);
}
.servers-list-table tbody tr:last-child td {
    border-bottom: none;
}
.servers-list-table td.list-col-pages {
    text-align: center;
}
.servers-list-table td.list-col-actions {
    text-align: right;
    white-space: nowrap;
}
.servers-list-table td.list-col-actions .btn-icon,
.servers-list-table td.list-col-actions .inline-form {
    display: inline-block;
}
.servers-list-table .list-col-name {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden;
}
.servers-list-table .server-url-row {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}
.servers-list-table .server-url-row .domain-link,
.servers-list-table .server-url-row .text-muted {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.servers-list-table .server-copy-host {
    flex-shrink: 0;
    padding: 4px;
    min-width: 24px;
    height: 24px;
    margin-left: 2px;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.servers-list-table .server-url-row:hover .server-copy-host,
.servers-list-table .server-copy-host:hover {
    opacity: 1;
}

/* Vibe Git table — нативная table для точного совпадения колонок */
.vibegit-list-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.vibegit-list-table col.col-check { width: 32px; }
.vibegit-list-table col.col-name { width: 20%; }
.vibegit-list-table col.col-domain { width: 18%; }
.vibegit-list-table col.col-server { width: 120px; }
.vibegit-list-table col.col-date { width: 120px; }
.vibegit-list-table col.col-actions { width: 60px; }
.vibegit-list-table th {
    padding: 12px 16px;
}
.vibegit-list-table td {
    padding: 16px 16px;
}
.vibegit-list-table th,
.vibegit-list-table td {
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    text-overflow: ellipsis;
}
.vibegit-list-table thead th {
    background: var(--bg-tertiary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-align: left;
}
.vibegit-list-table thead th.col-check,
.vibegit-list-table td.col-check {
    text-align: center;
}
.vibegit-list-table thead th:last-child,
.vibegit-list-table td.list-col-actions {
    text-align: right;
}
.vibegit-list-table tbody tr:hover {
    background: var(--bg-tertiary);
}
.vibegit-list-table tbody tr:last-child td {
    border-bottom: none;
}
.vibegit-list-table .list-col-name {
    display: flex;
    align-items: center;
    gap: 12px;
}
.vibegit-list-table .vg-site-row.cf-row-selected {
    background: rgba(6, 182, 212, 0.08);
}
.vibegit-list-table .col-check .cf-check-all,
.vibegit-list-table .col-check .cf-row-check {
    padding: 2px;
}
.vibegit-list-table .col-check .cf-check-all input,
.vibegit-list-table .col-check .cf-row-check input {
    width: 14px;
    height: 14px;
}

.cf-check-all,
.cf-row-check {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin: 0;
    padding: 4px;
}

.cf-check-all input,
.cf-row-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.cf-site-row.cf-row-selected {
    background: rgba(6, 182, 212, 0.08);
}

[data-theme="dark"] .cf-site-row.cf-row-selected {
    background: rgba(6, 182, 212, 0.12);
}

.cf-site-row.cf-row-selected:hover {
    background: rgba(6, 182, 212, 0.14);
}

[data-theme="dark"] .cf-site-row.cf-row-selected:hover {
    background: rgba(6, 182, 212, 0.18);
}

.cf-selection-bar {
    margin-bottom: 16px;
    animation: cfSelectionBarIn 0.2s ease;
}

@keyframes cfSelectionBarIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.cf-selection-bar-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.12), rgba(8, 145, 178, 0.08));
    border: 1px solid rgba(6, 182, 212, 0.25);
    border-radius: var(--radius-lg);
}

[data-theme="dark"] .cf-selection-bar-inner {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.18), rgba(8, 145, 178, 0.12));
    border-color: rgba(6, 182, 212, 0.35);
}

.cf-selection-count {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-primary);
    min-width: 28px;
}

.cf-selection-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.cf-selection-action {
    margin-left: 8px;
}

.cf-selection-clear {
    margin-left: auto;
    padding: 6px 10px;
    color: var(--text-muted);
}

.cf-selection-clear:hover {
    color: var(--accent-danger);
}

.list-item-tag {
    display: inline-flex;
    padding: 3px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.list-btn-danger:hover {
    color: var(--accent-danger) !important;
}

/* Responsive: list table on smaller screens */
@media (max-width: 900px) {
    .list-table-header {
        display: none;
    }

    .list-table-row {
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 8px 12px;
    }

    .list-col-name {
        flex: 1 1 100%;
    }

    .list-col-domain,
    .list-col-desc {
        flex: 1 1 100%;
    }

    .list-col-template,
    .list-col-pages,
    .list-col-group,
    .list-col-settings,
    .list-col-date {
        flex: 0 0 auto;
    }

    .list-col-actions {
        flex: 1 1 100%;
        justify-content: flex-start;
    }
}

/* ============================================
   Empty State
   ============================================ */

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
}

.empty-state.small {
    padding: 40px 20px;
}

.empty-state-icon {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.empty-state code {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 13px;
}

/* ============================================
   Modal
   ============================================ */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10100;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

[data-theme="dark"] .modal-backdrop {
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.modal-content.modal-md {
    max-width: 640px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Template Selector */
.template-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.template-option {
    cursor: pointer;
}

.template-option input {
    display: none;
}

.template-option-content {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.template-option input:checked + .template-option-content {
    border-color: var(--accent-primary);
    background: rgba(6, 182, 212, 0.1);
}

.template-option-preview {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: white;
    flex-shrink: 0;
}

.template-option-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.template-option-name {
    font-weight: 600;
    color: var(--text-primary);
}

.template-option-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================
   Flash Messages
   ============================================ */

.flash-messages {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.flash {
    padding: 14px 20px;
    padding-right: 48px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    position: relative;
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.flash-success {
    border-left: 4px solid var(--accent-success);
}

.flash-error {
    border-left: 4px solid var(--accent-danger);
}

.flash-info {
    border-left: 4px solid var(--accent-primary);
}

.flash-close {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

.flash-close:hover {
    color: var(--text-primary);
}

.flash-progress-title { font-weight: 500; }
.flash-progress-pct { margin-left: 8px; font-weight: 600; color: var(--accent-primary); }
.flash-progress-bar {
    margin-top: 10px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}
.flash-progress-fill {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 3px;
    width: 0;
    transition: width 0.15s ease;
}

/* ============================================
   Auth Pages
   ============================================ */

.auth-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.auth-card {
    flex: 1;
    max-width: 440px;
    margin: auto;
    padding: 48px;
}

.auth-header {
    text-align: center;
    margin-bottom: 40px;
}

.auth-logo {
    margin-bottom: 24px;
}

.auth-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-subtitle {
    color: var(--text-secondary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-footer {
    text-align: center;
    margin-top: 32px;
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-decoration {
    flex: 1;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    display: none;
    position: relative;
    overflow: hidden;
}

@media (min-width: 1024px) {
    .auth-decoration {
        display: block;
    }
}

.decoration-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(6, 182, 212, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(6, 182, 212, 0.1) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* ============================================
   Workspace Tabs
   ============================================ */

.workspace-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.tab-btn.active {
    color: var(--accent-primary);
    background: var(--bg-tertiary);
}

/* Tab Dropdown */
.tab-dropdown {
    position: relative;
}

.tab-dropdown-toggle {
    position: relative;
}

.tab-dropdown-toggle.active {
    color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.tab-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    padding: 4px;
    overflow: visible;
}

/* Невидимая зона над меню — курсор не "промахивается" при переходе от кнопки к пунктам */
.tab-dropdown-menu::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    height: 8px;
}

.tab-dropdown:hover .tab-dropdown-menu,
.tab-dropdown.open .tab-dropdown-menu {
    display: block;
}

.tab-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    text-align: left;
}

.tab-dropdown-item:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.tab-dropdown-item.active {
    color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

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

.section-header h2 {
    font-size: 16px;
    font-weight: 600;
}

/* ============================================
   Pages List
   ============================================ */

.pages-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.page-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.page-item:hover {
    border-color: var(--border-light);
}

.page-item-title {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-item-slug {
    font-size: 13px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: 4px;
}

.page-item-actions {
    display: flex;
    gap: 8px;
}

.badge {
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-primary {
    background: rgba(6, 182, 212, 0.2);
    color: var(--accent-primary);
}

.badge-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.badge-lang {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* ============================================
   Data Table (offers, etc.)
   ============================================ */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

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

.data-table tbody tr:hover {
    background: var(--bg-tertiary);
}

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

/* ============================================
   Style Editor with Live Preview
   ============================================ */

.style-editor-layout {
    display: grid;
    grid-template-columns: minmax(300px, 420px) 1fr;
    gap: 24px;
    align-items: start;
}

.style-editor-left-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.custom-css-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.custom-css-section label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.custom-css-section .form-hint {
    margin-bottom: 8px;
}

.custom-css-section .code-editor-textarea {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    tab-size: 2;
    resize: vertical;
}

.style-editor {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    overflow: hidden;
    max-width: 100%;
}

.style-search-wrap {
    position: relative;
    margin-bottom: 12px;
}

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

.style-search-input {
    width: 100%;
    padding: 8px 32px 8px 32px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.style-search-input:focus {
    border-color: var(--accent-primary);
}

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

.style-search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    display: none;
    border-radius: 4px;
}

.style-search-clear:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.style-search-empty {
    text-align: center;
    padding: 24px 12px;
    color: var(--text-muted);
    font-size: 13px;
}

.style-group {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    overflow: hidden;
    background: var(--bg-primary);
}

.style-group:last-child {
    margin-bottom: 0;
}

.style-group-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: none;
    cursor: pointer;
    gap: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s;
    text-align: left;
}

.style-group-toggle:hover {
    background: var(--bg-hover);
}

.style-group-icon {
    font-size: 14px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.style-group-label {
    flex: 1;
}

.style-group-count {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.style-group-chevron {
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.2s;
}

.style-group.collapsed .style-group-chevron {
    transform: rotate(-90deg);
}

.style-group-body {
    padding: 8px 12px 8px;
    border-top: 1px solid var(--border-color);
}

.style-group.collapsed .style-group-body {
    display: none;
}

.style-editor-compact .style-field {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    gap: 8px;
}

.style-editor-compact .style-field:last-child {
    border-bottom: none;
}

.style-field--highlight {
    background: rgba(37, 99, 235, 0.10);
    border-radius: 8px;
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.45);
    animation: styleFieldPulse 2s ease-out;
}
@keyframes styleFieldPulse {
    0%   { box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.6); background: rgba(37, 99, 235, 0.15); }
    100% { box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0);   background: rgba(37, 99, 235, 0);    }
}

.style-editor-compact .style-field label {
    margin-bottom: 0;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
    flex: 1;
    min-width: 100px;
}

/* Unified color picker (HEX / RGBA + transparency) */
.color-uni-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    min-width: 0;
}
.color-uni-picker {
    width: 30px;
    height: 26px;
    padding: 1px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
    flex-shrink: 0;
}
.color-uni-text {
    width: 100%;
    min-width: 0;
    flex: 1;
    padding: 3px 6px;
    font-size: 11px;
    font-family: var(--font-mono);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
}
.color-uni-text:focus { border-color: var(--accent-primary); outline: none; }
.color-uni-mode {
    padding: 2px 5px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.3px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1.4;
    transition: all 0.15s;
}
.color-uni-mode:hover { color: var(--text-primary); border-color: var(--accent-primary); }
.color-uni-transparent {
    display: flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}
.color-uni-transparent-cb { display: none; }
.color-uni-transparent-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    transition: all 0.15s;
    line-height: 1;
}
.color-uni-transparent-cb:checked + .color-uni-transparent-icon {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}
.color-uni-wrap.is-transparent .color-uni-picker { opacity: 0.3; pointer-events: none; }
.color-uni-wrap.is-transparent .color-uni-text { opacity: 0.5; }
    white-space: nowrap;
    max-width: 80px;
}

.style-editor-compact .form-select {
    width: 120px;
    padding: 6px 8px;
    font-size: 12px;
    flex-shrink: 0;
}

.style-editor-compact .number-input-wrapper {
    flex-shrink: 0;
}

.style-editor-compact .number-input-wrapper .form-input {
    width: 60px;
    padding: 6px 8px;
    font-size: 12px;
}

.style-preview-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: sticky;
    top: 32px;
}

.style-preview-header {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.preview-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.preview-size-btns {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: 6px;
    padding: 2px;
    gap: 1px;
}

.preview-size-btn {
    padding: 4px 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
}

.preview-size-btn:hover { color: var(--text-primary); }
.preview-size-btn.active { background: var(--accent-primary); color: #fff; }

.preview-dims {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    min-width: 80px;
    text-align: center;
}

.preview-frame-wrap {
    display: flex;
    justify-content: center;
    background: var(--bg-tertiary);
    overflow: auto;
}

.style-preview-frame {
    width: 100%;
    height: 500px;
    border: none;
    background: white;
    display: block;
    transition: width 0.3s ease;
    flex-shrink: 0;
}

.preview-resize-handle {
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: ns-resize;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    user-select: none;
    transition: color 0.15s;
}

.preview-resize-handle:hover { color: var(--text-primary); }

/* ============================================
   Editor Layout - Two Column
   ============================================ */

.editor-layout {
    display: flex;
    gap: 24px;
}

.editor-layout.with-preview .editor-main {
    flex: 1;
    min-width: 0;
}

.editor-main {
    flex: 1;
}

.editor-two-column {
    display: grid;
    grid-template-columns: 7fr 3fr;
    gap: 24px;
}

.editor-left {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.editor-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.form-section.no-padding {
    padding: 0;
}

.form-section-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 14px;
}

.form-section-body {
    padding: 20px;
}

.form-section.collapsible {
    padding: 0;
}

.section-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    list-style: none;
}

.section-toggle::-webkit-details-marker {
    display: none;
}

.section-toggle svg {
    transition: transform var(--transition-fast);
}

details[open] .section-toggle svg {
    transform: rotate(90deg);
}

details[open] .section-toggle {
    border-bottom: 1px solid var(--border-color);
}

.section-content {
    padding: 24px;
}

/* Editor Toolbar */
.editor-toolbar-custom {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.toolbar-btn svg {
    flex-shrink: 0;
}

.toolbar-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.toolbar-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* Preview Panel */
.preview-panel {
    width: 500px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    position: sticky;
    top: 32px;
}

.preview-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.preview-close {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}

.preview-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.preview-frame-container {
    flex: 1;
    overflow: hidden;
}

.preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

.preview-actions {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   Code Editor (Header/Footer)
   ============================================ */

.code-editor-wrapper {
    position: relative;
}

.code-editor-textarea {
    width: 100%;
    min-height: 300px;
    padding: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
}

.code-editor-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* ============================================
   Template Details
   ============================================ */

.template-details {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.detail-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.detail-section h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
}

.variables-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.variable-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.variable-name {
    font-weight: 500;
}

.variable-key {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 12px;
}

.variable-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.variable-type {
    padding: 2px 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-muted);
}

.variable-preview.color {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.variable-default {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-secondary);
}

/* Files Tabs */
.files-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.file-tab {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.file-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.file-tab.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.files-content {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.file-content {
    display: none;
}

.file-content.active {
    display: block;
}

.file-content pre {
    margin: 0;
    padding: 20px;
    overflow-x: auto;
}

.file-content code {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
}

/* ============================================
   Settings
   ============================================ */

.settings-container {
    max-width: 600px;
}

.settings-form {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.form-actions {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   Utilities
   ============================================ */

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

.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }

/* ============================================
   TinyMCE Editor Styles
   ============================================ */

.tox.tox-tinymce {
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
}

[data-theme="dark"] .tox.tox-tinymce {
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .tox .tox-toolbar,
[data-theme="dark"] .tox .tox-toolbar__overflow,
[data-theme="dark"] .tox .tox-toolbar__primary {
    background: var(--bg-tertiary) !important;
}

[data-theme="dark"] .tox .tox-edit-area__iframe {
    background: var(--bg-secondary) !important;
}

[data-theme="dark"] .tox .tox-statusbar {
    background: var(--bg-tertiary) !important;
    color: var(--text-muted) !important;
}

/* ============================================
   Status Badges
   ============================================ */

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.status-active {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

[data-theme="dark"] .status-active {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.status-inactive {
    background: rgba(239, 68, 68, 0.10);
    color: #dc2626;
}

[data-theme="dark"] .status-inactive {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.status-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

[data-theme="dark"] .status-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.status-info {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

[data-theme="dark"] .status-info {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

/* ============================================
   Server Avatar
   ============================================ */

.server-avatar {
    background: var(--bg-tertiary) !important;
    color: var(--text-secondary);
}

.server-avatar.server-active {
    background: rgba(34, 197, 94, 0.12) !important;
    color: #16a34a;
}

[data-theme="dark"] .server-avatar.server-active {
    background: rgba(34, 197, 94, 0.15) !important;
    color: #4ade80;
}

.server-avatar.server-inactive {
    background: rgba(239, 68, 68, 0.10) !important;
    color: #dc2626;
}

.list-item-sublabel {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============================================
   Form Checkbox
   ============================================ */

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.form-radio-group {
    display: flex;
    gap: 16px;
    align-items: center;
}

.form-radio {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
}

.form-radio input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    animation: toastIn 0.3s ease;
    max-width: 420px;
}

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

.toast-success {
    background: #16a34a;
    color: white;
}

.toast-error {
    background: #dc2626;
    color: white;
}

.toast-info {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    padding: 0;
    line-height: 1;
}

.toast-close:hover {
    opacity: 1;
}

/* ============================================
   Responsive — адаптация под обычные экраны (не Retina)
   ============================================ */

/* Страховка: горизонтальный скролл не должен появляться */
body {
    overflow-x: hidden;
}

/* 1600px — мягкий zoom для обычных мониторов */
@media (max-width: 1600px) {
    .main-content {
        zoom: 0.97;
    }
}

/* 1440px и меньше — компактный режим */
@media (max-width: 1440px) {
    .main-content {
        padding: 24px 28px;
        zoom: 0.94;
    }
    .page-header {
        margin-bottom: 24px;
        gap: 16px;
    }
    .page-header-content h1 {
        font-size: 24px;
    }
    .page-header-actions {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    .btn {
        padding: 8px 14px;
        font-size: 13px;
        gap: 6px;
    }
    .btn-sm {
        padding: 5px 10px;
        font-size: 12px;
    }
    .btn-icon {
        padding: 6px;
    }
    .btn-icon svg {
        width: 14px;
        height: 14px;
    }
    .form-group {
        margin-bottom: 16px;
    }
    .form-input,
    .form-select,
    .form-textarea {
        padding: 8px 12px;
        font-size: 13px;
    }
    .list-table-header {
        padding: 10px 20px;
        font-size: 11px;
    }
    .list-table-row {
        padding: 12px 20px;
        gap: 12px;
    }
    .list-item-avatar {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
    .list-col-name {
        min-width: 120px;
    }
    .list-col-domain {
        min-width: 100px;
    }
    .list-col-desc {
        min-width: 120px;
    }
    .list-col-template {
        min-width: 80px;
    }
    .list-col-group {
        min-width: 60px;
    }
    .stat-card {
        padding: 16px;
    }
    .stat-card-value {
        font-size: 24px;
    }
    .stat-card-label {
        font-size: 12px;
    }
    .stat-card-icon-wrap {
        width: 48px;
        height: 48px;
    }
    .stat-card-icon-wrap svg {
        width: 24px;
        height: 24px;
    }
    .monitor-stats {
        gap: 12px;
    }
    .monitor-stat-card {
        padding: 12px 16px;
    }
    .monitor-stat-value {
        font-size: 22px;
    }
    .monitor-stat-label {
        font-size: 12px;
    }
    .dash-stat-card {
        padding: 12px 14px;
    }
    .dash-stat-number {
        font-size: 22px;
    }
    .dash-stat-label,
    .dash-stat-sub {
        font-size: 11px;
    }
    .dash-card {
        padding: 14px 16px;
    }
    .dash-card-icon {
        width: 40px;
        height: 40px;
    }
    .dash-card-icon svg {
        width: 20px;
        height: 20px;
    }
    .dash-card-value {
        font-size: 20px;
    }
    .dash-card-title {
        font-size: 12px;
    }
    .dash-cards-grid {
        gap: 14px;
    }
    .modal-header {
        padding: 16px 20px;
    }
    .modal-header h2 {
        font-size: 16px;
    }
    .modal-body {
        padding: 16px 20px;
    }
    .modal-footer {
        padding: 12px 20px;
        gap: 8px;
    }
    .tab-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    .projects-grid,
    .templates-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
    .project-card-body,
    .template-card-body {
        padding: 16px;
    }
    .project-card-actions,
    .template-card-actions {
        padding: 12px 16px;
    }
    .filter-search {
        padding: 0 10px;
    }
    .filter-search-input {
        padding: 6px 0;
        font-size: 12px;
    }
    .filter-select {
        padding: 6px 24px 6px 8px;
        font-size: 11px;
    }
    #changesBadge,
    #opStatusBadge {
        padding: 6px 8px !important;
        font-size: 11px !important;
    }
    .sidebar .nav-item {
        padding: 10px 14px;
        font-size: 13px;
    }
    .sidebar .nav-item svg {
        width: 18px;
        height: 18px;
    }
}

/* 1280px и меньше — ещё компактнее */
@media (max-width: 1280px) {
    .main-content {
        padding: 20px 20px;
        zoom: 0.91;
    }
    .page-header {
        margin-bottom: 20px;
        gap: 12px;
    }
    .page-header-content h1 {
        font-size: 22px;
    }
    .btn {
        padding: 7px 12px;
        font-size: 12px;
    }
    .btn-sm {
        padding: 4px 8px;
        font-size: 11px;
    }
    .btn-icon {
        padding: 5px;
    }
    .list-table-header,
    .list-table-row {
        padding: 10px 16px;
        gap: 10px;
    }
    .list-col-name {
        flex: 1 1 0;
        min-width: 100px;
        max-width: none;
    }
    .list-col-domain {
        flex: 1 1 0;
        min-width: 80px;
    }
    .list-col-template {
        flex: 0 1 80px;
        min-width: 60px;
    }
    .list-col-group {
        flex: 0 1 70px;
        min-width: 50px;
    }
    .list-col-date {
        flex: 0 0 80px;
        min-width: 70px;
    }
    .list-col-actions {
        flex: 0 0 auto;
        min-width: auto;
        gap: 2px;
    }
    .list-col-actions .btn-icon {
        padding: 4px;
    }
    .list-col-actions .btn-icon svg {
        width: 14px;
        height: 14px;
    }
    .projects-grid,
    .templates-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 16px;
    }
    .project-card-preview,
    .template-card-preview {
        height: 120px;
    }
    .project-preview-placeholder,
    .template-preview-placeholder {
        width: 56px;
        height: 56px;
        font-size: 24px;
    }
    #changesBadge,
    #opStatusBadge {
        padding: 5px 6px !important;
        font-size: 10px !important;
    }
}

/* 1100px — таблицы максимально компактны */
@media (max-width: 1100px) {
    .main-content {
        zoom: 0.88;
        padding: 16px 16px;
    }
    .list-table-header,
    .list-table-row {
        padding: 10px 12px;
        gap: 8px;
    }
    .list-col-name {
        min-width: 80px;
    }
    .list-col-domain {
        min-width: 60px;
    }
    .list-col-template,
    .list-col-group,
    .list-col-settings {
        min-width: 50px;
    }
    .list-col-pages {
        flex: 0 0 40px;
    }
    .list-col-date {
        flex: 0 0 70px;
        min-width: 60px;
    }
}

@media (max-width: 1200px) {
    .editor-two-column {
        grid-template-columns: 1fr;
    }
    
    .style-editor-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    
    .page-header {
        flex-direction: column;
    }
}

/* ===== Notification Bell ===== */
.notifications-wrapper {
    position: relative;
    margin-left: auto;
    flex-shrink: 0;
}

.notifications-bell {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.notifications-bell:hover {
    color: var(--text-primary);
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.notif-dot {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-danger);
    border: 2px solid var(--bg-secondary);
}

.notifications-dropdown {
    position: absolute;
    top: 42px;
    left: 0;
    width: 380px;
    max-height: 480px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    overflow: hidden;
    z-index: 1000;
}

.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.notif-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.notif-mark-all,
.notif-clear-all {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notif-mark-all:hover {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
}

.notif-clear-all:hover {
    background: var(--bg-tertiary);
    color: var(--accent-danger);
}

.notif-dropdown-body {
    max-height: 420px;
    overflow-y: auto;
}

.notif-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.1s;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: var(--bg-tertiary);
}

.notif-item.notif-unread {
    background: color-mix(in srgb, var(--accent-primary) 6%, transparent);
}

.notif-item-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.notif-item-title {
    font-weight: 600;
    font-size: 0.85rem;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-item-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.notif-item-prompt {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-item-bottom {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notif-item-model {
    font-size: 0.7rem;
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-muted);
}

.notif-item-link {
    font-size: 0.8rem;
    color: var(--accent-primary);
    margin-left: auto;
    font-weight: 500;
}

.notif-item-error {
    font-size: 0.75rem;
    color: var(--accent-danger);
    margin-left: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.notif-item-pending {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: auto;
}

.notif-item-cancel {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    margin-left: 4px;
    color: var(--text-muted);
    opacity: 0.5;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.notif-item-cancel:hover {
    opacity: 1;
    color: var(--accent-danger);
    background: var(--bg-hover);
}

.notif-status-done {
    color: var(--accent-success);
    font-weight: 700;
}

.notif-status-error {
    color: var(--accent-danger);
    font-weight: 700;
}

.notif-status-processing {
    color: var(--accent-warning);
    animation: spin 2s linear infinite;
}

.notif-status-pending {
    color: var(--text-muted);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin-icon {
    animation: spin 1s linear infinite;
}

/* ===== AI Button in toolbar ===== */
.toolbar-btn-ai {
    background: linear-gradient(135deg, #0891b2, #06b6d4) !important;
    color: #fff !important;
    border: none !important;
    gap: 6px;
}

.toolbar-btn-ai:hover {
    background: linear-gradient(135deg, #0e7490, #0891b2) !important;
    color: #fff !important;
}

/* ===== AI Modal ===== */
.ai-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.ai-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 560px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0,0,0,0.2);
}

.ai-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 12px;
    border-bottom: 1px solid var(--border-color);
}

.ai-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.3rem;
    padding: 4px;
}

.ai-modal-body {
    padding: 20px 24px;
}

.ai-model-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.ai-presets-label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.ai-presets-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.ai-preset-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ai-preset-chip:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: color-mix(in srgb, var(--accent-primary) 8%, transparent);
}

.ai-preset-chip.active {
    border-color: var(--accent-primary);
    background: var(--accent-primary);
    color: #fff;
}

.ai-preset-chip .chip-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 13px;
    line-height: 1;
    opacity: 0.4;
    transition: opacity 0.15s, background 0.15s;
    flex-shrink: 0;
}

.ai-preset-chip .chip-delete:hover {
    opacity: 1;
    background: rgba(255, 60, 60, 0.2);
    color: #ff3c3c;
}

.ai-preset-chip.active .chip-delete:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.ai-prompt-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 16px;
}

.ai-prompt-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary) 15%, transparent);
}

.ai-modal-footer {
    padding: 0 24px 20px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.ai-generate-btn {
    background: linear-gradient(135deg, #0891b2, #06b6d4);
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.15s ease;
}

.ai-generate-btn:hover {
    opacity: 0.9;
}

.ai-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* AI Meta checkbox */
.ai-checkbox-label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.ai-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.ai-checkbox-hint {
    width: 100%;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 400;
    padding-left: 26px;
    margin-top: -2px;
}

/* Notification type badges */
.notif-type-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.notif-type-article {
    background: color-mix(in srgb, var(--accent-primary) 15%, transparent);
    color: var(--accent-primary);
}

.notif-type-meta {
    background: color-mix(in srgb, #f59e0b 15%, transparent);
    color: #d97706;
}
