/* Тёмная тема в духе macOS: мягкий графитовый фон, системный синий акцент */
:root {
  color-scheme: dark;
  --bg: #161618;
  --surface: #1f1f22;
  --surface-2: #2a2a2e;
  --line: #3a3a3f;
  --line-soft: #2c2c30;
  --text: #ececf1;
  --muted: #9a9aa2;
  --accent: #0a84ff;
  --accent-soft: rgba(10, 132, 255, .16);
  --accent-text: #4aa3ff;
  --splash: #ff9f0a;
  --splash-soft: rgba(255, 159, 10, .14);
  --ok: #30d158;
  --warn: #ffc15e;
  --warn-soft: rgba(255, 159, 10, .10);
  --danger: #ff6961;
  --stone: #34343a;
  --stone-edge: #55555c;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
a { color: var(--accent-text); }
[hidden] { display: none !important; }

/* ---------- верхняя панель ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 28px;
  padding: 0 24px; height: 58px;
  background: rgba(22, 22, 24, .85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--accent); text-decoration: none; font-weight: 600; white-space: nowrap; }
.brand span { color: var(--text); }
nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
nav a { padding: 7px 12px; border-radius: 99px; color: var(--muted); text-decoration: none; white-space: nowrap; font-size: 14px; }
nav a:hover { color: var(--text); }
nav a.active { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: 0 0 0 1px var(--line); }
.user { display: flex; gap: 12px; align-items: center; white-space: nowrap; font-size: 14px; }

main { max-width: 1400px; margin: 0 auto; padding: 24px; }

/* ---------- элементы ---------- */
.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.stack > * + * { margin-top: 14px; }
.hint { font-size: 13px; color: var(--muted); }
.hint.bad { color: var(--danger); }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); min-width: 0; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid transparent; border-radius: 10px; padding: 9px 12px; min-width: 0; width: 100%;
  transition: border-color .15s, background .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--line); }
input:focus, select:focus, textarea:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder { color: #6e6e76; }
input[type=number] { font-variant-numeric: tabular-nums; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
input.mini { width: 72px; padding: 5px 8px; font-size: 14px; }
input.ghost { background: none; margin-top: 8px; padding-left: 12px; color: var(--muted); }
input.ghost:focus { color: var(--text); }
textarea { resize: vertical; min-height: 60px; }

button { font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 8px 14px; transition: background .15s, border-color .15s; }
button:hover { background: var(--surface-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
button.primary:hover { background: #2b95ff; border-color: #2b95ff; }
button.danger { color: var(--danger); }
button.link { background: none; border: none; padding: 4px; color: var(--accent-text); }
button.link.muted { color: var(--muted); }
button.link:hover { text-decoration: underline; }
button.icon { padding: 6px 9px; line-height: 1; }
button.ghost-btn { border-color: transparent; color: var(--muted); background: none; }
button.ghost-btn:hover { background: var(--surface-2); color: var(--text); }
button:disabled { opacity: .45; cursor: default; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: none; background: none; padding: 5px 12px; border-radius: 8px; color: var(--muted); }
.seg button.on { background: #3d3d43; color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.seg.full { display: flex; width: 100%; margin: 8px 0 6px; }
.seg.full button { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 6px 4px; font-size: 13px; }
.seg.full button small { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.seg.full button.on { color: var(--accent-text); font-weight: 500; }

.pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 9px; border-radius: 99px; font-size: 14px; color: var(--muted); border-color: var(--line-soft); background: var(--surface); }
.pill svg { width: 22px; height: 16px; fill: currentColor; opacity: .55; }
.pill.on { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); font-weight: 500; }
.pill.on svg { opacity: .9; }

select.add-select { width: auto; max-width: 100%; background: none; border: 1px dashed var(--line); color: var(--accent-text); padding: 6px 10px; font-size: 14px; }
select.add-select:hover { background: var(--accent-soft); border-color: transparent; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
th { font-size: 12px; font-weight: 500; color: var(--muted); }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }

.alert { padding: 12px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.alert.info { background: var(--accent-soft); color: var(--accent-text); }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100; }
#toast div { background: #3a3a40; color: #fff; padding: 10px 18px; border-radius: 10px; margin-top: 8px; font-size: 14px; animation: fade 3s forwards; }
#toast div.error { background: var(--danger); }
@keyframes fade { 0%, 85% { opacity: 1 } 100% { opacity: 0 } }

/* ---------- вход ---------- */
.login { max-width: 360px; margin: 14vh auto 0; padding: 28px; }
.login h1 { margin-bottom: 4px; }
.login form { display: grid; gap: 14px; margin-top: 20px; }

/* ---------- калькулятор ---------- */
.calc { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.calc-side { position: sticky; top: 78px; max-height: calc(100vh - 96px); overflow-y: auto; border-radius: var(--radius); }
.page-head .status-select { width: auto; font-size: 14px; padding: 6px 10px; background: var(--surface); border-color: var(--line-soft); }
.client-grid { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 10px; }
.card.client { padding: 14px; }

.product-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.product-head input.title { font-weight: 600; font-size: 17px; background: none; padding: 4px 8px; }
.product-num { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-weight: 600; font-size: 13px; }
.shape-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }

.product-body { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); gap: 22px; }
.dims { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.dims .field input { font-size: 16px; }
.unit-input { position: relative; display: block; }
.unit-input input { padding-right: 36px; }
.unit-input::after { content: 'мм'; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #6e6e76; font-size: 13px; pointer-events: none; }

.drawing { background: var(--surface-2); border-radius: 12px; padding: 10px; min-height: 250px; display: flex; flex-direction: column; }
.drawing-svg { flex: 1; display: flex; }
.drawing svg { width: 100%; height: 100%; max-height: 370px; flex: 1; }
.legend { font-size: 12px; color: var(--muted); padding: 6px 4px 0; text-align: center; }
.legend span { font-weight: 500; }
.lg-edge { color: var(--accent-text); }
.lg-splash { color: var(--splash); }

svg .piece { fill: var(--stone); stroke: var(--stone-edge); stroke-width: 1; vector-effect: non-scaling-stroke; }
svg .edge { stroke-linecap: round; vector-effect: non-scaling-stroke; pointer-events: none; }
svg .edge.st-none { stroke: #6e6e76; stroke-width: 1.5; }
svg .edge.st-edge { stroke: var(--accent); stroke-width: 4; }
svg .edge.st-splash { stroke: var(--splash); stroke-width: 4; stroke-dasharray: 1 7; }
svg .edge-hit { stroke: transparent; stroke-width: 22; vector-effect: non-scaling-stroke; cursor: pointer; }
svg .edge-hit:hover { stroke: rgba(10, 132, 255, .18); }
svg .dim { fill: var(--muted); font-weight: 500; }
svg .dim.st-edge { fill: var(--accent-text); }
svg .dim.st-splash { fill: var(--splash); }
svg .plabel { fill: #6e6e76; }
svg .wall rect { stroke: none; }

.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .5); max-height: 320px; overflow-y: auto; }
.combo-list div { padding: 8px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; color: var(--text); }
.combo-list div:hover, .combo-list div.hl { background: var(--accent-soft); }
.combo-list .grp { font-size: 12px; font-weight: 500; color: var(--muted); cursor: default; padding: 8px 12px 4px; }
.combo-list .grp:hover { background: none; }

.product-foot { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.items { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.item { display: flex; align-items: center; gap: 6px; padding: 3px 4px 3px 12px; border-radius: 99px; background: var(--surface-2); font-size: 14px; }
.item input { width: 56px; padding: 3px 6px; text-align: center; background: var(--surface); }
.item button { padding: 2px 6px; }
.info { font-size: 13px; color: var(--muted); }
.info label { display: inline-flex; align-items: center; gap: 6px; }

.add-product { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding: 4px 2px; }
.add-product .muted { margin-right: 4px; font-size: 14px; }

/* сводка */
.card.sum { padding: 0; overflow: hidden; }
.sum-sec { padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.sum-h { font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; display: block; }
summary .sum-h { margin: 0; }
.stone-group + .stone-group { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.sum-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 3px 0; }
details summary { cursor: pointer; list-style: none; font-size: 13px; color: var(--muted); padding: 4px 0; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: '›'; display: inline-block; margin-left: 6px; transition: transform .15s; }
details[open] > summary::after { transform: rotate(90deg); }
details summary.sum-line::after { order: -1; margin: 0 4px 0 0; }
details summary.sum-line { justify-content: flex-start; }
details summary.sum-line .num { margin-left: auto; color: var(--text); }
.slabs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.slabs svg { width: 104px; height: auto; border-radius: 4px; cursor: zoom-in; }
.slabs.big svg { width: 100%; cursor: zoom-out; }
.svc { display: grid; grid-template-columns: 1fr auto 82px 22px; align-items: center; gap: 8px; padding: 4px 0; font-size: 14px; }
.sum-sec .add-select { margin-top: 8px; width: 100%; }
.notes { padding: 12px 20px; background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.notes div + div { margin-top: 3px; }
.sum-foot { padding: 18px 20px 20px; background: var(--surface-2); }
.sum-total { display: flex; justify-content: space-between; align-items: baseline; }
.sum-total span { font-size: 15px; color: var(--muted); }
.sum-total b { font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.actions .primary { grid-column: 1 / -1; padding: 11px; }

/* ---------- прочие страницы ---------- */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { flex: 1; }
.page-head h1 + .muted { order: 3; width: 100%; margin-top: -8px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters input { max-width: 320px; background: var(--surface); }
.filters select { max-width: 200px; background: var(--surface); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

/* ---------- КП (печать) ---------- */
.kp {
  --text: #1d1d1f; --muted: #6e6e73; --line: #e2e2e6; --line-soft: #ececf0; --surface-2: #f5f5f7;
  --stone: #eeeef1; --stone-edge: #c7c7cc; --accent: #0a6fd6; --accent-text: #0a6fd6; --splash: #d97a00;
  color: var(--text); color-scheme: light;
}
.kp { max-width: 880px; margin: 0 auto; background: #fff; padding: 40px 44px; border-radius: var(--radius); border: 1px solid var(--line-soft); }
.kp-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 18px; }
.kp h1 { font-size: 24px; }
.kp h2 { margin: 24px 0 10px; }
.kp-product { display: grid; grid-template-columns: 280px 1fr; gap: 20px; margin-bottom: 14px; page-break-inside: avoid; }
.kp-product svg { width: 100%; height: auto; max-height: 230px; border-radius: 8px; background: var(--surface-2); }
.kp table td, .kp table th { padding: 7px 8px; }
.kp-total { margin-top: 18px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.kp-total .big { font-size: 24px; font-weight: 600; }
.print-bar { max-width: 880px; margin: 0 auto 14px; display: flex; gap: 10px; }

@media (max-width: 1100px) {
  .calc { grid-template-columns: 1fr; }
  .calc-side { position: static; max-height: none; }
}
@media (max-width: 720px) {
  main { padding: 14px 16px; }
  .topbar { gap: 10px; padding: 0 12px; }
  .brand span { display: none; }
  .client-grid { grid-template-columns: 1fr; }
  .product-body { grid-template-columns: 1fr; }
  .kp { padding: 20px 16px; }
  .kp-product { grid-template-columns: 1fr; }
  .user #userBtn { display: none; }
}
@media print {
  body { background: #fff; }
  .topbar, .print-bar, #toast { display: none !important; }
  main { padding: 0; max-width: none; }
  .kp { border: none; padding: 0; max-width: none; }
}

/* чертёж внутри белого КП */
.kp svg .wall rect { stroke: none; }
.kp svg .edge.st-none { stroke: #aeaeb2; }
.kp svg .plabel { fill: #aeaeb2; }

/* переключатель «Чертёж / На листе» и раскрой */
.draw-tabs { align-self: flex-start; margin-bottom: 6px; font-size: 13px; }
.drawing-svg.slab-view { display: block; }
.drawing svg.layout { max-height: none; height: auto; display: block; user-select: none; -webkit-user-select: none; }
.layout .slab { fill: #26262a; stroke: #55555c; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.layout .slab.new { fill: none; stroke: #45454b; stroke-dasharray: 6 6; }
.layout .slab-usable { fill: none; stroke: #3d3d43; stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.layout .slab-title { fill: var(--muted); }
.layout .part { cursor: grab; touch-action: none; }
.layout .part rect { fill: rgba(154, 154, 162, .22); stroke: #7a7a82; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.layout .part.mine rect { fill: rgba(10, 132, 255, .30); stroke: var(--accent); }
.layout .part.splash rect { fill: rgba(255, 159, 10, .22); stroke: var(--splash); }
.layout .part.bad rect { fill: rgba(255, 105, 97, .30); stroke: var(--danger); stroke-width: 2; }
.layout .part text { fill: var(--text); pointer-events: none; }
.layout .part text.sz { fill: var(--muted); }
.layout .part:hover rect { stroke-width: 2.5; }
.layout .part.dragging { cursor: grabbing; opacity: .85; }
.lg-manual { color: var(--accent-text); font-weight: 500; }

/* правка размеров прямо на чертеже */
.drawing { position: relative; }
svg .dim-edit { cursor: text; }
svg .dim-edit:hover { fill: var(--text); text-decoration: underline; }
.dim-input { position: absolute; z-index: 5; width: 96px; padding: 6px 8px; text-align: center; font-size: 17px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), 0 8px 24px rgba(0,0,0,.5); }

/* упрощённый чертёж */
svg .dimline, svg .ext { stroke: #6e6e76; stroke-width: 1; vector-effect: non-scaling-stroke; }
svg .ext { stroke: #4a4a50; }
svg .dim { fill: var(--text); font-weight: 500; }
.legend { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
.legend .lg i { display: inline-block; width: 16px; height: 3px; border-radius: 2px; }
.legend .lg i.e { background: var(--accent); }
.legend .lg i.s { background: var(--splash); }
.legend .lg i.n { background: #6e6e76; height: 1px; }
.svc .qty { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.svc .qty input { width: 52px; padding: 3px 4px; text-align: right; background: none; border-color: transparent; font-size: 14px; }
.svc .qty input:hover { border-color: var(--line); }
.svc .qty input::placeholder { color: var(--text); }

/* клиент — компактная кнопка и окно */
.client-chip { border-radius: 99px; padding: 6px 14px; font-size: 14px; background: var(--surface); border-color: var(--line-soft); display: inline-flex; align-items: center; gap: 8px; max-width: 60%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-chip.empty { color: var(--accent-text); border-style: dashed; border-color: var(--line); background: none; }
.client-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.client-chip .dot.st-sent { background: var(--accent); }
.client-chip .dot.st-accepted, .client-chip .dot.st-done { background: var(--ok); }
.client-chip .dot.st-rejected { background: var(--danger); }
.client-dialog { width: min(440px, calc(100vw - 32px)); background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.client-dialog::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px); }
.client-dialog form { display: grid; gap: 12px; }

/* фото камней и профили кромки */
.swatch { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; flex: none; background: var(--stone); display: inline-block; vertical-align: middle; }
.swatch.empty { background: linear-gradient(135deg, #3a3a40, #2a2a2e); }
.combo.with-swatch .swatch { position: absolute; left: 7px; top: 50%; transform: translateY(-50%); z-index: 1; }
.combo.with-swatch input { padding-left: 40px; }
.combo-list .combo-name { display: inline-flex; align-items: center; gap: 10px; }
.profile-svg { width: 100%; height: 100%; }
.profile-svg path { fill: #8e8e96; }
.edge-pick { position: relative; }
.edge-btn { display: flex; align-items: center; gap: 10px; width: 100%; background: var(--surface-2); border-color: transparent; padding: 5px 10px; text-align: left; }
.edge-btn .edge-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.edge-img { width: 42px; height: 30px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; overflow: hidden; background: #2f2f34; }
.edge-img img { width: 100%; height: 100%; object-fit: cover; }
.edge-pop { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: min(460px, 80vw); display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .5); }
.edge-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; text-align: center; background: var(--surface-2); border-color: transparent; }
.edge-tile .edge-img { width: 100%; height: 64px; }
.edge-tile b { font-weight: 500; font-size: 13px; }
.edge-tile small { color: var(--muted); font-size: 12px; }
.edge-tile.on { border-color: var(--accent); background: var(--accent-soft); }
.photo-cell { white-space: nowrap; }
.photo-cell img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; vertical-align: middle; margin-right: 6px; }
.kp-pics { display: flex; gap: 12px; margin-top: 10px; }
.kp-pics figure { margin: 0; width: 120px; }
.kp-pics img, .kp-pics .profile-svg { width: 120px; height: 80px; object-fit: cover; border-radius: 6px; background: #f2f2f4; display: block; }
.kp .profile-svg path { fill: #6e6e73; }
.kp-pics figcaption { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* вырезы и углы на чертеже */
svg .cut rect, svg .cut circle { fill: #1c1c1f; stroke: #9a9aa2; stroke-width: 1.2; vector-effect: non-scaling-stroke; stroke-dasharray: 4 3; }
svg .cut.movable { cursor: grab; }
svg .cut.movable:hover rect, svg .cut.movable:hover circle { stroke: var(--accent); }
svg .cut.bad rect, svg .cut.bad circle { stroke: var(--danger); }
svg .cut-label { fill: var(--muted); pointer-events: none; }
svg .cutdim { stroke: #7a7a82; stroke-width: 1; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
svg .cutnum { fill: var(--accent-text); font-weight: 500; }
svg .corner-dot { cursor: pointer; }
svg .corner-dot circle.hit { fill: transparent; stroke: none; }
svg .corner-dot circle.dot { fill: transparent; stroke: #6e6e76; stroke-width: 1; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; }
svg .corner-dot:hover circle.dot { stroke: var(--accent); fill: var(--accent-soft); }
svg .corner-dot.on circle.dot { stroke: var(--accent); fill: var(--accent); stroke-dasharray: none; }
svg .corner-size { fill: var(--accent-text); }
svg .corner-note { fill: var(--muted); }
.kp svg .cut rect, .kp svg .cut circle { fill: #fff; stroke: #1d1d1f; }
.kp svg .cutnum { fill: #0a6fd6; }

/* обработка карточками */
.proc { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; width: 100%; }
.proc-card { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 6px; border-radius: 12px; background: var(--surface-2); min-width: 0; }
.proc-card.auto { opacity: .85; }
.proc-img { width: 44px; height: 32px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; overflow: hidden; background: #2f2f34; }
.proc-img img { width: 100%; height: 100%; object-fit: cover; }
.proc-svg { width: 100%; height: 100%; }
.proc-svg > * { fill: #8e8e96; }
.proc-svg .hole { fill: #2f2f34; stroke: #2f2f34; }
.proc-name { display: flex; flex-direction: column; font-size: 14px; line-height: 1.25; }
.proc-name small { color: var(--muted); font-size: 12px; }
.stepper { display: inline-flex; align-items: center; gap: 2px; background: var(--surface); border-radius: 8px; padding: 2px; }
.stepper button { border: none; background: none; padding: 2px 9px; font-size: 16px; color: var(--accent-text); }
.stepper button:hover { background: var(--accent-soft); }
.stepper b { min-width: 18px; text-align: center; font-weight: 500; }
.qty-inline { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.qty-inline input { width: 64px; padding: 4px 6px; }
.proc-add { position: relative; display: flex; }
.proc-add-btn { border: 1px dashed var(--line); background: none; color: var(--accent-text); border-radius: 12px; padding: 8px 14px; font-size: 14px; }
.proc-add-btn:hover { background: var(--accent-soft); border-color: transparent; }
.proc-pop { position: absolute; z-index: 30; bottom: calc(100% + 6px); left: 0; width: min(560px, 86vw); max-height: 60vh; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .5); }
.proc-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; text-align: center; background: var(--surface-2); border-color: transparent; }
.proc-tile .proc-img { width: 100%; height: 64px; }
.proc-tile b { font-weight: 500; font-size: 13px; line-height: 1.2; }
.proc-tile small { color: var(--muted); font-size: 12px; }
.proc-hint { grid-column: 1 / -1; font-size: 12px; color: var(--muted); text-align: center; padding-top: 2px; }
.support-opts { gap: 10px; }

/* файлы */
.files-chip { max-width: none; }
.files-dialog { width: min(560px, calc(100vw - 32px)); }
.files-list { display: grid; gap: 8px; margin-top: 10px; max-height: 50vh; overflow-y: auto; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 6px; border-radius: 10px; background: var(--surface-2); }
.file-thumb { width: 52px; height: 52px; flex: none; border-radius: 8px; overflow: hidden; background: #2f2f34; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: none; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-name { flex: 1; min-width: 0; color: var(--text); text-decoration: none; display: flex; flex-direction: column; overflow: hidden; text-overflow: ellipsis; }
.file-name small { color: var(--muted); font-size: 12px; }
.file-upload { cursor: pointer; padding: 8px 14px; border-radius: 10px; color: var(--accent-text); }
.kp-product.wide { grid-template-columns: 1fr; }
.kp-product.wide svg { max-height: 420px; }

/* ---------- всё на одном экране ---------- */
.ptabs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.ptab { display: inline-flex; align-items: center; gap: 7px; border-radius: 10px; padding: 7px 14px 7px 10px; font-size: 14px; background: none; border-color: transparent; color: var(--muted); }
.ptab svg { width: 20px; height: 15px; fill: currentColor; opacity: .6; }
.ptab:hover { color: var(--text); background: var(--surface); }
.ptab.on { background: var(--surface); color: var(--text); border-color: var(--line-soft); font-weight: 500; }
.ptab.on svg { opacity: 1; fill: var(--accent); }
.ptab.add { color: var(--accent-text); border: 1px dashed var(--line); padding: 7px 14px; }
.add-wrap { position: relative; }
.add-pop { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; display: flex; flex-direction: column; gap: 4px; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .5); min-width: 190px; }
.add-pop .pill { justify-content: flex-start; border-color: transparent; background: none; }
.add-pop .pill:hover { background: var(--surface-2); color: var(--text); }
.product-head { flex-wrap: wrap; row-gap: 8px; margin-bottom: 14px; }
.product-head input.title { width: 190px; flex: none; }
.product-head .shape-pills { margin: 0; flex: 1; flex-wrap: wrap; gap: 4px; }
.product-head .pill { padding: 5px 10px 5px 8px; font-size: 13px; }
.product-foot { margin-top: 12px; padding-top: 12px; }
.card.client, .add-product { display: none; }

@media (min-width: 1101px) {
  main { padding-top: 16px; padding-bottom: 16px; }
  .calc { height: calc(100vh - 58px - 32px); align-items: stretch; }
  #calcMain { display: flex; flex-direction: column; min-height: 0; }
  #calcMain .page-head { margin-bottom: 10px; }
  .card.product { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 16px 18px; }
  .product-body { flex: 1; min-height: 0; }
  .product-body > .stack { overflow-y: auto; }
  .drawing { min-height: 0; }
  .drawing-svg { flex: 1; min-height: 0; }
  .drawing svg.plan { max-height: none; height: 100%; }
  .drawing-svg.slab-view { overflow-y: auto; }
  .calc-side { position: static; top: auto; max-height: none; height: 100%; overflow: hidden; }
  .card.sum { height: 100%; display: flex; flex-direction: column; overflow-y: auto; }
  .card.sum .sum-foot { margin-top: auto; }
}
@media (min-width: 1101px) and (max-width: 1500px) {
  .product-head .pill span { display: none; }
  .product-head .pill { padding: 6px 9px; }
}
@media (min-width: 1101px) { main { max-width: 1800px; } }

/* ---------- адаптация под экраны ---------- */
.calc-top { gap: 8px; }
.calc-top .qnum { font-weight: 600; font-size: 17px; margin-right: 6px; white-space: nowrap; }
.calc-top .grow { flex: 1; min-width: 8px; }
.mbar { display: none; }
svg .cut.movable { touch-action: none; }

/* ноутбуки и iPad в альбомной ориентации: уже колонки */
@media (min-width: 1101px) and (max-width: 1400px) {
  .calc { grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; }
  .product-body { grid-template-columns: 230px minmax(0, 1fr); gap: 14px; }
  .product-head input.title { width: 150px; }
}
/* невысокие экраны (13" ноутбуки, 1366×768): меньше отступов */
@media (min-width: 1101px) and (max-height: 820px) {
  main { padding-top: 10px; padding-bottom: 10px; }
  .calc { height: calc(100vh - 58px - 20px); }
  .card.product { padding: 12px 14px; }
  .product-head { margin-bottom: 8px; }
  .product-body > .stack > * + * { margin-top: 10px; }
  .product-foot { margin-top: 8px; padding-top: 8px; }
  .draw-tabs { margin-bottom: 2px; }
  .legend { padding-top: 2px; }
  .sum-sec { padding: 12px 16px; }
  .sum-foot { padding: 14px 16px 16px; }
  .sum-total b { font-size: 26px; }
  .actions { margin-top: 10px; }
  .actions .primary { padding: 9px; }
}
/* большие мониторы: шире рабочая область */
@media (min-width: 2200px) {
  main { max-width: 2300px; }
  .calc { grid-template-columns: minmax(0, 1fr) 440px; }
  .product-body { grid-template-columns: 340px minmax(0, 1fr); }
}
/* планшет вертикально и телефоны: одна колонка, итог закреплён внизу */
@media (max-width: 1100px) {
  main { padding-bottom: 90px; }
  .mbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; gap: 10px; align-items: center;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(22, 22, 24, .92); backdrop-filter: blur(10px); border-top: 1px solid var(--line-soft); }
  .mbar-total { flex: 1; display: flex; flex-direction: column; align-items: flex-start; background: none; border: none; padding: 0; line-height: 1.15; }
  .mbar-total small { color: var(--muted); font-size: 12px; }
  .mbar-total b { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .mbar .primary { padding: 11px 22px; }
  .drawing { min-height: 300px; }
}
@media (max-width: 720px) {
  .calc-top .qnum { font-size: 15px; }
  .calc-top .grow { flex-basis: 100%; height: 0; }
  .product-head { flex-wrap: wrap; }
  .product-head input.title { width: auto; flex: 1; }
  .product-head .shape-pills { flex-basis: 100%; order: 3; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .product-head .pill span { display: none; }
  .product-head .pill { padding: 7px 11px; flex: none; }
  .card.product { padding: 14px; }
  .drawing { min-height: 320px; padding: 6px; }
  .proc-card { width: 100%; }
  .proc-name { flex: 1; }
  .edge-pop, .proc-pop { width: calc(100vw - 48px); }
  .proc-pop { left: 0; }
  nav a { padding: 7px 9px; }
}
@media (max-width: 1100px) {
  .calc { grid-template-columns: minmax(0, 1fr); }
  .product-body { grid-template-columns: minmax(0, 1fr); }
  .product-body > .stack { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; align-items: end; }
  .product-body > .stack > * + * { margin-top: 0; }
}

/* ================= ТЕЛЕФОН ================= */
nav a svg { display: none; }
.mview { display: none; }

@media (max-width: 720px) {
  * { -webkit-tap-highlight-color: transparent; }
  input, select, textarea { font-size: 16px; } /* иначе iPhone приближает страницу при вводе */

  /* шапка компактная, разделы — внизу, как в приложении */
  .topbar { height: 50px; padding: 0 16px; gap: 10px; }
  .brand span { display: inline; font-size: 15px; }
  .user { margin-left: auto; }
  nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; justify-content: space-around; gap: 0; overflow: visible;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: rgba(22, 22, 24, .94); backdrop-filter: blur(14px); border-top: 1px solid var(--line-soft); }
  nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 2px; border-radius: 10px; font-size: 10.5px; min-width: 0; }
  nav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  nav a svg { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  nav a svg circle[r="1"], nav a svg circle[r="1.5"] { fill: currentColor; }
  nav a.active { background: none; box-shadow: none; color: var(--accent-text); }
  main { padding: 12px 14px calc(80px + env(safe-area-inset-bottom)); }

  /* калькулятор: два экрана вместо длинной ленты */
  .calc main, main:has(.calc) { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
  .mview { display: flex; position: sticky; top: 50px; z-index: 15; margin: -12px -14px 12px; padding: 8px 14px; border-radius: 0;
    background: rgba(22, 22, 24, .94); backdrop-filter: blur(14px); width: auto; }
  .mview button { flex: 1; padding: 8px; font-size: 14px; }
  .mview b { font-weight: 600; margin-left: 4px; font-variant-numeric: tabular-nums; }
  .calc.sum-view #calcMain { display: none; }
  .calc:not(.sum-view) .calc-side { display: none; }
  .mbar { bottom: calc(57px + env(safe-area-inset-bottom)); padding: 8px 14px; gap: 8px; }
  .mbar button:not(.primary):not(.mbar-total) { padding: 11px 14px; }
  .mbar-total b { font-size: 20px; }

  /* изделие: сначала крупный чертёж, потом настройки */
  .calc-top { margin-bottom: 8px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .calc-top .grow { display: none; }
  .calc-top .ptab, .calc-top .client-chip { flex: none; }
  .calc-top .qnum { display: none; }
  .card.product { padding: 12px; border-radius: 16px; }
  .product-head { margin-bottom: 10px; }
  .product-head input.title { font-size: 17px; padding: 4px 6px; }
  .product-body { display: flex; flex-direction: column; gap: 14px; }
  .product-body .drawing { order: -1; min-height: 0; padding: 6px; border-radius: 14px; }
  .drawing-svg { min-height: 300px; }
  .drawing svg.plan { height: 300px; max-height: none; }
  .drawing-svg.slab-view { min-height: 0; }
  .draw-tabs { align-self: stretch; display: flex; }
  .draw-tabs button { flex: 1; }
  .product-body > .stack { display: flex; flex-direction: column; gap: 12px; }
  .product-body > .stack > * + * { margin-top: 0; }
  .dims { grid-template-columns: 1fr 1fr; }
  .product-foot { margin-top: 12px; padding-top: 12px; }
  .proc { flex-direction: column; }
  .proc-add, .proc-add-btn { width: 100%; }
  .proc-add-btn { padding: 12px; }
  .stepper button { padding: 6px 14px; font-size: 18px; }

  /* выбор кромки, вырезов, изделия — снизу экрана */
  .edge-pop, .proc-pop, .add-pop {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 72vh; overflow-y: auto; z-index: 70;
    border-radius: 18px 18px 0 0; padding: 22px 14px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -12px 40px rgba(0, 0, 0, .6);
    grid-template-columns: 1fr 1fr; }
  .edge-pop::before, .proc-pop::before, .add-pop::before { content: ''; position: absolute; top: 8px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: var(--line); }
  .add-pop { display: grid; }
  .add-pop[hidden], .edge-pop[hidden], .proc-pop[hidden] { display: none; }
  .add-pop .pill { padding: 14px 12px; font-size: 15px; background: var(--surface-2); border-radius: 12px; }

  /* окна — снизу, во всю ширину */
  .client-dialog { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: 18px 18px 0 0; border-bottom: none; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  .client-dialog .row button { flex: 1; padding: 12px; }

  /* сводка */
  .card.sum { border-radius: 16px; }
  .sum-total b { font-size: 26px; }
  .actions { display: none; } /* кнопки уже внизу экрана */

  /* список расчётов — карточками */
  .filters { flex-direction: column; }
  .filters input, .filters select { max-width: none; }
  #qTable thead { display: none; }
  #qTable tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
  #qTable td { display: block; border: none; padding: 0; }
  #qTable .q-id { font-weight: 600; }
  #qTable .q-date, #qTable .q-sum, #qTable .q-status { text-align: right; justify-self: end; }
  #qTable .q-client { font-size: 16px; }
  #qTable .q-addr { grid-column: 1 / -1; }
  #qTable .q-man { display: none; }
  #qTable .q-acts { grid-column: 1 / -1; justify-content: flex-end; }
  #qTable td[colspan] { grid-column: 1 / -1; }
  .page-head { gap: 8px; }
  .page-head h1 { flex-basis: 100%; }
  .kp { border-radius: 12px; }
  .print-bar { flex-wrap: wrap; }
}
nav a .short { display: none; }
@media (max-width: 720px) {
  .topbar { backdrop-filter: none; background: #161618; } /* иначе нижняя панель «прилипает» к шапке */
  nav a .full { display: none; }
  nav a .short { display: inline; }
  .product-body > .stack { align-items: stretch; }
  .product-body > .stack > .row { justify-content: space-between; }
  .ptab, .client-chip { white-space: nowrap; }
  .mview { margin-top: -12px; }
}
@media (max-width: 720px) {
  .calc { gap: 0; }
  .calc-side { margin-top: 0; }
  #qTable tr.click:hover td { background: none; }
  #qTable tr.click:active { background: var(--surface-2); }
}

/* тип изделия — выпадающий список */
.shape-pick { position: relative; }
.shape-cur { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px 7px 10px; border-radius: 10px; background: var(--surface-2); border-color: transparent; font-size: 14px; }
.shape-cur svg { width: 24px; height: 17px; fill: var(--accent); }
.shape-cur i { font-style: normal; color: var(--muted); font-size: 12px; margin-left: 2px; }
.shape-pop { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 210px; display: flex; flex-direction: column; gap: 2px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .5); }
.shape-pop[hidden] { display: none; }
.shape-opt { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: none; background: none; border-radius: 8px; text-align: left; font-size: 14px; }
.shape-opt svg { width: 26px; height: 19px; fill: #8e8e96; flex: none; }
.shape-opt:hover { background: var(--surface-2); }
.shape-opt.on { background: var(--accent-soft); color: var(--accent-text); }
.shape-opt.on svg { fill: var(--accent); }
.pop-title { font-size: 12px; color: var(--muted); padding: 4px 10px 6px; grid-column: 1 / -1; }
.product-head .grow { flex: 1; }
@media (max-width: 720px) {
  .product-head input.title { flex: 1 1 100%; order: 0; }
  .shape-pick { order: 1; }
  .shape-pop { position: fixed; left: 0; right: 0; bottom: 0; top: auto; min-width: 0; max-height: 72vh; overflow-y: auto; z-index: 70;
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px; border-radius: 18px 18px 0 0; padding: 22px 14px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -12px 40px rgba(0, 0, 0, .6); }
  .shape-pop[hidden] { display: none; }
  .shape-pop::before { content: ''; position: absolute; top: 8px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: var(--line); }
  .shape-opt { padding: 14px 12px; background: var(--surface-2); border-radius: 12px; font-size: 15px; }
}
@media (max-width: 720px) {
  .product-head input.title { flex: 1 1 auto; width: auto; order: 0; }
  .product-head .ghost-btn { order: 1; }
  .product-head .grow { display: none; }
  .shape-pick { order: 2; flex-basis: 100%; }
  .shape-cur { width: 100%; padding: 11px 14px; font-size: 15px; }
  .shape-cur i { margin-left: auto; }
}

/* стена на чертеже */
svg .wall-hatch { stroke: #5a5a62; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
svg .wall-line { stroke: #6e6e76; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.kp svg .wall-hatch { stroke: #b8b8bf; }
.kp svg .wall-line { stroke: #9a9aa0; }
.legend .lg i.w { height: 8px; width: 18px; border-radius: 1px; background: repeating-linear-gradient(45deg, #6e6e76 0 1.5px, transparent 1.5px 4px); border-bottom: 1px solid #6e6e76; }
.legend .lg i.c { width: 10px; height: 10px; border-radius: 50%; border: 1px dashed #8e8e96; background: none; }

/* левая колонка: вырезы и сводка по изделию */
.product-body > .stack { display: flex; flex-direction: column; }
.product-body > .stack .proc { flex-direction: column; margin-top: 2px; }
.product-body > .stack .proc-card { width: 100%; }
.product-body > .stack .proc-add, .product-body > .stack .proc-add-btn { width: 100%; }
.product-body > .stack .proc-name { flex: 1; min-width: 0; font-size: 13px; }
.proc-pop { max-height: 70vh; overflow-y: auto; }
.pstats { margin-top: auto !important; padding-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line-soft); }
.pstats div { display: flex; justify-content: space-between; gap: 8px; }
.pstats b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.pstats .wide { grid-column: 1 / -1; }
@media (max-width: 720px) {
  .pstats { margin-top: 4px !important; }
  .proc-pop { position: fixed !important; top: auto !important; left: 0 !important; bottom: 0 !important; }
}

/* ---------- сводка «чеком» ---------- */
.receipt { padding: 0; }
.r-title { font-size: 17px; font-weight: 600; padding: 18px 20px 6px; }
.r-row { padding: 12px 20px; border-bottom: 1px solid var(--line-soft); display: block; }
.r-main { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 15px; list-style: none; cursor: default; }
details.r-row > summary.r-main { cursor: pointer; }
details.r-row > summary::-webkit-details-marker { display: none; }
details.r-row > summary::after { content: none; }
.r-main b { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chev { font-style: normal; color: var(--muted); display: inline-block; margin-left: 4px; transition: transform .15s; }
details[open] .chev { transform: rotate(90deg); }
.r-sub { font-size: 13px; color: var(--muted); margin-top: 3px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.r-group { margin-top: 10px; color: var(--text); }
.r-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; padding: 4px 0; font-variant-numeric: tabular-nums; }
.r-line > span:last-child { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.r-line .rm { opacity: 0; padding: 0 2px; font-size: 12px; }
.r-line:hover .rm, .r-line .rm:focus { opacity: 1; }
.r-line.extra input { padding: 4px 6px; font-size: 13px; }
.r-line.extra input[type=number] { width: 90px; text-align: right; }
.r-warn { margin: 4px 20px 6px; font-size: 12.5px; color: var(--warn); display: grid; gap: 2px; }
.warn-text { color: var(--warn) !important; font-weight: 500 !important; }
.link-select { width: auto; max-width: 100%; padding: 2px 22px 2px 0; background-color: transparent; border: none; color: var(--accent-text); font-size: 13px; cursor: pointer; }
.link-select:hover { border: none; text-decoration: underline; }
.link-select:focus { box-shadow: none; }
.link-select.add { margin-top: 4px; padding-left: 0; }
.receipt .qty { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 13px; margin-left: 6px; }
.receipt .qty input { width: 48px; padding: 2px 4px; text-align: right; background: var(--surface-2); border-color: transparent; font-size: 13px; }
.add-line { margin-top: 2px; padding: 2px 0; }
.receipt .sum-foot { margin-top: auto; }
.actions.two { grid-template-columns: 1fr 2fr; }
.actions.two .primary { grid-column: auto; }
@media (max-width: 720px) { .r-line .rm { opacity: 1; } }
.receipt details summary { color: var(--text); font-size: 15px; padding: 0; }
.link-select { -webkit-appearance: none; appearance: none; padding-right: 16px;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%234aa3ff' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 2px center / 9px 6px; }
svg.plan, svg.layout { user-select: none; -webkit-user-select: none; }
svg .cutdim { pointer-events: none; }

/* размеры: тянуть мышью или ввести */
svg .dim-edit[data-param] { cursor: ew-resize; touch-action: none; }
body.scrubbing, body.scrubbing * { cursor: ew-resize !important; user-select: none !important; }
body.scrubbing svg .dim-edit[data-param] { fill: var(--accent-text); }
.dim-input { width: 112px; }

/* 3D */
.drawing-svg.view3d { position: relative; min-height: 0; overflow: hidden; border-radius: 10px; background: radial-gradient(ellipse at 50% 30%, #34343a, #222226); }
.drawing-svg.view3d canvas { display: block; touch-action: none; cursor: grab; }
.drawing-svg.view3d canvas:active { cursor: grabbing; }
@media (max-width: 720px) { .drawing-svg.view3d { height: 320px; } }
