* { margin: 0; padding: 0; box-sizing: border-box; }
html { overflow-x: hidden; }
body { 
    font-family: 'Inter', sans-serif; 
    background: #f5f5f5; 
    font-size: 13px; 
    overflow-x: hidden;
    max-width: 100vw;
}

/* Login */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-box {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
    width: 340px;
    max-width: 90vw;
}
.login-box h1 { margin-bottom: 20px; }
.login-box input {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
}
.error-text { color: #dc2626; margin-top: 10px; }

/* Main */
.main-screen { min-height: 100vh; display: flex; flex-direction: column; }

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}
.logo { color: white; font-size: 18px; font-weight: 700; white-space: nowrap; }
.header-controls { display: flex; gap: 10px; flex: 1; flex-wrap: wrap; }
.header-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.select-cabinet { padding: 8px 12px; border: none; border-radius: 6px; min-width: 160px; max-width: 100%; }
.sync-status { color: rgba(255,255,255,0.7); font-size: 11px; }
#userName { color: white; font-weight: 500; }

.btn { padding: 8px 16px; border: none; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; }
.btn-primary { background: #667eea; color: white; }
.btn-green { background: #10b981; color: white; }
.btn-red { background: #ef4444; color: white; }
.btn-purple { background: #8b5cf6; color: white; }
.btn-small { padding: 6px 10px; font-size: 11px; }

/* WB Stats Block - Воронка продаж */
.wb-stats-block {
    background: white;
    padding: 28px 24px;
    border-bottom: 1px solid #e5e7eb;
}
.wb-stats-row {
    display: flex;
    gap: 100px;
    margin-bottom: 28px;
    align-items: flex-start;
    padding-bottom: 20px;
    border-bottom: 1px solid #f3f4f6;
}
.wb-stat-item {
    display: flex;
    flex-direction: column;
    min-width: 180px;
}
.wb-stat-value {
    font-size: 40px;
    font-weight: 700;
    color: #111827;
    line-height: 1.1;
    letter-spacing: -0.5px;
}
.wb-stat-label {
    font-size: 15px;
    color: #6b7280;
    margin-top: 8px;
    line-height: 1.5;
    font-weight: 400;
}
.wb-stat-conv {
    font-size: 13px;
    color: #9ca3af;
    margin-top: 6px;
    font-weight: 400;
}

/* Chart */
.chart-block {
    margin-top: 0;
}
.chart-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.chart-title::before {
    content: '📊';
    font-size: 18px;
}
.chart-legend {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #6b7280;
}
.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot.gray { background: #d1d5db; }
.dot.purple { background: #a855f7; }

.chart-container {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 140px;
    padding: 15px 0;
    border-bottom: 1px solid #f3f4f6;
}
.chart-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
}
.chart-bars {
    display: flex;
    gap: 4px;
    align-items: flex-end;
    height: 110px;
    width: 100%;
    justify-content: center;
}
.chart-bar {
    width: 24px;
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: opacity 0.2s;
}
.chart-bar:hover { opacity: 0.8; }
.chart-bar.prev { background: #d1d5db; }
.chart-bar.curr { background: #a855f7; }
.chart-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

/* Stats Row */
.stats-row {
    background: white;
    padding: 10px 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    border-bottom: 1px solid #e5e7eb;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.stat-card {
    background: #f9fafb;
    padding: 8px 14px;
    border-radius: 6px;
}
.stat-card.stat-blue { background: #eff6ff; }
.stat-card.stat-orange { background: #fff7ed; }
.stat-card.stat-green { background: #ecfdf5; }
.stat-card.stat-red { background: #fef2f2; }
.stat-label { font-size: 9px; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 15px; font-weight: 700; margin-top: 2px; }

/* Filters */
.filters-row {
    background: white;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
    flex-wrap: wrap;
    gap: 10px;
}
.input-search {
    width: 280px;
    max-width: 100%;
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}
.last-sync { margin-left: auto; color: #9ca3af; font-size: 11px; white-space: nowrap; }

/* Меню фильтра колонок */
.column-filter-menu {
    position: absolute;
    top: 100%;
    right: 20px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 250px;
    max-height: 500px;
    overflow-y: auto;
    margin-top: 5px;
}
.column-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #e5e7eb;
}
.column-filter-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}
.btn-close-small {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}
.btn-close-small:hover {
    background: #f3f4f6;
    color: #111827;
}
.column-filter-options {
    padding: 10px;
    max-height: 350px;
    overflow-y: auto;
}
.column-filter-option {
    display: flex;
    align-items: center;
    padding: 10px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
}
.column-filter-option:hover {
    background: #f9fafb;
}
.column-filter-option input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}
.column-filter-option span {
    font-size: 14px;
    color: #111827;
    user-select: none;
}
.column-filter-actions {
    display: flex;
    gap: 10px;
    padding: 15px;
    border-top: 1px solid #e5e7eb;
}
.column-filter-actions .btn {
    flex: 1;
}

/* Excel-стиль фильтры в заголовках таблицы */
.th-filter-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
}
.th-filter-btn {
    background: transparent;
    border: none;
    padding: 2px 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: all 0.2s;
    opacity: 0.7;
    min-width: 18px;
    height: 18px;
}
.th-filter-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    opacity: 1;
}
.th-filter-btn.th-filter-active {
    background: rgba(102, 126, 234, 0.3);
    opacity: 1;
}
.th-filter-btn.th-filter-active:hover {
    background: rgba(102, 126, 234, 0.4);
}
.filter-caret {
    font-size: 10px;
    color: inherit;
    line-height: 1;
}
.excel-filter-dropdowns {
    position: relative;
    z-index: 1000;
}
.excel-filter-menu {
    position: absolute;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 280px;
    z-index: 1001;
}
.excel-filter-menu-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    background: #f9fafb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.excel-filter-close {
    background: transparent;
    border: none;
    font-size: 20px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    line-height: 1;
}
.excel-filter-close:hover {
    background: #f3f4f6;
    color: #111827;
}
.excel-filter-menu-body {
    padding: 16px;
}
.excel-filter-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}
.excel-filter-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.excel-filter-range {
    display: flex;
    gap: 12px;
}
.excel-filter-range-item {
    flex: 1;
}
.excel-filter-range-item label {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 6px;
    font-weight: 500;
}
.excel-filter-menu-footer {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}
.excel-filter-btn-apply {
    flex: 1;
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.excel-filter-btn-apply:hover {
    background: #5568d3;
}
.excel-filter-btn-clear {
    padding: 8px 16px;
    background: white;
    color: #6b7280;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.excel-filter-btn-clear:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

/* Table */
.table-wrapper { 
    flex: 1; 
    overflow-x: auto; 
    overflow-y: auto;
    background: white; 
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100vw;
}
.data-table { 
    width: 100%; 
    border-collapse: collapse; 
    min-width: 100%;
}
.data-table thead { position: sticky; top: 0; z-index: 10; }
.data-table th {
    background: #1f2937;
    color: white;
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
}
.data-table th.sortable { cursor: pointer; }
.data-table th.sortable:hover { background: #374151; }
.data-table td {
    padding: 8px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}
.data-table tr:hover { background: #fafafa; }

.cell-num { color: #9ca3af; text-align: center; font-size: 12px; }
.cell-photo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px !important;
}
.photo-article {
    font-size: 11px;
    color: #667eea;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
}
.photo-nmid {
    font-size: 13px;
    font-weight: 700;
    color: #111;
    text-align: center;
}
.photo-nmid a {
    color: inherit;
    text-decoration: none;
}
.photo-nmid a:hover {
    color: #667eea;
}
.photo-brand {
    font-size: 11px;
    color: #9ca3af;
    text-align: center;
}
.photo-cabinet {
    font-size: 9px;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
    text-align: center;
}
.cell-photo img {
    width: 210px;
    height: 270px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.cell-card { display: none; }
.card-nmid { font-size: 12px; font-weight: 700; color: #111; }
.card-nmid a { color: inherit; text-decoration: none; }
.card-nmid a:hover { color: #667eea; }
.card-brand { font-size: 10px; color: #9ca3af; }
.card-cabinet { font-size: 9px; background: #f3f4f6; padding: 2px 6px; border-radius: 3px; margin-top: 3px; display: inline-block; }

.cell-name { 
    text-align: left; 
    font-size: 12px; 
    color: #374151; 
    line-height: 1.4; 
    padding: 8px;
}
.product-title {
    font-weight: 500;
    color: #111827;
    margin-bottom: 6px;
}
.product-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11px;
    color: #6b7280;
    margin-top: 4px;
}
.product-info span {
    display: inline-block;
}
.product-article {
    color: #9ca3af;
}
.product-nmid a {
    color: #667eea;
    text-decoration: none;
}
.product-nmid a:hover {
    text-decoration: underline;
}
.product-brand {
    color: #6b7280;
    font-weight: 500;
}
.product-cabinet {
    color: #9ca3af;
    font-size: 10px;
}

/* WB Chart in Table - точно как на WB */
.cell-chart { padding: 16px 12px !important; width: 300px; }
.wb-chart-container {
    width: 100%;
    background: white;
}
/* Воронка продаж - уменьшенная */
.wb-funnel-block {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}
.wb-funnel-title {
    font-size: 12px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 10px;
}
.wb-funnel-row {
    display: flex;
    gap: 0;
    justify-content: space-between;
}
.wb-funnel-item {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    padding: 0 8px;
    border-right: 1px solid #f3f4f6;
}
.wb-funnel-item:last-child {
    border-right: none;
}
.wb-funnel-label {
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 4px;
    line-height: 1.3;
}
.wb-funnel-value {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    line-height: 1.1;
    letter-spacing: -0.3px;
    margin-bottom: 2px;
}
.wb-funnel-conv {
    font-size: 9px;
    color: #9ca3af;
    margin-top: 2px;
    line-height: 1.3;
    font-weight: 400;
}

/* График динамики продаж - уменьшенный */
.wb-chart-block {
    margin-top: 0;
}
.wb-chart-title-row {
    margin-bottom: 8px;
}
.wb-chart-title {
    font-size: 12px;
    font-weight: 600;
    color: #111827;
    line-height: 1.2;
}
.wb-chart-legend-row {
    display: flex;
    gap: 16px;
    font-size: 10px;
    color: #6b7280;
    margin-bottom: 8px;
}
.wb-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.wb-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.wb-legend-dot.gray { background: #d1d5db; }
.wb-legend-dot.purple { background: #a855f7; }
.wb-chart-body {
    display: flex;
    gap: 12px;
    position: relative;
    align-items: flex-start;
}
.wb-chart-area {
    flex: 1;
    position: relative;
    height: 80px;
    display: flex;
    align-items: flex-end;
}
.wb-chart-bars-wrapper {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0;
    height: 100%;
    width: 100%;
    padding: 0 2px;
}
.wb-chart-yaxis {
    display: flex;
    flex-direction: column-reverse;
    justify-content: space-between;
    align-items: flex-start;
    width: 22px;
    height: 80px;
    padding-left: 6px;
    flex-shrink: 0;
}
.wb-yaxis-label {
    font-size: 9px;
    color: #9ca3af;
    line-height: 1;
    font-weight: 400;
    text-align: left;
}
.wb-chart-day-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    height: 100%;
    position: relative;
}
.wb-chart-bars {
    display: flex;
    gap: 3px;
    align-items: flex-end;
    justify-content: center;
    height: 100%;
    width: 100%;
    position: relative;
    min-height: 80px;
}
.wb-chart-bar {
    width: 14px;
    border-radius: 2px 2px 0 0;
    min-height: 2px;
    transition: opacity 0.2s;
}
.wb-chart-bar.prev {
    background: #d1d5db;
}
.wb-chart-bar.curr {
    background: #a855f7;
}
.wb-chart-bar:hover {
    opacity: 0.85;
}
.wb-chart-day-label {
    font-size: 10px;
    color: #6b7280;
    font-weight: 500;
    margin-top: auto;
    padding-top: 2px;
}
.wb-chart-tooltip {
    position: absolute;
    bottom: calc(100% + 14px);
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
    z-index: 1000;
    white-space: nowrap;
    display: none;
    font-size: 12px;
    pointer-events: none;
    min-width: 240px;
    text-align: left;
}
.wb-chart-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: white;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}
.wb-chart-day-group:hover .wb-chart-tooltip {
    display: block;
}
.wb-tooltip-date {
    font-weight: 600;
    color: #111827;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
    line-height: 1.4;
}
.wb-tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    gap: 20px;
}
.wb-tooltip-label {
    color: #6b7280;
    font-size: 12px;
}
.wb-tooltip-value {
    font-weight: 600;
    color: #111827;
    font-size: 12px;
}

/* Tooltip */
.chart-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 1000;
    white-space: nowrap;
    display: none;
    font-size: 12px;
    pointer-events: none;
}
.mini-chart-day:hover .chart-tooltip { display: block; }
.tooltip-date {
    font-weight: 600;
    color: #111827;
    margin-bottom: 6px;
    font-size: 13px;
}
.tooltip-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 3px 0;
}
.tooltip-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.tooltip-dot.curr { background: #a855f7; }
.tooltip-dot.prev { background: #d1d5db; }
.tooltip-label {
    color: #6b7280;
    flex: 1;
}
.tooltip-value {
    font-weight: 700;
    color: #111827;
    font-size: 13px;
}

.cell-orders { text-align: center; }
.order-value { font-size: 15px; font-weight: 700; }
.order-today { color: #2563eb; }
.order-yesterday { color: #d97706; }
.order-week { color: #6b7280; }

.cell-ads { text-align: center; font-size: 12px; color: #9ca3af; }
.cell-price { font-weight: 700; color: #059669; font-size: 14px; }
.cell-stock { font-weight: 700; font-size: 14px; cursor: pointer; }
.cell-stock:hover { text-decoration: underline; }
.stock-low { color: #dc2626; }
.stock-med { color: #d97706; }
.stock-high { color: #059669; }
.cell-value { font-weight: 700; font-size: 13px; color: #374151; }

/* Loader */
.loader {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.95);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 1000;
}
.spinner {
    width: 40px; height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loaderText {
    text-align: center;
    font-size: 14px;
    line-height: 1.6;
    max-width: 500px;
    padding: 0 20px;
    font-family: 'Courier New', monospace;
}

/* Modal */
.modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 2000;
}
.modal-content { background: white; padding: 25px; border-radius: 12px; width: 380px; }
.modal-content.modal-wide { width: 600px; max-height: 80vh; overflow: auto; }
.modal-content.modal-photo-gallery { width: 90vw; max-width: 1200px; padding: 0; }
.modal-content h2 { margin-bottom: 15px; font-size: 18px; }
.modal-content input { width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid #e5e7eb; border-radius: 6px; }
.modal-buttons { display: flex; gap: 10px; margin-top: 15px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid #e5e7eb; }
.modal-header h2 { margin: 0; font-size: 18px; color: #111827; }
.modal-body { margin-bottom: 20px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; padding-top: 15px; border-top: 1px solid #e5e7eb; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; color: #374151; font-size: 13px; }
.form-group input { width: 100%; padding: 10px; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 13px; }
.form-group input:focus { outline: none; border-color: #667eea; }
.form-group small { display: block; margin-top: 4px; }
.btn-secondary { background: #6b7280; color: white; }
.btn-close { background: none; border: none; font-size: 24px; color: #6b7280; cursor: pointer; padding: 0; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 4px; }
.btn-close:hover { background: #f3f4f6; color: #111827; }

#stocksDetail table { width: 100%; border-collapse: collapse; }
#stocksDetail th, #stocksDetail td { padding: 8px; border: 1px solid #e5e7eb; text-align: left; font-size: 12px; }
#stocksDetail th { background: #f9fafb; }

.hidden { display: none !important; }

/* Advertising List */
.ads-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 60vh;
    overflow-y: auto;
}
.ad-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.2s;
}
.ad-card:hover { border-color: #667eea; }

.ad-info { flex: 1; }
.ad-name { font-weight: 700; font-size: 14px; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.ad-status { padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; text-transform: uppercase; }
.status-active { background: #dcfce7; color: #15803d; }
.status-pause { background: #f3f4f6; color: #6b7280; }
.ad-sub { font-size: 12px; color: #6b7280; display: flex; gap: 12px; }

.ad-stats { display: flex; gap: 16px; margin: 0 20px; }
.ad-stat-item { text-align: center; }
.ad-stat-val { font-weight: 700; font-size: 14px; }
.ad-stat-lbl { font-size: 10px; color: #6b7280; }

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

/* Photo Gallery */
.photo-gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 10px;
    border-bottom: 1px solid #e5e7eb;
}
.photo-gallery-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}
.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s;
}
.btn-close:hover {
    background: #f3f4f6;
    color: #111827;
}
.photo-gallery-main {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px 10px;
    gap: 20px;
    position: relative;
    min-height: 500px;
    background: #f9fafb;
}
.photo-gallery-sidebar {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100px;
    flex-shrink: 0;
}
.photo-gallery-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 10px;
    position: relative;
}
.photo-gallery-viewport {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 800px;
    max-height: 700px;
    background: white;
    border-radius: 8px;
}
.photo-gallery-viewport img {
    max-width: 100%;
    max-height: 700px;
    object-fit: contain;
    border-radius: 8px;
}
.photo-gallery-nav {
    width: 20px;
    height: 20px;
    border: none;
    background: white;
    border-radius: 50%;
    font-size: 10px;
    color: #111827;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.2s;
    flex-shrink: 0;
    z-index: 10;
}
.photo-gallery-nav:hover {
    background: #667eea;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
.photo-gallery-nav:active {
    transform: scale(0.95);
}
.photo-gallery-thumbnails {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 600px;
    width: 100%;
    padding: 0;
    align-items: center;
}
.photo-gallery-thumbnails::-webkit-scrollbar {
    width: 4px;
}
.photo-gallery-thumbnails::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}
.photo-gallery-thumbnails::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 2px;
}
.photo-gallery-thumbnails::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Мобильная версия */
@media (max-width: 768px) {
    .photo-gallery-main {
        flex-direction: column;
        padding: 15px 10px;
        gap: 15px;
    }
    .photo-gallery-sidebar {
        display: none;
    }
    .photo-gallery-center {
        width: 100%;
        position: relative;
    }
    .photo-gallery-viewport {
        max-width: 100%;
        max-height: 400px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        background: transparent;
    }
    .photo-gallery-viewport img {
        max-height: 400px;
        width: 100%;
        object-fit: cover;
        border-radius: 8px;
    }
    .photo-gallery-nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 18px;
        height: 18px;
        font-size: 9px;
        z-index: 20;
    }
    .photo-gallery-prev {
        left: 10px;
    }
    .photo-gallery-next {
        right: 10px;
    }
    .photo-gallery-header {
        padding: 10px 15px;
    }
    .photo-gallery-header h2 {
        font-size: 12px;
    }
    .photo-gallery-counter {
        bottom: 10px;
        font-size: 12px;
        padding: 6px 12px;
    }
    .btn-close {
        width: 24px;
        height: 24px;
        font-size: 20px;
    }
    .modal-content.modal-photo-gallery {
        width: 95vw;
        max-width: 95vw;
    }
}

/* ========== АДАПТИВНЫЙ ДИЗАЙН ДЛЯ МОБИЛЬНЫХ ========== */

@media (max-width: 768px) {
    body { font-size: 12px; }
    
    /* Header */
    .header {
        padding: 8px 12px;
        gap: 8px;
    }
    .logo { font-size: 16px; }
    .header-controls {
        width: 100%;
        order: 3;
        margin-top: 8px;
    }
    .header-right {
        margin-left: auto;
        gap: 8px;
    }
    .select-cabinet {
        min-width: 120px;
        font-size: 11px;
        padding: 6px 10px;
    }
    .btn-small {
        padding: 5px 8px;
        font-size: 10px;
    }
    .sync-status {
        display: none;
    }
    
    /* Stats */
    .stats-row {
        padding: 8px 12px;
        gap: 6px;
    }
    .stat-card {
        padding: 6px 10px;
        flex: 1 1 calc(50% - 3px);
        min-width: calc(50% - 3px);
    }
    .stat-label {
        font-size: 8px;
    }
    .stat-value {
        font-size: 13px;
    }
    
    /* Filters */
    .filters-row {
        padding: 8px 12px;
        gap: 8px;
    }
    .input-search {
        width: 100%;
        min-width: 0;
        font-size: 14px;
    }
    .filters-row .btn {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 10px;
        padding: 6px 8px;
        white-space: nowrap;
    }
    .last-sync {
        width: 100%;
        margin-left: 0;
        margin-top: 4px;
        text-align: center;
        font-size: 10px;
    }
    
    /* Table - карточный вид на мобильных */
    .data-table {
        display: block;
    }
    .data-table thead {
        display: none;
    }
    .data-table tbody {
        display: block;
    }
    .data-table tr {
        display: block;
        margin-bottom: 16px;
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        padding: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }
    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border: none;
        border-bottom: 1px solid #f3f4f6;
    }
    .data-table td:last-child {
        border-bottom: none;
    }
    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
        font-size: 11px;
        text-transform: uppercase;
        margin-right: 12px;
        flex-shrink: 0;
    }
    
    /* Ячейки в карточном виде */
    .cell-num {
        display: none;
    }
    .cell-photo {
        width: 100%;
        padding: 0 0 12px 0 !important;
        border-bottom: 1px solid #e5e7eb;
        margin-bottom: 12px;
    }
    .cell-photo img {
        width: 100%;
        max-width: 200px;
        height: auto;
        aspect-ratio: 210/270;
        margin: 0 auto;
    }
    .cell-name {
        flex-direction: column;
        align-items: flex-start;
        padding: 0 0 12px 0 !important;
        border-bottom: 1px solid #e5e7eb;
        margin-bottom: 12px;
    }
    .cell-name::before {
        content: 'НАЗВАНИЕ';
        margin-bottom: 8px;
    }
    .cell-chart {
        width: 100% !important;
        padding: 12px 0 !important;
        border-bottom: 1px solid #e5e7eb;
        margin-bottom: 12px;
    }
    .cell-chart::before {
        content: 'ЗАКАЗЫ (7 ДНЕЙ)';
        margin-bottom: 12px;
    }
    .cell-orders {
        width: 100%;
    }
    .cell-orders::before {
        content: attr(data-label);
    }
    .cell-ads {
        width: 100%;
        padding: 12px 0 !important;
        border-bottom: 1px solid #e5e7eb;
        margin-bottom: 12px;
    }
    .cell-ads::before {
        content: 'РЕКЛАМА';
        margin-bottom: 8px;
    }
    .cell-price::before {
        content: 'ЦЕНА';
    }
    .cell-stock::before {
        content: 'ОСТАТОК';
    }
    .cell-value::before {
        content: 'СТОИМОСТЬ';
    }
    
    /* Графики в карточках */
    .wb-chart-container {
        width: 100%;
    }
    .wb-funnel-row {
        flex-direction: column;
        gap: 12px;
    }
    .wb-funnel-item {
        border-right: none;
        border-bottom: 1px solid #f3f4f6;
        padding: 12px 0;
    }
    .wb-funnel-item:last-child {
        border-bottom: none;
    }
    .wb-chart-body {
        flex-direction: column;
    }
    .wb-chart-yaxis {
        display: none;
    }
    .wb-chart-area {
        width: 100%;
    }
    
    /* Modals */
    .modal-content {
        width: 95vw !important;
        max-width: 95vw !important;
        padding: 20px 15px;
        margin: 10px;
        max-height: 90vh;
        overflow-y: auto;
    }
    .modal-content.modal-wide {
        width: 95vw !important;
        max-width: 95vw !important;
    }
    
    /* Column filter menu */
    .column-filter-menu {
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: calc(100vw - 20px);
    }
    
    /* Excel filter menu */
    .excel-filter-menu {
        left: 10px !important;
        right: 10px !important;
        min-width: auto;
        max-width: calc(100vw - 20px);
    }
    
    /* Login */
    .login-box {
        padding: 30px 20px;
        width: 90vw;
        max-width: 400px;
    }
    
    /* WB Stats Block */
    .wb-stats-row {
        flex-direction: column;
        gap: 20px;
    }
    .wb-stat-item {
        min-width: 100%;
    }
    .wb-stat-value {
        font-size: 32px;
    }
}

@media (max-width: 480px) {
    body { font-size: 11px; }
    
    .header {
        padding: 6px 10px;
    }
    .logo {
        font-size: 14px;
    }
    
    .stats-row {
        padding: 6px 10px;
    }
    .stat-card {
        flex: 1 1 100%;
        min-width: 100%;
    }
    
    .filters-row {
        padding: 6px 10px;
    }
    .filters-row .btn {
        font-size: 9px;
        padding: 5px 6px;
    }
    
    .cell-photo img {
        max-width: 150px;
    }
    
    .photo-gallery-thumbnails {
        grid-template-columns: repeat(3, 50px);
        grid-template-rows: repeat(2, 50px);
        gap: 6px;
        padding: 8px 10px;
        max-height: 120px;
        height: 120px;
    }
    .photo-thumbnail {
        width: 50px;
        height: 50px;
        min-width: 50px;
        max-width: 50px;
    }
    .photo-gallery-main {
        padding: 15px 10px;
        min-height: 250px;
    }
    .photo-gallery-viewport img {
        max-height: 300px;
    }
    
    .modal-content {
        padding: 15px 12px;
    }
    
    .login-box {
        padding: 25px 15px;
    }
    .login-box h1 {
        font-size: 20px;
    }
}
.photo-thumbnail {
    width: 80px;
    height: 80px;
    min-width: 80px;
    max-width: 80px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    box-sizing: border-box;
    background: white;
}
.photo-thumbnail:hover {
    border-color: #667eea;
    transform: scale(1.05);
}
.photo-thumbnail.active {
    border-color: #a855f7;
    border-width: 3px;
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.2);
}
.photo-gallery-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    font-size: 14px;
    color: #111827;
    font-weight: 500;
    z-index: 10;
}
.photo-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Модальное окно управления рекламой */
.advertising-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
}
.ad-tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s;
    margin-bottom: -2px;
}
.ad-tab:hover {
    color: #667eea;
}
.ad-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}
.ad-tab-content {
    display: none;
    padding: 20px 0;
}
.ad-tab-content.active {
    display: block;
}
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: 500;
    color: #111827;
}
.form-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}
.form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
