/* «Чек кузнеца» — калькулятор Ям как заверенный клановый заказ (вид принят
   владельцем 28.08.2026, проба в _archive/pit-etalon-*). Язык — базовый язык
   сайта: документ на угле с бронзовой линией, одно золото, Yeseva/Golos. */

.order-wrap { width: min(860px, 100%); margin: 0 auto; }

/* ── Документ ── */
.order { position: relative; border: 1px solid var(--line); border-radius: 8px; background: var(--clan-charcoal);
  box-shadow: inset 0 1px color-mix(in srgb, var(--clan-sand) 8%, transparent);
  /* едва заметная линовка конторской книги */
  background-image: repeating-linear-gradient(180deg, transparent 0 46px, color-mix(in srgb, var(--clan-bronze) 7%, transparent) 46px 47px); }
.order::before { content: ""; position: absolute; inset: 7px; border: 1px solid color-mix(in srgb, var(--clan-bronze) 34%, transparent); border-radius: 5px; pointer-events: none; }

.order-head { position: relative; padding: 14px 34px 10px; border-bottom: 1px solid var(--line); text-align: center; }
.order-brand { display: flex; align-items: center; gap: 14px; margin: 0 0 6px; color: var(--muted); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; white-space: nowrap; }
.order-brand::before, .order-brand::after { content: ""; flex: 1; height: 1px; background: color-mix(in srgb, var(--clan-bronze) 42%, transparent); }
.order-head h2 { margin: 0 0 10px; font-family: "Yeseva One", Georgia, serif; font-weight: 400; font-size: clamp(26px, 3vw, 40px); color: color-mix(in srgb, var(--clan-sand) 94%, white); }

.order-pit { display: inline-flex; margin-left: auto; margin-right: auto; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; margin-bottom: 14px; }
.order-pit button { min-height: 42px; padding: 0 16px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 14px; }
.order-pit button:last-child { border-right: 0; }
.order-pit button[aria-checked="true"] { background: color-mix(in srgb, var(--clan-gold) 13%, var(--clan-charcoal)); color: var(--clan-gold); }
.order-pit button:hover { color: var(--clan-sand); }

.order-goal { display: flex; align-items: baseline; justify-content: center; gap: 10px; flex-wrap: wrap; }
.order-goal > span:first-child { color: var(--muted); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; }
.goal-unit { color: var(--muted); font-size: 13px; }
.goal-unit b { color: var(--clan-sand); font-weight: 600; }

/* редактируемые числа документа: без рамок, золотая черта снизу */
.order-input { border: 0; border-bottom: 1px solid color-mix(in srgb, var(--clan-bronze) 55%, transparent); border-radius: 0;
  background: transparent; color: color-mix(in srgb, var(--clan-sand) 94%, white); font: inherit; font-variant-numeric: tabular-nums; }
.order-input:focus { outline: none; border-bottom-color: var(--clan-gold); box-shadow: 0 1px 0 color-mix(in srgb, var(--clan-gold) 35%, transparent); }
.goal-input { width: 8.2ch; font-size: clamp(22px, 2.6vw, 30px); font-weight: 600; }
.inline-input { width: 4.6ch; font-size: inherit; color: var(--clan-sand); text-align: center; }
.drop-input { width: 3.2ch; }
.line-input { width: 5.6ch; font-size: 21px; font-weight: 600; text-align: right; }

/* ── Строки-слагаемые ── */
.order-lines { padding: 6px 34px 2px; }
.order-line { display: flex; align-items: baseline; gap: 12px; padding: 7px 0; }
.line-name { flex: 0 1 auto; min-width: 0; color: var(--clan-sand); font-size: 15px; }
.line-name small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.line-name small b { color: var(--clan-sand); font-weight: 600; }
.line-dots { flex: 1 1 24px; border-bottom: 1px dotted color-mix(in srgb, var(--clan-bronze) 48%, transparent); transform: translateY(-4px); }
.line-num { flex: 0 0 auto; display: inline-flex; align-items: baseline; gap: 7px; font-variant-numeric: tabular-nums; }
.line-num .num, .line-num .line-input { font-size: 21px; font-weight: 600; color: color-mix(in srgb, var(--clan-sand) 94%, white); }
.line-num em { font-style: normal; color: var(--muted); font-size: 11px; }
.line-num.plus .num { color: var(--clan-gold); }
.line-num.plus .num::before { content: "+ "; }

/* уровень — главная строка документа */
.line-level { padding-bottom: 4px; }
.line-level-value { display: inline-flex; align-items: center; gap: 10px; }
.level-num { align-items: baseline; }
.level-num .num { font-family: "Yeseva One", Georgia, serif; font-weight: 400; font-size: 34px; color: var(--clan-gold); }
.level-step { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 7px; background: var(--clan-charcoal);
  color: var(--clan-sand); font-size: 19px; line-height: 1; }
.level-step:hover { border-color: var(--clan-gold); color: var(--clan-gold); }
.level-range { width: 100%; margin: 0 0 2px; appearance: none; height: 22px; background: transparent; cursor: pointer; }
.level-range::-webkit-slider-runnable-track { height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--clan-gold) 0 var(--level-share, 26%), color-mix(in srgb, var(--clan-bronze) 40%, transparent) var(--level-share, 26%) 100%); }
.level-range::-webkit-slider-thumb { appearance: none; width: 18px; height: 18px; margin-top: -7.5px; border-radius: 50%;
  border: 1px solid var(--clan-gold); background: radial-gradient(120% 120% at 30% 25%, #3a3325 0%, #15120c 100%);
  box-shadow: 0 0 10px color-mix(in srgb, var(--clan-gold) 35%, transparent); }
.level-range::-moz-range-track { height: 3px; border-radius: 2px; background: color-mix(in srgb, var(--clan-bronze) 40%, transparent); }
.level-range::-moz-range-progress { height: 3px; border-radius: 2px; background: var(--clan-gold); }
.level-range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--clan-gold);
  background: radial-gradient(120% 120% at 30% 25%, #3a3325 0%, #15120c 100%); }
.level-range:focus-visible { outline: 2px solid var(--clan-gold); outline-offset: 4px; }

/* ── Итог ── */
.order-total { padding: 12px 34px 4px; border-top: 1px solid var(--line); }
.total-battles { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }
.total-battles b { color: var(--clan-sand); font-weight: 600; font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.total-battles .num { color: color-mix(in srgb, var(--clan-sand) 94%, white); }
.total-points { display: flex; align-items: baseline; gap: 14px; margin: 4px 0 2px; }
.total-points > span:first-child { font-family: "Yeseva One", Georgia, serif; font-size: clamp(28px, 4vw, 46px); color: var(--clan-gold); }
.num.giant { font-family: "Yeseva One", Georgia, serif; font-weight: 400; font-size: clamp(48px, 7vw, 84px); line-height: .94;
  color: var(--clan-gold); text-shadow: 0 0 34px color-mix(in srgb, var(--clan-gold) 22%, transparent); font-variant-numeric: tabular-nums; }
.total-unit { color: var(--muted); font-size: 12px; line-height: 1.35; text-transform: uppercase; letter-spacing: .1em; }
.total-share { margin: 3px 0 0; color: var(--muted); font-size: 13px; }

/* ── Печать-вердикт ── */
.order-verdict { position: relative; display: flex; align-items: center; gap: 26px; margin: 8px 12px 10px; padding: 14px 22px;
  border: 1px solid color-mix(in srgb, var(--clan-gold) 40%, transparent); border-radius: 7px;
  background: color-mix(in srgb, var(--clan-black) 74%, transparent); overflow: hidden; }
.order-verdict::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(70% 120% at 18% 50%, color-mix(in srgb, var(--clan-gold) 9%, transparent), transparent 70%); }
.verdict-stamp { flex: 0 0 auto; width: 108px; height: 108px; opacity: .92; transform: rotate(var(--stamp-rot, -8deg));
  filter: sepia(1) saturate(2.6) hue-rotate(5deg) brightness(1.5) drop-shadow(0 4px 10px rgba(0, 0, 0, .45)); }
.order-verdict.is-clear .verdict-stamp { opacity: 1; filter: sepia(1) saturate(3) hue-rotate(5deg) brightness(1.65) drop-shadow(0 4px 10px rgba(0, 0, 0, .45)); }
.verdict-stamp.thump { animation: stamp-thump .38s cubic-bezier(.2, 1.6, .35, 1); }
@keyframes stamp-thump { from { transform: rotate(var(--stamp-rot, -8deg)) scale(1.35); opacity: 0; } to { transform: rotate(var(--stamp-rot, -8deg)) scale(1); opacity: .92; } }
.verdict-word { position: relative; min-width: 0; }
.verdict-title { margin: 0; color: var(--muted); font-size: 13px; }
.verdict-big { display: flex; align-items: baseline; gap: 10px; margin: 2px 0; }
.verdict-big .num { font-family: "Yeseva One", Georgia, serif; font-weight: 400; font-size: clamp(40px, 5.5vw, 62px); line-height: 1;
  color: color-mix(in srgb, var(--clan-sand) 94%, white); font-variant-numeric: tabular-nums; }
.order-verdict.is-clear .verdict-big .num { color: var(--clan-gold); }
.verdict-big > span { color: var(--muted); font-size: 13px; }
.verdict-note { margin: 0; color: var(--muted); font-size: 13px; }

/* ── Служебное под документом ── */
.order-share { margin: 14px 2px 22px; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.order-share span { color: var(--muted); }

/* Плавающая «Готово» над клавиатурой (создаёт pit-order.js на телефоне):
   у цифровой клавиатуры iOS нет своей клавиши ввода. Позицию задаёт JS по
   visualViewport; right/bottom — запас без него. */
#kb-done { position: fixed; z-index: 90; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  min-height: 44px; padding: 0 22px; border: 0; border-radius: 7px;
  background: var(--clan-gold); color: var(--clan-black);
  font: 600 15px "Golos Text", "Segoe UI", Arial, sans-serif;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45); }
#kb-done:active { background: color-mix(in srgb, var(--clan-gold) 84%, white); }
.order-fold { border: 1px solid var(--line); border-radius: 8px; background: var(--clan-charcoal); margin-bottom: 14px; }
.order-fold summary { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 18px; cursor: pointer;
  color: var(--clan-sand); font-size: 15px; list-style: none; }
.order-fold summary::-webkit-details-marker { display: none; }
.fold-hint { color: var(--muted); font-size: 12px; }
.ledger-wrap { max-height: 380px; overflow: auto; border-top: 1px solid var(--line); }
.ledger-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.ledger-table th { position: sticky; top: 0; z-index: 2; background: var(--panel-raised); color: var(--clan-sand); text-align: right; padding: 8px 12px; }
.ledger-table th:first-child, .ledger-table td:first-child { text-align: left; }
.ledger-table td { padding: 6px 12px; text-align: right; color: var(--muted); border-top: 1px solid color-mix(in srgb, var(--clan-bronze) 22%, transparent); }
/* Таблица шире экрана прокручивается вбок — первая колонка (уровень, день)
   остаётся на месте, иначе строки не к чему привязать. Фон липких ячеек
   обязан быть глухим: под ними едут остальные колонки. */
.ledger-table th:first-child { left: 0; z-index: 3; }
.ledger-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--clan-charcoal); }
.ledger-table tr.here td:first-child { background: color-mix(in srgb, var(--clan-gold) 7%, var(--clan-charcoal)); }
.ledger-table tr.goal td:first-child { background: color-mix(in srgb, var(--clan-bronze) 14%, var(--clan-charcoal)); }
.ledger-table tr.here td { color: var(--clan-gold); background: color-mix(in srgb, var(--clan-gold) 7%, transparent); }
/* Целевой уровень в раскладке порогов: бронзовая метка, не спорит с золотом финала. */
.ledger-table tr.goal td { color: var(--clan-sand); background: color-mix(in srgb, var(--clan-bronze) 14%, transparent); }
.ledger-table tr.goal td:first-child::after { content: " · цель"; color: var(--muted); font-size: 11px; }
.ledger-table tr.here td:first-child::after { content: " · финал"; color: color-mix(in srgb, var(--clan-gold) 70%, transparent); font-size: 11px; }
.order-source { margin: 0 2px 8px; color: var(--muted); font-size: 11px; }

/* ── Каскад цифр ── */
/* Число из span-цифр не имеет права рваться на строки («1 28 | 0»). */
.num { display: inline-block; font-style: normal; white-space: nowrap; }
/* Все числовые <i> итога — прямые: у Yeseva/Golos нет курсива, синтетика чужая. */
.total-battles i { font-style: normal; }
.num .digit { display: inline-block; }
@media (prefers-reduced-motion: no-preference) {
  .num .digit.flip { animation: digit-flip .34s both; }
  @keyframes digit-flip { 0% { transform: translateY(-.62em); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
}

/* ── Прилипший итог (мобиле) ── */
.order-sticky { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line); background: color-mix(in srgb, var(--clan-black) 92%, transparent); backdrop-filter: blur(10px); }
.sticky-points { color: var(--clan-gold); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sticky-verdict { color: var(--muted); font-size: 13px; text-align: right; }

/* ── Адаптив ── */
@media (max-width: 640px) {
  .order-head { padding: 20px 18px 14px; }
  .order-lines { padding: 6px 18px 2px; }
  .order-total { padding: 14px 18px 4px; }
  .line-dots { display: none; }
  .order-line { justify-content: space-between; }
  .line-name { flex: 1 1 55%; }
  .line-num { margin-left: auto; }
  .total-battles { flex-wrap: wrap; }
  .total-battles b { font-size: 15px; }
  .order-verdict { flex-direction: row; gap: 16px; margin: 12px 8px 8px; padding: 16px; }
  .verdict-stamp { width: 84px; height: 84px; }
  .num.giant { font-size: clamp(44px, 13vw, 64px); }
  /* Пять колонок уровней Ямы обязаны влезать в экран телефона целиком. */
  .ledger-table th { padding: 8px 8px; }
  .ledger-table td { padding: 6px 8px; }
}

/* В приложении прилипший итог встаёт над нижним таббаром. */
html.tg-mode .order-sticky { bottom: calc(72px + var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))); }
/* Клавиатура открыта (kb-open ставит tg-miniapp.js): таббар уже спрятан,
   и итогу тоже нечего делать поверх формы ровно над клавиатурой. */
html.kb-open .order-sticky { display: none; }

/* ── «Заказ на сезон» (Калькулятор РБ) — та же контора, свои строки ── */
.rb-boss-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; }
.rb-boss-label { color: var(--muted); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; }
.rb-boss-select { max-width: min(420px, 100%); padding: 8px 10px; font-size: 15px; font-weight: 600;
  border: 1px solid var(--line); border-bottom-color: color-mix(in srgb, var(--clan-bronze) 55%, transparent);
  border-radius: 7px; background: var(--clan-black); }
.rb-boss-facts { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.rb-boss-facts .order-input { color: var(--clan-sand); }
.rb-fact { width: 5.4ch; }
.rb-narrow { width: 3ch; }
.rb-wide { width: 6.4ch; }
.rb-goal-input { width: 4.2ch; }
.rb-date { width: 12ch; font-size: 12px; color: var(--clan-sand); color-scheme: dark; }
.rb-drop-line { color: color-mix(in srgb, var(--clan-gold) 72%, var(--muted)); }
.line-forecast .line-num.forecast .num { color: var(--muted); font-weight: 400; }
.order-plan-note { margin: 0; padding: 10px 18px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
.ledger-table .rb-fair-input { width: 5ch; font-size: 13px; text-align: right; padding: 2px 2px; }
@media (max-width: 640px) {
  .rb-boss-row { flex-wrap: wrap; }
  .rb-boss-select { max-width: 100%; }
}
