@font-face { font-family: Manrope; font-weight: 400; src: url(fonts/Manrope-400.woff2) format('woff2'); }
@font-face { font-family: Manrope; font-weight: 500; src: url(fonts/Manrope-500.woff2) format('woff2'); }
@font-face { font-family: Manrope; font-weight: 600; src: url(fonts/Manrope-600.woff2) format('woff2'); }
@font-face { font-family: Manrope; font-weight: 700; src: url(fonts/Manrope-700.woff2) format('woff2'); }
@font-face { font-family: Manrope; font-weight: 800; src: url(fonts/Manrope-800.woff2) format('woff2'); }

:root {
  /* палитра rhinodesign.ru */
  --teal: #00908C;
  --teal-dark: #167C79;
  --teal-soft: #E5F4F3;
  --pink: #FF2C61;
  --pink-soft: #FFE9EF;
  --ink: #222222;
  --text: #4B4E51;
  --muted: #8A8D91;
  --line: #E3E5E8;
  --bg: #F6F7F9;
  --card: #FFFFFF;
  --radius: 16px;
  --pill: 25px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: Manrope, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ---------- верхняя панель ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 14px 28px; background: #fff; border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-direction: column; line-height: 1; }
.logo { font-weight: 800; font-size: 24px; letter-spacing: .5px; color: #181716; }
.tagline { font-size: 11px; color: var(--text); margin-top: 4px; letter-spacing: .2px; align-self: flex-end; }
.doc-title { flex: 1; display: flex; flex-direction: column; padding-left: 24px; border-left: 1px solid var(--line); }
.doc-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 600; }
.doc-name { font-size: 16px; font-weight: 700; color: var(--ink); }
.user-chip {
  display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--pill); padding: 5px 16px 5px 5px; transition: border-color .15s;
}
.user-chip:hover { border-color: var(--teal); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--teal); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.user-meta { display: flex; flex-direction: column; text-align: left; line-height: 1.2; }
.user-role { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; }
.user-name { font-size: 13px; font-weight: 700; color: var(--ink); }

/* ---------- раскладка ---------- */
.layout { flex: 1; display: flex; min-height: 0; }
.sidebar {
  width: 260px; flex-shrink: 0; padding: 20px 14px; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 16px; overflow-y: auto;
}
#nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px;
  color: var(--text); text-decoration: none; font-weight: 600; font-size: 13px; border: 0; background: none; text-align: left;
}
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--teal-soft); color: var(--teal-dark); }
.nav-num {
  width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line); flex-shrink: 0;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--muted); background: #fff;
}
.nav-item.done .nav-num { background: var(--teal); border-color: var(--teal); color: #fff; }
.nav-item.err .nav-num { border-color: var(--pink); color: var(--pink); }
.side-actions { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.autosave { font-size: 11px; color: var(--muted); text-align: center; }

.content { flex: 1; overflow-y: auto; padding: 24px 32px 40px; scroll-behavior: smooth; }

/* ---------- секции ---------- */
.section { max-width: 1040px; margin: 0 auto 22px; }
.section-head { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; }
.section-num {
  width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--ink); display: grid; place-items: center;
  font-weight: 700; color: var(--ink); font-size: 14px; background: #fff;
}
.section-title { font-size: 19px; font-weight: 800; color: var(--ink); margin: 0; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 12px; border: 1px solid transparent; }
.card.off .card-body { opacity: .35; pointer-events: none; filter: grayscale(.6); }
.card-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card.collapsible.off .card-head { margin-bottom: 0; }
.card.collapsible.off .card-body { display: none; }
.card-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.card-note { font-size: 12px; color: var(--muted); font-weight: 500; }
.spacer { flex: 1; }

.grid { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.sub { width: 100%; font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); font-weight: 700; margin-top: 8px; }
.sub:first-child { margin-top: 0; }

/* поля */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 160px; }
.field.full { flex: 1 1 100%; }
.field.grow { flex: 1 1 260px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text); }
.field label .req { color: var(--pink); margin-left: 2px; }
.input {
  height: 40px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 14px; font-size: 14px; color: var(--ink);
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; font-weight: 500;
}
.input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.input[readonly] { background: var(--bg); color: var(--text); }
.input.num { width: 92px; text-align: center; font-weight: 700; letter-spacing: 2px; font-variant-numeric: tabular-nums; }
.input.num.w6 { width: 150px; }
.input.num.w4 { width: 110px; }
.field.invalid .input { border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-soft); }
.field.inline { flex-direction: row; align-items: center; gap: 10px; min-width: 0; }
.field.inline label { white-space: nowrap; }

/* чипы-чекбоксы */
.chip {
  display: inline-flex; align-items: center; gap: 9px; height: 38px; padding: 0 16px 0 10px; border-radius: var(--pill);
  border: 1.5px solid var(--line); background: #fff; color: var(--ink); font-size: 13px; font-weight: 600;
  user-select: none; transition: all .12s;
}
.chip:hover { border-color: var(--teal); }
.chip .box {
  width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid #B9BDC2; display: grid; place-items: center; background: #fff; flex-shrink: 0;
}
.chip.radio .box { border-radius: 50%; }
.chip.on { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-dark); }
.chip.on .box { background: var(--teal); border-color: var(--teal); }
.chip.on .box::after { content: ''; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.chip.disabled { opacity: .4; pointer-events: none; }
.group-invalid .chip, .group-invalid .tile { border-color: var(--pink); }

/* плитки с макетами */
.tiles { display: flex; flex-wrap: wrap; gap: 12px; width: 100%; }
.tile {
  width: 172px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; padding: 10px; position: relative;
  display: flex; flex-direction: column; gap: 8px; align-items: center; transition: all .12s; text-align: center;
}
.tile:hover { border-color: var(--teal); }
.tile img { width: 100%; height: 104px; object-fit: contain; border-radius: 8px; background: #fafafa; }
.tile.cover img { height: 130px; }
.tile span { font-size: 12px; font-weight: 600; color: var(--ink); line-height: 1.25; }
.tile .box {
  position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid #B9BDC2; background: #fff;
  display: grid; place-items: center;
}
.tile.radio .box { border-radius: 50%; }
.tile.on { border-color: var(--teal); background: var(--teal-soft); box-shadow: 0 0 0 3px var(--teal-soft); }
.tile.on .box { background: var(--teal); border-color: var(--teal); }
.tile.on .box::after { content: ''; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.4px 2.4px 0; transform: rotate(45deg) translate(-1px, -1px); }

/* переключатель секции */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch .track { width: 40px; height: 22px; border-radius: 11px; background: #D5D8DC; position: relative; transition: background .15s; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch.on .track { background: var(--teal); }
.switch.on .track::after { left: 21px; }
.ar-toggle {
  height: 30px; padding: 0 12px; border-radius: 8px; border: 1.5px solid #B9BDC2; background: #fff; color: #9EA2A7;
  font-weight: 800; font-size: 13px; letter-spacing: .5px;
}
.ar-toggle.on { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.range { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.range .input { width: 64px; height: 34px; padding: 0 6px; }
.range.invalid .input { border-color: var(--pink); }

/* ---------- нижняя панель ---------- */
.actionbar {
  display: flex; align-items: center; gap: 20px; padding: 12px 28px; background: #fff; border-top: 1px solid var(--line);
}
.progress { flex: 1; display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 600; }
.progress-track { width: 220px; height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--teal); transition: width .2s; }
.actions { display: flex; gap: 10px; }

.btn {
  height: 44px; padding: 0 24px; border-radius: var(--pill); font-weight: 700; font-size: 14px; border: 1.5px solid transparent;
  transition: all .15s;
}
.btn.primary { background: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); }
.btn.outline { background: #fff; color: var(--teal-dark); border-color: var(--teal); }
.btn.outline:hover { background: var(--teal-soft); }
.btn.ghost { background: var(--bg); color: var(--ink); }
.btn.ghost:hover { background: var(--teal-soft); color: var(--teal-dark); }
.btn.danger { background: var(--pink); color: #fff; }
.btn.sm { height: 36px; font-size: 13px; padding: 0 16px; font-weight: 600; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ---------- модальные окна ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(24, 23, 22, .45); display: grid; place-items: center; z-index: 50; }
.modal-back[hidden] { display: none; }
.modal { width: min(520px, 92vw); max-height: 86vh; overflow: auto; background: #fff; border-radius: 20px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal h2 { margin: 0 0 6px; font-size: 21px; font-weight: 800; color: var(--ink); }
.modal p { margin: 0 0 16px; line-height: 1.5; }
.modal .field { margin-bottom: 14px; }
.modal .row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.modal .logo { margin-bottom: 18px; }
.issues { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.issues li { padding: 9px 12px; border-radius: 10px; background: var(--pink-soft); color: #B0173F; font-weight: 600; font-size: 13px; cursor: pointer; }
.issues li.warn { background: #FFF6E0; color: #8A6100; }
.issues li:hover { filter: brightness(.97); }
.path { font-size: 12px; background: var(--bg); padding: 10px 12px; border-radius: 10px; word-break: break-all; margin-bottom: 4px; }
.dir-row { display: flex; gap: 8px; align-items: center; }
.dir-row .path { flex: 1; margin: 0; }

.toast {
  position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px;
  border-radius: var(--pill); font-weight: 600; font-size: 13px; z-index: 60; box-shadow: 0 6px 20px rgba(0,0,0,.2);
}
.toast[hidden] { display: none; }

.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%, 100% { box-shadow: var(--shadow); } 30% { box-shadow: 0 0 0 4px var(--pink-soft), var(--shadow); } }

/* ---------- типы ТЗ ---------- */
.doc-title { border: 0; background: none; text-align: left; cursor: pointer; border-radius: 12px; padding: 4px 10px 4px 24px; margin-left: 0; }
.doc-title:hover .doc-name { color: var(--teal-dark); }
.doc-title:hover .doc-kicker { color: var(--teal); }
.modal.wide { width: min(860px, 94vw); }
.type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 8px; }
.type-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left; padding: 20px 18px;
  border: 1.5px solid var(--line); border-radius: 18px; background: #fff; transition: all .15s; position: relative; min-height: 210px;
}
.type-card:hover { border-color: var(--teal); box-shadow: 0 0 0 4px var(--teal-soft); transform: translateY(-1px); }
.type-card.current { border-color: var(--teal); background: var(--teal-soft); }
.type-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--teal-soft); color: var(--teal-dark); display: grid; place-items: center; }
.type-icon svg, .part-icon svg { width: 30px; height: 30px; }
.type-name { font-size: 17px; font-weight: 800; color: var(--ink); }
.type-desc { font-size: 12.5px; line-height: 1.45; color: var(--text); }
.type-badge { margin-top: auto; font-size: 11px; font-weight: 700; color: var(--teal-dark); background: #fff; border: 1px solid var(--teal); border-radius: 20px; padding: 3px 10px; }

/* коробка */
.box-card { display: flex; align-items: center; gap: 16px; border: 1.5px dashed #C9CDD2; box-shadow: none; }
.box-card.on { border-style: solid; border-color: var(--teal); background: var(--teal-soft); }
.box-text { flex: 1; }
.box-text .card-note { display: block; margin-top: 3px; }
.part-icon { width: 48px; height: 48px; border-radius: 14px; background: #fff; color: var(--teal-dark); display: grid; place-items: center; flex-shrink: 0; border: 1px solid var(--line); }
.sw-label { font-weight: 700; color: var(--ink); font-size: 14px; }
.part-sep { max-width: 1040px; margin: 30px auto 18px; display: flex; align-items: center; gap: 14px; padding-top: 22px; border-top: 2px dashed var(--line); }
.part-title { font-size: 20px; font-weight: 800; color: var(--ink); }
.part-sub { font-size: 12px; color: var(--muted); }
.nav-item.sub-part { padding-left: 20px; }
.nav-item.sub-part .nav-num { font-size: 9px; }

/* поля */
textarea.input.area { height: auto; padding: 10px 14px; resize: vertical; line-height: 1.45; min-height: 74px; }
.input.date { width: 170px; }
.input.num.w10 { width: 190px; letter-spacing: 1px; }
.img-drop {
  border: 1.5px dashed #C9CDD2; border-radius: 14px; background: var(--bg); min-height: 120px; display: flex; align-items: center; justify-content: center;
  position: relative; padding: 14px; transition: all .15s;
}
.img-drop.drag { border-color: var(--teal); background: var(--teal-soft); }
.img-empty { text-align: center; font-size: 13px; line-height: 1.6; color: var(--text); max-width: 520px; }
.img-empty span { font-size: 11.5px; color: var(--muted); }
.link { border: 0; background: none; color: var(--teal-dark); font-weight: 700; text-decoration: underline; padding: 0; font-size: 13px; }
.img-prev, .img-actions { display: none; }
.img-drop.has { justify-content: space-between; gap: 16px; }
.img-drop.has .img-empty { display: none; }
.img-drop.has .img-prev { display: block; max-height: 220px; max-width: 70%; border-radius: 8px; box-shadow: var(--shadow); background: #fff; }
.img-drop.has .img-actions { display: flex; flex-direction: column; gap: 8px; }

/* ---------- порядок разделов ---------- */
.order-hint { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); margin: 6px 4px 12px; }
.order-hint svg { width: 9px; height: 15px; flex-shrink: 0; color: var(--teal); }
.order-list { display: flex; flex-direction: column; }
.grip { width: 22px; height: 30px; display: grid; place-items: center; color: #B3B7BC; cursor: grab; border-radius: 6px; flex-shrink: 0; }
.grip:hover { color: var(--teal); background: var(--teal-soft); }
.grip svg { width: 9px; height: 15px; }
.card.dragging { opacity: .55; outline: 2px dashed var(--teal); }
.ord-badge { min-width: 26px; height: 26px; border-radius: 13px; display: inline-grid; place-items: center; font-size: 12px; font-weight: 800;
  background: var(--bg); color: #B3B7BC; border: 1.5px solid var(--line); padding: 0 6px; }
.ord-badge.on { background: var(--teal-dark); color: #fff; border-color: var(--teal-dark); }
.pages-box { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; }
.pages-box .input.num { width: 70px; height: 34px; padding: 0 6px; }
.pages-label { color: var(--text); }
.range-label { min-width: 74px; font-weight: 700; color: var(--teal-dark); font-size: 12.5px; }
.pages-box.invalid .input { border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-soft); }
.add-section { width: 100%; border-style: dashed; margin-top: 2px; }
.custom-card .cb-title { flex: 1; min-width: 240px; height: 36px; font-weight: 700; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 1.5px solid var(--line); background: #fff; color: var(--muted); font-size: 13px; }
.icon-btn:hover { border-color: var(--pink); color: var(--pink); }
.tile-icon { width: 100%; height: 104px; display: grid; place-items: center; color: var(--teal-dark); background: #fafafa; border-radius: 8px; }
.tile-icon svg { width: 64px; height: 64px; }
.tile.custom .tile-icon { color: #9EA2A7; }
.tile.custom.on .tile-icon { color: var(--teal-dark); }

/* ---------- сворачивание ---------- */
.card-foot { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.foot-state { font-size: 12.5px; font-weight: 600; color: var(--text); display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot.ok { background: var(--teal); }
.dot.err { background: var(--pink); }
.card.off .card-foot { display: none; }
.card-summary { display: none; width: 100%; text-align: left; border: 0; background: var(--bg); border-radius: 10px; padding: 10px 14px; margin-top: 12px;
  font-size: 12.5px; color: var(--text); line-height: 1.5; font-weight: 500; }
.card-summary .dot { margin-right: 8px; vertical-align: 1px; }
.card-summary:hover { background: var(--teal-soft); }
.sum-edit { float: right; color: var(--teal-dark); font-weight: 700; margin-left: 12px; }
.sum-err { color: #B0173F; }
.card.folded .card-body, .card.folded .card-foot { display: none; }
.card.folded .card-summary { display: block; }
.card.folded.complete { border-color: rgba(0,144,140,.35); }
.card-head { row-gap: 8px; }
.card-head .pages-box, .card-head .ar-toggle { flex-shrink: 0; }

/* комментарии к разделу */
.optional-note > label, .optional-note > textarea { display: none; }
.optional-note.open > label, .optional-note.open > textarea { display: block; }
.optional-note.open .note-open { display: none; }
.note-open { font-size: 12.5px; text-decoration: none; }

/* доп. информация */
.extras-preview { width: 100%; }
.ex-note { font-size: 13px; line-height: 1.5; margin: 0 0 12px; color: var(--text); }
.ex-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 14px; }
.ex-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.ex-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); color: var(--ink); }
.ex-table td em { font-style: normal; font-size: 11px; color: var(--teal-dark); background: var(--teal-soft); padding: 2px 7px; border-radius: 10px; margin-left: 4px; }
.ex-table tfoot td { font-weight: 800; border-bottom: 0; }
.ex-table .ord-badge { min-width: 22px; height: 22px; font-size: 11px; }
.ar-mini { font-size: 10px; background: var(--teal-dark); color: #fff; border-radius: 4px; padding: 1px 5px; margin-left: 4px; }
.ex-item { background: var(--bg); border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; }
.ex-title { font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.ex-title .ord-badge { min-width: 22px; height: 22px; font-size: 11px; }
.ex-range { font-weight: 500; color: var(--muted); font-size: 12px; }
.ex-item ul { margin: 6px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.5; }
.muted { color: var(--muted); }
textarea.input { font-family: inherit; }
.note-open { align-self: flex-start; }
