@font-face { font-family: Manrope; font-weight: 400; font-display: swap; src: url(fonts/manrope-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+2190-21FF; }
@font-face { font-family: Manrope; font-weight: 400; font-display: swap; src: url(fonts/manrope-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-024F; }
@font-face { font-family: Manrope; font-weight: 400; font-display: swap; src: url(fonts/manrope-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0400-04FF; }
@font-face { font-family: Manrope; font-weight: 700; font-display: swap; src: url(fonts/manrope-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: Manrope; font-weight: 700; font-display: swap; src: url(fonts/manrope-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-024F; }
@font-face { font-family: Manrope; font-weight: 700; font-display: swap; src: url(fonts/manrope-cyrillic-700-normal.woff2) format('woff2'); unicode-range: U+0400-04FF; }

:root {
  --navy: #0e1a38; --navy-2: #14244a; --line: #22345f; --paper: #eef2f7; --white: #fff;
  --ink: #1b2233; --muted: #5d6b85; --gold: #d6b676; --light: #e3a33c; --sel: #2f6fed; --warn: #d9480f;
  font: 15px/1.4 Manrope, system-ui, sans-serif; color: var(--ink);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: grid; overflow: hidden; background: var(--paper);
  grid-template: "top top top" 56px "tools stage side" 1fr / 88px 1fr 330px;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }

.top { grid-area: top; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--navy); color: #f3f6fa; }
.logo { font-size: 18px; letter-spacing: .02em; margin-right: auto; white-space: nowrap; }
.logo i { color: var(--gold); font-style: normal; }
.logo span { font-weight: 400; color: #c9d2de; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: none; padding: 8px 16px; min-height: 40px; }
.seg [aria-pressed="true"] { background: var(--gold); color: var(--navy); font-weight: 700; }
.ic { min-width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--navy-2); display: grid; place-items: center; }
.ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }

.tools { grid-area: tools; display: flex; flex-direction: column; gap: 4px; padding: 8px 6px; background: var(--white); border-right: 1px solid #d6dde8; overflow: auto; }
.tools button { display: grid; justify-items: center; gap: 2px; padding: 8px 2px; border: 1px solid transparent; border-radius: 10px; background: none; font-size: 11px; line-height: 1.15; text-align: center; }
.tools svg { width: 26px; height: 26px; fill: none; stroke: var(--navy); stroke-width: 1.6; }
.tools [aria-pressed="true"] { background: var(--navy); color: #fff; }
.tools [aria-pressed="true"] svg { stroke: var(--gold); }

.stage-wrap { grid-area: stage; position: relative; min-width: 0; min-height: 0; }
.status { position: absolute; inset: 8px 8px auto; margin: 0; padding: 6px 10px; border-radius: 8px; background: rgba(255,255,255,.85); color: var(--muted); font-size: 13px; pointer-events: none; z-index: 1; }
.plan { width: 100%; height: 100%; display: block; touch-action: none; user-select: none;
  background: linear-gradient(#dfe5ee 1px, transparent 1px) 0 0 / 24px 24px, linear-gradient(90deg, #dfe5ee 1px, transparent 1px) 0 0 / 24px 24px; }
.plan .room { fill: #fff; stroke: var(--navy); stroke-width: 3; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.plan .room.bad { stroke: var(--warn); stroke-dasharray: 6 4; }
.plan .wl { fill: var(--navy); text-anchor: middle; dominant-baseline: middle; font-weight: 700; }
.plan .hit { fill: transparent; stroke: transparent; stroke-width: 22; vector-effect: non-scaling-stroke; }
.plan .spot .body { fill: var(--light); stroke: #8a5a10; stroke-width: 1; vector-effect: non-scaling-stroke; }
.plan .lustr .body { fill: #fff3dc; stroke: #8a5a10; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.plan .lustr .core { fill: var(--light); }
.plan .line .body { stroke: var(--light); stroke-linecap: butt; }
.plan .track .body { stroke: #1d1d1d; }
.plan .track .lamp { fill: var(--light); }
.plan .niche { fill: rgba(227,163,60,.25); stroke: var(--light); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.plan .sel .body, .plan .niche.sel { stroke: var(--sel); stroke-width: 2.5; }
.plan .line.sel .body, .plan .track.sel .body { stroke: var(--sel); }
.plan .out .body { stroke: var(--warn); stroke-dasharray: 4 3; }
.plan .handle { fill: #fff; stroke: var(--sel); stroke-width: 2; vector-effect: non-scaling-stroke; cursor: grab; }
.plan .guide { stroke: #c2255c; stroke-width: 1; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.plan .ghost { stroke: var(--sel); stroke-width: 4; stroke-dasharray: 8 4; }
.plan .dim line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.plan .dim text { fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 4px; vector-effect: non-scaling-stroke; font-weight: 700; }
.plan .dim.warn line { stroke: var(--warn); }
.plan .dim.warn text { fill: var(--warn); }

.v3d { position: absolute; inset: 0; background: #07090e; }
.v3d .stage { position: absolute; inset: 0; color: #fff; display: grid; place-items: center; }
.v3d canvas { display: block; touch-action: none; }
.v3d-bar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 8px; }
.v3d-bar .btn { white-space: nowrap; background: rgba(14,26,56,.85); color: #fff; border-color: var(--line); }

.side { grid-area: side; min-height: 0; background: var(--white); border-left: 1px solid #d6dde8; display: flex; flex-direction: column; }
.sheet-handle { display: none; }
.panel { overflow: auto; padding: 14px 16px 24px; }
.panel h2 { margin: 0 0 12px; font-size: 18px; color: var(--navy); }
.panel h3 { margin: 16px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.box { padding: 10px; margin: 0 0 12px; border: 1px solid #dfe5ee; border-radius: 12px; }
.box h3 { margin-top: 0; }
.box small { display: block; margin-top: 6px; color: var(--muted); }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.row > * { flex: 1 1 120px; }
.f { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 6px; margin-bottom: 8px; }
.f span { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.f span:empty { display: none; }
.f input, .f select { width: 100%; min-height: 40px; padding: 6px 8px; border: 1px solid #c8d1de; border-radius: 8px; background: #fff; }
.f em { font-style: normal; color: var(--muted); font-size: 13px; }
.btn { min-height: 40px; padding: 8px 12px; border: 1px solid #c8d1de; border-radius: 10px; background: #fff; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 700; }
.btn.danger { color: var(--warn); border-color: #f0c2ad; }
.panel > .btn { width: 100%; margin-top: 8px; }
.walls { list-style: none; margin: 0 0 8px; padding: 0; }
.walls li { display: grid; grid-template-columns: 22px 1fr 76px 36px; gap: 6px; align-items: start; }
.walls li b { padding-top: 10px; color: var(--muted); }
.walls .f { margin-bottom: 6px; }
.walls .x { height: 40px; border: 1px solid #c8d1de; border-radius: 8px; background: #fff; }
.walls .closing { display: flex; gap: 6px; color: var(--muted); font-size: 13px; padding: 4px 0 8px; }
.walls .closing b { padding: 0; }
.stat { color: var(--muted); font-size: 13px; }
.warn { color: var(--warn); }
.chk { display: flex; gap: 8px; align-items: center; min-height: 40px; }
.sum { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; }
.sum dt { color: var(--muted); }
.sum dd { margin: 0; font-weight: 700; text-align: right; }

.hint { max-width: 440px; border: 0; border-radius: 16px; padding: 22px; box-shadow: 0 20px 60px rgba(8,16,38,.35); }
.hint::backdrop { background: rgba(8,16,38,.55); }
.hint h2 { margin: 0 0 10px; color: var(--navy); }
.hint ol { padding-left: 20px; margin: 0 0 16px; }
.hint li { margin-bottom: 8px; }
.hint .btn { width: 100%; }

/* telefon a menší tablet: nástroje dole, vlastnosti jako vysouvací list */
@media (max-width: 820px) {
  body { grid-template: "top" 56px "stage" 1fr "side" auto "tools" auto / 100%; }
  .logo span { display: none; }
  .tools { flex-direction: row; border: 0; border-top: 1px solid #d6dde8; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .tools button { flex: 1 1 0; min-width: 0; padding: 6px 0; font-size: 9px; letter-spacing: -.02em; }
  .status { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 4px 8px; }
  .tools svg { width: 22px; height: 22px; }
  .top { gap: 6px; padding: 0 8px; }
  .seg button { padding: 8px 10px; }
  .side { border: 0; border-top: 1px solid #d6dde8; }
  .sheet-handle { display: block; width: 100%; min-height: 40px; border: 0; background: #f6f8fb; font-weight: 700; color: var(--navy); }
  .sheet-handle::after { content: " ▲"; }
  body.sheet-open .sheet-handle::after { content: " ▼"; }
  .panel { display: none; max-height: 46vh; }
  body.sheet-open .panel { display: block; }
}
@media (prefers-reduced-motion: no-preference) { .tools button, .btn { transition: background .15s; } }

/* nábytek */
.plan .furn .body { fill: #ebe7e1; stroke: #8b919b; stroke-width: 1; vector-effect: non-scaling-stroke; }
.plan .furn .back { stroke: #5d6b85; stroke-width: 3; vector-effect: non-scaling-stroke; }
.plan .furn text { fill: #5d6b85; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.plan .furn.rug .body { fill: #f3eee6; stroke-dasharray: 4 3; }
.plan .furn.rug .back { display: none; }
.plan .furn.sel .body { stroke: var(--sel); stroke-width: 2.5; }
.cat { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.cat .btn { min-height: 40px; padding: 6px 8px; font-size: 13px; text-align: left; }
.cat [aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.wide { width: 100%; margin-bottom: 8px; }
.steps { padding-left: 18px; margin: 0 0 8px; font-size: 13px; }
.steps li { margin-bottom: 6px; }
.panel textarea { width: 100%; padding: 8px; border: 1px solid #c8d1de; border-radius: 8px; font: 12px/1.35 ui-monospace, monospace; margin-bottom: 8px; resize: vertical; }
.plan .furn .part { fill: #d9d3ca; stroke: #a8adb5; stroke-width: .5; vector-effect: non-scaling-stroke; }
.plan .win .body { fill: #e3f1f8; stroke: var(--navy); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.plan .win line { stroke: var(--navy); stroke-width: 1; vector-effect: non-scaling-stroke; }
.plan .door .body { fill: #fff; stroke: var(--navy); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.plan .door .swing { fill: none; stroke: #8b919b; stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.plan .win.sel .body, .plan .door.sel .body { stroke: var(--sel); stroke-width: 2.5; }
.plan .panel .body { fill: rgba(255, 226, 170, .45); stroke: var(--light); stroke-width: 2; vector-effect: non-scaling-stroke; }
.plan .panel.sel .body { stroke: var(--sel); }
.plan .seam line { stroke: #c2255c; stroke-width: 1; stroke-dasharray: 10 6; vector-effect: non-scaling-stroke; }
.plan .seam text { fill: #c2255c; }
.notes { margin: 0 0 12px; padding-left: 18px; font-size: 13px; color: var(--muted); }
.notes li { margin-bottom: 4px; }
.panel input[type=file] { grid-column: 1 / -1; font-size: 13px; }
@media (max-width: 820px) { .tools { overflow-x: auto; } .tools button { flex: 0 0 54px; } }

/* rozpočet */
.est { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 14px; }
.est td { padding: 6px 0; border-bottom: 1px solid #e3e8ef; vertical-align: top; }
.est td:last-child { text-align: right; white-space: nowrap; padding-left: 8px; font-weight: 700; }
.est small { display: block; color: var(--muted); font-size: 12px; }
.est .tot td { border: 0; padding-top: 10px; font-size: 18px; color: var(--navy); }
details.box summary { cursor: pointer; font-weight: 700; color: var(--navy); min-height: 32px; }
.panel input[type=text] { grid-column: 1 / -1; }

/* tisk nabídky a montážního listu (otevírá se v novém okně) */
body.doc { display: block; overflow: visible; height: auto; max-width: 820px; margin: 0 auto; padding: 24px; background: #fff; }
.doc header { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid var(--navy); padding-bottom: 8px; margin-bottom: 12px; }
.doc .logo { color: var(--navy); font-size: 22px; }
.doc .logo i { color: var(--gold); font-style: normal; }
.doc .est { font-size: 15px; }
.doc table:not(.est) { width: 100%; border-collapse: collapse; font-size: 12px; margin: 12px 0; }
.doc table:not(.est) th, .doc table:not(.est) td { border-bottom: 1px solid #ddd; padding: 5px 4px; text-align: left; vertical-align: top; }
.doc .print-plan { width: 100%; height: 360px; background: none; margin: 12px 0; }
.doc.fit .print-plan .furn { display: none; }
.doc .shot { width: 100%; border-radius: 8px; margin: 8px 0; }
.doc footer { margin-top: 16px; color: var(--muted); font-size: 12px; }
@media print { @page { margin: 12mm; } body.doc { padding: 0; } .doc .print-plan, .doc .shot, .doc tr { break-inside: avoid; } }
.plan .corner { fill: #c2255c; font-weight: 700; text-anchor: middle; dominant-baseline: middle; }

/* AI fotka */
.hint.ai { max-width: 560px; width: calc(100% - 24px); max-height: 92vh; overflow: auto; }
.ai img { width: 100%; border-radius: 10px; margin: 6px 0 10px; background: #0b0d12; }
.ai a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: inherit; }
.ai textarea { grid-column: 1 / -1; width: 100%; font: 12px/1.4 ui-monospace, monospace; padding: 8px; border: 1px solid #c8d1de; border-radius: 8px; }
.ai form { margin-top: 8px; }

.plan .rect .body { fill: none; stroke: var(--light); stroke-linejoin: miter; }
.plan .rect .hit { fill: none; }
.plan .rect.sel .body { stroke: var(--sel); }
.plan .rect.out .body { stroke: var(--warn); stroke-dasharray: 6 4; }

/* projekty */
.projects { list-style: none; margin: 12px 0; padding: 0; }
.projects li { padding: 10px 0; border-bottom: 1px solid #e3e8ef; }
.projects li.cur b { color: var(--sel); }
.projects small { display: block; color: var(--muted); margin-bottom: 6px; }

/* náhled pro klienta /v/ */
body.viewer { display: block; height: 100%; }
body.viewer .top { height: 56px; }
body.viewer .v3d { top: 56px; }
.vmsg { position: fixed; left: 50%; top: 45%; transform: translateX(-50%); color: #fff; font-size: 18px; text-align: center; margin: 0; }
