/* Safety Construction ЗУС — оформление. Шрифты системные: программа работает без интернета. */
:root {
  --text: #172231;
  --muted: #667283;
  --line: #e2e7ee;
  --line-strong: #cfd6e0;
  --bg: #f2f4f8;
  --panel: #fff;
  --head: #10233b;          /* шапка */
  --head-2: #183253;
  --head-text: #c9d4e3;
  --brand: #f39200;         /* сигнальный оранжевый */
  --accent: #1d4f91;        /* кнопки, ссылки */
  --accent-hover: #163f75;
  --accent-soft: #e8f0fb;
  --ok-bg: #e8f6ee;
  --ok: #1b6b3c;
  --err-bg: #fdeeee;
  --err: #b42318;
  --warn-bg: #fff6e0;
  --warn: #7a5200;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 35, 59, .06), 0 2px 8px rgba(16, 35, 59, .05);
  --focus: 0 0 0 3px rgba(29, 79, 145, .18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.55 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

/* ---------- шапка и меню ---------- */
.top {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--head);
  color: var(--head-text);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .2px;
  color: #fff;
  text-decoration: none;
}
.brand:hover { color: #fff; }
.brand::before {               /* знак: оранжевый щит с сеткой */
  content: "";
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background:
    repeating-linear-gradient(45deg, transparent 0 5px, rgba(16, 35, 59, .35) 5px 6px),
    repeating-linear-gradient(-45deg, transparent 0 5px, rgba(16, 35, 59, .35) 5px 6px),
    var(--brand);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25);
  flex: none;
}
.top .muted { color: var(--head-text); }
.user { display: flex; gap: 14px; align-items: center; font-size: .92rem; flex-wrap: wrap; }
.user a, .user button.link { color: var(--head-text); text-decoration: none; }
.user a:hover, .user button.link:hover { color: #fff; }
.user .feedback-link {
  padding: 4px 10px;
  border: 1px solid rgba(243, 146, 0, .6);
  border-radius: 999px;
  color: #ffd08a;
}
.user .feedback-link:hover { background: rgba(243, 146, 0, .15); color: #fff; }

.menu {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 0 14px;
  background: var(--head-2);
  white-space: nowrap;
  scrollbar-width: none;
  box-shadow: 0 2px 6px rgba(16, 35, 59, .15);
}
.menu::-webkit-scrollbar { display: none; }
.menu a {
  position: relative;
  padding: 11px 12px;
  color: var(--head-text);
  text-decoration: none;
  font-size: .93rem;
}
.menu a:hover { color: #fff; }
.menu a.active { color: #fff; font-weight: 600; }
.menu a.active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--brand);
}

main { max-width: 1180px; margin: 0 auto; padding: 22px 20px 48px; }

h1 { font-size: 1.55rem; line-height: 1.25; margin: 4px 0 16px; letter-spacing: -.2px; }
h2 { font-size: 1.15rem; margin: 28px 0 10px; }
h3 { font-size: 1rem; margin: 18px 0 8px; }
main > p:first-child > a:only-child { font-size: .9rem; text-decoration: none; }  /* «← назад» */

.muted { color: var(--muted); font-size: .9rem; }
.small { font-size: .84rem; }

/* ---------- карточки ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card > :last-child { margin-bottom: 0; }
.narrow { max-width: 420px; margin: 40px auto; padding: 26px 28px; }
.narrow h1 { font-size: 1.35rem; }

/* ---------- формы ---------- */
label { display: block; margin: 0 0 14px; font-size: .9rem; font-weight: 500; color: #2c3a4b; }
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 9px 12px;
  min-height: 40px;
  font: inherit;
  font-weight: 400;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: #b5c0ce; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
textarea { min-height: 80px; resize: vertical; }
/* даты на телефонах: родное поле с календарём не шире своей ячейки */
input, select { min-width: 0; max-width: 100%; }
input[type=date], input[type=month], input[type=time] {
  -webkit-appearance: none;
  appearance: none;
  text-align: left;
}
input::-webkit-date-and-time-value { text-align: left; }
input::-webkit-calendar-picker-indicator { margin-left: 4px; }
/* ячейки сеток не растягиваются под содержимое поля */
.filters-grid > *, .grid2 > *, .line-grid > * { min-width: 0; }
input[type=checkbox], input[type=radio] {
  display: inline;
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0 8px 0 0;
  accent-color: var(--accent);
}
label.check { display: flex; align-items: center; font-weight: 400; }
input[type=file] { padding: 7px; background: #fafbfd; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 18px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
button:hover, .button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
button:focus-visible, .button:focus-visible { outline: none; box-shadow: var(--focus); }
button.secondary, .button.secondary { background: #fff; color: var(--text); border-color: var(--line-strong); }
button.secondary:hover, .button.secondary:hover { background: #f4f6f9; border-color: #b5c0ce; color: var(--text); }
button.danger { background: var(--err); border-color: var(--err); }
button.danger:hover { background: #8f1c13; border-color: #8f1c13; }
button.link {
  min-height: 0;
  padding: 0;
  font-weight: 400;
  background: none;
  border: 0;
  color: var(--accent);
  text-decoration: underline;
}
button.link:hover { background: none; }
form.inline { display: inline; }

/* ---------- сообщения ---------- */
.msg {
  padding: 11px 14px;
  margin: 0 0 16px;
  border-radius: var(--radius-sm);
  border-left: 4px solid currentColor;
  background: var(--accent-soft);
  color: var(--accent);
}
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.error { background: var(--err-bg); color: var(--err); }
.msg.warn { background: var(--warn-bg); color: var(--warn); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.toolbar h1 { margin: 0; }

/* ---------- таблицы: на узком экране прокручиваются ---------- */
.table-wrap {
  overflow-x: auto;
  margin-bottom: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
tr:last-child > td { border-bottom: 0; }
th {
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: var(--muted);
  background: #f7f9fb;
}
tbody tr:hover td, table tr:hover > td { background: #fafcff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.center { text-align: center; }
tr.inactive td { color: var(--muted); }
tr.total td { font-weight: 700; background: #f7f9fb; border-top: 1px solid var(--line-strong); }
table.fields th {
  width: 38%;
  background: none;
  text-transform: none;
  letter-spacing: 0;
  font-size: .9rem;
  font-weight: 500;
}
table.rights th { white-space: nowrap; }

/* ---------- сетки и разное ---------- */
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 18px; }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } }

.tag { display: inline-block; padding: 3px 11px; margin: 0 6px 6px 0; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .88rem; }
.row-form { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.row-form input { margin: 0; max-width: 260px; }
fieldset.checks { border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 0 0 14px; padding: 8px 14px; }
fieldset.checks legend { font-size: .9rem; font-weight: 500; padding: 0 4px; }
fieldset.checks label.check { margin: 4px 0; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters select { width: auto; margin: 0; }
.buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.status { white-space: nowrap; }
.s-cancelled { color: var(--err); }
.s-closed { color: var(--muted); }
.s-open { color: var(--err); }
.s-done { color: var(--ok); }

/* шкала статусов заявки */
ol.flow { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 16px; font-size: .82rem; }
ol.flow li { padding: 4px 11px; border-radius: 999px; background: #e9edf2; color: var(--muted); }
ol.flow li.done { background: var(--ok-bg); color: var(--ok); }
ol.flow li.current { background: var(--accent); color: #fff; font-weight: 600; }

/* строки материалов в формах — карточками, удобно на телефоне */
.line { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; background: #fcfdfe; }
.line-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.line-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; align-items: end; }
.line-grid label { margin: 0; }
.line-grid .info { font-size: .88rem; color: var(--muted); }
.line-grid .order-box b { font-size: 1.2rem; color: var(--text); }
.line-grid select { margin-top: 5px; }
.line.short { border-color: #f1b8b3; background: var(--err-bg); }
.warn-line { margin: 6px 0 0; color: var(--warn); font-size: .88rem; }
.warn-line:empty { display: none; }
@media (min-width: 720px) { .line-grid { grid-template-columns: repeat(4, 1fr); } }
.line-grid.three { grid-template-columns: repeat(3, 1fr); }

.card.exports { display: flex; flex-wrap: wrap; gap: 10px; }
.card.exports textarea { flex-basis: 100%; }
.card.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.card.actions details { flex-basis: 100%; }

.photos { display: flex; flex-wrap: wrap; gap: 10px; }
.photo { display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; }
.photo img { width: 140px; height: 140px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); box-shadow: var(--shadow); }
.photo .file { display: flex; align-items: center; justify-content: center; width: 140px; height: 140px;
               border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); color: var(--muted); background: #fff; }

/* фильтры отчётов и оперативной таблицы */
.filters-grid { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 720px) { .filters-grid { grid-template-columns: repeat(4, 1fr); } }
.filters-grid fieldset, .filters-grid .buttons { grid-column: 1 / -1; }
.filters-grid fieldset.checks { display: flex; flex-wrap: wrap; gap: 4px 16px; }
table.optable { font-size: .84rem; }
table.optable th, table.optable td { padding: 7px 8px; white-space: nowrap; }
table.optable td.note { white-space: normal; min-width: 260px; }
table.optable tr.k-delivery td { background: #f3f8ff; }
table.optable tr.total td { font-weight: 700; border-top: 2px solid var(--line-strong); }

input.price { max-width: 150px; margin: 0; }

/* главная: что ждёт и быстрые действия */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile {
  display: flex; flex-direction: column; gap: 2px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--muted);
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.tile:hover { border-color: var(--accent); color: var(--muted); transform: translateY(-1px); }
.tile b { font-size: 1.9rem; line-height: 1.1; color: var(--text); }
.tile.hot { border-left: 4px solid var(--brand); }
.tile.hot b { color: var(--brand); }
.home-actions { margin: 4px 0 18px; }
.home-actions .button { min-height: 46px; padding: 10px 20px; }

/* настройки */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.tile.setting strong { color: var(--text); font-size: 1.02rem; }
.tile.setting span { font-size: .88rem; }

/* доступ по сети */
.big { font-size: 1.25rem; word-break: break-all; }
.qr svg { width: 220px; height: auto; max-width: 100%; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.feedback-link { white-space: nowrap; }

/* телефон */
@media (max-width: 600px) {
  body { font-size: 15px; }
  .top { padding: 10px 14px; }
  main { padding: 16px 14px 40px; }
  h1 { font-size: 1.3rem; }
  .card { padding: 14px 16px; border-radius: 10px; }
  th, td { padding: 9px 10px; }
  .home-actions .button { flex: 1 1 calc(50% - 10px); }
  .tiles { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .tile { padding: 10px 10px 12px; }
  .tile b { font-size: 1.5rem; }
  .tile span { font-size: .78rem; line-height: 1.3; }
}
