/* ---------- Шапка по макету: логотип · вкладки · сбор и магазин ----------
   Боковые части делят свободное место поровну, поэтому вкладки стоят ровно по
   центру. Правая группа занимает всю свою половину: плашка сбора тянется до
   края экрана, а на узком окне сжимается, обрезая подпись многоточием. */
/* Содержимое шапки выровнено по тем же боковым границам, что и контент. */
header { display: block; padding: 22px 0 12px; }
.headinner { display: flex; align-items: center; gap: 12px; justify-content: space-between;
             max-width: 1440px; margin: 0 auto; padding: 0 22px; }
.brand { display: flex; align-items: center; gap: 10px; flex: 1 1 0; min-width: 0; }
.brand-mark { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--text); flex: none; }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: .12em;
              overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.headinner .tabs { margin: 0; flex: none; }
.headright { display: flex; align-items: center; gap: 10px;
             flex: 1 1 0; min-width: 0; justify-content: flex-end; }
/* Плашка сбора по содержимому: она прижимается к правому краю вместе с
   выбором магазина и только сжимается на узком окне, но не растягивается. */
.headright .gearbtn { flex: 0 1 auto; min-width: 0; justify-content: flex-start; }
.headright #shop { text-transform: uppercase; flex: 0 1 auto; min-width: 74px;
                   overflow: hidden; text-overflow: ellipsis; }


/* Строка панели: заголовок, форма и действия в один ряд (макет 2a) */
.panelbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.panelbar h2 { margin: 0; margin-right: auto; white-space: nowrap; }
.panelbar .addform { flex: 1; min-width: 320px; margin: 0; flex-wrap: nowrap; }
.panelbar button { flex: none; white-space: nowrap; }


/* Сообщения о действиях — всплывающими карточками у нижнего края.
   Строка под шапкой терялась из виду: нажал кнопку, ответ ушёл наверх, и
   действие выглядело как бездействие. */
#status { max-width: 1440px; margin: 0 auto; padding: 0 22px;
          min-height: 18px; color: var(--muted); font-size: 13px; }

#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
          z-index: 60; display: flex; flex-direction: column; gap: 8px;
          align-items: center; pointer-events: none; width: min(720px, calc(100vw - 32px)); }

.toast { pointer-events: auto; width: 100%; box-sizing: border-box;
         background: var(--surface); color: var(--text); border: 1px solid var(--line-strong);
         border-left: 4px solid var(--muted-2); border-radius: 12px;
         padding: 12px 40px 12px 14px; font-size: 14px; line-height: 1.4;
         box-shadow: var(--sh-modal); position: relative;
         animation: toast-in .18s ease-out; }
.toast.ok   { border-left-color: var(--down); }
.toast.warn { border-left-color: var(--st-warn-fg); }
.toast.err  { border-left-color: var(--up); }
.toast.busy { border-left-color: var(--muted-2); }
.toast .x { position: absolute; top: 6px; right: 8px; border: 0; background: none;
            color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer;
            padding: 4px 6px; }
.toast .x:hover { color: var(--text); }

/* Список дополнительных входов в кабинет */
.loginlist { display: flex; flex-direction: column; gap: 6px; width: 100%; margin-top: 8px; }

/* Инструменты ячейки замера: заметка и срез выдачи. Показываются по наведению,
   чтобы не мешать читать саму матрицу. */
.mcell { position: relative; }
/* Инструменты по краям ячейки: срез слева, заметка справа. Рядом они
   наезжали на само число, а читают в первую очередь его. */
.mtools { position: absolute; top: 1px; left: 2px; right: 2px;
          display: none; justify-content: space-between; }
.mcell:hover .mtools { display: flex; }
.mtool { border: 0; background: var(--surface); color: var(--muted); cursor: pointer;
         font-size: 11px; line-height: 1; padding: 2px 4px; border-radius: 5px;
         box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.mtool:hover { color: var(--text); }
/* Уголок у ячейки с заметкой: он должен ловиться взглядом на всей матрице,
   поэтому крупный и контрастный, а не деликатная метка в углу. */
.mcell.noted::after { content: ""; position: absolute; top: 0; right: 0;
                      border: 9px solid transparent; border-top-color: #e07b1a;
                      border-right-color: #e07b1a; }

/* Окна заметки и среза выдачи */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.62); z-index: 70;
         display: flex; align-items: center; justify-content: center; padding: 24px; }
.sheet[hidden] { display: none; }
.sheet-inner { background: var(--surface); border-radius: 14px; padding: 18px;
               width: min(520px, 100%); max-height: 80vh; overflow: auto;
               box-shadow: var(--sh-modal); }
.sheet.wide .sheet-inner { width: min(1600px, 100%); max-height: 88vh; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head button { border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--muted); }
.sheet-sub { color: var(--muted); font-size: 13px; margin: 4px 0 12px; }
.sheet textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--line-strong);
                  border-radius: 10px; padding: 10px; font: inherit; resize: vertical;
                  background: var(--card); color: var(--text); }
.sheet textarea::placeholder { color: var(--muted-2); }
.sheet textarea:focus { outline: none; border-color: var(--accent);
                        box-shadow: 0 0 0 3px var(--accent-soft); }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.notelist { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.noteitem { display: flex; align-items: center; gap: 10px; font-size: 13px;
            background: var(--surface); border-radius: 8px; padding: 6px 10px; }
.noteitem .when { color: var(--muted); white-space: nowrap; }
.noteitem .what { flex: 1; }
.noteitem .drop { border: 0; background: none; color: var(--muted); cursor: pointer; }

/* Срез выдачи: колонки разделены линиями, числа выровнены по правому краю,
   пояснения кабинета уходят второй строкой — одной строкой ячейки наезжали. */
table.serp { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
table.serp th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px;
                padding: 8px; border-bottom: 1px solid var(--line-strong);
                border-right: 1px solid var(--line); white-space: nowrap;
                position: sticky; top: 0; background: var(--surface); z-index: 1; }
table.serp td { padding: 8px; border-bottom: 1px solid var(--line);
                border-right: 1px solid var(--line); vertical-align: top; }
table.serp th:last-child, table.serp td:last-child { border-right: 0; }
/* Наша строка выделена акцентом-подложкой: заливка самим акцентом сделала бы
   светлую полосу со светлым текстом. */
table.serp tr.ours td { background: var(--accent-soft); }
table.serp tr:hover td { background: var(--card-hover); }
table.serp .pos { text-align: center; font-variant-numeric: tabular-nums; }
table.serp .num { text-align: right; font-variant-numeric: tabular-nums; }
/* Ширины заданы через colgroup: название без ширины забирает весь остаток.
   Ниже min-width таблица не сжимается — уезжает в горизонтальную прокрутку. */
.serp-scroll { overflow: auto; max-height: 72vh; }
table.serp { min-width: 1564px; }
/* Шапка в два яруса, как в отчёте кабинета: группа сверху, колонки под ней.
   Названия колонок дословно из отчёта, поэтому длинные — им нужен перенос. */
table.serp th { white-space: normal; vertical-align: bottom; line-height: 1.25; }
table.serp thead tr:first-child th { top: 0; height: 34px; }
table.serp thead tr + tr th { top: 34px; }
table.serp th.group { text-align: center; border-bottom: 1px solid var(--line); }
table.serp th.blank { border-right: 0; }
table.serp th.edge, table.serp td.edge { border-right: 1px solid var(--line-strong); }
/* Флекс живёт внутри ячейки: на самой td он ломает раскладку таблицы. */
table.serp td.name .cell { display: flex; gap: 8px; align-items: flex-start; }
table.serp td.name .thumb-link { flex: 0 0 36px; display: block; line-height: 0; }
table.serp .pic { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 6px;
                  object-fit: cover; background: var(--surface); }
table.serp .txt { display: block; min-width: 0; }
/* Длинное название режется двумя строками — строки перестают быть башнями. */
table.serp .ttl { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
                  overflow: hidden; overflow-wrap: anywhere; }
table.serp .sub { display: block; color: var(--muted); font-size: 11px; margin-top: 2px;
                  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.serp tr.ours .sub { white-space: normal; }
.loginrow { display: flex; align-items: center; justify-content: space-between; gap: 12px;
            background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
            padding: 8px 12px; font-size: 13px; color: var(--text-2); }
.toast.leaving { animation: toast-out .16s ease-in forwards; }

@keyframes toast-in  { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to   { opacity: 0; transform: translateY(8px); } }

