/* LineControl — чистый рабочий дашборд */
:root {
  --bg: #eef1f4;
  --card: #ffffff;
  --ink: #22303c;
  --muted: #7a8794;
  --line: #dfe5ea;
  --accent: #2e7d5b;        /* машинный зелёный */
  --accent-ink: #ffffff;
  --wait: #b97a1a;
  --wait-bg: #fdf3e2;
  --ok-bg: #e6f3ec;
  --danger: #b4372f;
  --radius: 10px;
  font-size: 15px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.45;
}
.mono { font-family: "JetBrains Mono", Consolas, monospace; font-variant-numeric: tabular-nums; }

/* Шапка */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-in {
  max-width: 1180px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; gap: 24px; height: 56px;
}
.logo { font-weight: 800; font-size: 19px; color: var(--ink); text-decoration: none; letter-spacing: -.3px; }
.logo span { color: var(--accent); }
.logo.big { font-size: 26px; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 8px; font-weight: 500;
}
.topbar nav a:hover { color: var(--ink); background: var(--bg); }
.topbar nav a.active { color: var(--accent); background: var(--ok-bg); }
.who { display: flex; align-items: center; gap: 10px; }
.who small { color: var(--muted); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 6px 0 16px; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* Карточки */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
}
.card.empty { text-align: center; color: var(--muted); padding: 40px; }

/* Сетка оператора: центр + правая панель */
.operator-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .operator-grid { grid-template-columns: 1fr; } }

/* Таблицы */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line);
}
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; }
.tbl tr.done td { color: var(--muted); }
.tbl tr.done td:nth-child(2) { text-decoration: line-through; }
.tbl tr.inactive td { color: var(--muted); }

/* Чипы статусов */
.chip {
  display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: var(--bg); color: var(--muted);
}
.chip-ok { background: var(--ok-bg); color: var(--accent); }
.chip-wait { background: var(--wait-bg); color: var(--wait); }

/* Формы */
label { display: block; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
input, select {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 15px; background: #fff; color: var(--ink);
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 6px; }
.row label { flex: 0 0 auto; margin-bottom: 0; }
.row .grow { flex: 1 1 180px; }
.item-row { background: var(--bg); padding: 10px; border-radius: 8px; margin-bottom: 8px; }
.item-row input[name="length_mm"], .item-row input[name="qty"] { width: 110px; }

.btn {
  display: inline-block; padding: 8px 16px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--ink); }
.btn-block { width: 100%; }

.alert { background: #fbe9e7; color: var(--danger); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }
.alert.info { background: var(--ok-bg); color: var(--accent); }
.muted { color: var(--muted); }

/* Правая панель "Отправлено" */
.sent-list { list-style: none; margin: 0; padding: 0; }
.sent-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.sent-list li:last-child { border-bottom: 0; }
.sent-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rod { font-weight: 700; }

/* Очередь оформителя */
.queue { display: grid; gap: 16px; }
.cut-card.is-sent { border-left: 4px solid var(--wait); }
.cut-card.is-done { border-left: 4px solid var(--accent); opacity: .85; }
.cut-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cut-head .rod { font-size: 17px; }

/* Админ */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { text-align: center; padding: 20px 10px; margin-bottom: 0; }
.stat b { display: block; font-size: 30px; color: var(--accent); font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.filters { display: flex; gap: 10px; align-items: center; }
.filters input { margin-top: 0; width: auto; }
.actions { white-space: nowrap; }
.inline-details { display: inline-block; }
.inline-details summary { cursor: pointer; color: var(--muted); font-size: 13px; }

.eq-tabs { display: flex; gap: 6px; }
.eq-tabs a { padding: 6px 14px; border-radius: 20px; text-decoration: none; color: var(--muted); background: var(--card); border: 1px solid var(--line); }
.eq-tabs a.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.eq-badge { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 6px 14px; font-weight: 600; }

/* Логин */
.login-page { display: grid; place-items: center; min-height: 100vh; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 32px; width: 340px; }
.login-card .logo { display: block; text-align: center; margin-bottom: 4px; }
.login-card p { text-align: center; margin-top: 0; }

@media (prefers-reduced-motion: no-preference) {
  .btn, .chip, input, select { transition: all .12s ease; }
}
code { background: var(--bg); padding: 2px 6px; border-radius: 6px; font-size: 13px; }

/* Индикатор живого обновления */
.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); vertical-align: middle; margin-left: 6px;
}
.live-dot.off { background: var(--danger); }
.live-dot.tick { box-shadow: 0 0 0 4px rgba(46,125,91,.18); }
@media (prefers-reduced-motion: no-preference) { .live-dot { transition: box-shadow .3s ease; } }
