/* Seller-Map. Образец — веб 10X: белый фон, один акцентный фиолетовый,
   мелкий аккуратный шрифт, тонкие серые линии, цвет только «хорошо/плохо». */
:root {
  --bg: #F6F6F9;
  --panel: #FFFFFF;
  --line: #ECECF2;
  --text: #1C1C28;
  --muted: #8A8AA0;
  --accent: #6D4AFF;
  --accent-soft: #EFEBFF;
  --good: #16A36A;
  --good-soft: #E6F6EE;
  --bad: #E5484D;
  --bad-soft: #FDECEC;
  --amber: #B7791F;
  --amber-soft: #FDF3E1;
  --radius: 12px;
  --rail: 76px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "tnum" 1;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 20px; color: var(--accent); }
h2 { font-size: 20px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--bad); }
.neg { color: var(--bad); }

/* --- левая колонка ---------------------------------------------------- */
.rail {
  position: fixed; inset: 0 auto 0 0; width: var(--rail);
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; padding: 16px 0; gap: 18px; z-index: 10;
}
.brand { font-weight: 800; font-style: italic; font-size: 20px; color: var(--text); letter-spacing: -.02em; }
.rail nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.rail nav a, .rail-exit button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: 60px; padding: 8px 0; border-radius: 10px; color: var(--muted);
  font-size: 10px; background: none; border: 0; cursor: pointer; font-family: inherit;
}
.rail svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rail nav a.on { color: var(--accent); background: var(--accent-soft); }
.rail nav a:hover:not(.soon), .rail-exit button:hover { color: var(--text); }
.rail nav a.soon { opacity: .45; cursor: default; }

main.with-rail { margin-left: var(--rail); padding: 18px 24px 40px; max-width: 1500px; }
.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.who { display: flex; align-items: center; gap: 10px; }
.cabinet { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 5px 12px; font-size: 13px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 600; }

/* --- фильтры ----------------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; margin-bottom: 14px; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; overflow-x: auto; max-width: 100%; }
.seg a { padding: 6px 12px; border-radius: 7px; color: var(--muted); white-space: nowrap; font-size: 13px; }
.seg a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* --- панели и карточки ---------------------------------------------------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.panel-head { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; margin-bottom: 12px; }
.panel.key { background: var(--accent-soft); border-color: #DDD5FF; }
.cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.card { background: var(--panel); border-radius: 10px; padding: 12px 14px 6px; min-width: 0; }
.card-title { font-size: 12px; color: var(--muted); }
.card-value { font-size: 22px; font-weight: 600; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-value small { font-size: 13px; color: var(--muted); margin-left: 3px; font-weight: 500; }
.card-extra { display: block; font-size: 12px; color: var(--muted); font-weight: 500; margin: 1px 0 0; }
.delta { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 6px; margin-top: 4px; }
.delta.good { color: var(--good); background: var(--good-soft); }
.delta.bad { color: var(--bad); background: var(--bad-soft); }
.delta.flat { color: var(--muted); }
.spark { display: block; width: 100%; height: 56px; margin-top: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.placeholder { min-height: 120px; border-style: dashed; }

/* --- таблицы ------------------------------------------------------------ */
table.list { width: 100%; border-collapse: collapse; }
.list th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.list td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.list tr:last-child td { border-bottom: 0; }
.list .num { text-align: right; white-space: nowrap; }
.list tr.off td { opacity: .5; }
.actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 6px; }
.tag.green { color: var(--good); background: var(--good-soft); }
.tag.red { color: var(--bad); background: var(--bad-soft); }
.tag.amber { color: var(--amber); background: var(--amber-soft); }

/* --- формы -------------------------------------------------------------- */
input, select { font: inherit; padding: 9px 11px; border: 1px solid #DCDCE6; border-radius: 9px; background: #fff; color: var(--text); width: 100%; }
input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.btn { display: inline-block; font: inherit; font-weight: 600; color: #fff; background: var(--accent); border: 0; border-radius: 9px; padding: 9px 16px; cursor: pointer; text-align: center; }
.btn:hover { filter: brightness(1.08); }
button.link { font: inherit; background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; }
button.link.danger { color: var(--bad); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.row-form { display: grid; grid-template-columns: 1.2fr 1.5fr 1fr auto; gap: 8px; margin: 10px 0 6px; }
.copy { display: flex; gap: 8px; margin-top: 8px; }
.note { border-color: #DDD5FF; background: var(--accent-soft); }

/* --- вход ---------------------------------------------------------------- */
body.plain { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.auth { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.auth h2 { margin: 6px 0 14px; }
.auth-logo { font-weight: 800; font-style: italic; font-size: 26px; color: var(--accent); }
.auth .btn { width: 100%; margin-top: 4px; }

/* --- РНП ------------------------------------------------------------------ */
.rnp-filters { align-items: center; justify-content: flex-start; }
.pick { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.pick select { width: auto; padding: 6px 28px 6px 10px; font-size: 13px; }
.search { max-width: 260px; padding: 7px 11px; font-size: 13px; margin-left: auto; }
.rnp-note { margin: -4px 0 12px; }
.rnp-block { display: grid; grid-template-columns: 270px minmax(0, 1fr); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.rnp-block.is-total { border-color: #DDD5FF; }
.rnp-block.is-total .rnp-card { background: var(--accent-soft); }
.rnp-card { padding: 12px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.rnp-id { display: flex; gap: 10px; }
.rnp-id img, .rnp-id .ph { width: 64px; height: 86px; object-fit: cover; border-radius: 8px; flex: none; background: #F0F0F5; display: grid; place-items: center; font-size: 24px; color: var(--accent); }
.rnp-name { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rnp-name .vc { font-size: 13px; line-height: 1.3; }
.rnp-name .muted { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rnp-stats { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; margin: 0; font-size: 12px; }
.rnp-stats dt { color: var(--muted); padding: 2px 0; }
.rnp-stats dd { margin: 0; text-align: right; font-weight: 600; padding: 2px 6px; border-radius: 5px; }
.rnp-table-wrap { overflow-x: auto; }
.rnp-table { border-collapse: separate; border-spacing: 0; font-size: 12px; width: max-content; min-width: 100%; }
.rnp-table th, .rnp-table td { padding: 4px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: right; }
.rnp-table thead th { font-weight: 500; color: var(--muted); background: #FAFAFC; position: sticky; top: 0; }
.rnp-table thead th.day span { display: block; font-size: 10px; }
.rnp-table thead th.wknd { color: #7B5CE0; background: #F1ECFF; }
.rnp-table .sticky { position: sticky; left: 0; z-index: 1; background: var(--panel); text-align: left; }
.rnp-table thead .sticky { background: #FAFAFC; z-index: 2; }
.rnp-table .lbl { font-weight: 600; }
.rnp-table td.sum { background: #FAFAFC; color: #44445A; }
.rnp-table td.chart { padding: 2px 6px; }
.rnp-table tr:last-child th, .rnp-table tr:last-child td { border-bottom: 0; }
.bars { display: block; width: 120px; height: 30px; }
.g-orders .lbl { color: #3C78D8; } .g-buyouts .lbl { color: #D27A0F; }
.g-spp .lbl { color: #7F7F95; } .g-adv .lbl { color: #D63B40; } .g-profit .lbl { color: #11885A; }
.g-adv td, .g-adv th { border-top: 1px solid #D9D9E3; }
td.ctx { color: #A3A3B5; background: #F7F7FA; }
td.est { font-style: italic; }
td.pos { color: var(--good); font-weight: 600; } td.neg { color: var(--bad); font-weight: 600; }
.c-red { background: #E5484D; color: #fff; } .c-pink { background: #FBE1E1; } .c-peach { background: #FDEBD8; }
.c-yellow { background: #FFF4CC; } .c-green { background: #E3F4EA; } .c-green2 { background: #BFE6CF; }
.heat0 { background: #F5F8FF; } .heat1 { background: #E6EEFD; } .heat2 { background: #D3E1FB; }
.heat3 { background: #BCD1F8; } .heat4 { background: #A4C2F4; }

/* --- таблицы-разделы ------------------------------------------------------ */
.tbl-panel { padding: 0; overflow: hidden; }
.tbl-wrap { overflow: auto; max-height: calc(100vh - 190px); }
.tbl { border-collapse: separate; border-spacing: 0; font-size: 12px; width: max-content; min-width: 100%; }
.tbl th, .tbl td { padding: 6px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl thead th { position: sticky; top: 0; background: #FAFAFC; color: var(--muted); font-weight: 500;
  cursor: pointer; user-select: none; z-index: 2; text-align: right; }
.tbl thead tr.grp th { cursor: default; color: var(--text); font-weight: 600; text-align: center;
  border-left: 1px solid var(--line); background: #F3F1FD; }
.tbl thead tr.grp + tr th { top: 29px; }
.tbl thead th[data-dir="asc"]::after { content: " ↑"; color: var(--accent); }
.tbl thead th[data-dir="desc"]::after { content: " ↓"; color: var(--accent); }
.tbl td { text-align: right; }
.tbl .k-text, .tbl .k-id { text-align: left; }
.tbl td.k-text { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.tbl .fz { position: sticky; left: 0; background: var(--panel); z-index: 1; }
.tbl thead .fz { z-index: 3; background: #FAFAFC; }
.tbl tbody tr:hover td { background: #FAF9FF; }
.tbl tr.alert td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.tbl td.neg { color: var(--bad); }

.sku-head { display: flex; gap: 14px; align-items: center; }
.sku-head img { width: 54px; height: 72px; object-fit: cover; border-radius: 8px; }
.sku-tbl tr.wk td.fz { color: #7B5CE0; }
.link-more { margin-left: auto; font-size: 13px; }

/* --- остатки и настройки -------------------------------------------------- */
.upload-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 10px; }
.upload-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.upload-form input[type=file] { width: auto; padding: 6px; }
.btn.ghost { background: var(--accent-soft); color: var(--accent); }
.err-box { margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: var(--bad-soft); color: #9B1C1F; font-size: 13px; }
.err-box ul { margin: 6px 0 0; padding-left: 18px; }
.ok { color: var(--good); font-weight: 600; margin-top: 10px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin: 12px 0; }
.settings-grid label, label.wide { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
label.wide { margin-top: 6px; }
label.check { display: flex; gap: 8px; align-items: center; font-size: 13px; margin: 8px 0; }
label.check input { width: auto; }

/* --- планшет и телефон ----------------------------------------------------- */
@media (max-width: 1200px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .rnp-block { grid-template-columns: 1fr; }
  .rnp-card { border-right: 0; border-bottom: 1px solid var(--line); }
  .rnp-stats { grid-template-columns: 1fr auto 1fr auto; }
  .search { max-width: none; margin-left: 0; width: 100%; }
  .rnp-table th.sticky { max-width: 120px; white-space: normal; }
  :root { --rail: 0px; }
  .rail {
    inset: auto 0 0 0; width: 100%; height: calc(62px + env(safe-area-inset-bottom));
    flex-direction: row; justify-content: space-around; padding: 4px 8px env(safe-area-inset-bottom);
    border-right: 0; border-top: 1px solid var(--line); gap: 0;
  }
  .rail .brand { display: none; }
  .rail nav { flex-direction: row; flex: 1 1 auto; gap: 2px; overflow-x: auto; }
  .rail nav a, .rail-exit button { width: 58px; flex: none; }
  .tbl-wrap { max-height: none; }
  main.with-rail { margin-left: 0; padding: 12px 16px 90px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card { padding: 10px 10px 4px; }
  .card-value { font-size: 18px; }
  .card-extra { display: block; margin: 0; font-size: 12px; }
  .grid-2 { grid-template-columns: 1fr; }
  .row-form { grid-template-columns: 1fr; }
  .list th:nth-child(n+4), .list td:nth-child(n+4) { display: none; }
  .filters { flex-direction: column; }
  .cabinet { display: none; }
}
