/* «Эмоджи» — одно приложение студии. Фирменные цвета (27.11, вариант А): жёлтый шар #FFC62E, графит #1B1B1F.
   --brand — заливка (кнопки, выбранное), на ней текст --on-brand; --brand-line — рамки; --accent — текст и ссылки (тёмно-янтарный: жёлтый на белом не читается). */
:root {
  --bg: #f4f5f7; --card: #fff; --line: #e6e8eb; --text: #1f2328; --muted: #6b7280;
  --accent: #9A6500; --accent-soft: #FFF3CC; --brand: #FFC62E; --brand-line: #F0B000; --on-brand: #1B1B1F;  --red: #dc2626; --green: #16a34a;
  --bar-h: 58px;  /* высота нижней панели без «чёлки» */
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
/* ПРАВИЛО: экран не должен съезжать вбок нигде. Страховка: длинные слова/ссылки переносятся,
   а что всё же вылезло — обрезается (clip, не hidden: не ломает липкую шапку). Причину всё равно чинить. */
html, body { overflow-x: clip; }
body { overflow-wrap: break-word; }
body { font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg);
  -webkit-text-size-adjust: 100%; touch-action: manipulation; }
button, select, input, textarea { font: inherit; color: inherit; }
button, .ghost {
  border: 1px solid #e9e8e5; background: #fff; border-radius: 10px; padding: 7px 14px; cursor: pointer; text-decoration: none;
  white-space: nowrap; font-weight: 600; line-height: 1.25; box-shadow: 0 1px 2px #1f23280d; -webkit-tap-highlight-color: transparent;
}
button:active, .ghost:active { transform: scale(.97); }
.muted { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }

/* вход */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-box { background: var(--card); padding: 24px; border-radius: 14px; width: 320px; max-width: 100%; box-shadow: 0 2px 12px #0001; }
.login-box h1 { font-size: 20px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.login-box h1 img { width: 32px; height: 32px; border-radius: 8px; }
.login-box input { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; }
.login-box button { width: 100%; color: var(--on-brand); background: linear-gradient(180deg, #FFD43F, #FFC21A); border-color: #F0B000; padding: 10px; }
.wait { color: var(--red); }

/* шапка */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; background: #fff;
  border-bottom: 1px solid var(--line); padding: 0 12px; padding-top: env(safe-area-inset-top); box-sizing: content-box; height: 52px; }
@media (max-width: 760px) { .top { height: 48px; } }  /* высота — как в «Чатах» (chats.css): при переходе шапка не прыгает */
.logo { flex: 1; display: flex; align-items: center; gap: 9px; min-width: 0; }
.logo > div { min-width: 0; }
.logo img { width: 32px; height: 32px; border-radius: 9px; }
.logo b { display: block; font-size: 17px; line-height: 1.1; }
.logo small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }  /* длинная строка — в одну строку, шапка не растёт */
.sync-btn, .menu-btn { position: relative; flex-shrink: 0; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%;
  background: none; box-shadow: none; display: inline-flex; align-items: center; justify-content: center; }
.sync-btn span { display: block; font-size: 21px; line-height: 1; transition: transform .2s; }
.menu-btn { font-size: 21px; }
.sync-btn.busy { pointer-events: none; }
.sync-btn.busy span { animation: sync-breathe 1s ease-in-out infinite; }
.sync-btn.busy::before { content: ''; position: absolute; inset: 4px; border-radius: 50%; border: 2px solid var(--brand-line);
  animation: sync-wave 1s ease-out infinite; pointer-events: none; }
.sync-btn.done span { animation: sync-pop .35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes sync-breathe { 50% { transform: scale(.8); opacity: .55; } }
@keyframes sync-wave { from { transform: scale(.6); opacity: .7; } to { transform: scale(1.35); opacity: 0; } }
@keyframes sync-pop { from { transform: scale(.4); } }
.sync-btn.fresh::after { content: ''; position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%;
  background: #ef4444; box-shadow: 0 0 0 2px var(--card); }

/* меню ☰ */
.menu { position: absolute; right: 10px; top: calc(100% + 4px); z-index: 20; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 24px #0002; width: 320px; max-width: calc(100vw - 20px); max-height: calc(100dvh - 120px); overflow-y: auto; padding: 6px;
  display: flex; flex-direction: column; }
/* одно меню на всех страницах (как в chats.css): подпись группы + пункты в 2 колонки */
.menu a { padding: 7px 8px; border-radius: 8px; font-size: 14px; color: var(--text); text-decoration: none; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu a:active { background: var(--accent-soft); }
.menu-who { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 2px 6px 8px;
  color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); }
.menu .menu-who a { font-size: 13px; color: var(--muted); }
.menu-grp { padding: 4px 0; }
.menu-grp + .menu-grp { border-top: 1px solid var(--line); }
.menu-cap { padding: 2px 8px; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.menu-items { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }

/* разделы */
main { max-width: 900px; margin: 0 auto; padding: 14px 16px calc(var(--bar-h) + 24px + env(safe-area-inset-bottom)); }
h2 { font-size: 20px; margin: 4px 0 12px; }
.card { background: var(--card); border-radius: 14px; padding: 16px; box-shadow: 0 1px 3px #1f23280f; margin-bottom: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 0 0 12px; }
.stat { background: var(--card); border-radius: 14px; padding: 12px 14px; box-shadow: 0 1px 3px #1f23280f; }
.stat b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.moving { border: 1px dashed #f5eace; background: #fffdf7; }
.moving p { margin: 0 0 6px; }
.seg { display: inline-flex; background: #efefed; border-radius: 10px; padding: 3px; margin-bottom: 12px; }
.seg button { border: 0; box-shadow: none; background: none; padding: 6px 14px; border-radius: 8px; }
.seg button.on { background: #fff; box-shadow: 0 1px 2px #1f23281a; color: var(--accent); }
/* вкладки видны все сразу: не влезли в строку — переносятся (на телефоне по две в ряд), без прокрутки */
.seg { max-width: 100%; flex-wrap: wrap; gap: 3px; }
.seg button { white-space: nowrap; }
@media (max-width: 760px) { .seg { display: flex; } .seg button { flex: 1 1 40%; padding: 8px 6px; font-size: 14px; } }
.seg button.seg-ico { flex: 0 0 auto; padding-left: 12px; padding-right: 12px; }  /* ⚙️ — маленькая кнопка без подписи */
.howto { margin: 4px 0 10px; }
/* «⋯ Ещё» — редкие кнопки панели под одной (static/shell.js закрывает по нажатию) */
.xmore { position: relative; }
.bar > .xmore { align-self: stretch; display: flex; }  /* в ряду кнопок — той же высоты, что соседние (у них эмодзи выше строки) */
.bar > .xmore > summary { display: flex; align-items: center; }
/* выглядит как обычная кнопка (button выше); есть новое — маленькая красная точка в углу, как у 🔄 */
.xmore summary { position: relative; list-style: none; cursor: pointer; padding: 7px 12px; border: 1px solid #e9e8e5; border-radius: 10px; background: #fff;
  white-space: nowrap; font-weight: 600; line-height: 1.25; box-shadow: 0 1px 2px #1f23280d; outline: none;
  margin: 0; font-size: inherit; color: var(--text);  /* перебить «details summary» из orders.css: отступ 10px, мелкий серый шрифт */ -webkit-tap-highlight-color: transparent; }
.xmore summary::-webkit-details-marker { display: none; }
.xmore summary.dot::after { content: ''; position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border-radius: 50%; background: #ef4444; border: 2px solid #fff; }
.xmore[open] summary { background: var(--accent-soft, #f7f6f3); color: var(--accent); }
/* окно открывается вниз от кнопки; у правого края экрана — прижато вправо (класс right ставит shell.js), страница не съезжает */
.xmore-pop { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 200px; max-width: calc(100vw - 32px); display: flex; flex-direction: column; gap: 4px;
  padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 20px #1f232826; }
.xmore-pop.right { left: auto; right: 0; }
.xmore-pop button, .xmore-pop a { text-align: left; border: 0; box-shadow: none; background: none; }
.xmore-pop button:hover { background: var(--accent-soft, #f7f6f3); }
.howto summary { cursor: pointer; color: var(--muted, #737270); font-size: 14px; }


/* прайс (price.js + price-edit.js) — один экран; у сотрудника цены текстом (.pe-ro); всё под .pe-root, чтобы не задеть остальные разделы */
.pe-root { --surface: #fff; --fg: var(--text); --line-2: #dad9d5; --warn: #8a6100; --warn-soft: #fbf0d4; --up: #b4451f; --up-soft: #fbe9e1; }
.pe-root .small { font-size: 13px; }
.pe-root .btn { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--fg); box-shadow: none; }
.pe-root .btn.pri { background: var(--brand); border-color: var(--brand-line); color: var(--on-brand); }
.pe-root .btn:disabled { opacity: .5; cursor: default; }
.pe-root .btn.sm { padding: 4px 10px; font-size: 13px; }
.pe-root .field { display: grid; gap: 4px; min-width: 0; }
.pe-root .field > span { font-size: 13px; color: var(--muted); }
.pe-root .inp { width: 100%; min-width: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); font-size: 15px; }
.pe-root .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pe-root .pill { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.pe-root .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pe-root .pill.tag { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.pe-root .tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.pe-root table.tbl { border-collapse: collapse; width: 100%; font-size: 14px; }
.pe-root .tbl td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.pe-root .tbl td.r { text-align: right; }
.pe-root .tbl tr.chg td { background: var(--warn-soft); }
.pe-root .tbl input.inp { padding: 5px 8px; }
.pe-root .tbl .price-in { width: 110px; text-align: right; }
.pe-root .callout { background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.pe-root .sticky-save { position: sticky; bottom: calc(var(--bar-h) + 6px + env(safe-area-inset-bottom));  /* +6px — как у корзины калькулятора: меню чуть выше --bar-h */ z-index: 4; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 6px 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; box-shadow: 0 -6px 20px rgba(20, 10, 40, .08); }
.pe-root #pe-impact { flex: 1; min-width: 0; }
.pe-root .confirm-box { margin: 14px 0; border: 1px solid var(--brand-line); }
.pe-root .confirm-box ul { margin: 6px 0; padding-left: 20px; }
.pe-root .confirm-list { max-height: 260px; overflow: auto; }
.pe-root .pl { display: grid; gap: 12px; }
.pe-root .pl-sec { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.pe-root .pl-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; background: var(--accent-soft); min-height: 46px; }
.pe-root .pl-head b { flex: 1; min-width: 0; font-weight: 600; }
.pe-root .pl-head .pl-open b { flex: none; }
.pe-root .pl-lock { flex: none; white-space: nowrap; }
.pe-root .pl-tools { display: grid; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg); }
.pe-root .pl-tools select.inp { flex: 1; min-width: 0; }
.pe-root .pl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; padding: 5px 14px; border-top: 1px solid var(--line); }
.pe-root .pl-head + .pl-row, .pe-root .pl-tools + .pl-row { border-top: 0; }
.pe-root .pl-row.chg { background: var(--warn-soft); }
.pe-own .pl-row.lift { background: var(--accent-soft); }
.pe-own .pl-row[data-code] { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }  /* у владельца зажатие = правка, текст не выделяем */
.pe-root .pl-row.del { background: var(--up-soft); }
/* название целиком: поле растёт в высоту по тексту (невидимая копия текста задаёт высоту) */
.pe-root .pl-nw { display: grid; min-width: 0; }
.pe-root .pl-nw > textarea, .pe-root .pl-nw::after { grid-area: 1 / 1; font: inherit; font-size: 15px; line-height: 1.3; padding: 5px 8px; border: 1px solid transparent;
  white-space: pre-wrap; overflow-wrap: anywhere; }
.pe-root .pl-nw > textarea { resize: none; overflow: hidden; border-color: var(--line-2); min-height: 0; height: auto; }
.pe-root .pl-nw::after { content: attr(data-v) " "; visibility: hidden; pointer-events: none; }
.pe-root .pl-sub { display: flex; align-items: center; gap: 6px; }
.pe-root .pl-row .pl-price { width: 84px; text-align: right; padding: 5px 8px; }
.pe-root .pl-used { width: 70px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pe-root .pl-sname { flex: 1; min-width: 0; }
.pe-root .pl-row > .pl-sname { padding: 6px 0; font-size: 15px; line-height: 1.3; }
.pe-root .pl-val { min-width: 84px; text-align: right; white-space: nowrap; }
.pe-root .pl-open { all: unset; cursor: pointer; display: block; padding: 6px 0; flex: 1; min-width: 0; }
.pe-root .pl-chev { display: inline-block; width: 1em; color: var(--accent); }
.pe-root .pl-row.pe .pl-sname { padding: 4px 0; }
.pe-root .pl-ctl { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; }
.pe-root .pl-ctl .pl-to { flex: 1; min-width: 0; padding: 5px 8px; font-size: 13px; color: var(--muted); }
.pe-root .pl-row.hl, .pe-root .pl-sec.hl > .pl-head { box-shadow: inset 4px 0 0 var(--brand-line); }
.pe-root .pl-new { margin-bottom: 12px; border-color: var(--brand-line); }
.pe-root .pl-new .pl-head b { flex: none; }
.pe-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; margin-bottom: 4px; }
.pe-hint { flex: 1; min-width: 0; }
.pe-root .pl-q { display: block; width: 100%; margin: 0 0 12px; }
/* ⠿ — ручка: за неё тянут сразу, поэтому браузер не должен листать страницу под пальцем (touch-action) */
.pe-root .pl-grip { flex: none; width: 34px; height: 36px; display: grid; place-items: center; margin-right: -6px; color: var(--accent); font-size: 22px; line-height: 1;
  cursor: grab; touch-action: none; border-radius: 8px; }
.pe-root .pl-grip:active { background: var(--accent-soft); }
.pe-root .pl-ed .pl-row, .pe-root .pl-ed .pl-head { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.pe-root .pl-ed .inp { -webkit-user-select: text; user-select: text; }
.pe-root .pl-ed .lift, .pe-root .pl-ed .lift > .pl-head { background: var(--accent-soft); }
.pe-root .pl-ed .drag { position: relative; z-index: 5; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.pe-root .pl-ed .pl-row.drag { background: var(--surface); }
.pe-root .pl.sdrag .pl-row, .pe-root .pl.sdrag .pl-tools { display: none; }
/* меню при зажатии — поверх всего, снизу экрана */
.hold-menu { position: fixed; inset: 0; z-index: 100; display: grid; align-items: end; justify-items: center; background: rgba(0, 0, 0, .35);
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px)); }
.hold-box { display: grid; gap: 8px; width: 100%; max-width: 420px; padding: 14px; border-radius: 14px; background: #fff; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); }
.hold-title { font-weight: 600; padding: 2px 4px 6px; overflow-wrap: anywhere; }
.hold-box .btn { width: 100%; justify-content: center; min-height: 44px; font-size: 16px; }
@media (max-width: 600px) {
  .pe-root .pl-row { gap: 6px; padding: 4px 8px 4px 10px; }
  .pe-root .pl-row .pl-price { width: 60px; padding: 5px 6px; }
  .pe-root .pl-sub { gap: 3px; }
  .pe-root .pl-used { width: 38px; font-size: 11px; }
  .pe-root .pl-val { min-width: 60px; }
  .pe-root .inp, .pe-root .pl-nw::after, .pe-root .pl-ctl .pl-to { font-size: 16px; }  /* меньше 16px — iPhone приближает страницу при вводе */
  .pe-root .sticky-save { flex-wrap: nowrap; padding: 6px 8px; }
}

/* цели для пальца не меньше 36 px (аудит 22.11 A11Y-1) */
.seg button { min-height: 36px; }
