:root {
  --paper:#f7f4ed;
  --surface:#fffefa;
  --ink:#263b38;
  --muted:#66736d;
  --line:#dedfd4;
  --accent:#b74635;
  --accent-dark:#903729;
  --soft:#f9eae3;
  --good:#236750;
  --radius:14px;
  font-family:"Segoe UI",Arial,sans-serif;
  font-size:16px;
  color:var(--ink);
  background:var(--paper);
  font-synthesis:none}
* {
  box-sizing:border-box}
body {
  margin:0}
button,input {
  font:inherit}
button {
  min-height:44px;
  padding:10px 16px;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--surface);
  color:var(--ink);
  font-weight:600;
  cursor:pointer}
button:hover {
  border-color:var(--accent)}
button:disabled {
  opacity:.5;
  cursor:not-allowed}
button.primary {
  background:var(--accent);
  border-color:var(--accent);
  color:white}
button.primary:hover {
  background:var(--accent-dark)}
button.quiet {
  background:transparent;
  border-color:transparent}
input {
  min-height:46px;
  border:1px solid #bbc5bd;
  border-radius:9px;
  background:white;
  padding:10px 12px;
  width:100%;
  color:var(--ink)}
input[type=checkbox] {
  width:22px;
  height:22px;
  min-height:22px;
  accent-color:var(--accent);
  cursor:pointer}
button:focus-visible,input:focus-visible,summary:focus-visible {
  outline:3px solid #b9682e;
  outline-offset:3px}
[hidden] {
  display:none!important}
.training {
  background:#263b38;
  color:#fff5d7;
  padding:9px 20px;
  text-align:center;
  font-size:12px;
  line-height:1.5;
  letter-spacing:.15px}
.dot {
  display:inline-block;
  width:7px;
  height:7px;
  border-radius:50%;
  background:#f7c277;
  margin-right:7px}
.topbar {
  max-width:1160px;
  margin:auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:24px 24px 19px;
  gap:14px}
.brand {
  display:flex;
  gap:12px;
  align-items:center}
.brand-mark {
  display:grid;
  place-items:center;
  width:42px;
  height:42px;
  border-radius:12px;
  background:var(--accent);
  color:white;
  font-size:25px;
  font-weight:700}
.brand strong {
  display:block;
  font-size:24px;
  letter-spacing:-.8px}
.brand small {
  display:block;
  font-size:12px;
  color:var(--muted);
  margin-top:2px}
.account {
  display:flex;
  align-items:center;
  gap:12px;
  font-size:13px}
.account>span {
  max-width:180px}
main {
  max-width:1112px;
  margin:0 auto;
  padding:20px 24px 40px}
h1,h2,h3,p {
  margin-top:0}
h1 {
  font-size:34px;
  line-height:1.18;
  letter-spacing:-1px;
  margin-bottom:12px}
h2 {
  font-size:22px;
  letter-spacing:-.5px}
h3 {
  font-size:16px;
  line-height:1.35}
.eyebrow {
  font-size:11px;
  font-weight:750;
  letter-spacing:1.65px;
  color:var(--accent);
  margin-bottom:12px}
.muted {
  color:var(--muted);
  line-height:1.6}
.small {
  font-size:12px}
.wide {
  width:100%}
.login-layout {
  display:grid;
  grid-template-columns:1.1fr 1fr;
  gap:72px;
  align-items:center;
  min-height:570px}
.login-copy h1 {
  font-size:44px}
.login-copy>p {
  max-width:470px;
  line-height:1.7}
.steps {
  padding-left:22px;
  line-height:2.3;
  font-size:15px;
  margin:24px 0}
.login-form {
  background:var(--surface);
  padding:30px;
  border:1px solid var(--line);
  border-radius:20px;
  box-shadow:0 16px 38px #27352b08}
.login-form label {
  display:block;
  margin:16px 0 8px;
  font-weight:600;
  font-size:13px}
.login-form .primary {
  margin:22px 0 12px}
.demo-roles {
  display:flex;
  flex-wrap:wrap;
  gap:6px}
.demo-roles button {
  font-size:12px;
  padding:8px 10px;
  min-height:40px}
#message {
  position:sticky;
  top:10px;
  z-index:5;
  padding:14px 16px;
  border-radius:12px;
  border:1px solid #b1ccba;
  background:#eaf5eb;
  color:#20543c;
  margin-bottom:20px;
  font-size:14px;
  box-shadow:0 6px 18px #19312912}
#message.error {
  background:#fff0e9;
  border-color:#e1b5a4;
  color:#813c2d}
.section-title {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  padding:20px 0 26px}
.section-title h1 {
  margin-bottom:0}
.connection {
  white-space:nowrap;
  font-size:12px;
  color:var(--good);
  padding:7px 11px;
  background:#edf3e8;
  border-radius:20px}
.toolbar {
  display:flex;
  justify-content:space-between;
  align-items:end;
  gap:20px;
  margin-bottom:14px}
.search-label {
  font-size:12px;
  display:block;
  flex:1;
  max-width:460px;
  color:var(--muted)}
.search-label input {
  margin-top:7px}
.view-toggle {
  display:flex;
  background:#ecece3;
  border-radius:11px;
  padding:4px}
.view-toggle button {
  border:0;
  min-height:38px;
  background:transparent;
  font-size:13px}
.view-toggle button.active {
  background:white;
  box-shadow:0 2px 4px #1d292b12;
  color:var(--accent)}
.catalog-note {
  display:flex;
  justify-content:space-between;
  gap:16px;
  color:var(--muted);
  font-size:11px;
  margin-bottom:14px}
.product-list {
  display:grid;
  gap:9px}
.product {
  display:grid;
  grid-template-columns:44px minmax(170px,1fr) 94px 84px 88px 110px;
  align-items:center;
  gap:14px;
  border:1px solid var(--line);
  background:var(--surface);
  border-radius:var(--radius);
  padding:14px 16px}
.product.selected {
  border-color:#dca18d;
  background:#fffaf6}
.pick {
  min-height:44px;
  display:flex;
  align-items:center;
  justify-content:center}
.product h3 {
  margin:0 0 5px}
.product [data-detail] {
  padding:0;
  min-height:auto;
  border:0;
  text-align:left;
  font-size:15px;
  font-weight:700;
  border-radius:3px;
  background:transparent}
.sku {
  font-size:10px;
  color:var(--muted);
  letter-spacing:.6px}
.unit-price {
  font-variant-numeric:tabular-nums;
  font-weight:650;
  font-size:15px}
.unit-price small {
  display:block;
  font-size:11px;
  font-weight:400;
  color:var(--muted);
  margin-top:4px}
.control {
  display:block;
  font-size:10px;
  color:var(--muted)}
.control input {
  margin-top:5px;
  padding:8px;
  min-height:44px;
  text-align:center;
  font-size:15px;
  font-variant-numeric:tabular-nums}
.private-price {
  font-size:14px;
  font-weight:650;
  text-align:right;
  font-variant-numeric:tabular-nums}
.private-price small {
  display:block;
  font-size:10px;
  font-weight:400;
  color:var(--muted);
  margin-bottom:5px}
.product-list.cards {
  grid-template-columns:repeat(2,minmax(0,1fr))}
.cards .product {
  grid-template-columns:40px 1fr 1fr;
  align-items:start;
  gap:14px}
.product .thumb {
  display:none}
.cards .product {
  grid-template-columns:40px 1fr 1fr;
  padding:0 0 16px;
  overflow:hidden}
.cards .product .thumb {
  display:block;
  grid-column:1/4;
  aspect-ratio:4/3;
  background:#fff;
  border-bottom:1px solid var(--line);
  margin-bottom:12px}
.cards .product .thumb img {
  width:100%;
  height:100%;
  object-fit:cover;
  display:block}
.cards .product > *:not(.thumb) {
  margin-left:14px;
  margin-right:14px}
.cards .product .pick {
  margin-left:14px}
.cards .product .title-cell {
  grid-column:2/4;
  text-align:left}
.cards .unit-price {
  grid-column:1/4;
  border-top:1px solid var(--line);
  padding-top:12px}
.cards .private-price {
  text-align:left}
.totals {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:18px;
  padding:26px 0 16px}
.totals span {
  font-size:12px;
  color:var(--muted);
  display:block;
  margin-bottom:8px}
.totals strong {
  font-size:26px;
  font-variant-numeric:tabular-nums;
  letter-spacing:-.7px}
.totals>div:last-child strong {
  color:var(--good)}
.checkout {
  position:static;
  bottom:12px;
  z-index:3;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  padding:15px 18px;
  border:1px solid #d4d7ca;
  background:#fffefa;
  box-shadow:0 8px 28px #18302518;
  border-radius:var(--radius);
  margin:18px 0 30px}
.checkout strong {
  font-size:14px}
.checkout small {
  display:block;
  font-size:11px;
  color:var(--muted);
  margin-top:5px;
  line-height:1.5}
.orders-section {
  border-top:1px solid var(--line);
  padding-top:28px;
  margin-top:30px}
.orders-heading {
  display:flex;
  align-items:start;
  justify-content:space-between;
  gap:16px}
.orders-heading h2 {
  margin-bottom:8px}
.orders-heading p {
  max-width:630px}
.empty {
  padding:32px 22px;
  background:#efeee6;
  border:1px dashed #c7cec1;
  border-radius:var(--radius);
  color:var(--muted);
  font-size:14px;
  text-align:center}
.order {
  border:1px solid var(--line);
  background:var(--surface);
  border-radius:var(--radius);
  margin:14px 0;
  padding:20px}
.order-head {
  display:flex;
  justify-content:space-between;
  align-items:start;
  gap:16px;
  margin-bottom:14px}
.order-head h3 {
  margin:0 0 6px;
  font-size:18px}
.order-meta {
  font-size:11px;
  color:var(--muted)}
.badge {
  font-size:11px;
  white-space:nowrap;
  padding:7px 10px;
  border-radius:20px;
  background:#eee9d8;
  color:#69592e}
.badge.accepted {
  background:#e2f1e8;
  color:#236750}
.badge.shipped {
  background:#e3edf2;
  color:#2d6278}
.badge.rejected,.badge.cancelled {
  background:#f5e6e0;
  color:#8c4634}
.order-line {
  display:flex;
  justify-content:space-between;
  gap:18px;
  font-size:13px;
  padding:9px 0;
  border-top:1px solid #ecece2;
  line-height:1.5}
.order-line>span:last-child {
  white-space:nowrap;
  font-variant-numeric:tabular-nums}
.order-total {
  display:flex;
  justify-content:space-between;
  padding:16px 0 5px;
  font-size:15px;
  font-weight:700}
.order-actions {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:16px}
.order-actions button {
  font-size:13px}
.order details {
  margin-top:15px;
  border-top:1px solid var(--line);
  padding-top:12px}
.order summary {
  font-size:12px;
  color:var(--muted);
  cursor:pointer;
  min-height:30px}
.event {
  font-size:11px;
  color:var(--muted);
  line-height:1.6;
  padding:4px 0}
.recovery {
  padding:18px;
  background:#fff0df;
  border:1px solid #debf9a;
  border-radius:12px;
  margin:20px 0}
.recovery p {
  font-size:13px;
  line-height:1.6}
.recovery button {
  font-size:13px}
dialog {
  border:1px solid var(--line);
  border-radius:18px;
  padding:26px;
  max-width:600px;
  width:calc(100% - 28px);
  color:var(--ink);
  background:var(--surface);
  max-height:88dvh;
  overflow:auto}
dialog::backdrop {
  background:#102e32a3}
.dialog-head {
  display:flex;
  align-items:start;
  justify-content:space-between;
  gap:14px}
.dialog-head h2 {
  margin-top:8px}
dialog p {
  font-size:14px;
  line-height:1.6}
.confirmation-total {
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding:20px 0;
  font-size:18px}
.detail-placeholder {
  height:100px;
  background:#f0eee3;
  border-radius:12px;
  display:grid;
  place-items:center;
  color:var(--muted);
  margin-bottom:18px;
  font-size:13px}
footer {
  max-width:1112px;
  margin:0 auto;
  padding:20px 24px 30px;
  color:var(--muted);
  font-size:11px;
  border-top:1px solid var(--line)}
@media(max-width:760px) {
  .topbar {
  padding:18px 16px}
.brand strong {
  font-size:21px}
.brand small {
  font-size:10px}
.account {
  font-size:11px;
  gap:2px}
.account>span {
  max-width:110px}
.account button {
  padding:8px}
main {
  padding:8px 14px 30px}
h1 {
  font-size:29px}
.login-layout {
  grid-template-columns:1fr;
  gap:22px;
  min-height:0}
.login-copy {
  padding:16px 8px 0}
.login-copy h1 {
  font-size:32px}
.login-copy>p:not(.eyebrow) {
  font-size:14px}
.steps {
  margin:16px 0;
  font-size:13px}
.login-form {
  padding:22px}
.section-title {
  align-items:start;
  padding:16px 0 22px}
.section-title h1 {
  font-size:28px}
.connection {
  font-size:10px;
  padding:6px 8px;
  white-space:normal;
  text-align:center;
  max-width:100px}
.toolbar {
  gap:10px}
.view-toggle button {
  padding:8px 10px;
  font-size:12px}
.catalog-note {
  font-size:10px;
  line-height:1.5;
  gap:14px}
.catalog-note>span:last-child {
  text-align:right;
  max-width:190px}
.product {
  grid-template-columns:72px minmax(0,1fr) minmax(0,1fr);
  gap:12px;
  padding:13px 12px}
.product .title-cell {
  grid-column:2/4;
  min-width:0}
.product [data-detail] {
  font-size:15px}
.product .unit-price {
  grid-column:1/2;
  grid-row:2;
  font-size:13px;
  align-self:center;
  word-break:normal}
.product .unit-price small {
  font-size:9px}
.product .control {
  grid-row:2}
.product .private-price {
  grid-column:2/4;
  text-align:right;
  font-size:12px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:15px}
.private-price small {
  margin:0}
.product-list.cards {
  grid-template-columns:1fr}
.cards .product {
  grid-template-columns:72px minmax(0,1fr) minmax(0,1fr)}
.cards .unit-price {
  grid-column:1/2}
.cards .private-price {
  grid-column:2/4}
.totals {
  gap:8px;
  padding-top:23px}
.totals span {
  font-size:10px;
  min-height:26px;
  margin-bottom:5px}
.totals strong {
  font-size:19px;
  letter-spacing:-.6px}
.checkout {
  bottom:8px;
  padding:12px;
  gap:10px;
  align-items:center}
.checkout strong {
  font-size:12px}
.checkout small {
  font-size:10px}
.checkout .primary {
  padding:11px 12px;
  font-size:12px;
  max-width:140px;
  flex-shrink:0}
.orders-heading h2 {
  font-size:21px}
.orders-heading button {
  font-size:12px;
  padding:10px}
.order {
  padding:16px}
.order-head {
  gap:8px}
.order-head h3 {
  font-size:17px}
.badge {
  font-size:10px;
  padding:6px 8px}
.order-line {
  font-size:12px}
.order-line>span:first-child {
  min-width:0}
.order-meta {
  font-size:10px}
.confirmation-total {
  font-size:16px}
footer {
  padding-left:16px;
  padding-right:16px}
.training {
  font-size:10px;
  padding:8px 16px}
#message {
  font-size:12px;
  line-height:1.5}
}
@media(prefers-reduced-motion:reduce) {
  * {
  scroll-behavior:auto!important}
}


/* Панель поиска и переключатель вида всегда на виду при прокрутке */
.toolbar {
  position:sticky;
  top:0;
  z-index:8;
  background:var(--paper);
  padding:10px 0 12px;
  margin-bottom:10px;
  border-bottom:1px solid var(--line);
  box-shadow:0 10px 14px -14px rgba(38,59,56,.55)}
.toolbar .search-label {
  min-width:0}
@media (max-width:640px) {
  .toolbar {
    flex-wrap:nowrap;
    align-items:flex-end;
    gap:8px}
  .toolbar .search-label {
    flex:1 1 auto}
  .toolbar .search-label input {
    padding:8px 10px;
    font-size:14px}
  .toolbar .view-toggle button {
    padding:8px 10px;
    font-size:12px}
  .toolbar .view-toggle {
    flex:0 0 auto}}

.confirm-warning {
  border:1px solid #e1b5a4;
  background:#fff4ee;
  color:#7c3626;
  border-radius:12px;
  padding:14px 16px;
  margin:14px 0;
  font-size:14px;
  line-height:1.45}
.confirm-warning ul {
  margin:10px 0;
  padding-left:20px}
.ack {
  display:flex;
  align-items:center;
  gap:10px;
  font-size:14px;
  margin:0 0 14px;
  min-height:44px}
.ack input {
  width:22px;
  height:22px}

/* --- Внешний вид: переключатель тем --- */
:root[data-theme="warm"] {
  --paper:#fbf3e6;
  --surface:#fffaf1;
  --line:#e4d8c6;
  --accent:#a8592f;
  --accent-dark:#8a4623;
  --soft:#f7e7d8}
:root[data-theme="dark"] {
  --paper:#151917;
  --surface:#1c2220;
  --ink:#e9eee9;
  --muted:#9dab9f;
  --line:#2f3835;
  --accent:#e0713f;
  --accent-dark:#f0905f;
  --soft:#2a211d;
  --good:#6cc59a}
:root[data-theme="dark"] .product.selected {
  background:#241d19;
  border-color:#7d4632}
:root[data-theme="dark"] #message {
  background:#1c2a24;
  border-color:#3a5a49;
  color:#c6e6d5;
  box-shadow:none}
:root[data-theme="dark"] #message.error {
  background:#2b1c17;
  border-color:#6d3a2b;
  color:#f0c0ab}
:root[data-theme="dark"] .confirm-warning {
  background:#2b1c17;
  border-color:#6d3a2b;
  color:#f2c6b3}
:root[data-theme="dark"] dialog {
  background:var(--surface);
  color:var(--ink);
  border-color:var(--line)}
:root[data-theme="dark"] .detail-placeholder {
  background:#222a27;
  border-color:#3a453f;
  color:var(--muted)}
:root[data-theme="dark"] .connection {
  background:#1f2c26;
  color:#8fd7b3}
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] button {
  background:var(--surface);
  color:var(--ink);
  border-color:var(--line)}
:root[data-theme="dark"] button.primary {
  background:var(--accent);
  border-color:var(--accent);
  color:#17110d}
:root[data-theme="dark"] .badge {
  background:#26302c;
  color:#dfe8e2}
.theme-pick {
  display:flex;
  align-items:center;
  gap:6px;
  font-size:12px;
  color:var(--muted);
  margin-right:8px;
  white-space:nowrap}
.theme-pick select {
  min-height:36px;
  padding:4px 8px;
  font-size:13px;
  border-radius:9px}
@media (max-width:640px) {
  .theme-pick {
    font-size:0}
  .theme-pick select {
    font-size:12px;
    min-height:34px;
    padding:4px 6px}}

/* тёмная тема: чекбоксы и поля не должны светиться белым */
:root[data-theme="dark"] input[type="checkbox"] {
  accent-color:var(--accent);
  background:var(--surface)}
:root[data-theme="dark"] input[type="search"],
:root[data-theme="dark"] input[type="number"],
:root[data-theme="dark"] input[type="text"],
:root[data-theme="dark"] input[type="password"] {
  background:#202724;
  color:var(--ink)}
/* шапка на узком экране: ничего не обрезаем */
@media (max-width:640px) {
  .topbar {
    padding:16px 14px 12px;
    gap:8px;
    flex-wrap:nowrap}
  .account {
    gap:6px;
    min-width:0;
    flex-wrap:nowrap}
  #account-name {
    max-width:70px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    font-size:12px}
  .account .quiet {
    padding:8px 10px;
    font-size:12px;
    min-height:36px}}

.stock-list {
  display:grid;
  gap:10px}
.stock-row {
  display:grid;
  grid-template-columns:minmax(0,1fr) auto 120px auto auto;
  align-items:center;
  gap:14px;
  border:1px solid var(--line);
  background:var(--surface);
  border-radius:var(--radius);
  padding:12px 16px}
.stock-row .control input {
  margin-top:4px;
  min-height:40px;
  text-align:center}
.stock-available {white-space:nowrap}
@media (max-width:640px) {
  .stock-row {
    grid-template-columns:1fr auto;
    gap:8px 10px}
  .stock-row .stock-name {grid-column:1/3}
  .stock-row .control {grid-column:1/2}
  .stock-row [data-save] {grid-column:2/3}
  .stock-row .stock-available {grid-column:1/3}}

.cost-box {
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:var(--surface);
  padding:12px 16px;
  margin:0 0 14px}
.cost-box summary {
  cursor:pointer;
  font-weight:650;
  min-height:32px;
  display:flex;
  align-items:center}
.cost-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(150px,1fr));
  gap:12px 16px;
  margin:14px 0 10px}
.cost-grid output {
  display:block;
  margin-top:6px;
  font-weight:650}
.cost-box .error-text {color:#a33b23}
.min-line {
  display:block;
  font-style:normal;
  font-size:11px;
  font-weight:400;
  color:var(--muted);
  margin-top:4px}
.min-line.below {
  color:#b23a1f;
  font-weight:650}
