:root {
  --teal: #00a19a;
  --teal-dark: #00756f;
  --red: #e30613;
  --bg: #f4f6f6;
  --line: #d8dddd;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: 'Segoe UI', Arial, sans-serif; background: var(--bg); color: #222;
}
header {
  background: var(--teal); color: #fff; padding: 10px 20px;
  display: flex; align-items: center; gap: 30px;
  border-bottom: 4px solid var(--red);
}
.logo { font-size: 22px; font-weight: 800; font-style: italic; letter-spacing: 1px; }
.logo span { font-style: normal; font-weight: 400; opacity: .85; }
nav { display: flex; gap: 6px; }
.tab {
  background: transparent; color: #fff; border: none; padding: 8px 14px;
  font-size: 14px; cursor: pointer; border-radius: 4px;
}
.tab.active { background: rgba(255,255,255,.2); font-weight: 600; }
.tab:hover { background: rgba(255,255,255,.12); }
main { padding: 20px; max-width: 1500px; margin: 0 auto; }
.page { display: none; }
.page.active { display: block; }
h2 { font-size: 16px; margin: 18px 0 8px; color: var(--teal-dark); text-transform: uppercase; letter-spacing: .4px; }
label { display: block; font-size: 13px; margin: 8px 0 3px; color: #555; }
input[type=text], input:not([type]), select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 4px; font-size: 14px; font-family: inherit;
}
textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 380px 1fr; gap: 26px; align-items: start; }
.hint { font-size: 12px; color: #777; margin: 4px 0 10px; }
.sections label { display: flex; gap: 8px; align-items: center; margin: 4px 0; font-size: 14px; color: #222; }
.sections input { width: auto; }
.actions { margin: 22px 0; display: flex; gap: 12px; align-items: center; }
.actions.left { justify-content: flex-start; flex-wrap: wrap; }
.actions.left label { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; }
.actions.left select { width: auto; max-width: 300px; }
.actions.left input[type=file] { width: auto; }
.btn {
  background: #fff; border: 1px solid var(--teal); color: var(--teal-dark);
  padding: 9px 18px; font-size: 14px; border-radius: 4px; cursor: pointer;
}
.btn:hover { background: #e6f5f4; }
.btn.primary { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn.primary:hover { background: var(--teal-dark); }
.tbl { border-collapse: collapse; width: 100%; background: #fff; }
.tbl th, .tbl td { border: 1px solid var(--line); padding: 5px 8px; font-size: 13px; text-align: left; }
.tbl th { background: #eef4f4; }
.tbl input { border: none; padding: 3px; width: 90px; }
#invest_table { table-layout: fixed; }
#invest_table th:first-child, #invest_table td:first-child { width: 74px; }
#invest_table input { width: 100%; box-sizing: border-box; }
.tbl.wide th, .tbl.wide td { padding: 7px 10px; }
.sec-block { background: #fff; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 14px; overflow: hidden; }
.sec-block > h3 {
  margin: 0; padding: 9px 12px; font-size: 14px; background: #eef4f4; color: var(--teal-dark);
  display: flex; justify-content: space-between; align-items: center;
}
.sec-block .body { padding: 8px 12px; }
.prod-group { border-bottom: 1px dashed #eee; padding: 5px 0; }
.prod-group:last-child { border-bottom: none; }
.prod-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.prod-head .name { font-weight: 600; }
.prod-head .cat { color: #888; font-size: 12px; }
.pack-row { display: flex; gap: 14px; margin: 3px 0 0 26px; font-size: 13px; color: #444; flex-wrap: wrap; }
.pack-row .pack { min-width: 70px; }
.pack-row .pr { color: #00756f; }
.pack-row .no-price { color: var(--red); font-weight: 600; }
.spec-preview { color: #777; font-size: 12px; margin: 2px 0 0 26px; max-width: 700px; }
.brand-tags { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-left: 8px; }
.brand-tag { background: #dff0ef; color: var(--teal-dark); border-radius: 3px; padding: 1px 6px; font-size: 11px; }
#preview_area img { width: 100%; max-width: 720px; border: 1px solid var(--line); margin: 10px 0; display: block; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.report { background: #fff8e1; border: 1px solid #ffe082; padding: 10px 14px; border-radius: 4px; margin: 10px 0; font-size: 13px; }
.report.errors { background: #fdecea; border-color: #f5c6c0; }
.report ul { margin: 6px 0 2px 18px; padding: 0; }
.ok { color: #2e7d32; }
#build_status { font-size: 13px; color: #555; }
.cat-table td { vertical-align: top; }
.cat-table .brand-editor label { display: inline-flex; margin: 2px 8px 2px 0; font-size: 12px; gap: 4px; }
.cat-table .brand-editor input { width: auto; }
.spec-ov { width: 260px !important; font-size: 12px; }
.mini { font-size: 12px; color: #777; }
a { color: var(--teal-dark); }

/* --- v2: двухуровневый выбор, город, пресеты, допуски --- */
.date-readonly {
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 4px;
  background: #eef1f1; color: #555; font-size: 14px;
}
.pack-item { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; margin: 0; color: #222; }
.pack-item input { width: auto; }
.pack-item.off .pack, .pack-item.off .pr { opacity: .45; text-decoration: line-through; }
.spec-preview.warn { color: #b26a00; }
.btn.danger { border-color: #d99; color: #a33; padding: 3px 9px; }
.btn.danger:hover { background: #fbecec; }
.city-row { display: flex; gap: 6px; margin: 4px 0; }
.city-row input { flex: 1; }
#preset_editor { max-height: 560px; overflow-y: auto; }
#approvals_editor select { width: auto; min-width: 160px; }
#approvals_editor input { width: auto; }

/* ---------- профиль пользователя ---------- */
.me-badge {
  margin-left: auto; font-size: 13px; cursor: pointer; padding: 6px 12px;
  border-radius: 14px; background: rgba(255,255,255,.15); white-space: nowrap;
}
.me-badge:hover { background: rgba(255,255,255,.28); }
.gate {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.gate-card {
  background: #fff; border-radius: 8px; padding: 22px 26px; width: 440px;
  max-width: 92vw; max-height: 90vh; overflow: auto;
  border-top: 4px solid var(--red);
}
.gate-pick {
  display: block; width: 100%; text-align: left; margin: 6px 0; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 6px; background: #f7fafa;
  cursor: pointer; font-size: 14px; font-family: inherit;
}
.gate-pick:hover { border-color: var(--teal); background: #e6f5f4; }
.gate-pick .mini { display: block; color: #777; margin-top: 2px; }
input.req { border-color: var(--red); }
