@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;600;700&display=swap');

:root {
  font: 13px/1.35 Roboto, Arial, sans-serif;
  color: #202724;
  background: #f8faf9;
  --line: #d9e0dc;
  --cell-line: #e4e7e5;
  --ink: #202724;
  --green: #176743;
  --muted: #53635b;
  --heading: #ebf1ed;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.topbar { min-height: 36px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; padding: 3px 12px;
  background: white; border-bottom: 1px solid var(--line); }
.wordmark { color: var(--green); font-weight: 700; letter-spacing: .08em; font-size: 12px; }
.section-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.section-tabs a { display: block; padding: 5px 9px; color: var(--green); text-decoration: none; border-radius: 4px; }
.section-tabs a[aria-current="page"] { background: #e4efe8; font-weight: 500; }
.account-actions { margin-left: auto; display: flex; gap: 6px; }
main { max-width: none; margin: 0 auto; padding: 7px 10px; }
h1 { font-size: 21px; letter-spacing: -.02em; line-height: 1.15; margin: 0; }
.page-title { display: flex; gap: 10px; align-items: baseline; margin-bottom: 10px; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; padding: 7px 9px; background: #fff; border: 1px solid var(--line); border-radius: 4px; }
.heatmap-toolbar { padding: 4px 6px;
  border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.heatmap-toolbar .filters { padding: 0; border: 0; gap: 4px 7px; }
label, .toolbar-field { display: flex; flex-direction: column; gap: 2px; font-size: 11px; font-weight: 500; color: var(--muted); }
.cabinet { min-width: min(200px, 100%); }
.toolbar-menu { position: relative; margin: 0; }
.toolbar-trigger { display: flex; align-items: center; justify-content: space-between; gap: 5px;
  width: auto; min-height: 27px; padding: 0 7px; list-style: none; border: 1px solid var(--line);
  border-radius: 4px; color: var(--green); background: #fff; font-size: 12px; white-space: nowrap; }
.toolbar-trigger::after { content: "▾"; font-size: 10px; }
.toolbar-trigger::-webkit-details-marker { display: none; }
.toolbar-trigger:hover, .toolbar-menu[open] > .toolbar-trigger { background: var(--heading); }
.toolbar-trigger:focus-visible { outline: 2px solid #327cbd; outline-offset: 1px; }
.toolbar-field .toolbar-trigger { min-width: 155px; }
.toolbar-popup { position: absolute; top: calc(100% + 4px); left: 0; z-index: 8; display: grid; gap: 6px;
  max-height: min(530px, 70dvh); padding: 7px; overflow: auto; border: 1px solid #c5d1ca; border-radius: 5px;
  box-shadow: 0 3px 10px #182b2322; background: #fff; color: var(--ink); font-size: 12px; }
.cabinet-popup { width: min(310px, calc(100vw - 24px)); }
.selection-popup { right: 0; left: auto; width: min(590px, calc(100vw - 24px));
  grid-template-columns: repeat(2, minmax(0, 1fr)); }
.toolbar-popup fieldset { min-width: 0; margin: 0; padding: 4px 7px 6px; border: 1px solid var(--line); border-radius: 3px; }
.toolbar-popup legend { font-weight: 600; }
.toolbar-popup button { margin-top: 4px; min-height: 23px; }
.toolbar-popup .menu-done { justify-self: end; }
.column-choices, .selection-popup .menu-done { grid-column: 1 / -1; }
.choice-list { display: grid; gap: 2px; }
.toolbar-popup label { flex-direction: row; align-items: start; gap: 5px; font-size: 12px; color: var(--ink); }
.toolbar-popup input { min-height: 0; margin: 1px 0 0; accent-color: var(--green); cursor: pointer; }
.toolbar-popup label:has(input:checked) { color: var(--green); }
#column-blocks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; }
#column-blocks details { margin: 2px 0 0 18px; }
#column-blocks details .choice-list { margin-top: 3px; }
@media (max-width: 700px) {
  .toolbar-popup { position: fixed; left: 8px; right: 8px; top: var(--menu-top, 120px); width: auto; }
}
@media (max-width: 410px) {
  .selection-popup, #column-blocks { grid-template-columns: 1fr; }
}
.cabinet-label { display: block; color: var(--muted); font-size: 10px; font-weight: 400; }
input, select, button { font: inherit; min-height: 27px; border-radius: 4px; }
input, select { background: #fff; color: var(--ink); border: 1px solid #c5d1ca; padding: 0 6px; }
button { border: 1px solid var(--green); color: #fff; background: var(--green); padding: 0 8px; cursor: pointer; font-weight: 500; }
button:disabled, button[aria-disabled="true"] { cursor: default; opacity: .6; }
button.secondary { color: var(--green); border-color: var(--line); background: #fff; }
button:focus-visible, input:focus-visible, select:focus-visible, .grid:focus-visible { outline: 2px solid #327cbd; outline-offset: 1px; }
#product-filters input { width: 120px; }
.grid-feedback { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.grid-feedback button { min-height: 20px; font-size: 11px; }
.message { color: var(--muted); min-height: 1em; margin: 4px 0; font-size: 12px; }
.message.error { color: #9b2634; }
details { margin: 3px 0 5px; color: var(--muted); font-size: 11px; }
details ul { margin: 4px 0; }
summary { cursor: pointer; width: fit-content; }
.grid { overflow: auto; border: 1px solid var(--line); max-height: max(260px, calc(100dvh - 146px)); background: white; }
table { --product-width: 128px; --date-width: 52px; --header-height: 21px; width: max-content;
  border-collapse: separate; border-spacing: 0;
  background: white; font: 11px/1.16 Roboto, Arial, sans-serif; font-variant-numeric: tabular-nums; }
table.money-grid { --date-width: 65px; }
th, td { height: 18px; min-width: 0; text-align: right; white-space: nowrap; padding: 1px 3px;
  border-right: 1px solid var(--cell-line); border-bottom: 1px solid var(--cell-line); }
thead th { position: sticky; top: 0; z-index: 3; height: var(--header-height); padding: 0; background: var(--heading); font-weight: 500; }
thead tr:nth-child(2) th { top: var(--header-height); }
thead .block-heading { text-align: left; padding: 0 4px; border-left: 1px solid var(--line); }
thead .block-column { padding: 0 5px; font-size: 11px; }
.block-start { border-left: 1px solid var(--line); }
.block-value { vertical-align: top; }
.block-text { text-align: left; max-width: 175px; overflow: hidden; text-overflow: ellipsis; }
[data-block] { background: #f3f7f4; }
[data-block="sales"], [data-block="salesAverage"] { background: #f7f0ed; }
[data-block="orders"], [data-block="ordersAverage"] { background: #eef3f9; }
[data-block="reviews"] { background: #f5f0f8; }
thead [data-block] { box-shadow: inset 0 -1px var(--line); }
th.first { position: sticky; left: 0; z-index: 2; text-align: left; width: var(--product-width);
  min-width: var(--product-width); max-width: var(--product-width); background: #fff; vertical-align: top; }
th.metric-label { position: sticky; left: var(--product-width); z-index: 2; text-align: left; width: 92px;
  min-width: 92px; max-width: 92px; background: #f8faf9; color: var(--muted); font-weight: 400;
  overflow: hidden; text-overflow: ellipsis; }
thead .first, thead .metric-label { z-index: 4; background: var(--heading); }
#heatmap .product-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden; white-space: normal; overflow-wrap: anywhere;
  color: var(--ink); font-size: 12px; font-weight: 400; line-height: 1.2; }
.detail-button { display: block; width: 100%; padding: 0; min-height: 15px; border: 0; border-radius: 0; color: inherit;
  background: transparent; text-align: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-button:hover { text-decoration: underline; }
#heatmap-detail, #profile, #review-detail { width: min(620px, 95vw); max-height: 82dvh; padding: 16px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; color: var(--ink); }
#profile { width: min(380px, 95vw); }
#heatmap-detail::backdrop, #profile::backdrop, #review-detail::backdrop { background: #15271d66; }
#heatmap-detail header, #profile header, #review-detail header { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
#heatmap-detail h2, #profile h2, #review-detail h2 { margin: 0 0 8px; font-size: 15px; }
#profile dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; }
#profile dt { color: var(--muted); }
#profile dd { margin: 0; overflow-wrap: anywhere; }
#heatmap-detail h3 { margin: 9px 0 4px; font-size: 12px; }
#heatmap-detail dl { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; margin: 4px 0 7px; }
#heatmap-detail dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
#detail-product img { max-width: 72px; max-height: 92px; object-fit: contain; float: right; margin: 0 0 4px 10px; }
#detail-values { clear: both; }
#detail-review-links { display: flex; flex-wrap: wrap; gap: 5px; margin: 2px 0 8px; }
.review-action { padding: 4px 8px; border: 1px solid #b6d2c2; border-radius: 4px; background: #edf5ef;
  color: var(--green); font-weight: 500; text-decoration: none; }
.review-action:hover, .review-cell-link:hover { text-decoration: underline; }
tbody.service-row .first { background: #f8f1e7; color: #694b24; }
#heatmap { --product-width: 154px; --date-width: 46px; font-size: 12px; }
#heatmap.money-grid { --date-width: 60px; }
#heatmap thead { position: sticky; top: 0; z-index: 3; }
#heatmap thead th { position: static; text-align: center; vertical-align: middle; white-space: normal; }
#heatmap thead :is(.first, .metric-label) { position: sticky; top: auto; }
#heatmap th.metric-label { width: 82px; min-width: 82px; max-width: 82px; }
#heatmap :is(.date-cell, .summary-cell) > .detail-button { min-width: max-content; }
#heatmap .product-group .first { padding: 2px 4px; }
#heatmap .cabinet-label { display: block; color: var(--ink); font-size: 11px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-codes .detail-button { font-size: 12px; font-weight: 600; }
.product-codes button[title="Открыть карточку товара"] { color: var(--green); text-decoration: underline; }
#heatmap :is(.block-column, .block-value)[data-block] {
  width: 56px; padding: 1px 3px;
}
#heatmap :is(.block-column, .block-value)[data-block="catalog"].block-text {
  width: 68px; min-width: 58px; max-width: 70px; white-space: normal;
  overflow-wrap: anywhere; word-break: normal; text-overflow: clip;
}
#heatmap thead .block-column {
  overflow-wrap: anywhere; height: 27px; font-size: 11px; line-height: 1.15;
}
#heatmap .block-toggle {
  min-width: 17px; min-height: 16px; padding: 0 3px; margin-left: 4px; line-height: 1;
  background: #fff; color: var(--green); border: 1px solid var(--line); font-size: 11px;
}
#heatmap .collapsed-heading { font-size: 9px; padding: 0 2px; }
#heatmap .collapsed-heading .block-toggle { margin-left: 2px; min-width: 14px; padding: 0 2px; }
.monthly-table .closure-action { text-align: left; }
.monthly-table .closure-action button { min-height: 20px; padding: 1px 5px; font-size: 11px; }
.monthly-table .closure-action details { margin: 0; }
.monthly-table .closure-action details ul { max-width: 265px; white-space: normal; padding-left: 18px; }
#product-card { box-sizing: border-box; width: min(980px, 96vw); max-height: 88dvh; padding: 14px;
  border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); }
#product-card::backdrop { background: #15271d66; }
#product-card header { display: flex; justify-content: space-between; gap: 10px; }
#product-card h2 { margin: 0 0 4px; font-size: 16px; }
#product-card-cabinet { font-weight: 700; margin: 0 0 8px; }
.card-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 0 6px; border-bottom: 1px solid var(--line); }
.card-tabs button, .card-tools input, .card-tools select { min-height: 25px; }
.card-tabs button[aria-pressed="true"] { background: #e4efe8; border-color: #b6d2c2; font-weight: 700; }
.card-panel { padding-top: 7px; }
.card-tools { display: flex; flex-wrap: wrap; align-items: end; gap: 5px 10px; padding-bottom: 7px; }
.card-tools input[type="search"] { width: min(240px, 65vw); }
.card-tools output { align-self: end; color: var(--muted); font-size: 11px; }
.card-tools .card-check { flex-direction: row; align-items: center; }
.card-tools .card-check input { min-height: 0; }
.card-overview img { float: right; max-width: min(160px, 27vw); max-height: 180px; object-fit: contain; margin: 0 0 8px 10px; }
.card-overview .card-field-table { width: auto; min-width: min(440px, 60%); }
.card-overview p { white-space: pre-wrap; }
.card-overview > details { clear: both; }
.card-panel details > summary { font-weight: 600; color: var(--green); padding: 2px 0; }
.card-panel details > ol { padding-left: 20px; margin: 3px 0; }
.card-field-table { width: 100%; }
.card-field-table :is(th, td) { padding: 3px 6px; text-align: left; vertical-align: top; white-space: pre-wrap; overflow-wrap: anywhere; }
.card-field-table th { width: 30%; min-width: 86px; background: #f5f8f6; font-weight: 500; }
.card-table-grid { max-height: 49dvh; overflow: auto; border: 1px solid var(--line); }
.card-table-grid table { min-width: 100%; }
.card-table-grid :is(th, td) { padding: 3px 7px; text-align: left; vertical-align: top; }
.card-table-grid .card-number { text-align: right; }
.card-table-grid .card-field-table td { min-width: 86px; max-width: min(360px, 52vw); white-space: pre-wrap; }
.card-sort { min-height: 18px; padding: 0; background: transparent; border: 0; color: var(--ink); cursor: pointer; }
.card-sort:hover, .card-sort:focus-visible { text-decoration: underline; }
.card-table-grid th[aria-sort="ascending"] .card-sort::after { content: " ↑"; }
.card-table-grid th[aria-sort="descending"] .card-sort::after { content: " ↓"; }
.product-card-links { display: flex; flex-wrap: wrap; gap: 5px; margin: 5px 0; }
.monthly-filters { margin-bottom: 5px; align-items: end; }
#closure-reasons { margin: 6px 0; padding-left: 22px; color: var(--muted); }
.monthly-table { --product-width: 176px; --header-height: 24px; font-size: 12px; }
.monthly-table thead th { padding: 3px 6px; }
.monthly-table .block-heading:first-of-type { background: #eef3f9; }
.monthly-table .block-heading:last-of-type { background: #f7f0ed; }
.monthly-table td, .monthly-table tbody th { padding: 4px 6px; }
.monthly-table .monthly-preview > * { background: #f0f7f2; }
.monthly-table .monthly-period-total > * { background: #e2eee7; font-weight: 700; border-top: 2px solid #9aafa0; }
.monthly-table .monthly-market-total > * { background: #eef3f8; font-weight: 600; }
.monthly-table .monthly-market-total[data-subtotal="wb"] > * { background: #f3edf6; }
#pager select { min-height: 23px; padding: 1px 4px; }
.heatmap-totals th, .heatmap-totals td { background: #e6efe9; font-weight: 700; }
.heatmap-totals .first { background: #dcebe1; }
.heatmap-totals tr[data-metric-band="sales"] > :not(.first) { background: #f3e7e5; }
.heatmap-totals tr[data-metric-band="orders"] > :not(.first) { background: #e2edf8; }
.heatmap-totals tr[data-metric-band="reviews"] > :not(.first) { background: #ede6f5; }
.heatmap-totals tr:last-child > * { border-bottom-color: #9fb3a7; }
.heatmap-totals + tbody > tr:first-child > * { border-top: 1px solid #9fb3a7; }
.product-group + .product-group > tr:first-child > * { border-top: 1px solid #d5dfd9; }
.product-group tr[data-metric-band="sales"] > .metric-label { background: #faf0ee; }
.product-group tr[data-metric-band="orders"] > .metric-label { background: #edf4fa; }
.product-group tr[data-metric-band="reviews"] > .metric-label { background: #f4eef9; }
.date-cell { width: var(--date-width); min-width: var(--date-width); }
.summary-cell { min-width: 53px; font-weight: 500; }
td.summary-cell { background: #f2f6f3; }
td.empty { color: #76857d; }
.column-button { position: relative; min-height: 20px; width: 100%; border: 0; border-radius: 0;
  background: transparent; color: var(--ink); display: grid; place-items: center; padding: 0 8px; font-size: inherit; }
.column-button:hover { background: #dce9e1; }
.column-indicator { position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  font-size: 9px; color: var(--muted); }
.column-indicator.filtered { color: #106139; font-weight: 700; }
.column-indicator.filtered::before { content: ""; position: absolute; top: -1px; right: 0;
  width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
#column-menu { position: fixed; z-index: 9; margin: 0; padding: 9px; min-width: 232px; max-width: min(96vw, 300px);
  border: 1px solid #aabeb1; border-radius: 5px; background: #fff; color: var(--ink); box-shadow: 0 4px 12px #182b2330; }
#column-menu form { display: grid; gap: 6px; }
#column-menu strong { font-size: 13px; }
#column-active-filters { margin: 0; font-size: 11px; }
.column-sort, .column-actions { display: flex; justify-content: space-between; gap: 4px; }
#column-menu button { font-size: 11px; min-height: 25px; padding: 0 4px; }
#pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 6px; font-size: 11px; }
#pager button { min-height: 23px; }
.signin { max-width: 410px; margin: 8vh auto 0; padding: 22px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.signin form { display: grid; gap: 12px; margin-top: 16px; }
.signin .message { margin: 0; }
@media (max-width: 550px) { main { padding: 10px 8px; } .cabinet { flex: 1 1 100%; } .topbar { padding: 5px 8px; } }

#profile-metrics-heading { margin: 12px 0 6px; font-size: 13px; }
#profile-metrics h4 { margin: 6px 0 3px; font-size: 12px; }
#profile-metrics ul { margin: 0 0 8px; padding-left: 18px; columns: 2 125px; }
#profile-metrics li { break-inside: avoid; }

.review-search { min-width: min(230px, 100%); }
.review-status { margin: 10px 0; }
.review-status:empty { display: none; }
.review-grid { margin-top: 5px; }
.review-table { width: 100%; }
.review-table th, .review-table td { text-align: left; vertical-align: top; padding: 3px 5px; }
.review-table thead th { vertical-align: middle; }
.review-table thead button { min-height: 18px; padding: 0 3px; border: 0; background: transparent; color: var(--ink); }
.review-table thead button:hover { background: #dce9e1; }
.review-table thead button::after { content: " ↕"; color: var(--muted); font-size: 9px; }
.review-table thead button[data-direction="asc"]::after { content: " ↑"; color: var(--green); }
.review-table thead button[data-direction="desc"]::after { content: " ↓"; color: var(--green); }
.review-table .review-group th { padding: 3px 6px; background: #e7f1ea; color: var(--green); }
.review-table td.review-text { min-width: 100px; max-width: 240px; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-table td.review-product { min-width: 115px; max-width: 180px; }
.review-cell-link { color: var(--green); }
.review-snippet { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.review-product-scope { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 5px 0; }
.review-product-scope span { color: var(--green); overflow-wrap: anywhere; }
#review-detail section { margin-top: 10px; }
#review-detail h3, #review-detail section p { margin: 3px 0; font-size: 12px; }
#review-detail section p { white-space: pre-wrap; overflow-wrap: anywhere; }
.review-table .review-rating { text-align: center; font-weight: 600; }
.review-table .review-rating[data-rating="1"], .review-table .review-rating[data-rating="2"] { background: #f8e4e5; }
.review-table .review-rating[data-rating="4"], .review-table .review-rating[data-rating="5"] { background: #e4f0e8; }
.review-table tr:hover td { box-shadow: inset 0 0 0 40px #17674307; }
.review-pager { display: flex; justify-content: end; align-items: center; gap: 8px; margin: 5px 0; }

.etl-panel { margin-bottom: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.etl-panel-header { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 8px; }
.etl-panel h2 { margin: 0 0 6px; font-size: 15px; }
.etl-panel select { max-width: min(440px, 85vw); }
#etl-graph { height: min(480px, 62vh); min-height: 270px; margin-top: 8px; border: 1px solid var(--line); background: #f6f8f7; }
#etl-workers { display: flex; gap: 8px 20px; flex-wrap: wrap; padding-left: 18px; color: var(--muted); }
.etl-table-wrap { max-height: 260px; overflow: auto; }
.etl-table { width: 100%; }
.etl-table th, .etl-table td { min-width: 90px; text-align: left; }
.etl-table th:first-child, .etl-table td:first-child { min-width: 220px; }
.etl-overview-controls { display: flex; flex-wrap: wrap; gap: 6px; }
.etl-table tr.etl-failed td { background: #fbeef0; }
.etl-table tr.etl-unseen td { color: var(--muted); }
