:root{--bg:#0b1220;--card:#111b2e;--line:#25324a;--txt:#eef3fb;--muted:#a8b3c7;--accent:#68a0ff;--ok:#39c98a;--danger:#ff6875}*{box-sizing:border-box}body{margin:0;background:#0a1020;color:var(--txt);font-family:Inter,system-ui,-apple-system,Segoe UI,sans-serif}header{border-bottom:1px solid var(--line);background:#0d1729}.wrap{width:min(1120px,calc(100% - 32px));margin:auto}.nav{display:flex;align-items:center;gap:18px;height:62px}.nav strong{margin-right:auto}.nav a{color:var(--muted);text-decoration:none}.card{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:22px;margin:18px 0}.narrow{max-width:480px;margin:64px auto}.public-head{padding:40px 0 12px}.public-head h1,.toolbar h1{font-size:clamp(30px,5vw,46px);margin:8px 0}.muted{color:var(--muted)}label{display:grid;gap:8px;color:var(--muted);font-size:14px}input,select,textarea{width:100%;padding:11px 12px;border-radius:10px;border:1px solid var(--line);background:#0b1323;color:var(--txt);font:inherit}textarea{resize:vertical}button,.button{display:inline-flex;align-items:center;justify-content:center;padding:11px 15px;border:0;border-radius:10px;background:var(--accent);color:#08101e;font-weight:700;cursor:pointer;text-decoration:none}.ghost{background:transparent;color:var(--txt);border:1px solid var(--line)}.danger{background:var(--danger);color:#26070a}.primary{background:var(--accent)}.big{width:100%;padding:15px;font-size:17px}.stack{display:grid;gap:18px}.toolbar{display:flex;gap:20px;justify-content:space-between;align-items:center;padding-top:28px}.actions,.unit-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin:20px 0}.stats div{padding:20px;background:var(--card);border:1px solid var(--line);border-radius:14px}.stats b{display:block;font-size:28px}.stats span{color:var(--muted)}.row{display:grid;grid-template-columns:1fr 1.5fr 1.7fr auto;gap:10px}.unit{display:flex;justify-content:space-between;gap:20px;align-items:center}.tag{font-size:12px;letter-spacing:.08em;color:var(--accent);font-weight:800}.status{padding:7px 10px;border-radius:999px;border:1px solid #745d14;color:#ffd66c;font-size:12px;font-weight:800}.status.done{color:#8ff0c5;border-color:#206f53}.flash{padding:12px 14px;border-radius:10px;margin-top:18px}.flash.success{background:#0d2f24}.flash.error{background:#3a1218}.balcony-title{display:flex;justify-content:space-between;align-items:flex-start}.balcony h2{margin:4px 0}.pd-frame,.admin-preview{position:relative;border:1px solid var(--line);border-radius:12px;overflow:hidden;background:#fff}.pd-frame img,.admin-preview img{display:block;width:100%;height:auto;user-select:none;-webkit-user-drag:none}.zone{position:absolute;border:3px solid #ff4d63;background:rgba(255,77,99,.16);box-shadow:0 0 0 1px rgba(255,255,255,.35) inset;pointer-events:none}.choices{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}.choices label{display:block}.choices input{position:absolute;opacity:0}.choices span{display:block;padding:15px;border:2px solid var(--line);border-radius:12px;text-align:center;color:var(--txt);font-weight:800}.choices input:checked+span{border-color:var(--accent);background:rgba(104,160,255,.12)}.grid2{display:grid;grid-template-columns:1fr 1fr;gap:14px}.check{display:flex;align-items:center;gap:10px}.check input{width:auto}.successbox{border-color:#206f53}.balcony-admin{border-top:1px solid var(--line);padding-top:18px;margin-top:18px}.balcony-admin form{margin-bottom:12px}.admin-preview{margin-bottom:10px}.hr,hr{border:0;border-top:1px solid var(--line);margin:24px 0}@media(max-width:920px){.choices{grid-template-columns:1fr 1fr}}
@media(max-width:760px){.row,.grid2,.choices,.stats{grid-template-columns:1fr}.toolbar,.unit{align-items:flex-start;flex-direction:column}.unit-actions{width:100%}.button,button{min-height:42px}}
.editor{cursor:crosshair;touch-action:none}.editor-hint{position:absolute;left:10px;bottom:10px;background:rgba(0,0,0,.72);color:#fff;padding:7px 9px;border-radius:8px;font-size:12px;pointer-events:none}

.admin-preview{touch-action:none;user-select:none}.admin-preview .zone{pointer-events:none}.editor-hint{z-index:5}

/* v5: highly visible balcony editor frame */
.admin-preview { position: relative; cursor: crosshair; }
.admin-preview img { user-select: none; -webkit-user-drag: none; }
.admin-preview .zone {
  border: 4px solid #ff00ff !important;
  background: rgba(255, 0, 255, 0.16) !important;
  box-shadow: 0 0 0 2px #ffffff, 0 0 14px rgba(255,0,255,.95) !important;
  pointer-events: none;
}

/* v6: copy invitation button */
.copy-invitation { cursor: pointer; }
.copy-invitation:disabled { opacity: .75; cursor: default; }

/* v7: owner-facing focused view of the exact marked balcony */
.focus-wrap{background:#0a1020;border:1px solid var(--line);border-radius:14px;padding:8px;overflow:hidden}
.pd-focus{position:relative;width:100%;height:clamp(300px,52vw,620px);overflow:hidden;background:#fff;border-radius:10px}
.pd-focus-image{position:absolute;max-width:none;user-select:none;-webkit-user-drag:none}
.pd-focus .zone{position:absolute!important;border:5px solid #00ff66!important;background:rgba(0,255,102,.15)!important;box-shadow:0 0 0 2px #07130c,0 0 18px rgba(0,255,102,.95)!important;pointer-events:none}
.focus-caption{margin:10px 2px 0;color:var(--muted);font-size:14px}

.public-head .tag{display:inline-block;max-width:100%;line-height:1.5}

/* v9: responsive full-house preview and no horizontal overflow */
html, body { max-width: 100%; overflow-x: hidden; }
.wrap { width: min(1100px, calc(100% - 32px)); max-width: 100%; }
.public-head { padding-bottom: 8px; }
.balcony { overflow: hidden; }
.pd-full { position: relative; width: 100%; max-width: 100%; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.pd-full img { display: block; width: 100%; max-width: 100%; height: auto; }
.pd-full .full-zone { position: absolute !important; z-index: 3; border: 5px solid #00ff66 !important; background: rgba(0,255,102,.12) !important; box-shadow: 0 0 0 2px #07130c, 0 0 18px rgba(0,255,102,.95) !important; pointer-events: none; }
.compact { margin: 3px 0 0; font-size: 13px; }
.admin-preview { max-width: 100%; overflow: hidden; }
.admin-preview img { width: 100%; max-width: 100%; height: auto; }

/* v10: drawing-based left/right orientation */
.focus-caption { margin: 8px 0 10px; }

/* v11: mobile readability - zoom around the selected balcony */
.pd-full { position: relative; }
.pd-canvas { position: relative; width: 100%; transform-origin: 0 0; }
.pd-canvas img { display: block; width: 100%; height: auto; max-width: none; user-select: none; -webkit-user-drag: none; }
.pd-canvas .full-zone { position: absolute !important; z-index: 3; }
.mobile-zoom-toggle { display: none; }

@media (max-width: 760px) {
  .wrap { width: min(100% - 20px, 680px); }
  .public-head { padding-top: 24px; }
  .public-head h1 { font-size: 30px; line-height: 1.15; }
  .balcony.card { padding: 14px; }
  .balcony-title h2 { font-size: 24px; }
  .compact { font-size: 12px; line-height: 1.35; }
  .mobile-zoom-container {
    height: min(68vw, 430px);
    min-height: 300px;
    overflow: hidden;
    border-radius: 10px;
    background: #fff;
  }
  .mobile-zoom-container .pd-canvas {
    will-change: transform;
  }
  .mobile-zoom-container .full-zone {
    border-width: 4px !important;
  }
  .mobile-zoom-toggle {
    display: block;
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 10;
    min-height: 38px;
    padding: 8px 11px;
    border-radius: 9px;
    background: rgba(10,16,32,.9);
    color: #eef3fb;
    border: 1px solid rgba(255,255,255,.3);
    box-shadow: 0 4px 16px rgba(0,0,0,.28);
    font-size: 12px;
    font-weight: 800;
  }
  .choices span { padding: 16px 10px; font-size: 14px; }
  .big { font-size: 16px; }
}

.settings-card{max-width:720px}.narrow-form{max-width:560px}.narrow-form input{width:100%}

/* v15: clearer import workflow */
.auto-card { display:flex; gap:24px; align-items:center; justify-content:space-between; flex-wrap:wrap; }

/* v16: auto assignment emphasis */
.auto-card button { white-space: nowrap; }

/* v18: visual verification of every assigned balcony */
.overview-toolbar { align-items:flex-start; }
.overview-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; margin:18px 0; }
.overview-stats div { padding:18px 20px; background:var(--card); border:1px solid var(--line); border-radius:14px; }
.overview-stats b { display:block; font-size:28px; }
.overview-stats span { color:var(--muted); }
.overview-card-head { display:flex; align-items:center; justify-content:space-between; gap:18px; margin-bottom:14px; }
.overview-card-head h2 { margin:0 0 4px; }
.legend { display:flex; gap:16px; color:var(--muted); font-size:13px; white-space:nowrap; }
.legend-dot { display:inline-block; width:11px; height:11px; border-radius:3px; margin-right:6px; vertical-align:-1px; }
.legend-1172 { background:#00e5ff; }
.legend-1173 { background:#ff4de1; }
.overview-drawing { position:relative; overflow:hidden; border:1px solid var(--line); border-radius:12px; background:#fff; line-height:0; }
.overview-drawing img { display:block; width:100%; max-width:100%; height:auto; user-select:none; -webkit-user-drag:none; }
.overview-zone { position:absolute; z-index:4; display:block; box-sizing:border-box; text-decoration:none; }
.overview-zone span {
  position:absolute; left:50%; top:50%; transform:translate(-50%,-50%);
  display:block; padding:3px 5px; border-radius:5px;
  font:800 10px/1.1 system-ui,sans-serif; white-space:nowrap;
  color:#07130c; background:#fff;
  box-shadow:0 0 0 2px rgba(255,255,255,.85);
  pointer-events:none;
}
.overview-zone.zone-1172 { border:4px solid #00e5ff; box-shadow:0 0 0 2px rgba(0,0,0,.9),0 0 14px rgba(0,229,255,.95); background:rgba(0,229,255,.10); }
.overview-zone.zone-1173 { border:4px solid #ff4de1; box-shadow:0 0 0 2px rgba(0,0,0,.9),0 0 14px rgba(255,77,225,.95); background:rgba(255,77,225,.10); }
.overview-zone:hover { z-index:8; filter:brightness(1.2); }
.overview-list { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-top:12px; }
.overview-list a { display:grid; grid-template-columns:auto 1fr auto; gap:8px; align-items:center; padding:9px 10px; border:1px solid var(--line); border-radius:9px; color:var(--txt); text-decoration:none; background:rgba(255,255,255,.02); min-width:0; }
.overview-list a:hover { border-color:var(--accent); }
.overview-list strong { font-size:12px; white-space:nowrap; }
.overview-list span { font-size:11px; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.overview-list em { font-size:10px; font-style:normal; color:#ffd66c; white-space:nowrap; }
@media(max-width:760px) {
  .overview-stats { grid-template-columns:1fr; }
  .overview-card-head { align-items:flex-start; flex-direction:column; }
  .overview-list { grid-template-columns:1fr; }
  .overview-zone span { font-size:8px; padding:2px 3px; }
  .overview-zone.zone-1172,.overview-zone.zone-1173 { border-width:3px; }
}

.ref-links { margin: 14px 0; display:flex; flex-wrap:wrap; gap:10px; align-items:center; font-size:13px; }
.ref-links a { color:var(--accent); text-decoration:none; font-weight:800; }
.ref-links a:hover { text-decoration:underline; }

/* v23 mobile overflow hardening
   Prevent any flex/grid child, long text, transformed drawing or form control
   from making the document wider than the viewport. */
html {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

body {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: clip;
}

header,
main,
.wrap,
.card,
.toolbar,
.unit,
.balcony,
.overview-card,
.public-head,
.stack,
.actions,
.unit-actions,
.overview-card-head,
.overview-list,
.auto-card {
  min-width: 0;
  max-width: 100%;
}

main.wrap {
  width: min(1120px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}

img,
video,
canvas,
svg {
  max-width: 100%;
}

input,
select,
textarea,
button,
.button {
  min-width: 0;
}

h1,
h2,
h3,
p,
.tag,
.muted,
.focus-caption,
.public-head,
.overview-card-head,
.overview-list span,
.overview-list strong,
button,
.button,
a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* The drawing itself is clipped by its own viewport. A transformed canvas
   must never become a source of document-level horizontal scrolling. */
.pd-full,
.mobile-zoom-container,
.pd-canvas,
.overview-drawing,
.admin-preview,
.pd-frame,
.focus-wrap {
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.pd-canvas {
  width: 100%;
}

@media (max-width: 760px) {
  main.wrap {
    width: calc(100% - 20px);
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
  }

  .nav {
    min-width: 0;
    gap: 10px;
  }

  .nav strong {
    min-width: 0;
  }

  .nav a {
    min-width: 0;
  }

  .toolbar,
  .overview-card-head,
  .balcony-title {
    width: 100%;
    min-width: 0;
  }

  .actions,
  .unit-actions {
    max-width: 100%;
  }

  .button,
  button {
    max-width: 100%;
  }

  /* Keep the zoomed facade inside its viewport. */
  .mobile-zoom-container {
    width: 100%;
    max-width: 100%;
    position: relative;
    contain: paint;
  }

  .mobile-zoom-container .pd-canvas {
    max-width: none;
  }
}

/* v23.1 mobile layout fix: contain the zoom layer without CSS transforms.
   The previous transform-based approach could leak transformed overflow into
   the mobile viewport on some browsers. The facade layer now grows by width
   and is clipped by its own viewport. */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden !important;
}

main {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

@media (max-width: 760px) {
  .mobile-zoom-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden !important;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
    contain: layout paint;
    isolation: isolate;
  }

  .mobile-zoom-container .pd-canvas {
    position: relative;
    display: block;
    max-width: none;
    width: 100%;
    margin: 0;
    transform: none !important;
    will-change: auto;
  }

  .mobile-zoom-container .pd-canvas img {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
  }

  /* Keep the save action permanently reachable on phones. */
  form.stack {
    padding-bottom: 92px;
  }

  .mobile-submit-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: rgba(10, 16, 32, .96);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px rgba(0,0,0,.28);
    backdrop-filter: blur(8px);
  }

  .mobile-submit-bar .big {
    display: flex;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    min-height: 54px;
  }
}

/* v23.2: hard containment for the mobile zoom layer. The zoomed drawing is
   absolutely positioned inside a fixed/clipped viewport, so it cannot change
   the document's scrollable width even on browsers with quirky transformed
   overflow handling. */
html, body {
  overflow-x: hidden !important;
  overscroll-behavior-x: none;
}

@media (max-width: 760px) {
  .mobile-zoom-container {
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
    contain: layout paint size;
    isolation: isolate;
  }

  .mobile-zoom-container .pd-canvas {
    position: relative;
    left: 0;
    top: 0;
    margin: 0;
    transform: none !important;
    max-width: none !important;
    width: 100%;
  }

  .mobile-zoom-container .pd-canvas img {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
  }

  .mobile-submit-bar {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
}


/* Selection of the glazing system. */
.choices { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 18px; }
.choices input:focus-visible + span { outline: 3px solid #fff; outline-offset: 4px; }
.choices label { position: relative; }
.choices input { inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.tag, .status, .compact, .overview-list strong, .overview-list span, .overview-list em { font-size: .875rem; }
.overview-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.overview-list em { white-space: normal; }
@media (max-width:760px) { .choices, .overview-list { grid-template-columns:1fr; } .nav { flex-wrap:wrap; } }
@media (max-width:760px) { .balcony-title { flex-direction:column; gap:12px; margin-bottom:12px; } .nav { height:auto; min-height:62px; padding-block:12px; } }

/* Equal presentation of both glazing variants and their supplied prices. */
.glazing-guide { margin: 20px 0 30px; }
.glazing-options { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; }
.glazing-option { margin:0; line-height:1.55; }
.glazing-option h3 { margin:0; font-size:1.25rem; }
.glazing-option h4 { margin:20px 0 8px; font-size:1rem; }
.glazing-option ul { padding-left:22px; margin:0; }
.glazing-option li + li { margin-top:8px; }
.glazing-price { font-size:1.75rem; font-weight:800; margin:12px 0 16px; }
.glazing-price span { font-size:1rem; font-weight:400; color:var(--muted); }
.glazing-summary { padding:18px; }
.glazing-summary table { width:100%; table-layout:fixed; border-collapse:collapse; font-size:1rem; }
.glazing-summary caption { text-align:left; font-size:1.25rem; font-weight:700; padding-bottom:16px; }
.glazing-summary th, .glazing-summary td { text-align:left; vertical-align:top; padding:12px 10px; border-bottom:1px solid var(--line); overflow-wrap:anywhere; }
.glazing-summary thead th { color:var(--accent); }
.glazing-summary tbody th { font-weight:500; }
.glazing-source { color:var(--muted); font-size:.875rem; line-height:1.5; margin:16px 0 0; }
.choice-price { display:block; font-size:1.125rem; margin-top:8px; }
.choices small { display:block; font-size:.875rem; font-weight:400; color:var(--muted); margin-top:6px; }
@media(max-width:760px) {
  .glazing-options { grid-template-columns:1fr; }
  .glazing-summary { padding:12px; }
  .glazing-summary table { font-size:.875rem; }
  .glazing-summary th, .glazing-summary td { padding:10px 5px; }
  .nav strong { font-size:.875rem; }
}
