/* Ремонт — мобильный first (360–430px). Шрифт ≥16px, крупные кнопки, тёмный акцент. */

:root {
  --bg: #f2f4f8;
  --card: #ffffff;
  --ink: #1c2430;
  --muted: #6b7684;
  --line: #e3e8ef;
  --accent: #1f6feb;
  --accent-dark: #1a5cd0;
  --danger: #d64545;
  --ok: #2e8b57;
  --warn-bg: #fff6e0;
  --warn-ink: #8a6100;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

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

/* --- шапка и нижняя навигация --- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
}

.topbar__name { font-size: 20px; font-weight: 700; letter-spacing: 0.2px; }

.topbar__user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar__who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bottomnav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottomnav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
}

.bottomnav__icon { width: 24px; height: 24px; }
.bottomnav__label { font-size: 11px; line-height: 1.15; }

.bottomnav__item.is-active { color: var(--accent); }

/* --- каркас страницы --- */

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 12px calc(76px + env(safe-area-inset-bottom));
}

.pagetitle { font-size: 22px; margin: 8px 0 12px; }
.sectiontitle { font-size: 19px; margin: 20px 0 8px; }
.backlink { display: inline-block; margin-top: 4px; color: var(--accent); text-decoration: none; }
.muted { color: var(--muted); font-weight: 400; font-size: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.list { margin-top: 12px; }

/* --- кнопки --- */

.btn {
  display: inline-block;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--line);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:active { background: var(--accent-dark); }
.btn--secondary { background: #e8effd; color: var(--accent-dark); }
.btn--ghost { background: transparent; color: var(--accent-dark); border-color: var(--line); }
.btn--danger { background: #fdeaea; color: var(--danger); }
.btn--small { min-height: 38px; padding: 6px 12px; font-size: 14px; }
.btn--block { display: block; width: 100%; }
.topbar .btn--ghost { color: #fff; border-color: rgba(255, 255, 255, 0.45); }

.inlineform { display: inline-flex; margin: 0; }

/* --- формы --- */

.form .field { margin-bottom: 12px; }

.field label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }

.field input,
.field select,
.field textarea,
.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.field textarea { min-height: 64px; resize: vertical; }

.field--error input,
.field--error select,
.field--error textarea { border-color: var(--danger); }

.field__error { color: var(--danger); font-size: 14px; margin-top: 4px; }
.field__hint { color: var(--muted); font-size: 13px; margin-top: 4px; }

.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; min-width: 0; }

.form__actions { display: flex; gap: 10px; align-items: center; }
.form__title { font-size: 17px; margin: 0 0 12px; }
.form-card summary { display: block; }

.form--filters .field-row { flex-wrap: wrap; }
.form--filters .field { min-width: calc(50% - 5px); }

/* --- список позиций --- */

.itemcard { display: block; text-decoration: none; color: inherit; }

.itemcard__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.itemcard__title { font-weight: 700; font-size: 17px; min-width: 0; overflow-wrap: anywhere; }
.itemcard__plan { white-space: nowrap; font-weight: 700; color: var(--accent-dark); }
.itemcard__meta { color: var(--muted); font-size: 14px; margin-top: 2px; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.badge--muted { background: #eef2f7; color: var(--muted); }
.badge--chosen { background: #e3f5ea; color: var(--ok); }
.badge--rejected { background: #fdeaea; color: var(--danger); }

.st-idea { background: #eef2f7; color: var(--muted); }
.st-chosen { background: #e8effd; color: var(--accent-dark); }
.st-ordered { background: #fff1d6; color: #8a6100; }
.st-bought { background: #e3f5ea; color: var(--ok); }
.st-delivered { background: #e3f5ea; color: var(--ok); }
.st-installed { background: #d9f2e4; color: #1d6b41; }

.totalrow { display: flex; justify-content: space-between; align-items: center; font-size: 17px; }
.totalrow__sum { color: var(--accent-dark); }

.empty { text-align: center; padding: 20px 16px; }
.empty p { margin-top: 0; }
.empty__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* --- карточка позиции --- */

.meta__line { margin-bottom: 6px; }
.meta__line--small { font-size: 14px; color: var(--muted); }
.meta__plan { font-size: 20px; color: var(--accent-dark); }

.variant--rejected { opacity: 0.75; background: #f7f8fa; }
.variant--chosen { border-color: var(--accent); }

.variant__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.variant__title { font-weight: 600; color: var(--accent-dark); overflow-wrap: anywhere; }
.variant__line { margin-top: 4px; }
.variant__line--small { font-size: 14px; color: var(--muted); }
.variant__shop { font-weight: 600; }
.variant__reason {
  margin-top: 8px;
  padding: 8px 10px;
  background: #fdeaea;
  color: var(--danger);
  border-radius: 10px;
  font-size: 14px;
}

.variant__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  margin-top: 10px;
}

.rejectbox summary { list-style: none; }
.rejectbox summary::-webkit-details-marker { display: none; }
.rejectbox__form { margin-top: 8px; }

.dangerzone { margin-top: 16px; }

/* --- справочники --- */

.section__title { font-size: 18px; margin: 0 0 10px; }
.catlist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

.catrow { display: flex; gap: 8px; align-items: flex-start; }
.catrow--off { opacity: 0.55; }
.catrow__main { display: flex; gap: 6px; flex: 1; min-width: 0; flex-wrap: wrap; }
.catrow__main .input { width: auto; flex: 1; min-width: 90px; }
.catrow__main .input--num { flex: 0 0 64px; min-width: 64px; }
.catrow__side { flex: 0 0 auto; }
.catrow__text { padding: 6px 0; }
.catrow__text .muted { margin-left: 8px; }

.catadd { border-top: 1px dashed var(--line); padding-top: 10px; }
.catadd .input { margin-bottom: 6px; }
.catadd__row { display: flex; gap: 6px; }
.catadd__row .input { flex: 1; min-width: 0; margin-bottom: 0; }

.stagelist { margin: 0; padding-left: 22px; }
.stagelist li { margin-bottom: 4px; }

/* --- share --- */

.newitem {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.newitem.is-hidden { display: none; }
.newitem__label { font-size: 14px; color: var(--muted); margin-bottom: 8px; }

.notice {
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 10px;
  font-size: 15px;
}

.notice--ok { background: #e3f5ea; color: #1d6b41; }
.notice--warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice--error { background: #fdeaea; color: var(--danger); }

/* --- вход --- */

.page--auth { padding-top: 8vh; }
.auth { max-width: 360px; margin: 0 auto; text-align: center; }
.auth__logo { font-size: 44px; }
.auth__title { margin: 6px 0 2px; font-size: 26px; }
.auth__hint { color: var(--muted); margin: 0 0 16px; }
.auth .card { text-align: left; }

/* --- узкие экраны --- */

@media (max-width: 360px) {
  .field-row { display: block; }
  .form--filters .field { min-width: 100%; }
  .catrow__main .input--num { flex: 1 1 50%; }
}

/* --- этап 2–4: заказы, работы, платежи, отчёты --- */

.quickactions { display: flex; gap: 10px; margin-bottom: 10px; }
.quickactions .btn { flex: 1; }

.checklist { display: flex; flex-direction: column; gap: 6px; }
.check { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.check input { width: 20px; height: 20px; flex: 0 0 20px; }
.check--single { margin-top: 8px; }

.plainlist { margin: 0; padding-left: 20px; }
.plainlist li { margin-bottom: 4px; }

.payrow__top { display: flex; justify-content: space-between; align-items: center; }
.payrow__meta { color: var(--muted); font-size: 14px; margin-top: 2px; }
.payrow--cancelled { opacity: 0.6; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat__label { color: var(--muted); font-size: 13px; }
.stat__val { font-size: 20px; font-weight: 700; color: var(--accent-dark); margin-top: 4px; }
.stat__val--warn { color: var(--danger); }

.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.table .num, .table th.num { text-align: right; }
.table tr:last-child td { border-bottom: none; }

/* --- иконки-кнопки (корзина, глаз) --- */

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-height: 0;
  padding: 0;
  flex: 0 0 auto;
}

.icon-btn svg { width: 20px; height: 20px; }

.btn svg { width: 18px; height: 18px; vertical-align: -3px; margin-right: 6px; }

/* иконка в квадратной кнопке без текста — строго по центру */
.btn.icon-btn svg { width: 20px; height: 20px; margin: 0; vertical-align: middle; }
