/* Кабинет менеджера ВПО */
@font-face { font-family: "Oswald"; src: url("../fonts/Oswald.987a2513f4a4.woff") format("woff"); font-weight: 200 700; font-display: swap; }
:root {
  --red: #89171A; --red-dark: #6E1214; --red-soft: #F7E6E3; --navy: #1E2357; --accent: #F0D070;
  --bg: #F6F3EE; --card: #FFFFFF; --line: #E7DFD2; --ink: #26201D; --muted: #6F635C;
  --ok: #2F7D4F; --ok-soft: #E3F1E8; --warn: #9A6A00; --warn-soft: #FFF3D1; --off: #8A817B; --off-soft: #EFEBE6;
  --sans: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; --display: "Oswald", "Arial Narrow", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); }
a { color: var(--red); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1 { font: 500 30px/1.15 var(--display); margin: 0; }
h2 { font: 500 20px/1.2 var(--display); margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.grow { flex: 1; }

/* Каркас: меню слева, работа справа */
.layout { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--red); color: #FBF1EC; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side__brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font: 500 18px/1.15 var(--display); padding: 0 8px 18px; }
.side__brand img { height: 40px; }
.side a.nav { display: flex; justify-content: space-between; align-items: center; color: #F3DCD5; text-decoration: none; padding: 10px 12px; border-radius: 10px; font-weight: 600; }
.side a.nav:hover { background: rgba(255,255,255,.08); color: #fff; }
.side a.nav.on { background: #fff; color: var(--red); }
.side .count { background: var(--accent); color: var(--ink); border-radius: 999px; font-size: 12px; font-weight: 800; min-width: 24px; text-align: center; padding: 1px 7px; }
.side .count.zero { background: rgba(255,255,255,.18); color: #F3DCD5; }
.side__foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid rgba(255,255,255,.18); font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.side__foot a { color: #F3DCD5; }
.main { padding: 28px clamp(16px, 3vw, 40px) 60px; min-width: 0; }
.head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 22px; }
.head .btn { margin-left: auto; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border: 0; border-radius: 10px; background: var(--red); color: #fff; font: 700 14px var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--red-dark); color: #fff; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--red); color: var(--red); }
.btn.ok { background: var(--ok); }
.btn.danger { background: var(--card); color: var(--red); border: 1px solid var(--red); }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }

/* Карточки и сетки */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; text-decoration: none; color: var(--ink); display: block; }
.kpi b { display: block; font: 600 30px/1.1 var(--display); margin: 4px 0; }
.kpi.hot { border-color: var(--red); background: var(--red-soft); }
.kpi small { color: var(--muted); }
.panes { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.bars div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; height: 100%; font-size: 11px; color: var(--muted); }
.bars i { display: block; width: 100%; background: var(--red); border-radius: 6px 6px 2px 2px; min-height: 3px; }
.bars span.n { font-weight: 700; color: var(--ink); }
.warns { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.warns li { background: var(--warn-soft); border-radius: 10px; padding: 10px 12px; }
.warns li.none { background: var(--ok-soft); }

/* Вкладки-фильтры */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tabs a { text-decoration: none; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 14px; }
.tabs a.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.tabs a span { opacity: .6; margin-left: 4px; }

/* Таблица заказов */
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #FBF9F6; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.rowlink { cursor: pointer; }
.table tr.rowlink:hover td { background: #FBF7F2; }
.scroll { overflow-x: auto; }
.chip { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.chip.new, .chip.paid { background: var(--red-soft); color: var(--red); }
.chip.awaiting_payment { background: var(--warn-soft); color: var(--warn); }
.chip.confirmed { background: #E4E7F3; color: var(--navy); }
.chip.done { background: var(--ok-soft); color: var(--ok); }
.chip.cancelled, .chip.off { background: var(--off-soft); color: var(--off); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }

/* Товары: карточки с быстрой правкой */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.pcard.hidden { opacity: .65; }
.pcard__pic { aspect-ratio: 2/1; background: #EFE7DA center/cover no-repeat; position: relative; display: block; }
.pcard__pic .chips { position: absolute; left: 8px; top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.pcard__body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pcard__title { font: 500 18px var(--display); color: var(--ink); text-decoration: none; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: auto; }
.price-input { width: 110px; font: 700 16px var(--sans); padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; cursor: pointer; user-select: none; }
.toggle input { width: 18px; height: 18px; margin: 0; accent-color: var(--ok); }
.saved { font-size: 12px; color: var(--ok); min-height: 16px; }
.saved.err { color: var(--red); }

/* Формы с предпросмотром */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.preview { position: sticky; top: 20px; }
.preview .label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
fieldset { border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 16px 18px; margin: 0 0 14px; }
legend { font: 500 17px var(--display); padding: 0 6px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 700; }
.field input[type=text], .field input[type=number], .field input[type=email], .field input[type=url], .field input[type=date], .field input:not([type]), .field select, .field textarea {
  font: 15px var(--sans); padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #FFFDFB; width: 100%; }
.field textarea { resize: vertical; }
.field .help { font-size: 12px; color: var(--muted); }
.field .err { font-size: 13px; color: var(--red); font-weight: 600; }
.field.check { flex-direction: row; align-items: center; gap: 8px; }
.field.check input { width: 18px; height: 18px; accent-color: var(--red); }
.savebar { position: sticky; bottom: 0; background: rgba(246,243,238,.95); padding: 12px 0; display: flex; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); }

/* Предпросмотр карточки как на сайте */
.site-card { background: #fff; border: 1px solid #EDE4D3; border-radius: 22px; overflow: hidden; font-family: Georgia, serif; color: #2A1A16; }
.site-card__pic { aspect-ratio: 2/1; background: #EDE4D3 center/cover no-repeat; position: relative; }
.site-card__pic span { position: absolute; left: 12px; top: 12px; background: #fff; font: 700 12px var(--sans); padding: 4px 10px; border-radius: 999px; }
.site-card__body { padding: 16px 18px 18px; }
.site-card__title { font: 500 20px var(--display); margin: 0 0 4px; }
.site-card__meta { font-size: 13px; color: #6B5A50; margin: 0 0 12px; }
.site-card__foot { display: flex; justify-content: space-between; align-items: center; }
.site-card__price { font: 600 22px var(--display); }
.site-card__btn { background: #89171A; color: #FBF8F1; border-radius: 12px; padding: 9px 14px; font: 700 13px var(--sans); }
.site-card__btn.off { background: #EDE4D3; color: #4F3F37; }

.messages { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 6px; }
.messages li { padding: 10px 14px; border-radius: 10px; background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.messages li.warning { background: var(--warn-soft); color: var(--warn); }
.messages li.error { background: var(--red-soft); color: var(--red); }
.empty { padding: 30px; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: 14px; }

/* Вход */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--red); }
.login .card { width: min(380px, 100%); padding: 28px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 10px; }
  .side__brand { width: 100%; padding-bottom: 6px; }
  .side__foot { display: none; }
  .editor { grid-template-columns: 1fr; }
  .preview { position: static; order: -1; }
}
@media print {
  .side, .savebar, .no-print { display: none !important; }
  .layout { display: block; }
  body { background: #fff; }
}

/* Поле выбора фото — крупная понятная кнопка */
.field input[type=file] { padding: 14px; border: 2px dashed var(--line); border-radius: 12px; background: #fff; width: 100%; cursor: pointer; }
.field input[type=file]:hover { border-color: var(--red); }
.field input[type=file]::file-selector-button { font: inherit; font-weight: 700; border: 0; border-radius: 8px; padding: 8px 14px; margin-right: 12px; background: var(--red); color: #fff; cursor: pointer; }
.site-card__meta { font-family: inherit; }
