/* ProAnvil CRM — mobile-first, без сборки */

:root {
  --bg: #0b0d10;
  --panel: #14171c;
  --panel2: #1b1f26;
  --line: #272d36;
  --text: #eceef1;
  --muted: #8d949e;
  --accent: #ff5a1f;
  --accent-soft: rgba(255, 90, 31, 0.14);
  --ok: #35c26b;
  --warn: #ffb020;
  --over: #ff4d4d;
  --radius: 14px;
}

* { box-sizing: border-box; }

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

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 14px;
  background: rgba(11, 13, 16, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-size: 16px; letter-spacing: 0.02em; color: var(--text); font-weight: 600; }
.brand img { display: block; height: 19px; width: auto; }
.page-title { display: none; }
.top-action { display: none; }
.top .top-action { display: none; }
.main { min-height: 100vh; }
.sidenav { display: none; }
.brand b { color: var(--accent); font-weight: 700; }
.top-right { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.who { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline { display: inline; }
.link { background: none; border: 0; color: var(--muted); font: inherit; padding: 0; cursor: pointer; }
.link:hover { color: var(--text); }

.wrap { padding: 12px 12px 92px; max-width: 980px; margin: 0 auto; }

h1 { font-size: 20px; margin: 4px 0 12px; font-weight: 650; }
h2 { font-size: 16px; margin: 0 0 10px; font-weight: 600; }
h3 { font-size: 14px; margin: 0 0 8px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.card.tight { padding: 0; overflow: hidden; }

/* вход */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.login-card .brand { font-size: 20px; margin-bottom: 2px; }
.login-card .brand img { display: block; height: 27px; width: auto; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.gap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 10px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.stat .v { font-size: 22px; font-weight: 700; }
.stat .k { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.alert .v { color: var(--over); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 12px; line-height: 18px;
  background: var(--panel2); color: var(--muted); border: 1px solid var(--line);
  white-space: nowrap;
}
.chip.ok { color: var(--ok); border-color: rgba(53,194,107,.35); background: rgba(53,194,107,.1); }
.chip.warn { color: var(--warn); border-color: rgba(255,176,32,.35); background: rgba(255,176,32,.1); }
.chip.over { color: var(--over); border-color: rgba(255,77,77,.4); background: rgba(255,77,77,.12); }
.chip.accent { color: var(--accent); border-color: rgba(255,90,31,.4); background: var(--accent-soft); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 10px 16px;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none;
}
.btn:hover { text-decoration: none; border-color: #3a424d; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--over); border-color: rgba(255,77,77,.4); background: rgba(255,77,77,.08); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn.block { width: 100%; }

/* список строк вместо таблиц на телефоне */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-bottom: 1px solid var(--line);
  color: inherit;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--panel2); text-decoration: none; }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.row .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); }
table.data th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* шкала износа */
.bar { height: 6px; background: #22272f; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--ok); }
.bar > i.warn { background: var(--warn); }
.bar > i.over { background: var(--over); }
.wear { min-width: 86px; }

/* формы */
.field { margin-bottom: 12px; }
.field > label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; padding: 11px 12px;
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 16px;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox] { width: 20px; height: 20px; padding: 0; accent-color: var(--accent); }
input[type=file] { padding: 8px; font-size: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.err { background: rgba(255,77,77,.12); border: 1px solid rgba(255,77,77,.4); color: #ffb3b3; padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-size: 13.5px; }
.ok { background: rgba(53,194,107,.12); border: 1px solid rgba(53,194,107,.4); color: #a6f0c3; padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-size: 13.5px; }

.check { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: 0; }
.check span { padding-top: 2px; }

/* таб-бар */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(15, 18, 22, 0.97);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 2px 8px; color: var(--muted); font-size: 11px;
}
.tab:hover { text-decoration: none; color: var(--text); }
.tab svg { width: 22px; height: 22px; }
.tab.on { color: var(--accent); }

/* мелочи */
.avatar { width: 34px; height: 34px; border-radius: 9px; background: var(--panel2); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--accent); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.sys { border-bottom: 1px solid var(--line); padding: 10px 0; }
.sys:last-child { border-bottom: 0; }
.sys summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sys summary::-webkit-details-marker { display: none; }
.sys-name { font-weight: 600; font-size: 14px; }
.unit { padding: 8px 0 2px 10px; border-left: 2px solid var(--line); margin-top: 8px; }
.unit-name { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.part-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.part-row .grow { flex: 1; min-width: 0; }
.lap { font-variant-numeric: tabular-nums; }

@media (min-width: 720px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .wrap { padding: 16px 16px 92px; }
  h1 { font-size: 24px; }
}

/* ---------- десктоп: боковое меню вместо нижнего ---------- */
@media (min-width: 1000px) {
  .sidenav {
    display: flex; flex-direction: column;
    position: fixed; top: 0; bottom: 0; left: 0; width: 236px; z-index: 40;
    background: #101317; border-right: 1px solid var(--line);
    padding: 14px 10px 10px;
  }
  .sidenav-brand { display: block; padding: 4px 10px 12px; }
  .sidenav-brand img { display: block; height: 26px; width: auto; }
  .snav-scroll { flex: 1; overflow-y: auto; }
  .nav-group {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
    color: #5f6771; padding: 14px 12px 6px;
  }
  .snav {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 9px;
    color: #b3b9c2; font-size: 14px;
  }
  .snav:hover { background: var(--panel2); color: var(--text); text-decoration: none; }
  .snav.on { background: var(--accent-soft); color: var(--accent); }
  .snav svg { width: 18px; height: 18px; flex: none; }
  .sidenav-foot { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding: 10px 8px 2px; }
  .sn-user { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sn-role { font-size: 11.5px; color: var(--muted); }
  .avatar-sm {
    width: 30px; height: 30px; border-radius: 8px; flex: none;
    background: var(--panel2); color: var(--accent);
    display: flex; align-items: center; justify-content: center; font-weight: 700;
  }

  .main { margin-left: 236px; }
  .top { height: 58px; padding: 0 24px; }
  .brand { display: none; }
  .page-title { display: block; font-size: 15px; font-weight: 600; }
  .top-action { display: inline-flex; }
  .top .top-action { display: inline-flex; }
  .tabbar { display: none; }
  .wrap { padding: 18px 24px 40px; max-width: 1320px; }
  .card { padding: 16px; margin-bottom: 12px; }
  h1 { font-size: 22px; }
  .row { padding: 9px 14px; }
  table.data th, table.data td { padding: 8px 10px; }
  .cols { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 14px; align-items: start; }
  .cols > * { min-width: 0; }
  .cols.equal { grid-template-columns: 1fr 1fr; }
  .cols .card:last-child { margin-bottom: 12px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .mobile-quick { display: none; }
}

@media (min-width: 1400px) {
  .wrap { max-width: 1480px; }
}
