﻿/* =========================================================
   Машаня — админ-панель
   Локальный дашборд: каталог, склад, заказы, футер.
   ========================================================= */
:root {
  --font-sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-display: Georgia, "Times New Roman", serif;

  --bg: #F4F0F8;
  --panel: #FFFFFF;
  --panel-soft: #F7F3FB;
  --ink: #2B2233;
  --ink-soft: #4C3E58;
  --muted: #7B6D86;
  --line: #E5DCEF;
  --line-strong: #D6C9E4;

  --brand: #3F2347;
  --brand-2: #4E2F57;
  --accent: #7A4B86;
  --accent-deep: #5A2D63;
  --accent-soft: #E8DDF2;
  --green: #5D7250;
  --green-soft: #EAF0E3;
  --amber: #9B5F25;
  --amber-soft: #FBF0DF;
  --red: #A23A2A;
  --red-soft: #FBE9E5;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 3px 14px rgba(74, 36, 71, .06);
  --shadow: 0 24px 60px -32px rgba(74, 36, 71, .3);
  --sidebar: 252px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll,
body.sidebar-open {
  overflow: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

h1, h2, h3, h4, p, ul, ol {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

::selection {
  background: var(--accent-soft);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 300;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--brand);
  color: #F8F4FC;
  font-size: 11px;
  transform: translateY(-160%);
  transition: transform .2s var(--ease);
}

.skip-link:focus-visible {
  transform: none;
}

.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

/* ---------- Каркас ---------- */
.admin-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  width: var(--sidebar);
  height: 100vh;
  padding: 22px 16px;
  background: var(--brand);
  color: #F7F3FB;
  overflow-y: auto;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 8px 22px;
  border-bottom: 1px solid rgba(248, 244, 252, .12);
}

.sidebar__mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #F7F3FB;
  color: var(--brand);
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
}

.sidebar__brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 400;
  line-height: 1.1;
}

.sidebar__brand small {
  display: block;
  margin-top: 2px;
  color: rgba(248, 244, 252, .5);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 18px;
}

.side-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: rgba(248, 244, 252, .68);
  font-size: 12.5px;
  text-align: left;
  transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}

.side-nav__item .icon {
  width: 18px;
  height: 18px;
  opacity: .8;
}

.side-nav__item:hover {
  background: rgba(248, 244, 252, .07);
  color: #F8F4FC;
}

.side-nav__item.is-active {
  background: rgba(248, 244, 252, .12);
  border-color: rgba(248, 244, 252, .08);
  color: #F8F4FC;
}

.side-nav__count {
  margin-left: auto;
  color: rgba(248, 244, 252, .45);
  font-size: 10px;
  font-style: normal;
}

.side-nav__badge {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: auto;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
}

.side-nav__badge[hidden] {
  display: none;
}

.sidebar__bottom {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(248, 244, 252, .12);
}

.sidebar__storefront,
.sidebar__reset {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(248, 244, 252, .7);
  font-size: 11.5px;
  text-align: left;
}

.sidebar__storefront:hover,
.sidebar__reset:hover {
  background: rgba(248, 244, 252, .07);
  color: #F8F4FC;
}

.sidebar__storefront .icon,
.sidebar__reset .icon {
  width: 15px;
  height: 15px;
}

.sidebar__note {
  margin-top: 10px;
  padding: 0 10px;
  color: rgba(248, 244, 252, .35);
  font-size: 9.5px;
  line-height: 1.6;
}

.sidebar-backdrop {
  display: none;
}

.admin-main {
  min-width: 0;
}

/* ---------- Верхняя панель ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 78px;
  padding: 14px clamp(18px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  background: rgba(244, 240, 248, .92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar__burger {
  display: none;
}

.topbar__heading {
  min-width: 0;
}

.topbar__eyebrow {
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .14em;
  line-height: 1.4;
  text-transform: uppercase;
}

.topbar__title {
  font-family: var(--font-display);
  font-size: clamp(24px, 2.6vw, 31px);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -.01em;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.save-state {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.save-state::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--green);
  vertical-align: 1px;
}

.content {
  width: min(100%, 1440px);
  margin-inline: auto;
  padding: clamp(20px, 3vw, 34px);
}

/* ---------- Общие элементы ---------- */
.eyebrow {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 22px;
}

.view-head h2 {
  font-family: var(--font-display);
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -.01em;
}

.view-head__text {
  max-width: 560px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.view-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 0 0 auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}

.btn .icon {
  width: 15px;
  height: 15px;
}

.btn--primary {
  background: var(--brand);
  color: #F8F4FC;
}

.btn--primary:hover {
  background: var(--brand-2);
  transform: translateY(-1px);
}

.btn--ghost {
  border-color: var(--line-strong);
  background: var(--panel);
  color: var(--ink-soft);
}

.btn--ghost:hover {
  border-color: var(--brand);
  color: var(--ink);
}

.btn--small {
  min-height: 36px;
  padding-inline: 14px;
  font-size: 11px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  transition: background-color .2s var(--ease), color .2s var(--ease);
}

.icon-btn:hover {
  background: var(--panel-soft);
  color: var(--ink);
}

.icon-btn--danger:hover {
  background: var(--red-soft);
  color: var(--red);
}

.text-btn {
  padding: 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--accent-deep);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.text-btn:hover {
  border-color: var(--accent);
}

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel__head h3 {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

.panel__head p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
}

.empty-state {
  padding: 24px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--muted);
  font-size: 11.5px;
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-inline {
  padding: 16px 4px;
  color: var(--muted);
  font-size: 11.5px;
}

/* ---------- KPI ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kpi-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kpi {
  position: relative;
  min-height: 132px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.kpi::after {
  content: "";
  position: absolute;
  top: -34px;
  right: -34px;
  width: 100px;
  height: 100px;
  border: 1px solid var(--line);
  border-radius: 50%;
  opacity: .55;
  pointer-events: none;
}

.kpi--accent {
  background: var(--brand);
  border-color: var(--brand);
  color: #F8F4FC;
}

.kpi--accent::after {
  border-color: rgba(248, 244, 252, .2);
}

.kpi--warning {
  background: var(--amber-soft);
  border-color: #E4D3B8;
}

.kpi__icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--accent-deep);
}

.kpi--accent .kpi__icon {
  background: rgba(248, 244, 252, .12);
  color: #F8F4FC;
}

.kpi__icon .icon {
  width: 16px;
  height: 16px;
}

.kpi__label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.kpi--accent .kpi__label {
  color: rgba(248, 244, 252, .58);
}

.kpi__value {
  display: block;
  margin-top: 3px;
  font-family: var(--font-display);
  font-size: clamp(24px, 2.4vw, 32px);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -.02em;
}

.kpi small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9.5px;
}

.kpi--accent small {
  color: rgba(248, 244, 252, .48);
}

/* ---------- Дашборд ---------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 16px;
  margin-bottom: 16px;
}

.low-stock,
.recent-orders {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.low-stock__item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.low-stock__item:last-child {
  border-bottom: 0;
}

.low-stock__item img {
  width: 42px;
  height: 54px;
  border-radius: 8px;
  background: var(--panel-soft);
  object-fit: cover;
}

.low-stock__info strong,
.recent-order strong {
  display: block;
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.low-stock__info span {
  display: block;
  color: var(--muted);
  font-size: 9.5px;
}

.recent-order {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.recent-order:last-child {
  border-bottom: 0;
}

.recent-order:hover .recent-order__number {
  color: var(--accent);
}

.recent-order__number {
  font-size: 11px;
  font-weight: 700;
}

.recent-order__customer {
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-order__total {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.hint-panel {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--panel-soft);
}

.hint-panel__icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.hint-panel__icon .icon {
  width: 16px;
  height: 16px;
}

.hint-panel p {
  max-width: 900px;
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.65;
}

/* ---------- Панель инструментов / таблицы ---------- */
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.search-field {
  position: relative;
  flex: 1 1 230px;
  max-width: 360px;
}

.search-field .icon {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  min-height: 38px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-soft);
  font-size: 11.5px;
  outline: none;
}

.search-field input:focus {
  border-color: var(--brand);
  background: var(--panel);
}

.select {
  min-height: 38px;
  max-width: 190px;
  padding: 0 32px 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background-color: var(--panel-soft);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 16px, calc(100% - 10px) 16px;
  background-repeat: no-repeat;
  background-size: 4px 4px, 4px 4px;
  font-size: 11px;
  appearance: none;
  outline: none;
}

.select:focus {
  border-color: var(--brand);
}

.toolbar__count {
  margin-left: auto;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.data-table th {
  padding: 8px 9px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: #FAF7FD;
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.product-cell img {
  flex: 0 0 auto;
  width: 36px;
  height: 46px;
  border-radius: 7px;
  background: var(--panel-soft);
  object-fit: cover;
}

.product-cell__name {
  display: block;
  max-width: 190px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-cell__id {
  display: block;
  max-width: 180px;
  overflow: hidden;
  color: var(--muted);
  font-size: 8.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-pill {
  display: inline-block;
  max-width: 140px;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--panel-soft);
  color: var(--ink-soft);
  font-size: 9px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.price-edit {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.price-edit input {
  width: 65px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 10.5px;
  font-weight: 600;
  text-align: right;
  outline: none;
}

.price-edit input::-webkit-outer-spin-button,
.price-edit input::-webkit-inner-spin-button,
.stock-edit input::-webkit-outer-spin-button,
.stock-edit input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.price-edit span {
  color: var(--muted);
  font-size: 9px;
}

.old-price {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1.45;
  text-decoration: line-through;
}

.discount {
  color: var(--accent-deep);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.stock-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
}

.stock-pill::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.stock-pill--low {
  background: var(--amber-soft);
  color: var(--amber);
}

.stock-pill--out {
  background: var(--red-soft);
  color: var(--red);
}

.stock-edit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.stock-edit input {
  width: 42px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 10.5px;
  font-weight: 600;
  text-align: right;
  outline: none;
}

.stock-edit span {
  color: var(--muted);
  font-size: 8px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge--new {
  background: #e9f0e4;
  color: #4f6642;
}

.status-badge--hit {
  background: #F3E8F6;
  color: #974932;
}

.status-badge--processing {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-badge--done {
  background: #e8efe3;
  color: var(--green);
}

.status-badge--cancelled {
  background: var(--red-soft);
  color: var(--red);
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.row-actions .icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
}

.row-actions .icon-btn .icon {
  width: 14px;
  height: 14px;
}

.status-select {
  min-height: 29px;
  max-width: 125px;
  padding: 0 24px 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background-color: var(--panel);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 10px) 12px, calc(100% - 7px) 12px;
  background-repeat: no-repeat;
  background-size: 3px 3px, 3px 3px;
  font-size: 9.5px;
  appearance: none;
  outline: none;
}

.order-link {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.order-link strong {
  font-size: 11px;
}

.order-link span {
  color: var(--muted);
  font-size: 8.5px;
}

.order-link:hover strong {
  color: var(--accent);
}

.customer-cell strong {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
}

.customer-cell span {
  display: block;
  color: var(--muted);
  font-size: 9px;
}

.items-preview {
  display: block;
  max-width: 180px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-total {
  font-weight: 700;
  white-space: nowrap;
}

.order-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 22px 8px;
  max-height: 62vh;
  overflow-y: auto;
}

.order-details__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.order-details__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  color: var(--muted);
  font-size: 10px;
}

.order-details__section h3 {
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
}

.order-details__customer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
  font-size: 11px;
}

.order-details__customer span {
  color: var(--muted);
}

.order-details__comment {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.6;
}

.order-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.order-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}

.order-item:last-child {
  border-bottom: 0;
}

.order-item img {
  width: 38px;
  height: 48px;
  border-radius: 6px;
  background: var(--panel-soft);
  object-fit: cover;
}

.order-item strong {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
}

.order-item span {
  color: var(--muted);
  font-size: 9px;
}

.order-item__price {
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.order-total-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.order-total-line strong {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

.order-total-line--accent {
  margin-top: 5px;
  padding-top: 9px;
  border-top: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: 13px;
}

.order-total-line--accent strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
}

/* ---------- Формы ---------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field--wide {
  grid-column: 1 / -1;
}

.field__label {
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.input {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-soft);
  font-size: 11.5px;
  outline: none;
  transition: border-color .2s var(--ease), background-color .2s var(--ease);
}

.input:focus {
  border-color: var(--brand);
  background: var(--panel);
}

.input--area {
  min-height: 80px;
  padding: 9px 11px;
  resize: vertical;
  line-height: 1.6;
}

.input--readonly {
  color: var(--muted);
  background: #F7F3FB;
  cursor: default;
}

.form-note {
  min-height: 16px;
  margin-top: 8px;
  color: var(--red);
  font-size: 10.5px;
}

.category-field {
  margin-top: 2px;
  padding: 0;
  border: 0;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 2px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--ink-soft);
  font-size: 10px;
  cursor: pointer;
}

.checkbox:has(input:checked) {
  border-color: var(--brand);
  background: #F7F3FB;
  color: var(--ink);
}

.checkbox input {
  width: 13px;
  height: 13px;
  accent-color: var(--brand);
}

/* ---------- Настройки ---------- */
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: 16px;
  align-items: start;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.form-section h3 {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
}

.settings-form__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 4px;
}

.footer-preview {
  position: sticky;
  top: 100px;
  background: var(--brand);
  border-color: var(--brand);
  color: #F7F3FB;
}

.footer-preview .panel__head h3 {
  color: #F8F4FC;
}

.footer-preview .panel__head p {
  color: rgba(248, 244, 252, .45);
}

.footer-preview__body {
  padding-top: 4px;
}

.footer-preview__brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
}

.footer-preview__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #F7F3FB;
  color: var(--brand);
  font-family: var(--font-display);
  font-size: 18px;
}

.footer-preview__brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
}

.footer-preview__brand small {
  display: block;
  color: rgba(248, 244, 252, .45);
  font-size: 7px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.footer-preview__body > p {
  color: rgba(248, 244, 252, .58);
  font-size: 10.5px;
  line-height: 1.65;
}

.footer-preview__contacts {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 16px;
  color: rgba(248, 244, 252, .78);
  font-size: 10px;
}

.footer-preview__socials {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 14px;
}

.footer-preview__socials span {
  padding: 3px 8px;
  border: 1px solid rgba(248, 244, 252, .18);
  border-radius: 999px;
  color: rgba(248, 244, 252, .7);
  font-size: 8.5px;
}

.footer-preview__copyright {
  margin-top: 18px;
  padding-top: 10px;
  border-top: 1px solid rgba(248, 244, 252, .12);
  color: rgba(248, 244, 252, .38) !important;
  font-size: 8.5px !important;
}

/* ---------- Модальные окна ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(35, 19, 43, .55);
  backdrop-filter: blur(2px);
}

.modal__dialog {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  animation: modalIn .22s var(--ease);
}

.modal__dialog--order {
  width: min(620px, 100%);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(.99); }
  to { opacity: 1; transform: none; }
}

.modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.modal__head h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.1;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
}

.product-form {
  padding: 18px 22px 0;
}

.product-form__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 18px;
}

.product-form__fields {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.product-form__aside {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.image-preview {
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-form__hint {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
}

/* ---------- Тост ---------- */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  z-index: 200;
  max-width: calc(100vw - 32px);
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--brand);
  color: #F8F4FC;
  font-size: 11.5px;
  line-height: 1.45;
  text-align: center;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Адаптив ---------- */
@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .footer-preview {
    position: static;
  }
}

@media (max-width: 920px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    visibility: hidden;
    transform: translateX(-102%);
    transition: transform .3s var(--ease), visibility 0s linear .3s;
  }

  body.sidebar-open .sidebar {
    visibility: visible;
    transform: none;
    transition-delay: 0s;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: block;
    background: rgba(30, 22, 18, .45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s var(--ease);
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .topbar__burger {
    display: inline-grid;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .view-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }
}

@media (max-width: 720px) {
  .content {
    padding: 16px;
  }

  .topbar {
    min-height: 68px;
    padding: 10px 16px;
  }

  .save-state {
    display: none;
  }

  .kpi-grid,
  .kpi-grid--three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi {
    min-height: 118px;
    padding: 14px;
  }

  .toolbar {
    align-items: stretch;
  }

  .search-field {
    flex-basis: 100%;
    max-width: none;
  }

  .select {
    flex: 1;
    max-width: none;
  }

  .toolbar__count {
    width: 100%;
    margin-left: 0;
  }

  .panel {
    padding: 14px;
  }

  /* Таблицы превращаются в карточки */
  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    margin-bottom: 10px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
  }

  .data-table tbody tr:hover {
    background: var(--panel);
  }

  .data-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 0;
    border: 0;
    text-align: right;
  }

  .data-table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 8.5px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
  }

  .data-table td:first-child {
    padding-top: 0;
  }

  .data-table td[data-label="Товар"] {
    justify-content: flex-start;
    text-align: left;
  }

  .data-table td[data-label="Заказ"],
  .data-table td[data-label="Покупатель"] {
    justify-content: flex-start;
    text-align: left;
  }

  .data-table td[data-label="Товар"]::before {
    display: none;
  }

  .product-cell__name {
    max-width: 190px;
  }

  .row-actions {
    justify-content: flex-end;
  }

  .product-form__layout {
    grid-template-columns: 1fr;
  }

  .product-form__aside {
    display: none;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .field--wide {
    grid-column: auto;
  }

  .order-details__customer {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: 8px;
  }

  .modal__dialog {
    max-height: calc(100vh - 16px);
  }

  .modal__head,
  .modal__footer {
    padding-inline: 16px;
  }

  .product-form {
    padding-inline: 16px;
  }
}

@media (max-width: 480px) {
  .topbar__actions .btn span {
    display: none;
  }

  .topbar__actions .btn {
    width: 36px;
    padding: 0;
  }

  .kpi-grid,
  .kpi-grid--three {
    grid-template-columns: 1fr;
  }

  .kpi {
    min-height: 0;
  }

  .view-actions {
    width: 100%;
  }

  .view-actions .btn {
    flex: 1;
  }

  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .footer-preview {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

.field__hint {
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1.45;
}

.sizes-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  max-width: 160px;
  margin-top: 4px;
}

.size-tag {
  display: inline-flex;
  align-items: center;
  min-height: 17px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-soft);
  color: var(--ink-soft);
  font-size: 8px;
  font-weight: 600;
  line-height: 1;
}

.sizes-preview__empty {
  color: var(--muted);
  font-size: 8px;
  font-style: italic;
}

.image-gallery {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.image-gallery[hidden] {
  display: none;
}

.image-gallery__item {
  flex: 0 0 44px;
  width: 44px;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  opacity: .78;
  transition: opacity .2s var(--ease), border-color .2s var(--ease);
}

.image-gallery__item:hover,
.image-gallery__item.is-main {
  opacity: 1;
  border-color: var(--accent);
}

.image-gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 720px) {
  .image-gallery {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.sales-count {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.3;
  white-space: nowrap;
}
