/*
  style.css — внешний вид всего сайта.

  Цвета вынесены в «переменные» (--bg, --gold …) в самом начале.
  Хотите другой оттенок — меняете одну строку, и он меняется везде.
*/

:root {
  --bg: #f6f1e8;
  --bg-deep: #efe6d6;
  --paper: #fffdf9;
  --line: #e7ddcb;
  --line-strong: #d8c9ae;
  --ink: #2e261e;
  --ink-soft: #5d5043;
  --muted: #968672;
  --gold: #b0814a;
  --gold-deep: #8f6532;
  --gold-soft: #f1dcb9;
  --gold-glow: #f2b880;      /* цвет купола на логотипе */
  --ok: #6f8b5a;
  --danger: #b5523b;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(80, 60, 30, .04), 0 12px 32px -12px rgba(80, 60, 30, .14);
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Manrope", -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.22, .8, .24, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font: 15px/1.55 var(--sans);
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 50% -120px, rgba(242, 184, 128, .28), transparent 70%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
/* Лёгкая «бумажная» фактура поверх фона */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1; opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .35 0 0 0 0 .2 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold-deep); }
.muted { color: var(--muted); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ─── Шапка ──────────────────────────────────────────────────── */
.topbar {
  max-width: 1180px; margin: 0 auto; padding: 22px 24px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.topbar__logo img { height: 40px; display: block; }
.topbar__badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px;
  background: rgba(255, 253, 249, .7); border: 1px solid var(--line);
  font-size: 13px; color: var(--ink-soft); backdrop-filter: blur(6px);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(111, 139, 90, .5); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(111, 139, 90, .45); } 70%, 100% { box-shadow: 0 0 0 9px rgba(111, 139, 90, 0); } }
.topbar__nav { margin-left: auto; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.link { color: var(--ink-soft); text-decoration: none; font-size: 14px; }
.link:hover { color: var(--gold-deep); }

/* ─── Первый экран ───────────────────────────────────────────── */
.hero { text-align: center; padding: 28px 24px 40px; max-width: 760px; margin: 0 auto; }
.eyebrow {
  margin: 0 0 10px; font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold); font-weight: 600;
}
.hero h1 {
  margin: 0; font: 600 clamp(44px, 7vw, 76px)/1 var(--serif); letter-spacing: -.01em;
  animation: rise .9s var(--ease) both;
}
.hero h1 em { font-style: italic; color: var(--gold); font-weight: 500; }
.ornament { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 22px 0 18px; color: var(--gold); animation: rise .9s .1s var(--ease) both; }
.ornament span { height: 1px; width: 80px; background: linear-gradient(90deg, transparent, var(--line-strong)); }
.ornament span:last-child { transform: scaleX(-1); }
.ornament i { font-style: normal; font-size: 13px; }
.lead { margin: 0 auto; max-width: 560px; color: var(--ink-soft); font-size: 16.5px; animation: rise .9s .18s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ─── Раскладка страницы заказа ──────────────────────────────── */
.order-layout {
  max-width: 1180px; margin: 0 auto; padding: 0 24px 40px;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; /* все блоки — одной колонкой во всю ширину */
}

/* ─── Блок «Как считается стоимость» ─────────────────────────── */
.price-info {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 20px; box-shadow: var(--shadow); overflow: hidden;
}
.price-info summary {
  list-style: none; display: flex; align-items: center; gap: 14px; padding: 16px 20px; cursor: pointer;
}
.price-info summary::-webkit-details-marker { display: none; }
.price-info summary b { display: block; font-weight: 600; }
.price-info summary small { color: var(--muted); font-size: 13px; }
.price-info__icon {
  flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--gold-soft); color: var(--gold-deep); font: 600 20px var(--serif);
}
.chev { margin-left: auto; width: 10px; height: 10px; border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted); transform: rotate(45deg); transition: transform .3s var(--ease); }
.price-info[open] .chev { transform: rotate(225deg); }
.price-info__body { padding: 0 20px 20px; color: var(--ink-soft); animation: rise .4s var(--ease); }
.price-info__body p { margin: 0 0 12px; }
.example {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 14px;
  padding: 14px; border-radius: 14px; background: var(--bg); border: 1px dashed var(--line-strong);
}
.example div { flex: 1 1 120px; }
.example small { display: block; color: var(--muted); font-size: 12px; }
.example b { color: var(--ink); font-weight: 600; }
.example > span { color: var(--gold); }
.box-prices ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; }
.box-prices li { display: flex; justify-content: space-between; border-bottom: 1px dotted var(--line-strong); padding: 4px 0; }
.box-prices li b { color: var(--ink); font-weight: 600; }

/* ─── Карточка доски ─────────────────────────────────────────── */
.boards { display: grid; gap: 18px; }
.board {
  background: var(--paper); border: 1px solid var(--line); border-radius: 24px;
  padding: 20px 22px 0; box-shadow: var(--shadow);
  transition: box-shadow .3s, border-color .3s;
}
.board:focus-within { border-color: var(--line-strong); box-shadow: 0 1px 2px rgba(80,60,30,.04), 0 18px 40px -14px rgba(120, 85, 40, .22); }
.board--enter { animation: boardIn .55s var(--ease) both; }
.board--leave { animation: boardOut .28s ease-in forwards; }
@keyframes boardIn { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes boardOut { to { opacity: 0; transform: translateX(30px) scale(.97); } }

.board__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.board__title { margin: 0; font: 600 26px/1 var(--serif); }
.board__title span { color: var(--gold); }
.boards.single .icon-btn[data-remove] { visibility: hidden; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid transparent; background: transparent;
  display: grid; place-items: center; color: var(--muted); transition: all .2s;
}
.icon-btn:hover { background: var(--bg); color: var(--danger); border-color: var(--line); }

.board__grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; }

/* Поля ввода */
.field { display: block; margin-bottom: 14px; }
.field__label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.field__label small { font-weight: 400; color: var(--muted); }
.field input, .field textarea, .filters select, .filters input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; outline: none; transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus, .field textarea:focus, .filters select:focus, .filters input:focus {
  border-color: var(--gold); box-shadow: 0 0 0 4px rgba(176, 129, 74, .14);
}
.field input::placeholder, .field textarea::placeholder { color: #c2b6a5; }

.unit-input { position: relative; display: block; }
.unit-input input { padding-right: 44px; font-size: 18px; font-weight: 600; }
.unit-input i { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-size: 14px; pointer-events: none; }

.dims { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 10px; }
.dims .field { margin-bottom: 0; }
.dims__x { padding-bottom: 12px; color: var(--gold); font-size: 20px; }
.dims--small { grid-template-columns: 1fr 1fr; padding: 4px 0 14px 54px; gap: 12px; }
.dims--small .unit-input input { font-size: 16px; }

.formula {
  margin: 10px 0 16px; padding: 10px 12px; border-radius: 12px; background: var(--bg);
  font-size: 13.5px; color: var(--ink-soft); min-height: 40px; transition: background .3s, color .3s;
}
.formula b { color: var(--ink); }
.formula--warn { background: #fbece6; color: var(--danger); }
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; white-space: nowrap;
  background: var(--gold-soft); color: var(--gold-deep); font-weight: 600;
}

/* Количество */
.qty { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.qty .field__label { margin: 0; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: #fff; overflow: hidden; }
.stepper button { width: 38px; height: 38px; border: 0; background: transparent; font-size: 18px; color: var(--gold-deep); transition: background .2s; }
.stepper button:hover { background: var(--bg); }
.stepper input { width: 40px; text-align: center; border: 0; outline: none; font-weight: 700; background: transparent; padding: 0; }

/* Переключатели */
.options { display: grid; }
.toggle {
  display: flex; align-items: center; gap: 14px; padding: 12px 0; cursor: pointer;
  border-bottom: 1px solid var(--line); user-select: none; transition: opacity .25s;
}
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle__switch {
  flex: none; position: relative; width: 40px; height: 24px; border-radius: 999px;
  background: var(--line); transition: background .3s var(--ease);
}
.toggle__switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); transition: transform .35s var(--ease);
}
.toggle input:checked + .toggle__switch { background: var(--gold); }
.toggle input:checked + .toggle__switch::after { transform: translateX(16px); }
.toggle input:focus-visible + .toggle__switch { box-shadow: 0 0 0 4px rgba(176, 129, 74, .2); }
.toggle__text b { display: block; font-weight: 600; font-size: 14.5px; }
.toggle__text small { color: var(--muted); font-size: 12.5px; }
.toggle.is-disabled { opacity: .45; cursor: not-allowed; }

/* Плавное раскрытие доп. полей */
.reveal { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .4s var(--ease); }
.reveal.open { grid-template-rows: 1fr; }
.reveal__inner { overflow: hidden; opacity: 0; transition: opacity .3s; }
.reveal.open .reveal__inner { opacity: 1; transition-delay: .08s; }
.reveal.open + .toggle, .reveal.open { border-bottom: 1px solid var(--line); }

/* Выбор коробки */
.box-choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 6px 0 14px 54px; border-radius: 14px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
  cursor: pointer; transition: all .2s;
}
.chip span b { font-weight: 600; font-size: 14px; }
.chip span small { color: var(--muted); }
.chip:hover span { border-color: var(--line-strong); }
.chip input:checked + span { border-color: var(--gold); background: #fdf6ea; box-shadow: inset 0 0 0 1px var(--gold); }
.chip input:checked + span small { color: var(--gold-deep); font-weight: 600; }
.chip input:focus-visible + span { box-shadow: 0 0 0 4px rgba(176, 129, 74, .2); }

/* Схема доски */
.board__preview {
  background: linear-gradient(180deg, #f8f2e7, #f3eadb);
  border-radius: 18px; padding: 10px 8px 14px; align-self: start;
  display: flex; flex-direction: column; align-items: center; position: sticky; top: 20px;
}
.board__preview svg { width: 100%; height: auto; display: block; }
.board__preview svg .ghost { opacity: .28; }
.board__preview svg path { transition: d .35s var(--ease); }
.board__preview .dim path { stroke: var(--muted); stroke-width: 1; fill: none; }
.board__preview .dim text { fill: var(--ink-soft); font: 600 11px var(--sans); text-anchor: middle; }
.preview__caption { margin: 2px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); line-height: 1.45; min-height: 36px; }
.preview__caption b { color: var(--ink); font-size: 14px; }

.board__foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin: 18px -22px 0; padding: 14px 22px; border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, rgba(241, 220, 185, .25)); border-radius: 0 0 24px 24px;
}
.board__lines { color: var(--muted); font-size: 13.5px; }
.board__foot strong { font: 600 24px var(--serif); }

.add-board {
  width: 100%; margin-top: 18px; padding: 18px; border-radius: 20px;
  border: 1.5px dashed var(--line-strong); background: rgba(255, 253, 249, .5);
  color: var(--gold-deep); font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: all .25s var(--ease);
}
.add-board:hover:not(:disabled) { background: var(--paper); border-color: var(--gold); transform: translateY(-1px); }
.add-board:disabled { opacity: .4; cursor: not-allowed; }
.plus { width: 26px; height: 26px; border-radius: 50%; background: var(--gold-soft); display: grid; place-items: center; font-size: 18px; transition: transform .35s var(--ease); }
.add-board:hover .plus { transform: rotate(90deg); }

/* ─── Правая панель ──────────────────────────────────────────── */
.panel {
  background: var(--paper); border: 1px solid var(--line); border-radius: 24px; padding: 24px;
  box-shadow: var(--shadow);
}
.panel { padding: 24px 28px; }
.panel h2 { margin: 0 0 16px; font: 600 28px/1 var(--serif); }
.panel__fields { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; }
.field--wide { grid-column: 1 / -1; }
.checkout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center;
  margin: 6px -28px 0; padding: 20px 28px 0; border-top: 1px solid var(--line);
}
.checkout__action { display: flex; flex-direction: column; justify-content: center; }
.checkout__action .form-error { margin-top: 0; text-align: center; }
.summary__lines { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.summary__lines li { display: flex; justify-content: space-between; gap: 10px; color: var(--ink-soft); animation: rise .35s var(--ease); }
.summary__lines b { font-weight: 600; color: var(--ink); white-space: nowrap; }
.summary__total { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 0 4px; border-top: 1px dashed var(--line-strong); }
.summary__total span { font-weight: 600; color: var(--ink-soft); }
.summary__total strong { font: 600 36px/1 var(--serif); color: var(--ink); font-variant-numeric: tabular-nums; }

.form-error { min-height: 20px; margin: 8px 0; color: var(--danger); font-size: 13.5px; }
.fine { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }

/* Главная кнопка с «бликом» */
.btn-primary {
  position: relative; width: 100%; padding: 16px 20px; border: 0; border-radius: 16px; overflow: hidden;
  background: linear-gradient(135deg, #c39357, #a5763f); color: #fffaf2; font-weight: 700; font-size: 15.5px; letter-spacing: .01em;
  box-shadow: 0 10px 24px -10px rgba(143, 101, 50, .7), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .2s var(--ease), box-shadow .2s;
}
.btn-primary::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent); transform: skewX(-20deg);
  animation: shine 4.5s infinite;
}
@keyframes shine { 0%, 70% { left: -60%; } 100% { left: 130%; } }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -10px rgba(143, 101, 50, .75), inset 0 1px 0 rgba(255,255,255,.25); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { cursor: wait; }
.spinner { display: none; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; margin: 0 auto; }
.btn-primary.loading .btn-primary__text { display: none; }
.btn-primary.loading .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Ошибка в поле: красная рамка и «встряхивание» */
.invalid input, .invalid textarea, .stepper.invalid, [data-box-list].invalid { border-color: var(--danger) !important; }
[data-box-list].invalid { box-shadow: inset 0 0 0 1px rgba(181, 82, 59, .35); }
.invalid { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* ─── Экран «Заказ принят» ───────────────────────────────────── */
.success {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px;
  background: rgba(46, 38, 30, .32); backdrop-filter: blur(6px); opacity: 0; transition: opacity .35s;
}
.success[hidden] { display: none; } /* без этого display:grid перебивает атрибут hidden */
.success.show { opacity: 1; }
.success__card {
  width: min(440px, 100%); text-align: center; padding: 38px 30px 30px; border-radius: 28px;
  background: var(--paper); box-shadow: 0 30px 80px -20px rgba(46, 38, 30, .45);
  transform: translateY(24px) scale(.96); transition: transform .5s var(--ease);
}
.success.show .success__card { transform: none; }
.success__check { width: 84px; height: 84px; margin-bottom: 14px; }
.success__check circle { fill: #fbf3e5; stroke: var(--gold); stroke-width: 2.5; stroke-dasharray: 230; stroke-dashoffset: 230; }
.success__check path { fill: none; stroke: var(--gold-deep); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; }
.success.show .success__check circle { animation: draw .7s .15s var(--ease) forwards; }
.success.show .success__check path { animation: draw .45s .7s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.success h2 { margin: 0 0 8px; font: 600 46px/1 var(--serif); }
.success__text { color: var(--ink-soft); margin: 0 0 8px; }
.success__sum { margin: 0 0 22px; color: var(--muted); }
.success__sum b { color: var(--ink); }
.btn-ghost {
  padding: 13px 22px; border-radius: 14px; border: 1px solid var(--line-strong); background: transparent;
  font-weight: 600; color: var(--gold-deep); transition: all .2s;
}
.btn-ghost:hover { background: var(--bg); border-color: var(--gold); }

.footer { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 24px 40px; color: var(--muted); font-size: 13px; }

/* ─── Вход для преподавателя ─────────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login__card {
  width: min(400px, 100%); background: var(--paper); border: 1px solid var(--line); border-radius: 28px;
  padding: 36px 30px 26px; text-align: center; box-shadow: var(--shadow); animation: rise .7s var(--ease) both;
}
.login__card.shake { animation: shake .45s; }
.login__logo { height: 46px; margin-bottom: 18px; }
.login__card h1 { margin: 0 0 22px; font: 600 34px/1.05 var(--serif); }
.login__card .field { text-align: left; }
.pass { position: relative; display: block; }
.pass input { padding-right: 48px; }
.pass__eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); padding: 8px; }
.login__back { display: inline-block; margin-top: 16px; font-size: 13.5px; color: var(--muted); text-decoration: none; }

/* ─── Панель преподавателя ───────────────────────────────────── */
.admin { max-width: 1180px; margin: 0 auto; padding: 8px 24px 60px; }
.admin__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.admin__head h1 { margin: 0; font: 600 52px/1 var(--serif); }
.reset { font-size: 14px; color: var(--danger); text-decoration: none; }

.btn-excel {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 12px;
  background: var(--ink); color: #fbf6ee; text-decoration: none; font-weight: 600; font-size: 14px;
  transition: transform .2s, background .2s;
}
.btn-excel:hover { background: #46392c; transform: translateY(-1px); }
.btn-excel--light { background: #fffaf2; color: #3b3127; box-shadow: inset 0 0 0 1px #e3d4bd; }
.btn-excel--light:hover { background: #f6ecdc; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr) 1.45fr 1.45fr; gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 16px 18px;
  box-shadow: var(--shadow); animation: rise .6s var(--ease) both;
}
.stat:nth-child(2) { animation-delay: .05s; } .stat:nth-child(3) { animation-delay: .1s; } .stat:nth-child(4) { animation-delay: .15s; }
.stat small { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 600; }
.stat b { display: block; font: 600 40px/1.15 var(--serif); font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.stat--accent { background: linear-gradient(140deg, #fdf5e7, #f6e5c8); border-color: #ebd5b0; }
.stat--teacher { background: linear-gradient(140deg, #f3f1ea, #e6e3d6); border-color: #d8d3c1; }
.stat:nth-child(5) { animation-delay: .2s; }

.filters {
  display: grid; grid-template-columns: minmax(200px, 1.4fr) 1fr 1fr auto; gap: 10px; align-items: center;
  padding: 10px; background: rgba(255, 253, 249, .7); border: 1px solid var(--line); border-radius: 18px; margin-bottom: 24px;
  backdrop-filter: blur(6px); position: sticky; top: 8px; z-index: 5;
}
.filters__search { position: relative; display: block; }
.filters__search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.filters__search input { padding-left: 40px; }
.filters select {
  appearance: none; cursor: pointer; padding-right: 34px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23968672' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 13px center;
}
.seg { display: flex; background: var(--bg-deep); border-radius: 12px; padding: 3px; }
.seg label { position: relative; }
.seg input { position: absolute; inset: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 8px 13px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); cursor: pointer; white-space: nowrap; transition: all .2s; }
.seg input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(80,60,30,.12); }

.sizes { margin-bottom: 28px; }
.sizes h2, .orders-title { margin: 0 0 12px; font: 600 28px var(--serif); }
.sizes h2 small { font: 500 13px var(--sans); color: var(--muted); margin-left: 6px; }
.sizes__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.size-card {
  display: grid; gap: 4px; padding: 14px 16px; border-radius: 18px; text-decoration: none; color: inherit;
  background: var(--paper); border: 1px solid var(--line); transition: all .25s var(--ease);
}
.size-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.size-card.active { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); background: #fdf6ea; }
.size-card__dim { font: 600 22px var(--serif); }
.size-card__dim i { font: 400 13px var(--sans); color: var(--muted); font-style: normal; }
.size-card__count { color: var(--ink-soft); font-size: 13px; }
.size-card__count b { font-size: 18px; color: var(--ink); }
.size-card__bar { height: 4px; border-radius: 4px; background: var(--bg-deep); overflow: hidden; }
.size-card__bar span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--gold-glow), var(--gold)); animation: grow 1s var(--ease) both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } }
.size-card__meta { font-size: 12px; color: var(--muted); min-height: 18px; }

.orders { display: grid; gap: 14px; }
.order {
  background: var(--paper); border: 1px solid var(--line); border-radius: 22px; padding: 18px 20px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
  animation: rise .5s calc(var(--i, 0) * 40ms) var(--ease) both; transition: opacity .4s, transform .4s;
}
.order::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--gold-glow); transition: background .3s; }
.order.is-done::before { background: var(--ok); }
.order.is-done { background: #fcfbf8; }
.order.removing { opacity: 0; transform: translateX(40px); }
.order__head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.order__num { font: 600 15px var(--sans); padding: 5px 10px; border-radius: 10px; background: var(--bg); color: var(--gold-deep); }
.order__who { flex: 1 1 220px; display: grid; }
.order__who b { font-size: 16.5px; font-weight: 700; }
.order__who span { font-size: 13px; color: var(--muted); }
.order__who a { color: var(--ink-soft); text-decoration: none; }
.order__side { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.order__sums { display: flex; gap: 16px; margin-right: 6px; }
.order__sum { font: 600 26px/1.1 var(--serif); white-space: nowrap; text-align: right; }
.order__sum small { display: block; font: 600 10px var(--sans); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.order__sum--teacher { color: var(--muted); font-size: 22px; }
.status {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid #f0d6b5; background: #fdf3e4; color: #9a6a31; font-weight: 600; font-size: 13px; transition: all .25s;
}
.status__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status:hover { filter: brightness(.97); transform: translateY(-1px); }
.is-done .status { border-color: #cfdcc4; background: #eef3e9; color: #4f6a3d; }

.items { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.items li {
  display: grid; grid-template-columns: 130px 46px 1fr auto; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 12px; background: var(--bg); font-size: 14px; transition: background .3s;
}
.items li.match { background: #fbedd6; box-shadow: inset 0 0 0 1px #edcf9f; }
.items__dim { font-weight: 700; }
.items__qty { color: var(--gold-deep); font-weight: 700; }
.items__tags { display: flex; flex-wrap: wrap; gap: 5px; }
.items__tags .tag { background: #fff; border: 1px solid var(--line); color: var(--ink-soft); font-weight: 500; }
.items__tags .tag--box { border-color: #e8d2ac; color: var(--gold-deep); }
.items__price { font-weight: 600; white-space: nowrap; text-align: right; }
.items__price small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.order__comment {
  margin: 12px 0 0; padding: 10px 14px; border-left: 2px solid var(--gold-soft); color: var(--ink-soft);
  font-size: 14px; font-style: italic; background: linear-gradient(90deg, rgba(241,220,185,.18), transparent);
}

.empty { text-align: center; padding: 60px 20px; border: 1.5px dashed var(--line-strong); border-radius: 24px; color: var(--muted); }
.empty h3 { margin: 12px 0 4px; font: 600 28px var(--serif); color: var(--ink); }
.empty p { margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; z-index: 60;
  padding: 12px 20px; border-radius: 14px; background: var(--ink); color: #fbf6ee; font-size: 14px;
  box-shadow: 0 14px 30px -10px rgba(0,0,0,.4); transition: all .35s var(--ease); pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ─── Адаптивность: планшеты и телефоны ──────────────────────── */
@media (max-width: 980px) {
  .board__grid { grid-template-columns: minmax(0, 1fr) 240px; gap: 22px; }
  .checkout { grid-template-columns: 1fr; gap: 12px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat--teacher { grid-column: 1 / -1; }
  .filters { grid-template-columns: 1fr 1fr; position: static; }
  .filters__search, .seg { grid-column: 1 / -1; }
  .seg span { flex: 1; text-align: center; }
  .seg label { flex: 1; }
}
@media (max-width: 640px) {
  .topbar { padding: 16px; }
  .topbar__logo img { height: 34px; }
  .topbar__nav { margin-left: 0; width: 100%; justify-content: space-between; gap: 10px; }
  .hero { padding: 16px 16px 28px; }
  .order-layout, .admin { padding-left: 16px; padding-right: 16px; }
  .board { padding: 16px 16px 0; }
  .board__foot { margin: 16px -16px 0; padding: 12px 16px; }
  .board__grid { grid-template-columns: 1fr; }
  .board__preview { order: -1; position: static; flex-direction: row; gap: 10px; padding: 8px 12px; }
  .board__preview svg { width: 46%; }
  .preview__caption { text-align: left; }
  .dims--small, .box-choices { padding-left: 0; }
  .panel { padding: 20px; }
  .panel__fields { grid-template-columns: 1fr; }
  .checkout { margin: 6px -20px 0; padding: 16px 20px 0; }
  .admin__head h1 { font-size: 40px; }
  .stat b { font-size: 32px; }
  .order__side { margin-left: 0; width: 100%; }
  .order__sums { margin-right: auto; gap: 12px; }
  .order__sum { font-size: 22px; }
  .order__sum--teacher { font-size: 19px; }
  .order__side { gap: 6px; }
  .items li { grid-template-columns: 1fr auto; }
  .items__tags { grid-column: 1 / -1; order: 3; }
  .box-prices ul { grid-template-columns: 1fr; }
}

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

/* ─── Галочка согласия на обработку персональных данных ──────── */
.consent { position: relative; display: flex; align-items: flex-start; gap: 12px; margin: 4px 0 18px; cursor: pointer; font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; }
.consent input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.consent__box {
  flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 7px; border: 1.5px solid var(--line-strong);
  background: #fff; display: grid; place-items: center; color: #fff; transition: all .25s var(--ease);
}
.consent__box svg { transform: scale(0); transition: transform .3s var(--ease); }
.consent input:checked + .consent__box { background: var(--gold); border-color: var(--gold); }
.consent input:checked + .consent__box svg { transform: scale(1); }
.consent input:focus-visible + .consent__box { box-shadow: 0 0 0 4px rgba(176, 129, 74, .2); }
.consent.invalid .consent__box { border-color: var(--danger); }
.consent a { color: var(--gold-deep); }

/* ─── Страница «Согласие на обработку ПДн» ──────────────────── */
.legal { max-width: 760px; margin: 0 auto; padding: 8px 24px 60px; }
.legal__card { background: var(--paper); border: 1px solid var(--line); border-radius: 24px; padding: 32px 36px; box-shadow: var(--shadow); }
.legal h1 { margin: 0 0 18px; font: 600 38px/1.1 var(--serif); }
.legal h2 { margin: 22px 0 8px; font: 600 22px var(--serif); }
.legal p, .legal li { color: var(--ink-soft); }
.legal ul { padding-left: 20px; }
@media (max-width: 640px) { .legal__card { padding: 22px 20px; } .legal h1 { font-size: 30px; } }

/* ─── Карточка коробки (размер = доска, цена автоматически) ──── */
.box-info {
  display: flex; align-items: center; gap: 14px; margin: 4px 0 14px 54px;
  padding: 12px 16px; border-radius: 14px; border: 1px solid #ebd5b0;
  background: linear-gradient(135deg, #fdf6ea, #faefdc);
  animation: rise .4s var(--ease);
}
.box-info__icon { flex: none; width: 36px; height: 36px; }
.box-info__text { display: grid; }
.box-info__text b { font-weight: 600; font-size: 14.5px; }
.box-info__text small { color: var(--muted); font-size: 12.5px; }
.box-info__price { margin-left: auto; font: 600 22px var(--serif); color: var(--gold-deep); white-space: nowrap; }
.board__preview .box-outline { fill: rgba(251, 241, 225, .6); stroke: var(--gold); stroke-width: 1.2; stroke-dasharray: 4 3; }
@media (max-width: 640px) { .box-info { margin-left: 0; } }
