/* ERP Интер Ремувалс — общие стили. Работают в основном с компьютера,
   но всё обязано читаться и на телефоне (ширина 390). */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1c1f24;
  --muted: #6b7280;
  --line: #e3e6ea;
  --accent: #2557d6;
  --accent-text: #ffffff;
  --ok: #1d7a46;
  --ok-bg: #e5f4ec;
  --wait: #8a5a00;
  --wait-bg: #fdf1d8;
  --err: #b42318;
  --err-bg: #fdecea;
  --radius: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1d2025;
    --text: #e8eaed;
    --muted: #9aa1ab;
    --line: #2f343b;
    --accent: #6b93ff;
    --accent-text: #0d1117;
    --ok: #6fd39b;
    --ok-bg: #173325;
    --wait: #f0c36a;
    --wait-bg: #3a2e14;
    --err: #ff8a80;
    --err-bg: #3d1d1b;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
/* «Скрыто» сильнее любого display из стилей блока: иначе панель выбора и
   «осталось 0» висели на экране, хотя скрипт их спрятал. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 22px; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ─── Рамка ─── */
.top {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.brand span { font-weight: 400; color: var(--muted); }
.menu { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.menu a { padding: 6px 12px; border-radius: 8px; color: var(--text); text-decoration: none; }
.menu a[aria-current="page"] { background: var(--bg); font-weight: 600; }
.who { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.who form { margin: 0; }
.page { max-width: 1200px; margin: 0 auto; padding: 24px; }
.head { margin-bottom: 16px; }

/* ─── Карточки и формы ─── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.narrow { width: 100%; max-width: 400px; }
label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
input, select {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px;
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.error { color: var(--err); background: var(--err-bg); padding: 8px 12px; border-radius: 8px; margin: 0 0 14px; }

.btn {
  display: inline-block; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: progress; }
.narrow .btn.primary { width: 100%; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }


/* ─── Таблица ─── */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.off td { color: var(--muted); }
.table select { margin: 0; padding: 6px 8px; width: auto; }
.actions { text-align: right; white-space: nowrap; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; }
.tag.ok { color: var(--ok); background: var(--ok-bg); }
.tag.wait { color: var(--wait); background: var(--wait-bg); }
.tag.off { color: var(--muted); background: var(--bg); }

/* ─── Всплывающее сообщение ─── */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px);
  padding: 10px 18px; border-radius: 8px; background: var(--text); color: var(--bg);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--err); color: #fff; }

/* Уменьшение движения: смысл оставляем (сообщение появляется), без сдвига. */
@media (prefers-reduced-motion: reduce) {
  #toast { transition: opacity .15s; transform: translate(-50%, 0); }
}

/* ─── Телефон ─── */
@media (max-width: 700px) {
  .top { padding: 10px 16px; gap: 6px 16px; }
  /* Меню одной строкой с прокруткой внутри себя — не полэкрана из пунктов. */
  .menu { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .menu a { white-space: nowrap; }
  .who span { display: none; }
  .who { margin-left: auto; }
  .page { padding: 16px; }
  .table thead { display: none; }
  .table tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .table td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 0; }
  .table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 13px; }
  .actions { justify-content: flex-start !important; flex-wrap: wrap; }
}

.tag.bad { color: var(--err); background: var(--err-bg); }
.notice { padding: 10px 14px; border-radius: 8px; margin: 0 0 16px; }
.notice.ok { color: var(--ok); background: var(--ok-bg); }
h2 { font-size: 17px; margin: 0 0 12px; }
