/* ===== CSS Variables ===== */
:root {
    --primary: #1a1a2e;
    --secondary: #16213e;
    --accent: #0f3460;
    --highlight: #e94560;
    --text: #f1f1f1;
    --text-secondary: #b0b0b0;
    --border: #2d3748;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 10px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.25);
    --transition: 0.25s ease;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    background-color: var(--primary);
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.5;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #4a5568;
}

/* ===== Layout ===== */
.container {
    display: flex;
    min-height: 100vh;
}

/* ===== Flash Messages ===== */
.flash {
    padding: 12px 18px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    animation: flashSlideIn 0.35s ease;
}

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

.error {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    font-size: 0.95rem;
    text-align: center;
    display: block;
}

.success {
    color: var(--success);
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    font-size: 0.95rem;
    text-align: center;
    display: block;
}

#msg_block {
    display: block;
    transition: opacity 0.5s ease;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 260px;
    background-color: var(--secondary);
    transition: width var(--transition), left var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.25);
    z-index: 100;
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: 64px;
}

.sidebar-header {
    padding: 18px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--secondary);
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.15rem;
}

.logo i {
    color: var(--highlight);
    font-size: 1.4rem;
}

.logo-text {
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition);
}

.sidebar.collapsed .logo-text {
    opacity: 0;
    width: 0;
    display: none;
}

.toggle-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.3s, color 0.2s;
    padding: 4px;
}

.toggle-btn:hover {
    color: var(--text);
}

.sidebar.collapsed .toggle-btn {
    transform: rotate(180deg);
}

.sidebar-menu {
    padding: 10px 0;
}

.sidebar-menu hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 8px 16px;
}

/* Menu items */
.menu-item {
    padding: 11px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    position: relative;
    border-left: 3px solid transparent;
    color: var(--text-secondary);
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.menu-item.active {
    background-color: rgba(15, 52, 96, 0.5);
    border-left-color: var(--highlight);
    color: var(--text);
}

.menu-item i:first-child {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.menu-text {
    white-space: nowrap;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    font-size: 0.9rem;
}

.sidebar.collapsed .menu-text {
    display: none;
}

.dropdown-arrow {
    margin-left: auto;
    transition: transform 0.3s;
    font-size: 0.7rem;
}

.menu-item.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* Submenu */
.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: rgba(0, 0, 0, 0.15);
}

.submenu.open {
    max-height: 300px;
}

.submenu-item {
    text-decoration: none;
    padding: 9px 20px 9px 50px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    color: var(--text-secondary);
    font-size: 0.88rem;
    display: block;
}

.submenu-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.submenu-item.active {
    color: var(--highlight);
}

.sidebar.collapsed .submenu {
    display: none;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    transition: all 0.3s;
    min-width: 0;
}

/* ===== Header ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}

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

.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

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

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--highlight));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.user-name {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== Cards ===== */
.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.card {
    background-color: var(--secondary);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid transparent;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.05);
}

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

.card-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.card-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.card-icon.users {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.card-icon.orders {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.card-icon.revenue {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.card-icon.visitors {
    background-color: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.card-value {
    font-size: 1.7rem;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.card-change {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-change.positive { color: var(--success); }
.card-change.negative { color: var(--danger); }

/* ===== Tables ===== */
.table-container {
    background-color: var(--secondary);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.table-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 10px;
}

.table-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background-color: var(--secondary);
}

.table-responsive table {
    min-width: 600px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

th {
    background-color: rgba(0, 0, 0, 0.2);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Status badges */
.status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-block;
}

.status.active {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.status.pending {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.status.inactive {
    background-color: rgba(107, 114, 128, 0.15);
    color: #6b7280;
}

/* ===== Buttons ===== */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.88rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-primary {
    background-color: #2563eb;
    color: white;
}

.btn-primary:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    padding: 8px 24px;
    background-color: var(--danger);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-danger:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
}

/* Action icon buttons */
.action-buttons {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-icon {
    padding: 0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
}

.btn-edit {
    background-color: var(--accent);
    color: var(--text);
}
.btn-edit:hover {
    background-color: #0d2a4d;
    transform: translateY(-1px);
}

.btn-delete {
    background-color: var(--danger);
    color: var(--text);
}
.btn-delete:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
}

.btn-off {
    background-color: #22c55e;
    color: white;
}
.btn-off:hover {
    background-color: #16a34a;
    transform: translateY(-1px);
}

.btn-on {
    background-color: #d97706;
    color: white;
}
.btn-on:hover {
    background-color: #b45309;
    transform: translateY(-1px);
}

.btn-apply {
    background-color: #eab308;
    color: #1a1a2e;
    font-weight: 600;
}
.btn-apply:hover {
    background-color: #ca8a04;
    transform: translateY(-1px);
}

.btn-list {
    padding: 4px 10px;
    background-color: var(--highlight);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    transition: all 0.2s ease;
}
.btn-list:hover {
    background-color: #d03050;
}

.btn-info {
    color: #4FC3F7;
    background: transparent;
}
.btn-info:hover {
    color: #81D4FA;
    background: rgba(79, 195, 247, 0.1);
}

/* ===== Charts ===== */
.charts-container {
    gap: 20px;
    margin-bottom: 24px;
    width: 100%;
    box-sizing: border-box;
}

.chart-canvas {
    width: 100%;
    height: 100px;
    display: block;
}

.chart-card {
    background-color: var(--secondary);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.03);
    margin-bottom: 16px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
    gap: 8px;
}

.chart-title {
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
}

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

.chart-container {
    position: relative;
    min-height: 300px;
    width: 100%;
}

/* Chart rows for A/B tests */
.chart-row {
    display: flex;
    gap: 16px;
    width: 100%;
}

.chart-row .chart-card {
    flex: 0 0 calc(25% - 12px);
    box-sizing: border-box;
}

.chart-row-5 {
    display: flex;
    gap: 16px;
    width: 100%;
    flex-wrap: nowrap;
}

.chart-card-5 {
    flex: 0 0 calc(20% - 12.8px);
    box-sizing: border-box;
    background-color: var(--secondary);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.chart-container-5 {
    min-height: 250px;
    width: 100%;
}

/* ===== Forms ===== */
.form-container {
    background-color: var(--secondary);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.form-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

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

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

.form-control {
    width: 100%;
    padding: 10px 14px;
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    resize: vertical;
}

.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 18px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.two-column-form {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.message-column {
    flex: 1;
    min-width: 280px;
}

.buttons-column {
    flex: 0 0 240px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.invite-row input[type="number"] {
    width: 70px;
    padding: 4px 6px;
    font-size: 0.88rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.25);
    color: var(--text);
}

/* Compact form variant */
.form-container-s {
    max-width: 800px;
    margin: 0 auto;
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--secondary);
}

.form-title-s {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.form-group-s {
    margin-bottom: 1rem;
}

.form-group-s label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
    color: #ffffff;
    font-size: 0.9rem;
}

.form-group-s input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    box-sizing: border-box;
    background-color: rgba(0, 0, 0, 0.25);
    color: #ffffff;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group-s input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Price grid */
.price-grid-s {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Warning box */
.w-m {
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: var(--radius);
    padding: 14px;
    background: rgba(245, 158, 11, 0.05);
}

.test-user-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.test-user-field input {
    margin: 0;
    padding: 6px 10px;
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.88rem;
}

.test-user-field small {
    font-size: 0.7em;
    color: var(--text-secondary);
}

/* Filter / radio / device options */
.filter-options,
.device-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.filter-option,
.device-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.filter-option:hover,
.device-option:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

.filter-mode-selector,
.radio-options,
.device-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.filter-mode-option,
.radio-option,
.device-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.9rem;
}

.filter-mode-option:hover,
.radio-option:hover,
.device-option:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

.filter-block {
    transition: opacity 0.2s, height 0.2s;
}

/* Range slider */
.form-range {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--highlight);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.form-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--highlight);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ===== Custom checkbox ===== */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: normal;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-custom {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--success);
    border-color: var(--success);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: "\2713";
    display: block;
    color: white;
    font-size: 12px;
    text-align: center;
    line-height: 16px;
}

.checkbox-label:hover .checkbox-custom {
    border-color: #555;
}

.small-number-input {
    width: 80px;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    text-align: center;
    font-size: 0.88rem;
    background-color: rgba(0, 0, 0, 0.25);
    color: var(--text);
}

/* ===== Modals ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--secondary);
    margin: 6% auto;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

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

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

.modal-header h3 {
    margin: 0;
    color: var(--text);
    font-size: 1.1rem;
}

.close {
    color: var(--text-secondary);
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.close:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.modal-body {
    padding: 20px;
}

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

.text-warning {
    color: var(--warning);
    font-size: 0.88rem;
    margin-top: 8px;
}

/* ===== Spoiler / Accordion ===== */
.spoiler-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
}

.spoiler-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background-color: var(--secondary);
    cursor: pointer;
    transition: background-color 0.2s;
}

.spoiler-header:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.spoiler-arrow {
    transition: transform 0.3s ease;
    font-size: 13px;
    color: var(--text-secondary);
}

.spoiler-content {
    padding: 0;
    background-color: var(--secondary);
}

.spoiler-header.active .spoiler-arrow {
    transform: rotate(180deg);
}

/* ===== Support details ===== */
.details-box {
    background-color: rgba(255, 255, 255, 0.03);
    padding: 12px 16px;
    border-radius: 8px;
    margin: 4px 0;
}

.inner-table {
    width: 100%;
    border-collapse: collapse;
}

.inner-table th, .inner-table td {
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 0.88rem;
}

.inner-table th {
    text-align: left;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.details-row {
    background-color: rgba(255, 255, 255, 0.02);
}

/* ===== Round badge ===== */
.round {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background-color: var(--highlight);
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
}
.bot_c {
    padding: 5px;
    margin: 5px;
    font-size: 18px;
    border-bottom: 1px solid #2D3748;
}
.trial-cards {
    border: 1px solid #4A5568;
    border-radius: var(--radius);
    padding: 16px;
    background: rgba(22, 33, 62, 0.4);
}
/* ===== Pagination ===== */
.pagination-controls {
    margin-top: 20px;
    text-align: center;
}

.pagination {
    display: inline-flex;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-link,
.pagination-current {
    display: inline-block;
    padding: 6px 12px;
    text-decoration: none;
    border: 1px solid var(--border);
    background: var(--secondary);
    color: var(--text);
    border-radius: 6px;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.pagination-current {
    background: #2563eb;
    border-color: #2563eb;
    font-weight: 600;
}

.pagination-ellipsis {
    padding: 6px 8px;
    color: var(--text-secondary);
}

.pagination-link:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

/* ===== Tabs ===== */
.tabs-container {
    margin-bottom: 20px;
}

.tabs-header {
    display: flex;
    gap: 6px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    padding: 10px 18px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    white-space: nowrap;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    font-weight: 600;
}

.tab-content {
    display: none;
}

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

/* ===== Pages ===== */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* ===== Mobile Menu Button ===== */
.mobile-menu-btn {
    display: none;
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s;
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
    transition: opacity 0.3s;
}

.overlay.active {
    display: block;
}

/* ===== Responsive ===== */

/* Desktop wide: price grid 4 cols */
@media (min-width: 900px) {
    .price-grid-s {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 768px) {
    .form-row {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 600px) and (max-width: 899px) {
    .price-grid-s {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablet */
@media (max-width: 992px) {
    .charts-container {
        grid-template-columns: 1fr;
    }

    .chart-row {
        flex-wrap: wrap;
    }

    .chart-row .chart-card {
        flex: 0 0 calc(50% - 8px);
    }

    .chart-row-5 {
        flex-wrap: wrap;
    }

    .chart-card-5 {
        flex: 0 0 calc(50% - 8px);
    }
}

/* Mobile */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        height: 100vh;
        width: 260px;
        z-index: 1000;
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar.collapsed {
        width: 260px;
        left: -260px;
    }

    .sidebar.collapsed.open {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 16px;
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .page-title {
        font-size: 1.3rem;
    }

    .cards-container {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .card {
        padding: 14px;
    }

    .card-value {
        font-size: 1.4rem;
    }

    .card-title {
        font-size: 0.78rem;
    }

    .chart-canvas {
        height: 400px;
    }

    .chart-row,
    .chart-row-5 {
        flex-direction: column;
        gap: 16px;
    }

    .chart-row .chart-card,
    .chart-card-5 {
        flex: 0 0 100%;
    }

    .table-header {
        padding: 12px 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .table-actions {
        width: 100%;
    }

    .table-actions .btn {
        flex: 1;
        text-align: center;
        font-size: 0.82rem;
        padding: 7px 10px;
    }

    th, td {
        padding: 10px 12px;
        font-size: 0.82rem;
    }

    .modal-content {
        margin: 8% auto;
        width: 94%;
        border-radius: 10px;
    }

    .action-buttons {
        gap: 4px;
    }

    .btn-icon {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .two-column-form {
        flex-direction: column;
    }

    .buttons-column {
        flex: 1 1 100%;
    }

    .message-column {
        min-width: 100%;
    }

    .filter-mode-selector,
    .radio-options {
        flex-direction: column;
        gap: 6px;
    }

    .filter-mode-option,
    .radio-option {
        width: 100%;
    }

    .header {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }

    .user-name {
        display: none;
    }

    .form-container {
        padding: 16px;
    }

    .tabs-header {
        gap: 2px;
    }

    .tab-btn {
        padding: 8px 12px;
        font-size: 0.82rem;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .cards-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .main-content {
        padding: 12px;
    }

    .page-title {
        font-size: 1.15rem;
    }

    .modal-content {
        margin: 4% auto;
        width: 96%;
    }

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

    .form-container {
        padding: 14px;
        border-radius: 8px;
    }

    .spoiler-header {
        padding: 12px 14px;
    }

    .pagination-link,
    .pagination-current {
        padding: 5px 9px;
        font-size: 0.8rem;
    }
}

/* Tablet landscape */
@media (min-width: 769px) and (max-width: 1024px) {
    .chart-card-5 {
        flex: 0 0 calc(33.333% - 10.67px);
    }
}

@media (min-width: 1025px) and (max-width: 1400px) {
    .chart-card-5 {
        flex: 0 0 calc(25% - 12px);
    }
}

/* ===== Form actions (compact forms) ===== */
.form-actions-s {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.form-actions-s .btn-primary,
.form-container-s .btn-primary,
.form-container-s button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 28px;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.form-actions-s .btn-primary:hover,
.form-container-s .btn-primary:hover,
.form-container-s button[type="submit"]:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* A/B test group info */
.form-container-s b {
    color: var(--text);
}

/* Radio options inside forms - inline with proper spacing */
.form-container-s .radio-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 0;
}

.form-container-s .radio-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
}

/* Broadcast group selector in AB test */
.form-container-s div[style*="border: 1px solid white"] {
    border-color: var(--border) !important;
    border-radius: var(--radius) !important;
    background: rgba(0, 0, 0, 0.1);
}

/* ===== Menu badge ===== */
.menu-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    background-color: #f97316;
    color: white;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    margin-left: auto;
    flex-shrink: 0;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.sidebar.collapsed .menu-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    font-size: 9px;
    padding: 0 3px;
}

/* ===== Selection highlight ===== */
::selection {
    background: rgba(233, 69, 96, 0.3);
    color: white;
}


.card-icon.signup {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6; /* синий */
}



.devices-count-badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        min-width: 24px;
        height: 24px;
        border-radius: 50%;
        flex-shrink: 0;
        padding: 0;
        line-height: 1;
    }
    .vless-key-card {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        padding: 12px 16px;
        margin-bottom: 8px;
        cursor: pointer;
        transition: background 0.2s;
        position: relative;
    }
    .vless-key-card:hover {
        background: rgba(255, 255, 255, 0.1);
    }
    .vless-key-card:active {
        background: rgba(127, 255, 0, 0.1);
    }
    .vless-country {
        font-weight: 600;
        color: greenyellow;
        margin-bottom: 4px;
        font-size: 14px;
    }
    .vless-link {
        font-size: 12px;
        color: rgba(255, 255, 255, 0.5);
        word-break: break-all;
    }
    .vless-copied-msg {
        display: none;
        position: absolute;
        top: 50%;
        right: 16px;
        transform: translateY(-50%);
        color: greenyellow;
        font-size: 13px;
        font-weight: 600;
    }
    .support-keys-table {
        min-width: 1060px;
        table-layout: fixed;
    }
    .support-keys-table > thead > tr > th,
    .support-keys-table > tbody > tr > td {
        padding: 7px 8px;
        font-size: 0.78rem;
        vertical-align: middle;
        white-space: nowrap;
    }
    .support-keys-table > thead > tr > th {
        font-size: 0.68rem;
        letter-spacing: 0;
    }
    .support-keys-table .details-row > td {
        white-space: normal;
    }
    .support-keys-table .key-link {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: #D2691E;
    }
    .support-keys-table .action-buttons {
        gap: 4px;
        flex-wrap: nowrap;
    }
    .support-keys-table .btn-icon {
        width: 28px;
        height: 28px;
        min-width: 28px;
        font-size: 11px;
        border-radius: 5px;
    }
    .support-keys-table .toggle-devices-btn {
        width: 42px;
        min-width: 42px;
    }
    .support-keys-table .devices-count-badge {
        width: 18px;
        min-width: 18px;
        height: 18px;
        font-size: 10px;
    }
    .support-keys-table .inner-table th,
    .support-keys-table .inner-table td {
        padding: 5px 8px;
        font-size: 0.78rem;
    }

    @media (max-width: 768px) {
        .table-container table:not(.support-keys-table):not(.inner-table) th,
        .table-container table:not(.support-keys-table):not(.inner-table) td {
            white-space: normal;
            word-break: break-word;
            font-size: 0.72rem;
            padding: 8px 6px;
        }

        .support-keys-table {
            min-width: auto;
            table-layout: auto;
        }

        .support-keys-table th:nth-child(6),
        .support-keys-table td:nth-child(6),
        .support-keys-table th:nth-child(8),
        .support-keys-table td:nth-child(8) {
            display: none;
        }

        .support-keys-table th:nth-child(9),
        .support-keys-table td:nth-child(9) {
            display: table-cell;
            min-width: 118px;
        }

        .support-keys-table .key-link {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 180px;
            font-size: 0.7rem;
        }

        .support-keys-table .action-buttons {
            flex-wrap: wrap;
            justify-content: flex-start;
            gap: 3px;
            min-width: 108px;
        }

        .support-keys-table .btn-icon {
            width: 26px;
            height: 26px;
            min-width: 26px;
        }

        .support-keys-table .toggle-devices-btn {
            width: 38px;
            min-width: 38px;
        }

        .support-keys-table > thead > tr > th,
        .support-keys-table > tbody > tr > td {
            padding: 6px 5px;
            font-size: 0.68rem;
        }

        .support-keys-table > thead > tr > th {
            font-size: 0.58rem;
        }

        .table-header > .table-title {
            font-size: 0.9rem;
        }

        .vless-link {
            font-size: 11px;
        }

        .spoiler-section .table-title {
            font-size: 0.82rem;
        }
    }


/* ===== Dashboard loaders ===== */
.dash-loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--highlight);
    border-radius: 50%;
    animation: dash-spin 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes dash-spin {
    to { transform: rotate(360deg); }
}

[data-section] {
    min-height: 20px;
}

.autopaylog-loader-cell {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
}

/* ===== SEO admin dark overrides ===== */
.main-content > .page-header {
    background: var(--secondary) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow) !important;
    color: var(--text) !important;
    padding: 20px 24px !important;
    margin-bottom: 24px !important;
}

.main-content > .page-header .page-header-content {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 16px !important;
    flex-wrap: wrap !important;
}

.main-content > .page-header .page-title h1 {
    color: var(--text) !important;
    font-size: 1.45rem !important;
    margin: 0 !important;
}

.main-content > .page-header + .content-wrapper {
    background: var(--secondary) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow) !important;
    color: var(--text) !important;
    overflow-x: auto !important;
}

.main-content > .page-header + .content-wrapper .filters-bar {
    background: rgba(0, 0, 0, 0.16) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
}

.main-content > .page-header + .content-wrapper .seo-table {
    min-width: 720px;
}

.main-content > .page-header + .content-wrapper .seo-table thead {
    background: rgba(0, 0, 0, 0.2) !important;
}

.main-content > .page-header + .content-wrapper .seo-table th,
.main-content > .page-header + .content-wrapper .seo-table td {
    border-bottom-color: var(--border) !important;
    color: var(--text) !important;
}

.main-content > .page-header + .content-wrapper .seo-table th {
    color: var(--text-secondary) !important;
    font-size: 0.78rem !important;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.main-content > .page-header + .content-wrapper .seo-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03) !important;
}

.main-content > .page-header + .content-wrapper .form-section-title {
    color: var(--text) !important;
    border-bottom-color: var(--border) !important;
}

.main-content > .page-header + .content-wrapper .form-group label,
.main-content > .page-header + .content-wrapper .filter-group label {
    color: var(--text) !important;
}

.main-content > .page-header + .content-wrapper .form-control,
.main-content > .page-header + .content-wrapper select,
.main-content > .page-header + .content-wrapper textarea,
.main-content > .page-header + .content-wrapper input[type="text"],
.main-content > .page-header + .content-wrapper input[type="url"],
.main-content > .page-header + .content-wrapper input[type="number"],
.main-content > .page-header + .content-wrapper input[type="file"] {
    background: rgba(0, 0, 0, 0.25) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

.main-content > .page-header + .content-wrapper select option {
    background: var(--secondary);
    color: var(--text);
}

.main-content > .page-header + .content-wrapper .form-control:focus,
.main-content > .page-header + .content-wrapper select:focus,
.main-content > .page-header + .content-wrapper textarea:focus,
.main-content > .page-header + .content-wrapper input:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
}

.main-content > .page-header + .content-wrapper .form-control::placeholder,
.main-content > .page-header + .content-wrapper input::placeholder,
.main-content > .page-header + .content-wrapper textarea::placeholder {
    color: rgba(255, 255, 255, 0.35) !important;
}

.main-content > .page-header + .content-wrapper .seo-tabs {
    border-bottom-color: var(--border) !important;
}

.main-content > .page-header + .content-wrapper .seo-tab {
    color: var(--text-secondary) !important;
}

.main-content > .page-header + .content-wrapper .seo-tab.active {
    color: #93c5fd !important;
    border-bottom-color: #2563eb !important;
    background: rgba(59, 130, 246, 0.08) !important;
}

.main-content > .page-header + .content-wrapper .seo-tab:hover {
    color: var(--text) !important;
    background: rgba(255, 255, 255, 0.04) !important;
}

.main-content > .page-header + .content-wrapper .badge,
.main-content > .page-header + .content-wrapper .badge[style] {
    background: rgba(59, 130, 246, 0.15) !important;
    border: 1px solid rgba(59, 130, 246, 0.22) !important;
    color: #93c5fd !important;
}

.main-content > .page-header + .content-wrapper .status-active {
    background: rgba(16, 185, 129, 0.15) !important;
    border: 1px solid rgba(16, 185, 129, 0.25) !important;
    color: var(--success) !important;
}

.main-content > .page-header + .content-wrapper .status-inactive {
    background: rgba(239, 68, 68, 0.12) !important;
    border: 1px solid rgba(239, 68, 68, 0.24) !important;
    color: var(--danger) !important;
}

.main-content > .page-header + .content-wrapper .alert,
.main-content > .page-header + .content-wrapper .alert[style] {
    background: rgba(245, 158, 11, 0.08) !important;
    border: 1px solid rgba(245, 158, 11, 0.28) !important;
    color: var(--warning) !important;
}

.main-content > .page-header + .content-wrapper .alert-success {
    background: rgba(16, 185, 129, 0.12) !important;
    border-color: rgba(16, 185, 129, 0.28) !important;
    color: var(--success) !important;
}

.main-content > .page-header + .content-wrapper .alert-error {
    background: rgba(239, 68, 68, 0.12) !important;
    border-color: rgba(239, 68, 68, 0.28) !important;
    color: var(--danger) !important;
}

.main-content > .page-header + .content-wrapper code {
    background: rgba(59, 130, 246, 0.1) !important;
    border: 1px solid rgba(59, 130, 246, 0.18) !important;
    color: #93c5fd !important;
    border-radius: 4px;
    padding: 2px 6px;
}

.main-content > .page-header + .content-wrapper .text-muted,
.main-content > .page-header + .content-wrapper small {
    color: var(--text-secondary) !important;
}

.seo-editor-toolbar {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.seo-editor-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.65);
}

.seo-editor-dialog {
    width: min(860px, 100%);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.seo-editor-header,
.seo-editor-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.seo-editor-header h3 {
    margin: 0;
    color: var(--text);
    font-size: 1.1rem;
}

.seo-editor-close {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
    font-size: 1.4rem;
    line-height: 1;
}

.seo-editor-body {
    padding: 20px;
}

.seo-editor-actions {
    justify-content: flex-end;
    border-top: 1px solid var(--border);
    border-bottom: 0;
}

.seo-editor-form .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
}

.seo-schema-actions {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 14px;
}

.schema-json-field {
    min-height: 320px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.86rem;
    line-height: 1.55;
    resize: vertical;
}

.site-upload-control {
    margin-top: 10px;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.34);
}

.site-upload-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary, #f8fafc);
    font-size: 13px;
    font-weight: 600;
}

.site-upload-status {
    display: block;
    margin-top: 7px;
    color: var(--text-secondary, #94a3b8);
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.site-upload-success {
    color: #34d399;
}

.site-upload-error {
    color: #f87171;
}
