/* Калькулятор цен — сервис для сотрудников (этап С1). Цвета и размеры — docs/дизайн-сервиса.md. */
:root {
  --bg: #F5F6F8; --card: #FFFFFF; --line: #E3E6EB; --text: #16181D; --muted: #5B6270;
  --blue: #1F4FD1; --blue-h: #163A9E; --blue-bg: #EAF0FD;
  --green: #17703F; --green-bg: #E7F4EC; --yellow: #8A5A00; --yellow-bg: #FDF3DC; --red: #B42318; --red-bg: #FDECEA;
  --gray: #5B6270; --gray-bg: #EEF0F3; --tip: #1E2430; --r: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
       -webkit-text-size-adjust: 100%; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-h); text-decoration: underline; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 15px; margin: 0 0 8px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* шапка */
.top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-in { max-width: 1440px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 10px 24px; min-height: 60px; flex-wrap: nowrap; }
.who .nm, .brand, .nav a, #hintsBtn, .top .rep { white-space: nowrap; }
@media (max-width: 1360px) { .who .nm { display: none; } }
@media (max-width: 1100px) { .top-in { flex-wrap: wrap; } }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; color: var(--text); }
.logo { width: 32px; height: 32px; border-radius: 8px; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 700; }
.brand small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { padding: 10px 14px; border-radius: 10px; color: var(--muted); font-weight: 500; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; }
.nav a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--blue-bg); color: var(--blue); }
.count { background: var(--red); color: #fff; border-radius: 10px; font-size: 12px; padding: 0 7px; line-height: 18px; }
.spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 10px; }
.ava { width: 36px; height: 36px; border-radius: 50%; background: var(--blue-bg); color: var(--blue); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.who small { display: block; color: var(--muted); font-size: 12px; }

/* раскладка */
.wrap { max-width: 1440px; margin: 0 auto; padding: 24px; }
.narrow { max-width: 980px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.card + .card { margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.grid-res { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 14px; }

/* кнопки и поля */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 10px;
       border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: #C9CED6; text-decoration: none; color: var(--text); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-h); border-color: var(--blue-h); color: #fff; }
.btn.ghost { background: transparent; }
.btn.ghost.on { background: var(--blue-bg); border-color: #C7D5F7; color: var(--blue); }
.btn.danger { color: var(--red); }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: auto; }
.btn.wide { width: 100%; }
label.f { display: block; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; color: var(--text); background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid #C7D5F7; border-color: var(--blue); }
.field + .field { margin-top: 14px; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg label, .seg a { min-height: 38px; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label.on, .seg a.on, .seg input:checked + span { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg label span { padding: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--blue); }
.drop { border: 2px dashed #C9CED6; border-radius: var(--r); padding: 28px 16px; text-align: center; background: #FAFBFC; cursor: pointer; display: block; }
.drop:hover { border-color: var(--blue); }
.drop input { display: block; margin: 12px auto 0; max-width: 100%; }
.msg { padding: 12px 14px; border-radius: 10px; background: var(--yellow-bg); color: var(--yellow); margin-bottom: 16px; }
.msg.ok { background: var(--green-bg); color: var(--green); }
.msg.err { background: var(--red-bg); color: var(--red); }

/* шаги */
.steps { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 20px; }
.step { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 20px; background: #fff; border: 1px solid var(--line); color: var(--muted); font-weight: 500; }
.step b { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); font-size: 13px; }
.step.on { color: var(--blue); border-color: #C7D5F7; }
.step.on b { background: var(--blue); color: #fff; }
.step.done b { background: var(--green); color: #fff; }

/* плашки надёжности */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.b-ok { background: var(--green-bg); color: var(--green); }
.b-check { background: var(--yellow-bg); color: var(--yellow); }
.b-ask { background: var(--gray-bg); color: var(--gray); }
.b-err, .b-red { background: var(--red-bg); color: var(--red); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 14px; border-radius: 20px; border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 500; }
.chip:hover { text-decoration: none; border-color: #C9CED6; color: var(--text); }
.chip.on { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* итоги */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.kpi .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 13px; }

/* таблицы */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
table.t { border-collapse: collapse; width: 100%; font-size: 14px; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 13px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #FAFBFC; white-space: nowrap; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.sel td { background: var(--blue-bg); }
table.t tr.alt td { color: var(--muted); font-size: 13px; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #F7F9FD; }
.src { font-weight: 500; }
.note { display: block; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.note.err { color: var(--red); }

/* карточка позиции */
.pos-card { position: sticky; top: 80px; max-height: calc(100vh - 96px); overflow-y: auto; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.alts { list-style: none; padding: 0; margin: 0; }
.alts li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.alts li.main { font-weight: 600; }
details summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }

/* подсказки «?» */
.tip { position: relative; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--gray-bg); color: var(--muted);
       font-size: 12px; font-weight: 700; cursor: help; vertical-align: middle; margin-left: 4px; border: 0; padding: 0; font-family: inherit; }
.tip .tx { display: none; position: absolute; z-index: 30; left: 50%; top: 26px; transform: translateX(-50%); width: min(300px, 80vw); background: var(--tip);
           color: #fff; font-weight: 400; font-size: 13px; line-height: 1.45; text-align: left; padding: 10px 12px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.18); white-space: normal; }
.tip:hover .tx, .tip:focus .tx, .tip:focus-within .tx { display: block; }
body.hints-off .tip, body.hints-off .hint-box { display: none; }
.hint-box { background: var(--blue-bg); border: 1px solid #C7D5F7; border-radius: var(--r); padding: 14px 16px; color: #1A3A8F; }

/* вход */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login .hero { background: var(--blue); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center; }
.login .hero h1 { font-size: 34px; color: #fff; }
.login .hero ul { padding-left: 20px; line-height: 1.8; }
.login .side { display: grid; place-items: center; padding: 32px 20px; }
.login .box { width: 100%; max-width: 420px; }
.tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 12px 16px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; min-height: 44px; }
.tabs a.on { color: var(--blue); border-color: var(--blue); }
.tabs a:hover { text-decoration: none; }

.recent a.item { display: flex; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--text); }
.recent a.item:hover { text-decoration: none; color: var(--blue); }

/* телефон */
@media (max-width: 1100px) { .grid-res { grid-template-columns: 1fr; } .pos-card { position: static; max-height: none; } }
@media (max-width: 860px) {
  .grid2 { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login .hero { padding: 28px 20px; }
  .login .hero h1 { font-size: 24px; }
  .wrap { padding: 16px; }
  .top-in { padding: 8px 16px; gap: 8px; }
  .who small, .who .nm { display: none; }
  h1 { font-size: 22px; }
  .hide-m { display: none; }
}
@media (max-width: 640px) {
  table.t.cards thead { display: none; }
  table.t.cards, table.t.cards tbody, table.t.cards tr, table.t.cards td { display: block; width: 100%; }
  table.t.cards tr { border-bottom: 1px solid var(--line); padding: 8px 4px; }
  table.t.cards td { border: 0; padding: 4px 10px; text-align: left; }
  table.t.cards td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: 12.5px; }
  .nav a { padding: 8px 10px; }
  .top { position: static; }
  .top-in { gap: 4px 8px; }
  .brand small, .who .acc { display: none; }
  .nav { order: 3; width: 100%; }
  .nav a { min-height: 40px; }
  #hintsBtn, .who .btn { min-height: 40px; padding: 6px 10px; font-size: 13px; }
  .ava { width: 32px; height: 32px; }
}

/* этап С1б: тестовая копия */
.stage-bar { background: #8A5A00; color: #fff; text-align: center; font-weight: 600; padding: 6px 16px; font-size: 14px; }
@media (max-width: 640px) { .top .rep { min-height: 40px; padding: 6px 10px; font-size: 13px; } }
