/* ============================================================
   Земледел — мобильное приложение агронома
   Отдельный слой компонентов поверх tokens.css и base.css.
   Десктопный components.css мобильные экраны не подключают:
   у них другая шкала целей нажатия и другая раскладка.
   Общего с десктопом — токены, типографика и смысл статусов.
   Flutter: каждый блок соответствует будущему виджету.
   ============================================================ */

/* ------------------------------------------------------------
   Стенд и корпус
   На десктопе экран показывается телефоном по центру страницы,
   на телефоне (<= 520px) корпус разворачивается во весь экран.
   Flutter: этого слоя в приложении нет, он только для показа.
   ------------------------------------------------------------ */
.m-stand {
  min-height: 100vh;
  padding: 22px 16px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: var(--rail-deep);
}

.m-device {
  width: var(--m-width);
  max-width: 100%;
  min-height: calc(100vh - 44px);
  background: var(--bg);
  border-radius: var(--m-radius-device);
  box-shadow: var(--shadow-float);
  display: flex;
  flex-direction: column;
  font-size: var(--m-fs-body);
  position: relative;
}

/* Строка состояния телефона: время, сеть, батарея. Не часть приложения —
   но без неё офлайн-состояние читается как ошибка приложения, а не как
   отсутствие сети. Поэтому значок сети живёт именно здесь. */
.m-status {
  height: 38px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--m-fs-micro);
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--m-radius-device) var(--m-radius-device) 0 0;
}
.m-status .spacer { flex: 1; }
.m-status svg { width: 15px; height: 15px; }
.m-status .is-off { color: var(--warning); }

/* ------------------------------------------------------------
   Верхняя панель экрана
   Две строки: возврат и действие — сверху, крупный заголовок — снизу.
   Кнопка «Назад» подписана словом: голая стрелка пожилым не читается.
   Flutter: AppBar с bottom-заголовком.
   ------------------------------------------------------------ */
.m-top {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  padding: 4px var(--m-pad) 14px;
  border-bottom: 1px solid var(--border);
}
.m-top .bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
}
/* Корневой экран вкладки: возвращаться некуда, строки возврата нет —
   заголовок отступает от строки состояния сам. */
.m-top > h1:first-child { margin-top: 12px; }
.m-top h1 {
  font-size: var(--m-fs-title);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: -.01em;
  margin-top: 2px;
}
.m-top .sub {
  font-size: var(--m-fs-small);
  color: var(--text-secondary);
  margin-top: 5px;
}
.m-top .spacer { flex: 1; }

.m-back {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 44px;
  padding: 0 12px 0 4px;
  margin-left: -4px;
  color: var(--primary);
  font-weight: 600;
  font-size: var(--m-fs-body);
  border-radius: var(--radius-pill);
}
.m-back svg { width: 22px; height: 22px; }
.m-back:active { background: var(--primary-tint); }

.m-top-act {
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  border-radius: var(--radius-pill);
  color: var(--primary);
  font-weight: 600;
}
.m-top-act svg { width: 22px; height: 22px; }
.m-top-act:active { background: var(--primary-tint); }

/* ------------------------------------------------------------
   Полоса синхронизации
   Постоянная строка под шапкой: есть ли сеть и сколько записей
   ещё не ушло на сервер. Приложение офлайн-первое, поэтому
   состояние обмена не прячется в настройки — оно на каждом экране.
   Flutter: <SyncBanner state>
   ------------------------------------------------------------ */
.m-sync-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 8px var(--m-pad);
  font-size: var(--m-fs-small);
  font-weight: 500;
  text-align: left;
  background: var(--success-soft);
  color: var(--on-success-soft);
}
.m-sync-strip svg { width: 20px; height: 20px; flex: 0 0 20px; }
.m-sync-strip .spacer { flex: 1; }
.m-sync-strip .go { width: 18px; height: 18px; opacity: .6; }
.m-sync-strip.is-offline { background: var(--accent-soft); color: var(--on-accent-soft); }
.m-sync-strip.is-busy    { background: var(--info-soft);   color: var(--on-info-soft); }
.m-sync-strip.is-error   { background: var(--danger-soft); color: var(--on-danger-soft); }

/* ------------------------------------------------------------
   Тело экрана
   ------------------------------------------------------------ */
.m-body {
  flex: 1;
  padding: var(--m-pad) var(--m-pad) 24px;
  display: flex;
  flex-direction: column;
  gap: var(--m-gap);
  min-width: 0;
}
.m-body > * { min-width: 0; }

/* Заголовок группы внутри тела */
.m-h {
  font-size: var(--m-fs-small);
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.m-h .spacer { flex: 1; }
.m-h .cnt { color: var(--text-tertiary); font-weight: 400; }

.m-lead { font-size: var(--m-fs-lead); font-weight: 600; line-height: 1.3; }
.m-note-txt { font-size: var(--m-fs-small); color: var(--text-secondary); line-height: 1.4; }

/* ------------------------------------------------------------
   Карточка
   Flutter: <Card>
   ------------------------------------------------------------ */
.m-card {
  background: var(--surface);
  border-radius: var(--m-radius-card);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.m-card.is-flush { padding: 0; overflow: hidden; gap: 0; }
.m-card.is-accent { background: var(--surface-selected); }
/* Карточка состояния обмена: цвет совпадает с полосой синхронизации,
   иначе «нет сети» на мятной подложке читается как «всё хорошо». */
.m-card.is-wait { background: var(--accent-soft); }
.m-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.m-card-head h2 { font-size: var(--m-fs-lead); font-weight: 600; line-height: 1.25; min-width: 0; }
.m-card-head .spacer { flex: 1; }
.m-card-head .go { width: 20px; height: 20px; flex: 0 0 20px; color: var(--text-tertiary); }

.m-sep { height: 1px; background: var(--border); }

/* ------------------------------------------------------------
   Строка списка — основной элемент навигации
   Цель нажатия во всю ширину, стрелка справа, подпись под названием.
   Flutter: <ListTile>
   ------------------------------------------------------------ */
.m-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: var(--m-tap);
  padding: 12px 16px;
  text-align: left;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.m-row:last-child { border-bottom: 0; }
.m-row:active { background: var(--surface-hover); }
.m-row .tx { flex: 1; min-width: 0; }
.m-row .nm { display: block; font-weight: 600; line-height: 1.3; }
.m-row .ds {
  display: block;
  font-size: var(--m-fs-small);
  color: var(--text-secondary);
  line-height: 1.35;
  margin-top: 3px;
}
.m-row .go { width: 20px; height: 20px; color: var(--text-tertiary); flex: 0 0 20px; }
.m-row.is-done .nm { color: var(--text-secondary); }
.m-row > .m-status-tag, .m-row > .m-switch { flex: 0 0 auto; }

/* Круглый значок слева от строки */
.m-ic {
  width: 44px; height: 44px; flex: 0 0 44px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: var(--surface-muted);
  color: var(--text-secondary);
}
.m-ic svg { width: 22px; height: 22px; }
.m-ic.is-primary { background: var(--primary-tint);  color: var(--primary); }
.m-ic.is-ok      { background: var(--success-soft);  color: var(--success); }
.m-ic.is-warn    { background: var(--warning-soft);  color: var(--on-warning-soft); }
.m-ic.is-danger  { background: var(--danger-soft);   color: var(--danger); }
.m-ic.is-info    { background: var(--info-soft);     color: var(--info); }
.m-ic.is-accent  { background: var(--accent-soft);   color: var(--on-accent-soft); }

/* Цветная метка культуры слева от поля — та же, что в вебе */
.m-crop-mark {
  width: 6px; align-self: stretch; min-height: 40px;
  border-radius: 4px; flex: 0 0 6px;
  background: var(--crop-fallow);
}

/* ------------------------------------------------------------
   Задание на день
   Крупная карточка работы: что, где, когда и одна кнопка.
   Flutter: <TaskCard>
   ------------------------------------------------------------ */
.m-task {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--m-radius-card);
  padding: 16px;
  text-align: left;
  width: 100%;
  border-left: 5px solid var(--border-strong);
  min-width: 0;
}
.m-task.is-now  { border-left-color: var(--primary); }
.m-task.is-late { border-left-color: var(--danger); }
.m-task.is-done { border-left-color: var(--success); }
.m-task .top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.m-task .nm { font-size: var(--m-fs-lead); font-weight: 600; line-height: 1.25; }
.m-task .where {
  display: flex; align-items: center; gap: 7px;
  font-size: var(--m-fs-small); color: var(--text-secondary);
}
.m-task .where svg { width: 17px; height: 17px; flex: 0 0 17px; }

/* ------------------------------------------------------------
   Пара «подпись — значение»
   Подстановка из плана: агроном её читает, а не вводит.
   Flutter: <KeyValueRow>
   ------------------------------------------------------------ */
.m-kv { display: flex; flex-direction: column; }
.m-kv .r {
  display: flex; align-items: baseline; gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.m-kv .r:first-child { padding-top: 0; }
.m-kv .r:last-child { border-bottom: 0; padding-bottom: 0; }
.m-kv .k { font-size: var(--m-fs-small); color: var(--text-secondary); flex: 0 0 44%; }
.m-kv .v { flex: 1; text-align: right; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.m-kv .v.is-num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------
   Крупное число — итог замера
   Flutter: <FigureBlock>
   ------------------------------------------------------------ */
.m-figure {
  background: var(--surface-selected);
  border-radius: var(--m-radius-block);
  padding: 16px;
  text-align: center;
}
.m-figure .val {
  font-size: var(--m-fs-figure);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.m-figure .unit { font-size: var(--m-fs-body); font-weight: 600; color: var(--text-secondary); }
.m-figure .cap { font-size: var(--m-fs-small); color: var(--text-secondary); margin-top: 7px; }

/* ------------------------------------------------------------
   Кнопки
   Основная — во всю ширину и не ниже цели нажатия.
   Flutter: <PrimaryButton> · <SecondaryButton>
   ------------------------------------------------------------ */
.m-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: var(--m-tap);
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  font-size: var(--m-fs-body);
  font-weight: 600;
  background: var(--surface-muted);
  color: var(--text);
  transition: background var(--transition);
}
.m-btn svg { width: 22px; height: 22px; flex: 0 0 22px; }
.m-btn-primary { background: var(--primary); color: var(--on-dark); }
.m-btn-primary:active { background: var(--primary-hover); }
.m-btn-soft    { background: var(--primary-soft); color: var(--primary); }
.m-btn-soft:active { background: var(--primary-soft-hover); }
.m-btn-danger  { background: var(--danger); color: var(--on-dark); }
.m-btn-ghost   { background: transparent; color: var(--primary); }
.m-btn-outline { background: var(--surface); color: var(--text); border: 1.5px solid var(--border-strong); }
.m-btn.is-disabled { opacity: .45; pointer-events: none; }
.m-btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Кнопка-«ступенька» большого действия внизу экрана: не уезжает со скроллом */
.m-foot {
  position: sticky;
  bottom: 0;
  z-index: 25;
  margin: 4px calc(var(--m-pad) * -1) calc(var(--m-pad) * -1);
  padding: 12px var(--m-pad) 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ------------------------------------------------------------
   Формы
   Поля крупные: высота не меньше цели нажатия, подпись сверху,
   единица измерения внутри поля справа.
   Flutter: <BigField>
   ------------------------------------------------------------ */
.m-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.m-field > label { font-size: var(--m-fs-small); color: var(--text-secondary); font-weight: 500; }
.m-field > label .req { color: var(--danger); }
.m-field .hint { font-size: var(--m-fs-small); color: var(--text-tertiary); line-height: 1.35; }

.m-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--m-tap);
  padding: 0 16px;
  background: var(--surface-muted);
  border: 1.5px solid transparent;
  border-radius: var(--m-radius-block);
}
.m-control:focus-within { border-color: var(--primary); background: var(--surface); }
.m-control input,
.m-control select,
.m-control textarea {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  outline: none;
  font-size: var(--m-fs-body);
  padding: 14px 0;
  font-variant-numeric: tabular-nums;
}
.m-control textarea { resize: none; line-height: 1.4; }
.m-control select { appearance: none; }
.m-control .unit { color: var(--text-secondary); font-size: var(--m-fs-small); flex: 0 0 auto; }
.m-control .caret { width: 20px; height: 20px; color: var(--text-secondary); flex: 0 0 20px; }
.m-control.is-readonly { background: var(--surface-sunken); color: var(--text-secondary); }

/* Значение, подставленное системой: правится не здесь, а в вебе */
.m-derived {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: var(--m-radius-block);
  background: var(--surface-sunken);
  font-weight: 500;
  line-height: 1.35;
}
.m-derived svg { width: 20px; height: 20px; flex: 0 0 20px; color: var(--text-secondary); }
/* Источник значения уходит на свою строку, когда значение длинное:
   на 360 px он иначе съедает половину строки и рвёт её по слогам. */
.m-derived .src {
  margin-left: auto;
  font-size: var(--m-fs-micro);
  font-weight: 400;
  color: var(--text-tertiary);
  text-align: right;
  flex: 0 0 auto;
}

/* Счётчик: ввести число пальцем в поле трудно, кнопками — нет.
   Flutter: <Stepper> */
.m-stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-muted);
  border-radius: var(--m-radius-block);
  padding: 6px;
}
.m-stepper button {
  width: 52px; height: 52px; flex: 0 0 52px;
  border-radius: 14px;
  background: var(--surface);
  display: grid; place-items: center;
  color: var(--primary);
}
.m-stepper button:active { background: var(--primary-soft); }
.m-stepper button svg { width: 24px; height: 24px; }
.m-stepper .val {
  flex: 1;
  text-align: center;
  font-size: var(--m-fs-lead);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.m-stepper .val .u { font-size: var(--m-fs-small); font-weight: 500; color: var(--text-secondary); }

/* Выбор одного из немногих: крупные строки с галочкой, не выпадающий список.
   Flutter: <ChoiceList> */
.m-choice { display: flex; flex-direction: column; gap: 8px; }
.m-choice button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: var(--m-tap);
  padding: 12px 16px;
  text-align: left;
  border-radius: var(--m-radius-block);
  background: var(--surface-muted);
  border: 1.5px solid transparent;
  min-width: 0;
}
.m-choice button .tx { flex: 1; min-width: 0; }
.m-choice button .nm { display: block; font-weight: 600; }
.m-choice button .ds { display: block; font-size: var(--m-fs-small); color: var(--text-secondary); margin-top: 2px; }
.m-choice button .mark {
  width: 26px; height: 26px; flex: 0 0 26px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  display: grid; place-items: center;
  color: var(--on-dark);
}
.m-choice button .mark svg { width: 16px; height: 16px; opacity: 0; }
.m-choice button.is-selected {
  background: var(--surface-selected);
  border-color: var(--primary);
}
.m-choice button.is-selected .mark { background: var(--primary); border-color: var(--primary); }
.m-choice button.is-selected .mark svg { opacity: 1; }

/* Переключатель из двух-трёх значений
   Flutter: <SegmentedControl> */
.m-seg {
  display: flex;
  background: var(--surface-muted);
  border-radius: var(--radius-pill);
  padding: 4px;
  gap: 4px;
}
.m-seg button {
  flex: 1;
  min-height: 46px;
  border-radius: var(--radius-pill);
  font-size: var(--m-fs-small);
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0 10px;
}
.m-seg button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-panel); }

/* Тумблер настройки */
.m-switch {
  width: 56px; height: 32px; flex: 0 0 56px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  position: relative;
  transition: background var(--transition);
}
.m-switch::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--surface);
  transition: transform var(--transition);
}
.m-switch.is-on { background: var(--primary); }
.m-switch.is-on::after { transform: translateX(24px); }

/* ------------------------------------------------------------
   Фотофиксация
   Снимок — главное доказательство факта с поля, поэтому слот
   всегда виден и всегда первый.
   Flutter: <PhotoSlots>
   ------------------------------------------------------------ */
.m-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.m-photos button {
  aspect-ratio: 1;
  border-radius: var(--m-radius-block);
  background: var(--surface-muted);
  display: grid;
  place-items: center;
  gap: 4px;
  align-content: center;
  color: var(--text-secondary);
  font-size: var(--m-fs-micro);
  border: 1.5px dashed var(--border-strong);
}
.m-photos button svg { width: 26px; height: 26px; }
.m-photos button.is-shot {
  border-style: solid;
  border-color: transparent;
  background: var(--primary-soft);
  color: var(--primary);
}
.m-photos button.is-add { border-color: var(--primary); color: var(--primary); }

/* ------------------------------------------------------------
   Карта
   Спутниковая подложка та же, что в вебе. Панели поверх карты —
   тёмные, как в макете 03.
   Flutter: <FieldMap> поверх mapbox/OSM
   ------------------------------------------------------------ */
.m-map {
  position: relative;
  border-radius: var(--m-radius-card);
  overflow: hidden;
  background: var(--map-panel) url("../img/satellite.svg") center / cover no-repeat;
  height: 340px;
}
.m-map.is-tall { height: 480px; }
.m-map svg.layer { position: absolute; inset: 0; width: 100%; height: 100%; }

.m-map-panel {
  position: absolute;
  left: 10px; right: 10px;
  background: var(--map-panel);
  color: var(--on-dark);
  border-radius: var(--m-radius-block);
  padding: 12px 14px;
}
.m-map-panel.at-top { top: 10px; }
.m-map-panel.at-bottom { bottom: 10px; }
.m-map-panel .nm { font-weight: 600; font-size: var(--m-fs-lead); }
.m-map-panel .ds { font-size: var(--m-fs-small); color: var(--on-dark-muted); margin-top: 3px; }

.m-map-btn {
  position: absolute;
  right: 10px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--primary);
  display: grid; place-items: center;
  box-shadow: var(--shadow-panel);
}
.m-map-btn svg { width: 24px; height: 24px; }
.m-map-btn.at-gps { bottom: 122px; }
.m-map-btn.at-layers { bottom: 186px; }

/* Точка «вы здесь» */
.m-gps-dot {
  position: absolute;
  top: 32%; left: 52%;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--info);
  border: 3px solid var(--on-dark);
  box-shadow: var(--shadow-float);
}

/* ------------------------------------------------------------
   Плитки действий — экран «Записать»
   Flutter: <ActionGrid>
   ------------------------------------------------------------ */
.m-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.m-tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  min-height: 128px;
  border-radius: var(--m-radius-card);
  background: var(--surface);
  text-align: left;
}
.m-tile .nm { font-weight: 600; line-height: 1.25; }
.m-tile .ds { font-size: var(--m-fs-micro); color: var(--text-secondary); line-height: 1.3; margin-top: auto; }
.m-tile .tx { flex: 1; min-width: 0; }
.m-tile .tx .nm, .m-tile .tx .ds { display: block; }
.m-tile.is-wide { grid-column: 1 / -1; min-height: 0; flex-direction: row; align-items: center; }
.m-tile.is-wide .ds { margin-top: 3px; }

/* ------------------------------------------------------------
   Статусы и пометки — те же смыслы, что в вебе, крупнее
   ------------------------------------------------------------ */
.m-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--m-fs-micro);
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-muted);
  color: var(--text-secondary);
}
.m-status-tag svg { width: 14px; height: 14px; }
.m-status-tag.is-ok      { background: var(--success-soft); color: var(--on-success-soft); }
.m-status-tag.is-wait    { background: var(--accent-soft);  color: var(--on-accent-soft); }
.m-status-tag.is-late    { background: var(--danger-soft);  color: var(--on-danger-soft); }
.m-status-tag.is-warn    { background: var(--warning-soft); color: var(--on-warning-soft); }
.m-status-tag.is-info    { background: var(--info-soft);    color: var(--on-info-soft); }
.m-status-tag.is-now     { background: var(--primary-soft); color: var(--primary); }

.m-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--m-radius-block);
  background: var(--info-soft);
  color: var(--on-info-soft);
  font-size: var(--m-fs-small);
  line-height: 1.4;
}
.m-note svg { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 1px; }
.m-note.is-warn   { background: var(--warning-soft); color: var(--on-warning-soft); }
.m-note.is-danger { background: var(--danger-soft);  color: var(--on-danger-soft); }
.m-note.is-ok     { background: var(--success-soft); color: var(--on-success-soft); }
.m-note b { font-weight: 600; }

/* Список последствий действия — тот же приём, что confirmAction в вебе */
.m-effects { display: flex; flex-direction: column; }
.m-effects .r {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.m-effects .r:last-child { border-bottom: 0; }
.m-effects .ic {
  width: 26px; height: 26px; flex: 0 0 26px;
  border-radius: 50%;
  display: grid; place-items: center;
}
.m-effects .ic svg { width: 15px; height: 15px; }
.m-effects .tx { flex: 1; min-width: 0; }
.m-effects .tx b { display: block; font-weight: 600; line-height: 1.3; }
.m-effects .tx .d { font-size: var(--m-fs-small); color: var(--text-secondary); margin-top: 3px; line-height: 1.35; }
.m-effects .r.is-ok   .ic { background: var(--success-soft); color: var(--success); }
.m-effects .r.is-warn .ic { background: var(--warning-soft); color: var(--on-warning-soft); }
.m-effects .r.is-fail .ic { background: var(--danger-soft);  color: var(--danger); }

/* Пустое состояние */
.m-empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--text-secondary);
  font-size: var(--m-fs-small);
}
.m-empty svg { width: 52px; height: 52px; margin: 0 auto 14px; color: var(--text-tertiary); }
.m-empty h3 { font-size: var(--m-fs-lead); color: var(--text); font-weight: 600; margin-bottom: 6px; }

/* ------------------------------------------------------------
   Лента точек обхода
   Flutter: <RouteTimeline>
   ------------------------------------------------------------ */
.m-track { display: flex; flex-direction: column; }
.m-track .pt {
  display: flex;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px 0;
  min-width: 0;
}
.m-track .pt + .pt { border-top: 1px solid var(--border); }
.m-track .n {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: var(--m-fs-small);
  font-variant-numeric: tabular-nums;
}
.m-track .pt.is-hit .n { background: var(--danger-soft); color: var(--danger); }
.m-track .tx { flex: 1; min-width: 0; }
.m-track .tx .nm { display: block; font-weight: 600; line-height: 1.3; }
.m-track .tx .ds { display: block; font-size: var(--m-fs-small); color: var(--text-secondary); margin-top: 3px; line-height: 1.35; }
.m-track .go { width: 20px; height: 20px; color: var(--text-tertiary); flex: 0 0 20px; align-self: center; }

/* ------------------------------------------------------------
   Нижняя панель вкладок
   Четыре подписанных пункта. Иконка без подписи в этой аудитории
   не опознаётся, поэтому подпись обязательна.
   Flutter: <BottomNavigationBar>
   ------------------------------------------------------------ */
.m-tabbar {
  position: sticky;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--m-radius-device) var(--m-radius-device);
  padding: 6px 4px 10px;
}
.m-tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 2px;
  min-height: 58px;
  border-radius: var(--m-radius-block);
  font-size: var(--m-fs-micro);
  font-weight: 600;
  color: var(--text-secondary);
}
.m-tabbar a svg { width: 25px; height: 25px; }
.m-tabbar a.is-active { color: var(--primary); }
.m-tabbar a .badge {
  position: absolute;
  transform: translate(14px, -4px);
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: var(--on-dark);
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* ------------------------------------------------------------
   Нижний лист — мобильный аналог дровера
   Уровень ровно один, как и на десктопе.
   Flutter: showModalBottomSheet
   ------------------------------------------------------------ */
.m-sheet-scrim {
  position: fixed;
  inset: 0;
  background: var(--overlay-scrim);
  opacity: 0;
  visibility: hidden;
  z-index: 120;
  transition: opacity var(--transition), visibility var(--transition);
}
.m-sheet-scrim.is-open { opacity: 1; visibility: visible; }

.m-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 100%);
  width: var(--m-width);
  max-width: 100%;
  max-height: 88vh;
  z-index: 130;
  background: var(--surface);
  border-radius: 26px 26px 0 0;
  padding: 10px var(--m-pad) 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  transition: transform var(--transition);
}
.m-sheet.is-open { transform: translate(-50%, 0); }
.m-sheet .grip {
  width: 44px; height: 5px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  margin: 0 auto 4px;
  flex: 0 0 auto;
}
.m-sheet h2 { font-size: var(--m-fs-title); font-weight: 600; line-height: 1.2; }
.m-sheet .sub { font-size: var(--m-fs-small); color: var(--text-secondary); line-height: 1.4; }

/* ------------------------------------------------------------
   Всплывающее сообщение
   ------------------------------------------------------------ */
.m-toast {
  position: fixed;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%);
  z-index: 200;
  max-width: calc(var(--m-width) - 40px);
  background: var(--text);
  color: var(--on-dark);
  padding: 13px 22px;
  border-radius: var(--radius-pill);
  font-size: var(--m-fs-small);
  text-align: center;
  box-shadow: var(--shadow-float);
  opacity: 0;
  transition: opacity var(--transition);
}
.m-toast.is-on { opacity: 1; }

/* ------------------------------------------------------------
   Подпись стенда: чем этот экран является в вебе
   Только для показа прототипа, в приложении её нет.
   ------------------------------------------------------------ */
.m-caption {
  position: fixed;
  left: 28px;
  top: 28px;
  width: 306px;
  font-size: var(--fs-small);
  color: var(--on-dark-muted);
  line-height: 1.5;
}
.m-caption h3 { font-size: var(--fs-block-title); color: var(--on-dark); font-weight: 600; margin-bottom: 10px; }
.m-caption p { margin-bottom: 12px; }
.m-caption .k { display: block; margin-top: 14px; color: var(--on-dark-faint); font-size: var(--fs-micro); }

@media (max-width: 1180px) { .m-caption { display: none; } }

/* Телефон: корпус разворачивается во весь экран */
@media (max-width: 520px) {
  .m-stand { padding: 0; }
  .m-device {
    border-radius: 0;
    min-height: 100vh;
    box-shadow: none;
    width: 100%;
  }
  .m-status { border-radius: 0; }
  .m-tabbar { border-radius: 0; }
  .m-sheet { width: 100%; }
}
