/* Портал «Практики» — сдержанный вариант дизайн-системы «Практика» (эталон: docs/style-reference-restrained.pdf,
   «Справочник электромонтажа»). Белый фон, жёлтая линия под шапкой, заголовки 800 обычным регистром,
   серый второстепенный текст, тонкие линии, жёлтые кружки, тёмные карточки с жёлтым акцентом.
   Сначала телефон, потом широкий экран. */

@font-face {
  font-family: "Montserrat"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/static/fonts/montserrat-cyrillic-wght-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Montserrat"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/static/fonts/montserrat-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --yellow: #ffcd00;
  --ink: #141414;
  --black: #000000;
  --surface: #ffffff;
  --surface-alt: #eae8e3;     /* тёплый серый бренда: заливки полей, чипов */
  --surface-soft: #f4f3f0;    /* чередующиеся строки, мягкие плашки */
  --line: #e4e2dc;            /* тонкие линии и рамки карточек */
  --muted: #6e6e6e;           /* второстепенный текст (как в справочнике) */
  --muted-dark: #a7a7a7;      /* второстепенный текст на тёмном */
  --error: #e5533d;           /* только рамка поля с ошибкой */
  --font-sans: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 14px;             /* карточки, таблицы */
  --radius-s: 10px;           /* поля, плашки */
  --radius-pill: 100px;       /* кнопки, чипы */
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--surface); color: var(--ink);
  font: 400 15px/1.55 var(--font-sans); -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-decoration-color: var(--yellow); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--ink); outline-offset: 2px;
}
p { margin: 0 0 .8em; }
.ic { width: 1.15em; height: 1.15em; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Заголовки: 800, обычный регистр. Надзаголовок — мелкий, прописными, разрядка, серый */
h1 { font-weight: 800; font-size: 26px; line-height: 1.2; letter-spacing: -.01em; margin: 0 0 14px; overflow-wrap: anywhere; }
h2 { font-weight: 700; font-size: 17px; line-height: 1.3; margin: 0 0 12px; }
@media (min-width: 640px) { h1 { font-size: 30px; } }
.eyebrow { font-size: 11px; font-weight: 700; line-height: 1.4; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; }
.back { margin: 0 0 18px; font-size: 13px; font-weight: 600; }
.back a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--muted); }
.back a:hover { color: var(--ink); }

/* Шапка: логотип слева, меню, жёлтая линия снизу */
.top { background: var(--surface); position: sticky; top: 0; z-index: 5; border-bottom: 3px solid var(--yellow); }
.top-in { max-width: 1040px; margin: 0 auto; padding: 10px 16px 6px; display: flex; align-items: center; gap: 4px 16px; flex-wrap: wrap; }
.brand { display: block; margin-right: auto; line-height: 0; }
.brand img { height: 44px; width: auto; display: block; }
.top-nav { display: flex; gap: 2px; flex-wrap: wrap; margin: 0 -10px; }
.top-nav a { color: var(--muted); text-decoration: none; padding: 8px 10px; font-size: 14px; font-weight: 600; transition: color .15s; }
.top-nav a:hover { color: var(--ink); }
.top-nav a.on { color: var(--ink); font-weight: 700; }

main { max-width: 760px; margin: 0 auto; padding: 28px 16px 56px; }
main.wide { max-width: 1040px; }

/* Карточки: белые с тонкой рамкой */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 14px; }
.card.narrow { max-width: 440px; margin: 8px auto 16px; padding: 24px; }
@media (min-width: 640px) { .card { padding: 24px; } .card.narrow { padding: 32px; margin-top: 24px; } }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.5; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .04em; }
.with-ic { display: inline-flex; align-items: center; gap: 8px; }

/* Формы */
.form { display: flex; flex-direction: column; gap: 16px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; line-height: 1.3; }
.form label .muted { font-weight: 400; }
input[type=text], input:not([type]), input[type=tel], input[type=password], input[type=search], select {
  font: 400 16px/1.3 var(--font-sans); color: var(--ink); background: var(--surface);
  border: 1px solid #d6d3cc; border-radius: var(--radius-s);
  padding: 12px 14px; width: 100%; min-height: 48px;
}
input:focus, select:focus { border-color: var(--ink); }
input::placeholder { color: var(--muted); opacity: .8; }
input[aria-invalid=true] { border: 2px solid var(--error); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 44px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23141414' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 18px;
}
.form label.check { flex-direction: row; align-items: center; gap: 10px; font-size: 14px; font-weight: 400; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); flex: none; }
.access-row { padding-top: 14px; border-top: 1px solid var(--line); }
.access-row > span { font-size: 14px; }

/* Кнопки: главное действие — жёлтая капсула, остальные — тонкий контур */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 14px/1.2 var(--font-sans); min-height: 46px; padding: 12px 20px;
  border-radius: var(--radius-pill); border: 1.5px solid var(--ink);
  background: var(--surface); color: var(--ink); text-decoration: none; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--surface-soft); }
.btn.primary { background: var(--yellow); border-color: var(--yellow); font-weight: 700; }
.btn.primary:hover { background: var(--ink); border-color: var(--ink); color: var(--yellow); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn.dark:hover { background: var(--black); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn .ic { width: 17px; height: 17px; }
button.link { background: none; border: 0; color: var(--muted); font: 600 13px var(--font-sans); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 10px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
form.inline { display: inline; margin: 0; }
@media (max-width: 480px) { .hide-sm { display: none; } }
.form + p, .form + form { margin-top: 16px; }
.facts + .actions { margin-top: 18px; }

/* Сообщения: жёлтая полоска слева; ошибка — рамка цвета ошибки */
.flash { border-radius: var(--radius-s); padding: 12px 16px; margin-bottom: 14px; background: var(--surface-soft); border-left: 4px solid var(--yellow); font-size: 14px; font-weight: 500; }
.flash.err { background: var(--surface); border: 1.5px solid var(--error); border-left-width: 4px; }

/* Главная: плитки разделов — иконка в жёлтом кружке; плитка админки — тёмная */
.tiles { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .tiles { grid-template-columns: 1fr 1fr; } }
.tile {
  display: flex; flex-direction: column; gap: 4px; padding: 20px; min-height: 170px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); text-decoration: none; transition: border-color .15s;
}
.tile:hover { border-color: var(--ink); }
.tile-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--yellow); color: var(--ink); display: grid; place-items: center; margin-bottom: 10px; }
.tile-icon .ic { width: 20px; height: 20px; }
.tile-title { font-weight: 700; font-size: 17px; line-height: 1.3; }
.tile-desc { font-size: 13px; line-height: 1.5; color: var(--muted); margin-bottom: 12px; }
.tile-role { margin-top: auto; align-self: flex-start; padding: 4px 11px; font-size: 12px; font-weight: 600; border: 1.5px solid var(--ink); border-radius: var(--radius-pill); }
.tile.admin { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.tile.admin .tile-title { color: var(--yellow); }
.tile.admin .tile-desc { color: var(--muted-dark); }
.tile.admin:hover { border-color: var(--yellow); }

/* Список сотрудников — как строки таблицы */
.search { display: flex; gap: 8px; margin-bottom: 14px; }
.search input { flex: 1; }
.search .btn { padding: 12px 16px; }
.list { display: flex; flex-direction: column; margin-bottom: 20px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row {
  display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; text-decoration: none; color: var(--ink);
  background: var(--surface); border-top: 1px solid var(--line); transition: background .15s;
}
.row:first-child { border-top: 0; }
.row:nth-child(even) { background: var(--surface-soft); }
.row:hover { background: #fff8d6; }
.row.off { opacity: .5; }
.row-main { display: flex; flex-direction: column; gap: 2px; }
.row-main b { font-weight: 700; font-size: 15px; }
.row-side { display: flex; flex-wrap: wrap; gap: 6px; }
@media (min-width: 640px) {
  .row { flex-direction: row; align-items: center; justify-content: space-between; }
  .row-side { justify-content: flex-end; }
}
.list > p { margin: 0; padding: 16px; }
/* Чипы: контурные капсулы, как «Напряжение 24 В» в справочнике */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: var(--radius-pill); border: 1.5px solid var(--ink); background: var(--surface); white-space: nowrap; }
.badge .ic { width: 14px; height: 14px; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .02em; padding: 2px 9px; border-radius: var(--radius-pill); background: var(--yellow); color: var(--ink); vertical-align: 2px; }
.tag.red { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--error); }

/* Факты, пары, история */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; font-weight: 500; }
.pairs { list-style: none; padding: 0; margin: 0; }
.pairs li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; }
.pairs li:first-child { border-top: 0; padding-top: 0; }
.pairs b { font-weight: 700; font-size: 13px; text-align: right; }
.history { list-style: none; padding: 0; margin: 0; }
.history li { padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; }
.history li:first-child { border-top: 0; padding-top: 0; }
.history b { font-weight: 700; }

/* Временный пароль — тёмная плашка с жёлтым акцентом, как «Формула» в справочнике */
.secret { display: flex; flex-direction: column; gap: 12px; background: var(--ink); color: var(--surface); border-radius: var(--radius); padding: 20px; margin: 16px 0; }
.secret div { display: flex; flex-direction: column; gap: 2px; }
.secret .muted { color: var(--muted-dark); font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.secret b { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.secret b.mono { color: var(--yellow); font-size: 22px; }

/* ---------- Учёт МТЦ ---------- */
.list .item-row { flex-direction: row; align-items: center; gap: 12px; flex-wrap: wrap; }
.item-row .row-main { flex: 1 1 160px; min-width: 0; }
.item-row .row-side { flex: 1 1 100%; padding-left: 68px; }
@media (min-width: 640px) { .item-row .row-side { flex: 0 0 auto; padding-left: 0; } }
.thumb { width: 56px; height: 56px; border-radius: var(--radius-s); object-fit: cover; flex: none; background: var(--surface-soft); }
.thumb-empty { display: grid; place-items: center; color: var(--muted); }
.thumb-empty .ic { width: 22px; height: 22px; }
.card.attention { border: 2px solid var(--yellow); }
.move { padding: 14px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.card h2 + .move { border-top: 0; padding-top: 4px; }
.move-main { display: flex; flex-direction: column; gap: 2px; }
.move-main a { text-decoration: none; }
.move-actions { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.move-actions label { display: flex; flex-direction: column; gap: 4px; flex: 1 1 180px; font-weight: 600; }
.stats { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 6px 0 22px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(3, 1fr); } }
.stat { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.stat:hover { border-color: var(--ink); }
.stat > span:last-child { display: flex; flex-direction: column; }
.stat-ic { width: 36px; height: 36px; border-radius: 50%; background: var(--yellow); display: grid; place-items: center; flex: none; color: var(--ink); }
.stat-ic .ic { width: 18px; height: 18px; }
.stat.dark { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.stat.dark b { color: var(--yellow); }
.filters { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 12px; }
@media (min-width: 760px) { .filters { grid-template-columns: 2fr 1fr 1fr auto; } }
.narrow-form { max-width: 560px; }
.photo-pick { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.photo-preview { width: 120px; height: 120px; object-fit: cover; border-radius: var(--radius-s); }
.item-card { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 14px; }
@media (min-width: 760px) { .item-card { grid-template-columns: 320px 1fr; align-items: start; } .item-card .card { margin: 0; } }
.item-photo { display: block; border-radius: var(--radius); overflow: hidden; background: var(--surface-soft); aspect-ratio: 4 / 3; }
.item-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-photo-empty { aspect-ratio: 3 / 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); }
.item-photo-empty .ic { width: 40px; height: 40px; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.table th { background: var(--ink); color: var(--surface); font-weight: 600; text-align: left; padding: 10px 12px; border-bottom: 3px solid var(--yellow); white-space: nowrap; }
.table th:first-child { border-top-left-radius: var(--radius-s); }
.table th:last-child { border-top-right-radius: var(--radius-s); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:nth-child(even) td { background: var(--surface-soft); }
.table a { text-decoration: none; font-weight: 600; }
.checklist { list-style: none; padding: 0; margin: 0 0 14px; }
.checklist li { padding: 10px 0; border-top: 1px solid var(--line); }
.checklist li:first-child { border-top: 0; }
.checklist label.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.checklist input { margin-top: 2px; }
