/* Витафул Расчёт — базовые стили. Мобильный экран — приоритет (чек-лист, табель). */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #1c2024;
  --muted: #6b7280;
  --line: #dfe3e8;
  --accent: #1d6fd1;
  --error: #c0392b;
  --ok: #1f8b4c;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 700; text-decoration: none; color: var(--ink); }

.nav { display: flex; flex-wrap: wrap; gap: 16px; flex: 1; }
.nav a { color: var(--ink); text-decoration: none; }
.nav a:hover { color: var(--accent); }

.user { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.linklike {
  background: none; border: 0; padding: 0;
  color: var(--accent); cursor: pointer; font: inherit;
}

.content { max-width: 1100px; margin: 0 auto; padding: 24px 20px 64px; }

h1 { font-size: 24px; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 24px; }

.cards { list-style: none; display: grid; gap: 12px; padding: 0; margin: 0;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card a { display: block; padding: 18px 16px; text-decoration: none; color: var(--ink); font-weight: 600; }
.card:hover { border-color: var(--accent); }

.messages { list-style: none; padding: 0; margin: 16px auto; max-width: 1100px; }
.msg { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 8px; background: var(--panel); }
.msg--error { color: var(--error); border: 1px solid var(--error); }
.msg--success { color: var(--ok); border: 1px solid var(--ok); }

.login { max-width: 340px; margin: 40px auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.login label { display: block; margin: 12px 0 4px; font-size: 14px; color: var(--muted); }
.login input { width: 100%; padding: 10px 12px; font-size: 16px;
  border: 1px solid var(--line); border-radius: var(--radius); }
.login button { width: 100%; margin-top: 20px; padding: 12px; font-size: 16px;
  background: var(--accent); color: #fff; border: 0; border-radius: var(--radius); cursor: pointer; }

table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
th { font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 600px) {
  .content { padding: 16px 12px 48px; }
  .topbar { padding: 10px 12px; }
}

/* Цены клиента */
.panels { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin: 20px 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.panel h2 { font-size: 16px; margin: 0 0 12px; }
.panel label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.panel input, .panel select, .filters input, .filters select {
  width: 100%; padding: 8px 10px; font-size: 15px; margin-top: 3px;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink);
}
.panel button { padding: 9px 16px; background: var(--accent); color: #fff; border: 0;
  border-radius: var(--radius); cursor: pointer; font-size: 15px; }
.hint { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.filters { display: flex; gap: 16px; align-items: end; margin: 20px 0 12px; flex-wrap: wrap; }
.filters label { font-size: 14px; color: var(--muted); }
.filters input, .filters select { width: auto; min-width: 180px; }
.muted { color: var(--muted); font-size: 14px; }
.warn { color: #b26a00; font-weight: 600; }

/* Чек-лист — ввод с телефона */
.start-form { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.start-form label { flex: 1; min-width: 240px; margin-bottom: 0; }

.status { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.status--draft { background: #eceff1; color: #546e7a; }
.status--submitted { background: #e3f0fd; color: #1565c0; }
.status--confirmed { background: #e6f4ea; color: #1f8b4c; }
.status--in_act { background: #f3e8fd; color: #7b1fa2; }

.totals { display: flex; gap: 12px; flex-wrap: wrap; margin: 16px 0 24px; }
.totals div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; min-width: 150px; }
.totals span { display: block; font-size: 13px; color: var(--muted); }
.totals b { font-size: 20px; font-variant-numeric: tabular-nums; }
.totals__main { border-color: var(--accent); }

.grid-4 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.ops { display: grid; gap: 8px; margin-bottom: 24px; }
.op { display: grid; grid-template-columns: 1fr 130px 100px 160px auto; gap: 8px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.op__name { font-size: 15px; }
.op input, .op select { padding: 8px 10px; font-size: 16px; border: 1px solid var(--line);
  border-radius: var(--radius); width: 100%; }
.op input[type=number] { font-variant-numeric: tabular-nums; }

.btn-small { padding: 7px 12px; font-size: 14px; background: var(--accent); color: #fff;
  border: 0; border-radius: var(--radius); cursor: pointer; }
.btn-danger { background: var(--error); }
.btn-primary { padding: 14px 28px; font-size: 17px; font-weight: 600; background: var(--accent);
  color: #fff; border: 0; border-radius: var(--radius); cursor: pointer; }
.inline-form { display: inline-flex; gap: 4px; align-items: center; }
.inline-form input { padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); }

.actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 32px 0; }
.scroll-x { overflow-x: auto; }

@media (max-width: 700px) {
  /* На телефоне операция становится карточкой: название сверху, поля под ним крупные. */
  .op { grid-template-columns: 1fr auto; grid-template-areas: "name name" "variant variant" "qty ok" "comment comment"; }
  .op__name { grid-area: name; font-weight: 600; }
  .op select { grid-area: variant; }
  .op input[type=number] { grid-area: qty; font-size: 18px; padding: 12px; }
  .op input[type=text] { grid-area: comment; }
  .op button { grid-area: ok; padding: 12px 18px; }
  .totals div { flex: 1; min-width: 120px; }
  .btn-primary { width: 100%; }
}

/* Вкладки разрезов сметы */
.tabs { display: flex; gap: 4px; margin: 20px 0 0; border-bottom: 1px solid var(--line); }
.tab { padding: 10px 16px; text-decoration: none; color: var(--muted); font-size: 15px;
  border-bottom: 2px solid transparent; }
.tab--on { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }

/* Журнал документов */
.status--issued { background: #e3f0fd; color: #1565c0; }
.status--signed, .status--paid { background: #e6f4ea; color: #1f8b4c; }
.status--sent { background: #fff4e0; color: #b26a00; }
.status--partial { background: #fff4e0; color: #8a5300; }
.status--cancelled { background: #f1f1f1; color: #777; }
tr.overdue td { background: #fff6f5; }
a.btn-small { display: inline-block; text-decoration: none; }

/* Справочники: формы и таблицы с действиями */
.grid-4 label .hint { display: block; margin-top: 2px; font-size: 12px; }
.grid-4 select, .grid-4 input[type=text], .grid-4 input[type=date],
.grid-4 input[type=number], .grid-4 input[type=email] {
  width: 100%; padding: 8px 10px; font-size: 15px; margin-top: 3px;
  border: 1px solid var(--line); border-radius: var(--radius);
}
.grid-4 input[type=checkbox] { width: auto; margin-top: 6px; }
tfoot th { background: var(--panel); font-size: 15px; }
