/* Десктопная вебморда. Без адаптива/медиазапросов — по правилам проекта. */
* { box-sizing: border-box; }
body {
    margin: 0;
    font: 14px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: #1d2330;
    background: #f4f6f9;
}
a { color: #2a6df4; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 10px 20px;
    background: #1d2330;
    color: #fff;
}
.topbar .brand { color: #fff; font-weight: 600; }
.topbar .topnav a { color: #c9d4e8; margin-right: 16px; }
.topbar .user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar .user span { color: #c9d4e8; }
form.inline { display: inline; margin: 0; }
button.link {
    background: none; border: none; color: #ff9d9d; cursor: pointer; padding: 0; font: inherit;
}

.content { padding: 20px; max-width: 1200px; margin: 0 auto; }
h1 { font-size: 20px; margin: 0 0 16px; }

/* вход */
body.centered { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.card {
    background: #fff; padding: 28px 32px; border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08); width: 320px;
}
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #5a6477; }
.form input { padding: 8px 10px; border: 1px solid #cfd6e4; border-radius: 6px; font-size: 14px; }
button {
    padding: 8px 16px; border: 1px solid #2a6df4; background: #2a6df4; color: #fff;
    border-radius: 6px; cursor: pointer; font-size: 14px;
}
button:hover { background: #1f5ad6; }
.error { color: #c0392b; }

/* счётчики */
.counts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
    background: #e8edf6; color: #41506b; padding: 3px 10px; border-radius: 12px; font-size: 12px;
}
.chip.total { background: #1d2330; color: #fff; }

/* фильтры */
.filters {
    background: #fff; border: 1px solid #e3e8f0; border-radius: 8px;
    padding: 12px 14px; margin-bottom: 16px;
}
.filter-statuses { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-row input, .filter-row select {
    padding: 7px 9px; border: 1px solid #cfd6e4; border-radius: 6px; font-size: 13px;
}
label.check { font-size: 12px; color: #5a6477; display: inline-flex; align-items: center; gap: 4px; }
.btn-link { padding: 8px 12px; }

/* таблица */
table.grid { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #e3e8f0; }
table.grid th, table.grid td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #eef1f6; }
table.grid th { background: #f0f3f8; font-size: 12px; color: #5a6477; text-transform: uppercase; }
table.grid tr.flagged { background: #fff7ed; }
table.grid td.empty { text-align: center; color: #8a93a5; padding: 24px; }

.status { padding: 2px 8px; border-radius: 10px; font-size: 12px; background: #e8edf6; color: #41506b; }
.status-published { background: #d7f5e0; color: #1e7a45; }
.status-in_review { background: #fdeecb; color: #8a6d12; }
.status-error { background: #fbdcdc; color: #b02a2a; }

.pager { margin-top: 14px; }

/* ── рабочее место контентщика ─────────────────────────────────────────── */
.toolbar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: #fff; border: 1px solid #e3e8f0; border-radius: 8px;
    padding: 8px 12px; margin-bottom: 12px;
}
.toolbar .speed { margin-left: auto; color: #5a6477; font-size: 13px; }
button.primary { background: #1e7a45; border-color: #1e7a45; }
button.primary:hover { background: #176236; }

.lock-banner {
    background: #fdeecb; color: #8a6d12; border: 1px solid #f0d896;
    padding: 10px 14px; border-radius: 8px; margin-bottom: 12px;
}

.workspace { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.card-left, .card-right { background: #fff; border: 1px solid #e3e8f0; border-radius: 8px; padding: 16px; }
.card-left h2, .card-right h2 { font-size: 14px; margin: 18px 0 8px; color: #41506b; }
.prod-head h1 { font-size: 18px; margin: 0 0 6px; }
.prod-head .meta { display: flex; gap: 14px; flex-wrap: wrap; color: #5a6477; font-size: 13px; align-items: center; }

.text-field { margin-bottom: 12px; }
.text-field label { display: block; font-size: 12px; color: #5a6477; margin-bottom: 4px; }
.text-field .ver { color: #2a6df4; margin-left: 6px; }
.text-field .save-state { color: #1e7a45; margin-left: 6px; }
.text-field textarea {
    width: 100%; border: 1px solid #cfd6e4; border-radius: 6px; padding: 8px; font: inherit; resize: vertical;
}

/* плитки изображений + dropzone */
.tiles {
    display: flex; flex-wrap: wrap; gap: 8px; min-height: 80px;
    border: 1px dashed #cfd6e4; border-radius: 8px; padding: 8px; background: #fafbfd;
}
.tiles.dropzone { transition: background .1s; }
.tile {
    width: 120px; border: 1px solid #e3e8f0; border-radius: 6px; background: #fff;
    padding: 6px; cursor: grab; user-select: none;
}
.tile.dragging { opacity: .4; }
.tile .thumb {
    width: 100%; height: 80px; background: #eef1f6; border-radius: 4px;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.tile .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.tile .thumb .ph { color: #8a93a5; font-size: 13px; }
.tile .tile-label { font-size: 11px; color: #5a6477; margin: 4px 0; text-align: center; }
.process-menu { display: none; flex-wrap: wrap; gap: 3px; }
.process-btn {
    font-size: 10px; padding: 2px 5px; background: #eef1f6; color: #41506b;
    border: 1px solid #d6deea; border-radius: 4px; cursor: pointer;
}
.process-btn:hover { background: #e0e7f2; }

.picklist { list-style: none; padding: 0; margin: 0; }
.picklist li { padding: 4px 0; border-bottom: 1px solid #f0f3f8; }
.picklist .tag { background: #e8edf6; color: #41506b; font-size: 11px; padding: 1px 6px; border-radius: 8px; margin-left: 6px; }
.hint { color: #8a93a5; font-size: 13px; }

/* тосты */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { padding: 8px 14px; border-radius: 6px; color: #fff; font-size: 13px; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.toast.ok { background: #1e7a45; }
.toast.err { background: #c0392b; }

/* создание товара / шапка списка */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.page-head h1 { margin: 0; }
.btn-primary {
    background: #2a6df4; color: #fff; padding: 8px 14px; border-radius: 6px; font-size: 14px;
}
.btn-primary:hover { background: #1f5ad6; text-decoration: none; }
.form-wide { max-width: 520px; }
.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.field-error { color: #c0392b; font-size: 12px; }

/* ── карточка v2: слева превью, справа вкладки ──────────────────────────── */
.preview-main {
    width: 100%; min-height: 200px; background: #f0f3f8; border: 1px solid #e3e8f0;
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    overflow: hidden; margin-bottom: 10px;
}
.preview-main img { max-width: 100%; max-height: 360px; object-fit: contain; }
.ph-big { color: #8a93a5; font-size: 14px; }

.gallery-strip { min-height: 70px; }
.tile { position: relative; }

/* Контролы плитки видны в зависимости от контейнера, где она лежит сейчас. */
.tile .main-badge {
    position: absolute; top: 4px; left: 4px; z-index: 2; display: none;
    background: #1e7a45; color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 8px;
}
#gallery .tile.is-main { border-color: #1e7a45; box-shadow: 0 0 0 2px #1e7a45 inset; }
#gallery .tile.is-main .main-badge { display: inline-block; }

.tile-corner { position: absolute; top: 4px; right: 4px; z-index: 3; display: flex; gap: 3px; }
.tile-corner button {
    cursor: pointer; line-height: 1; padding: 2px 6px; font-size: 12px;
    background: rgba(255,255,255,.9); border: 1px solid #d6deea; border-radius: 4px;
}
.make-main { display: none; color: #8a6d12; }          /* по умолчанию скрыта */
#gallery .tile .make-main { display: inline-flex; }     /* «сделать главной» — только в галерее */
#gallery .tile.is-main .make-main { display: none; }    /* у самой главной не нужна */
.del-img { color: #c0392b; font-weight: 700; }
.del-img:hover { background: #c0392b; color: #fff; border-color: #c0392b; }

/* кнопки обработки — только в пуле «Собранные» */
#collected .tile .process-menu { display: flex; }

.pool-title { font-size: 13px; color: #5a6477; margin: 12px 0 6px; text-transform: uppercase; letter-spacing: .03em; }

.preview-texts { margin-top: 14px; }
.pv-block { margin-bottom: 12px; }
.pv-block h3 { font-size: 13px; color: #5a6477; margin: 0 0 4px; text-transform: uppercase; letter-spacing: .03em; }
.pv { white-space: normal; line-height: 1.5; }
table.pv-params { width: 100%; border-collapse: collapse; }
table.pv-params td { padding: 4px 8px; border-bottom: 1px solid #eef1f6; vertical-align: top; }
table.pv-params td:first-child { color: #5a6477; width: 40%; }

/* вкладки справа */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 2px solid #e3e8f0; margin-bottom: 14px; }
.tab {
    background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px;
    padding: 8px 12px; cursor: pointer; color: #5a6477; font-size: 13px; border-radius: 0;
}
.tab:hover { color: #1d2330; }
.tab.active { color: #2a6df4; border-bottom-color: #2a6df4; font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.tab-actions { margin-bottom: 10px; }
.tab-actions button { font-size: 13px; }

.quick-search { background: #f0f3f8; border: 1px solid #e3e8f0; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.quick-search .qs-label { color: #5a6477; font-size: 13px; }
.quick-search a { font-size: 13px; padding: 3px 10px; background: #fff; border: 1px solid #d6deea; border-radius: 6px; }

.preview-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pv-thumb { width: 64px; height: 64px; object-fit: cover; border: 1px solid #e3e8f0; border-radius: 6px; }
.pv-thumb:first-child { border-color: #1e7a45; box-shadow: 0 0 0 2px #1e7a45 inset; }

/* кнопки порядка/добавления на плитке (видимость — по контейнеру) */
.tile-move { display: flex; justify-content: center; gap: 4px; margin-top: 4px; }
.tile-move button {
    cursor: pointer; line-height: 1; padding: 2px 7px; font-size: 12px;
    background: #eef1f6; color: #41506b; border: 1px solid #d6deea; border-radius: 4px;
}
.tile-move button:hover { background: #e0e7f2; }
.move-left, .move-right { display: none; }
.add-to-card { display: none; font-weight: 700; color: #1e7a45; }
#gallery .tile .move-left, #gallery .tile .move-right { display: inline-flex; }
#collected .tile .add-to-card, #processed .tile .add-to-card { display: inline-flex; }

/* нормализация характеристик / генерация текста */
.normalize-box { margin-bottom: 12px; }
.normalize-box textarea {
    width: 100%; border: 1px solid #cfd6e4; border-radius: 6px; padding: 8px; font: inherit; resize: vertical;
}
#params-normalize { margin-top: 6px; }
button.mini { font-size: 11px; padding: 3px 8px; margin-left: 8px; background: #eef1f6; color: #2a6df4; border-color: #d6deea; }
button.mini:hover { background: #e0e7f2; }
