:root {
  --bg: #f5f6f8; --panel: #fff; --text: #1d2330; --muted: #6b7280; --line: #e3e6eb;
  --accent: #1f5fbf; --accent-soft: #e8f0fc; --ok: #1e7f4f; --ok-soft: #e3f4ea;
  --warn: #a15c00; --warn-soft: #fdf1dc; --bad: #b42318; --bad-soft: #fde8e6;
  --radius: 8px; font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
header { display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 56px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 600; white-space: nowrap; } .brand span { color: var(--muted); font-weight: 400; }
nav { display: flex; gap: 4px; }
nav button { border: 0; background: none; padding: 8px 14px; border-radius: 6px; font: inherit; color: var(--muted); cursor: pointer; }
nav button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
nav b { background: var(--accent); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 11px; margin-left: 4px; }
nav b:empty { display: none; }
.rate { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
main { padding: 20px; max-width: 1400px; margin: 0 auto; }
.tab { display: none; } .tab.active { display: block; }
.muted { color: var(--muted); }
h2 { font-size: 16px; margin: 0 0 12px; }

input, select, textarea { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
button { font: inherit; cursor: pointer; border-radius: 6px; padding: 6px 12px; border: 1px solid var(--accent); background: var(--accent); color: #fff; }
button.ghost { background: #fff; color: var(--accent); border-color: var(--line); }
button.small { padding: 2px 8px; font-size: 12px; }
button:disabled { opacity: .5; cursor: default; }
.chk { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }

.filters, .calc-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters input[type=search] { width: 240px; }
.calc-controls label { display: inline-flex; gap: 6px; align-items: center; }

.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card .table-wrap { border: 0; }
table.grid { width: 100%; border-collapse: collapse; }
.grid th, .grid td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
/* Зебра: строки не сливаются, на телефоне читать заметно проще */
.grid tbody tr:nth-child(even) { background: #fafbfd; }
.grid tbody tr.total { background: #f2f5fa; }
/* Длинный каталог: шапка таблицы остаётся на месте при прокрутке */
.grid thead th { position: sticky; top: 0; z-index: 2; background: #f7f8fa; border-bottom: 1px solid var(--line); }
.thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: #eef0f3; display: block; }
.thumb-empty { width: 44px; height: 44px; border-radius: 6px; background: #eef0f3; display: flex; align-items: center;
  justify-content: center; color: var(--muted); font-size: 11px; }
.grid th { font-size: 12px; font-weight: 600; color: var(--muted); background: #fafbfc; position: sticky; top: 0; }
.grid tbody tr:hover { background: #fafcff; }
#catalogTable tbody tr { cursor: pointer; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.grid.edit input, .grid.edit select { width: 100%; min-width: 70px; padding: 4px 6px; }
.grid.edit td { padding: 4px 6px; }
tr.total td { font-weight: 600; background: #fafbfc; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.b-draft { background: #eef0f3; color: #4b5563; } .b-check { background: var(--warn-soft); color: var(--warn); }
.b-verified { background: var(--ok-soft); color: var(--ok); } .b-archived { background: #f1f1f1; color: #999; }
.b-est { background: var(--warn-soft); color: var(--warn); } .b-ok { background: var(--ok-soft); color: var(--ok); }
.b-sample { background: var(--warn-soft); color: var(--warn); font-size: 11px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.card.narrow { max-width: 720px; }
.steps { padding-left: 20px; line-height: 1.7; }
.drop { display: block; border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); cursor: pointer; margin: 12px 0; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input { display: none; }
.empty { padding: 40px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi .l { color: var(--muted); font-size: 12px; } .kpi .v { font-size: 20px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi.main { border-color: var(--accent); } .kpi.main .v { color: var(--accent); }
.warnings { background: var(--warn-soft); color: var(--warn); border-radius: var(--radius); padding: 10px 14px 10px 30px; margin: 0 0 16px; }
.qty { width: 64px; text-align: right; }

.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--panel); border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(0,0,0,.08); z-index: 10; display: flex; flex-direction: column; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 2px 0 0; }
.drawer-body { overflow-y: auto; padding: 16px 18px 40px; }
.drawer h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 20px 0 8px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.form label.full { grid-column: 1 / -1; }
.form .chk { flex-direction: row; }
.actions { display: flex; gap: 8px; margin-top: 16px; position: sticky; bottom: -40px; background: var(--panel); padding: 12px 0; }
.quick { background: var(--accent-soft); border-radius: var(--radius); padding: 10px 14px; margin-top: 12px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1d2330; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 20; }
.toast.err { background: var(--bad); }

/* Планшет и уже: шапка в две строки, меню прокручивается горизонтально */
@media (max-width: 1100px) {
  header { flex-wrap: wrap; height: auto; padding: 8px 14px; gap: 6px 12px; }
  .rate { order: 2; margin-left: auto; }
  nav { order: 3; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: 2px; }
  nav::-webkit-scrollbar { display: none; }
  nav button { flex: 0 0 auto; white-space: nowrap; padding: 9px 12px; }
  .user-box { order: 4; width: 100%; justify-content: flex-end; }
}

/* Телефон: крупные цели под палец, одна колонка */
@media (max-width: 900px) {
  .brand { font-size: 14px; }
  .brand span { display: none; }
  .rate { font-size: 12px; }
  nav button { min-height: 40px; padding: 10px 12px; }
  .user-box { font-size: 12px; }
  main { padding: 12px; }
  .card { padding: 12px; }
  h1, h2 { font-size: 15px; }
  /* поля не выходят за экран и удобны для пальца */
  select, textarea, input:not([type=checkbox]):not([type=radio]) { max-width: 100%; }
  button, select, textarea, input:not([type=checkbox]):not([type=radio]) { min-height: 40px; }
  /* чекбоксы крупнее — иначе не попасть пальцем */
  input[type=checkbox], input[type=radio] { width: 18px; height: 18px; }
  .chk { gap: 8px; }
  .filters { gap: 8px; }
  .filters > * { max-width: 100%; }
  .form { grid-template-columns: 1fr; }
  /* «Расчёт»: подписи и поля в столбик, иначе select растягивает строку */
  .calc-controls { flex-direction: column; align-items: stretch; gap: 10px; }
  .calc-controls label { display: flex; flex-direction: column; align-items: stretch; gap: 4px; font-size: 12px; color: var(--muted); }
  .calc-controls label.chk { flex-direction: row; align-items: center; }
  .calc-controls select, .calc-controls button { width: 100%; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 10px; }
  .kpi .v { font-size: 17px; }
  .toast { left: 12px; right: 12px; transform: none; text-align: center; }
  /* кнопки в шапке таблиц не липнут к краю */
  .table-wrap { border-radius: 6px; }
}

[hidden] { display: none !important; }

/* Импорт PDF */
.ghost-file input { display: none; }
.ghost-file .btn { display: inline-block; padding: 6px 12px; border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; }
.review-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 40%); gap: 16px; align-items: start; }
.pdf-view { position: sticky; top: 72px; height: calc(100vh - 100px); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #f0f0f0; }
.pdf-view iframe { width: 100%; height: 100%; border: 0; }
.items td input, .items td select { width: 100%; padding: 4px 6px; }
.items td { vertical-align: top; padding: 6px; }
.items tr.st-accepted { background: #f3faf6; } .items tr.st-rejected { opacity: .45; } .items tr.st-published { background: #f5f7fb; }
.items .pg { font-size: 12px; margin-right: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: #fff; color: var(--muted); padding: 3px 8px; font-size: 12px; }
.seg button.on-accepted { background: var(--ok); color: #fff; } .seg button.on-rejected { background: var(--bad); color: #fff; }
.b-review { background: var(--accent-soft); color: var(--accent); } .b-processing, .b-queued { background: var(--warn-soft); color: var(--warn); }
.b-done { background: var(--ok-soft); color: var(--ok); } .b-failed { background: var(--bad-soft); color: var(--bad); }
.pre { white-space: pre-wrap; font-size: 13px; }
@media (max-width: 1000px) { .review-grid { grid-template-columns: 1fr; } .pdf-view { position: static; height: 70vh; } }
.items { min-width: 980px; }

/* Проекты и 3D-редактор */
.link { color: var(--accent); cursor: pointer; }
.pj-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.pj-title { font-size: 16px; font-weight: 600; min-width: 260px; }
.pj-body { display: grid; grid-template-columns: 260px minmax(0, 1fr) 280px; gap: 12px; height: calc(100vh - 150px); min-height: 520px; }
.pj-left, .pj-right { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; overflow-y: auto; }
.pj-left h3, .pj-right h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 8px; }
.pj-center { position: relative; display: flex; flex-direction: column; min-width: 0; }
.pj-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.pj-hint { font-size: 12px; margin-left: auto; }
.pj-canvas { flex: 1; position: relative; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #eef0f3; min-height: 300px; }
.pj-canvas canvas { display: block; }
.pj-canvas .empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border: 0; }
.pj-sel { position: absolute; left: 12px; right: 12px; bottom: 12px; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; box-shadow: 0 4px 16px rgba(0,0,0,.08); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.pj-sel input[type=number] { width: 80px; }
.room-btn { display: flex; justify-content: space-between; width: 100%; text-align: left; margin-bottom: 4px; background: #fff; color: var(--text); border-color: var(--line); }
.room-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.room-btn span { color: var(--muted); font-size: 12px; }
.open-row { display: grid; grid-template-columns: 70px 52px 1fr 1fr 24px; gap: 4px; margin-bottom: 4px; align-items: center; }
.open-row input, .open-row select { padding: 3px 4px; font-size: 12px; min-width: 0; }
.pk-list { margin-top: 8px; }
.pk-item { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.pk-item .t { flex: 1; min-width: 0; } .pk-item .t div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.issues-list li { margin: 3px 0; cursor: pointer; }
.issues-list li:hover { text-decoration: underline; }
@media (max-width: 1100px) { .pj-body { grid-template-columns: 1fr; height: auto; } .pj-canvas { height: 60vh; } .pj-hint { display: none; } }

/* Телефон и планшет: панели редактора переключаются вкладками, а не тянутся друг за другом */
.pj-mob-seg { display: none; }
@media (max-width: 1100px) {
  .pj-mob-seg { display: flex; gap: 6px; margin-bottom: 10px; position: sticky; top: 0; z-index: 5;
    background: var(--bg, #f4f5f7); padding: 4px 0; }
  .pj-mob-seg button { flex: 1; min-height: 44px; font-size: 14px; }
  .pj-body { display: block; height: auto; }
  .pj-body > .pj-left, .pj-body > .pj-center, .pj-body > .pj-right { display: none; }
  .pj-body.mob-left > .pj-left { display: block; }
  .pj-body.mob-center > .pj-center { display: flex; }
  .pj-body.mob-right > .pj-right { display: block; }
  .pj-body .pj-canvas { height: 46vh; min-height: 260px; }
  .pj-left, .pj-right { max-height: none; }
  /* крупные цели для пальца */
  button, .small, select, input[type=number], input[type=search] { min-height: 42px; }
  .open-row { grid-template-columns: 64px 1fr 1fr 32px; }
  .open-row input, .open-row select { font-size: 14px; }
}
.pj-options .seg button { padding: 4px 10px; }

/* Кнопки перемещения помещения */
.room-row { display: flex; gap: 4px; align-items: stretch; margin-bottom: 4px; }
.room-row .room-btn { flex: 1; min-width: 0; }
.room-move { display: flex; flex-direction: column; gap: 2px; }
.mini { width: 30px; padding: 0; font-size: 12px; line-height: 1; }
.mini[disabled] { opacity: .35; }

/* Каталог на телефоне: таблица превращается в карточки, без горизонтальной прокрутки */
@media (max-width: 760px) {
  #catalogTable thead { display: none; }
  #catalogTable, #catalogTable tbody, #catalogTable tr, #catalogTable td { display: block; width: auto; }
  #catalogTable tr { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; padding: 8px 10px; background: var(--panel); }
  #catalogTable td { border: 0; padding: 2px 0; display: flex; gap: 8px; }
  #catalogTable td::before { content: attr(data-label); color: var(--muted); font-size: 12px; min-width: 86px; flex: 0 0 86px; }
  #catalogTable td:empty { display: none; }
}

/* Помощь: горячие клавиши */
#helpBtn { position: fixed; right: 16px; bottom: 16px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel); color: var(--muted); font-size: 18px; font-weight: 600; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.12); z-index: 30; }
#helpBtn:hover { color: var(--accent); border-color: var(--accent); }
#helpPanel { position: fixed; right: 16px; bottom: 68px; width: min(330px, calc(100vw - 32px)); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: 0 8px 24px rgba(0,0,0,.16); z-index: 31; }
#helpPanel h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 8px; }
#helpPanel ul { margin: 0 0 10px; padding-left: 18px; font-size: 13px; line-height: 1.5; }
#helpPanel b { font-weight: 600; }

/* Пользователь и роли */
.user-box { display: flex; gap: 6px; align-items: center; font-size: 13px; white-space: nowrap; }
nav button[hidden] { display: none; }
/* Дизайнер не видит закупочных цен и расчёта */
body[data-role="designer"] .staff-only { display: none !important; }

/* Планировка помещения */
.plan-box input[type=file] { max-width: 100%; }
.plan-box input[type=range] { width: 100%; }
.plan-box .form { gap: 8px 10px; }
.plan-box .filters { margin-bottom: 0; }

/* Рабочее окно: палитра и спокойная компоновка конструктора офиса. */
#pjEditor { --bg:#f3f5f4; --text:#263b42; --muted:#64756c; --line:#dce3df; --accent:#245d4b; --accent-soft:#e7f0ea; color:var(--text); background:var(--bg); border-radius:12px; padding:16px; }
#pjEditor .pj-head { background:white; padding:16px; border:1px solid var(--line); border-radius:12px; }
#pjEditor button { min-height:36px; border-radius:8px; }
#pjEditor .pj-steps { display:flex; gap:6px; overflow-x:auto; padding:4px 0 12px; }
#pjEditor .pj-steps button { display:flex; align-items:center; gap:7px; flex:1 0 auto; color:var(--muted); background:white; border:1px solid var(--line); padding:10px; }
#pjEditor .pj-steps button span { display:inline-grid; place-items:center; width:24px; height:24px; border-radius:50%; background:#edf2ee; }
#pjEditor .pj-steps button[aria-current=step] { color:var(--accent); background:var(--accent-soft); border-color:#95b7a5; font-weight:600; }
.pj-guide { display:flex; align-items:center; justify-content:space-between; gap:20px; background:white; padding:20px; border:1px solid var(--line); border-radius:12px; }
.pj-eyebrow { font-size:12px; color:var(--accent); }
.pj-guide h2 { font-size:23px; margin:6px 0; }
.pj-guide p { max-width:850px; color:var(--muted); line-height:1.6; margin:0; }
.pj-guide-actions { display:flex; gap:8px; flex-shrink:0; }
.pj-progress { color:var(--muted); font-size:13px; padding:14px 2px; }
.pj-design-actions { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:14px; }
.pj-design-actions[hidden] { display:none; }
#pjEditor .pj-body { height:calc(100vh - 340px); min-height:540px; grid-template-columns:280px minmax(0,1fr) 280px; }
#pjEditor .pj-canvas { background:white; border-radius:12px; }
#pjEditor[data-step=object] .pj-body { display:block; height:auto; min-height:0; }
#pjEditor[data-step=object] .pj-left { max-width:760px; }
#pjEditor[data-step=object] .pj-center, #pjEditor[data-step=object] .pj-right,
#pjEditor[data-step=object] #pjMobSeg,
#pjEditor:not([data-step=cost]) #pjSpec,
#pjEditor:not([data-step=quote]) #pjQuotes, #pjEditor:not([data-step=quote]) #pjPayments,
#pjEditor[data-step=cost] .pj-body, #pjEditor[data-step=quote] .pj-body,
#pjEditor[data-step=cost] #pjMobSeg, #pjEditor[data-step=quote] #pjMobSeg,
#pjEditor[data-step=cost] #pjIssues, #pjEditor[data-step=quote] #pjIssues,
#pjEditor[data-step=object] #pjIssues { display:none; }
#pjEditor:not([data-step=plan]) [data-worksection=plan],
#pjEditor:not([data-step=design]) [data-worksection=design] { display:none; }
#pjEditor[data-step=plan] .pj-right, #pjEditor[data-step=design] .pj-right { display:none; }
#pjEditor[data-step=plan] .pj-body, #pjEditor[data-step=design] .pj-body { grid-template-columns:300px minmax(0,1fr); }
@media(max-width:1100px) {
  #pjEditor { padding:8px; }
  .pj-guide { align-items:flex-start; flex-direction:column; padding:15px; gap:12px; }
  .pj-guide h2 { font-size:21px; }
  .pj-guide-actions { width:100%; justify-content:space-between; }
  #pjEditor .pj-body { display:block; height:auto; min-height:0; }
  #pjEditor .pj-body > .pj-left, #pjEditor .pj-body > .pj-center, #pjEditor .pj-body > .pj-right { display:none; }
  #pjEditor .pj-body.mob-left > .pj-left, #pjEditor[data-step=object] .pj-body > .pj-left { display:block; }
  #pjEditor .pj-body.mob-center > .pj-center { display:flex; }
  #pjEditor[data-step=layout] .pj-body.mob-right > .pj-right, #pjEditor[data-step=catalog] .pj-body.mob-right > .pj-right { display:block; }
  #pjEditor[data-step=plan] [data-pjmob=right], #pjEditor[data-step=design] [data-pjmob=right] { display:none; }
  #pjEditor .pj-head > * { max-width:100%; }
  #pjEditor .pj-title { min-width:0; width:100%; }
  #pjEditor .pj-canvas { height:50vh; min-height:300px; }
}

@media(max-width:1100px) {
  #pjEditor[data-step=object] .pj-body > .pj-center, #pjEditor[data-step=object] .pj-body > .pj-right { display:none; }
}
/* План загружается до создания помещения; результат проверяется на втором этапе. */
#pjEditor:not([data-step=object]) #pjObjectUpload,
#pjEditor:not([data-step=plan]) #pjRecognition,
#pjRecognition[hidden] { display:none; }
#pjObjectUpload p, #pjRecognition p { line-height:1.55; }
.pu-review { display:grid; grid-template-columns:minmax(0,1.3fr) minmax(280px,1fr); gap:20px; align-items:start; }
.pu-preview { background:#f3f5f4; border:1px solid var(--line); border-radius:10px; overflow:auto; }
.pu-preview svg { display:block; width:100%; max-height:75vh; }
.pu-room { border:1px solid var(--line); border-radius:10px; padding:12px; margin:0 0 14px; min-width:0; }
.pu-room > label { display:grid; gap:5px; margin-bottom:10px; }
.pu-room .form { grid-template-columns:repeat(3,minmax(0,1fr)); }
.pu-room input { min-width:0; max-width:100%; }
.pu-error { color:var(--bad); }
@media(max-width:800px) { .pu-review { grid-template-columns:minmax(0,1fr); } .pu-room .form { grid-template-columns:1fr; } #pjObjectUpload .filters > * { max-width:100%; } }

/* Поля замеров и маршрут не расширяют экран телефона. */
#pjRoute { max-width: 100%; min-width: 0; }
#rpMeasurements { box-sizing: border-box; width: 100%; min-width: 0; }
#rpVertices input { min-width: 0; }
.open-row label { min-width: 0; }
.open-row label input { width: 100%; box-sizing: border-box; }

/* Конструктор свободной мебели — отдельное рабочее поле этапа 3. */
#pjEditor:not([data-step=layout]) #pjLayout,
#pjEditor[data-step=layout] #pjBody,
#pjEditor[data-step=layout] #pjMobSeg,
#pjEditor[data-step=layout] #pjIssues { display:none !important; }
#pjLayout { color:#263b42; min-width:0; }
#pjLayout * { box-sizing:border-box; }
#pjLayout input,#pjLayout select,#pjLayout textarea { min-width:0; max-width:100%; }
.lc-head { display:flex; align-items:end; gap:18px; flex-wrap:wrap; margin-bottom:14px; }
.lc-head h2 { margin:0 0 8px; }
.lc-head p { color:#64756c; margin:0; }
.lc-head label { display:grid; gap:5px; }
.lc-tools { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:12px 0; }
.lc-tools label { display:flex; align-items:center; gap:5px; }
.lc-work { display:grid; grid-template-columns:minmax(0,1fr) 315px; gap:16px; align-items:start; }
.lc-paper,.lc-side section { padding:14px; background:#fff; border:1px solid #dde4df; border-radius:12px; min-width:0; }
.lc-paper { position:sticky; top:12px; }
#lcCanvas { display:block; width:100%; height:65vh; min-height:400px; background:white; touch-action:none; outline:none; }
#lcCanvas:focus { box-shadow:0 0 0 2px #95b7a5; }
.lc-side { display:grid; gap:12px; min-width:0; }
.lc-side h3 { margin:0 0 12px; }
.lc-side p,.lc-paper p { line-height:1.5; overflow-wrap:anywhere; }
.lc-side label { display:grid; gap:4px; }
.lc-type { display:grid; grid-template-columns:minmax(0,1fr) 62px; gap:8px; align-items:center; margin:7px 0; }
.lc-type label { display:flex; align-items:center; gap:6px; font-size:13px; }
.lc-type input[type=number] { width:62px; }
.lc-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin:12px 0; }
.lc-item { display:flex; align-items:center; gap:6px; margin:5px 0; }
.lc-item button { flex:1; text-align:left; white-space:normal; }
.lc-item .selected { background:#e7f0ea; border-color:#245d4b; }
.lc-error { color:#a23e26; }
.lc-file { border:1px solid #dde4df; border-radius:8px; padding:7px; cursor:pointer; }
.lc-file input { max-width:130px !important; }
#lcSuggest { width:100%; margin-top:10px; white-space:normal; background:#245d4b; color:white; }
#lcBrief { width:100%; }
#lcStatus { font-size:13px; overflow-wrap:anywhere; }
@media(max-width:900px) {
 .lc-work { grid-template-columns:minmax(0,1fr); }
 .lc-paper { position:static; }
 #lcCanvas { height:55vh; min-height:350px; }
 .lc-head { display:block; }
 .lc-head label { margin-top:10px; }
 .lc-head select { width:100%; }
 .lc-side { grid-template-columns:minmax(0,1fr); }
}

#pjEditor:not([data-step=design]) #pjInterior {display:none}
#pjInterior {margin-bottom:14px;min-width:0}
#pjInterior h3 {margin-top:0}
#pjInterior p {line-height:1.5}
.ik-fields {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin:12px 0}
#pjInterior label {display:grid;gap:6px;min-width:0}
#pjInterior input,#pjInterior select,#pjInterior textarea {min-width:0;max-width:100%;box-sizing:border-box}
#ikNote {width:100%}
#pjInterior details {margin:12px 0;padding:10px;border:1px solid #dce3df;border-radius:8px}
.ik-palette {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:12px}
.ik-row {display:grid;grid-template-columns:minmax(0,1fr) 44px 80px;gap:6px}
#pjInterior .filters {flex-wrap:wrap}
#pjInterior .filters button {white-space:normal}
@media(max-width:700px){.ik-fields,.ik-palette{grid-template-columns:minmax(0,1fr)}#pjInterior .filters>*{max-width:100%}}
