#planeo-app,
#planeo-app * { box-sizing: border-box; }

#planeo-app {
  --p-bg: #eef4f8;
  --p-panel: #ffffff;
  --p-panel-soft: #f7faff;
  --p-line: #d9e3ec;
  --p-line-strong: #c5d3de;
  --p-text: #17314a;
  --p-muted: #687d91;
  --p-accent: #1f66c1;
  --p-accent-dark: #184f95;
  --p-accent-soft: #eaf3ff;
  --p-danger: #bb4343;
  width: 100%; height: 100vh; min-height: 100vh;
  margin: 0; color: var(--p-text); background: var(--p-bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

.planeo-shell {
  width: 100%; height: 100vh; min-height: 0; overflow: hidden;
  display: grid; grid-template-rows: 84px minmax(0, 1fr) 46px;
  background: var(--p-bg);
}

.planeo-topbar {
  min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 22px;
  padding: 10px 18px 10px 22px; background: #fff; border-bottom: 1px solid var(--p-line);
  box-shadow: 0 4px 20px rgba(35, 62, 85, .045); z-index: 15;
}
.planeo-header-left { min-width: 0; display: flex; align-items: center; gap: 18px; }
.planeo-brand { width: 220px; height: 58px; flex: 0 0 220px; display: flex; align-items: center; overflow: hidden; }
.planeo-logo { width: 100%; height: 100%; display: block; object-fit: contain; object-position: left center; }
.planeo-header-divider { width: 1px; height: 44px; background: var(--p-line); flex: 0 0 1px; }
.planeo-product-title { min-width: 0; }
.planeo-product-title strong { display: block; font-size: 18px; line-height: 1.1; letter-spacing: -.02em; }
.planeo-product-title span { display: block; margin-top: 5px; color: var(--p-muted); font-size: 12px; white-space: nowrap; }
.planeo-top-actions { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: nowrap; }

.planeo-button,
.planeo-icon-button,
.planeo-footer-button {
  appearance: none; border: 1px solid var(--p-line-strong); background: #fff; color: var(--p-text);
  font: inherit; font-weight: 750; cursor: pointer; text-decoration: none; transition: .15s ease;
}
.planeo-button { min-height: 42px; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; white-space: nowrap; }
.planeo-button:hover,.planeo-footer-button:hover { border-color: #aebfce; background: #f7faff; }
.planeo-button-primary { color: #fff; border-color: #1d5ba8; background: linear-gradient(180deg,#2b72cf,#1f61b5); box-shadow: 0 6px 16px rgba(31,102,193,.18); }
.planeo-button-primary:hover { color: #fff; border-color: #184f95; background: linear-gradient(180deg,#2366bb,#184f95); }
.planeo-button-danger { color: var(--p-danger); }
.planeo-button-large { min-height: 46px; padding-inline: 20px; }
.planeo-button-full { width: 100%; }
.planeo-button:disabled { opacity: .6; cursor: wait; }

.planeo-main { min-width: 0; min-height: 0; display: grid; grid-template-columns: 96px minmax(0,1fr) 340px; gap: 10px; padding: 10px; }

.planeo-toolrail {
  min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; padding: 10px 8px;
  background: #fff; border: 1px solid var(--p-line); border-radius: 14px; box-shadow: 0 6px 20px rgba(35,62,85,.045);
}
.planeo-tool {
  appearance: none; min-height: 66px; padding: 7px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 11px; background: transparent; color: #36516a; cursor: pointer; font: inherit; transition: .15s ease;
}
.planeo-tool span { font-size: 24px; line-height: 1; }
.planeo-tool small { font-size: 10px; font-weight: 800; line-height: 1; }
.planeo-tool:hover { background: #f5f9fe; border-color: #e3ebf2; }
.planeo-tool.is-active { color: var(--p-accent); background: var(--p-accent-soft); border-color: #d6e7fb; }
.planeo-tool-divider { height: 1px; margin: 3px 6px; background: var(--p-line); }

.planeo-workarea { min-width: 0; min-height: 0; }
.planeo-stage-wrap {
  position: relative; width: 100%; height: 100%; min-height: 0; overflow: hidden;
  background: #fff; border: 1px solid var(--p-line); border-radius: 14px; box-shadow: 0 8px 24px rgba(35,62,85,.05);
}
.planeo-stage {
  width: 100%; height: 100%; display: block; touch-action: none; user-select: none; cursor: default;
  background-color: #f9fbfd;
  background-image: linear-gradient(rgba(34,76,111,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(34,76,111,.035) 1px, transparent 1px);
  background-size: 22px 22px;
}
.planeo-stage.is-draw-tool { cursor: crosshair; }
.planeo-stage.is-pan-tool,.planeo-stage.is-space-pan { cursor: grab; }
.planeo-stage.is-panning { cursor: grabbing !important; }

.planeo-empty-state {
  position: absolute; z-index: 4; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(520px,calc(100% - 50px)); padding: 38px;
  text-align: center; background: rgba(255,255,255,.97); border: 1px solid var(--p-line); border-radius: 18px; box-shadow: 0 22px 55px rgba(36,59,78,.12);
}
.planeo-empty-icon { margin-bottom: 10px; color: var(--p-accent); font-size: 42px; }
.planeo-empty-state h2 { margin: 0 0 8px; font-size: 24px; }
.planeo-empty-state p { margin: 0 0 20px; color: var(--p-muted); line-height: 1.55; }
.planeo-stage-hint { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); pointer-events: none; padding: 7px 12px; border: 1px solid var(--p-line); border-radius: 999px; background: rgba(255,255,255,.92); color: #60758a; font-size: 10px; font-weight: 800; box-shadow: 0 4px 12px rgba(35,62,85,.05); }

.planeo-inspector { min-height: 0; overflow-y: auto; padding-right: 2px; }
.planeo-panel { margin-bottom: 10px; padding: 14px; background: #fff; border: 1px solid var(--p-line); border-radius: 14px; box-shadow: 0 6px 20px rgba(35,62,85,.045); }
.planeo-panel h3 { margin: 0 0 11px; font-size: 14px; line-height: 1.2; }
.planeo-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.planeo-lock-badge,.planeo-mini-badge { display: inline-flex; align-items: center; min-height: 23px; padding: 0 7px; border: 1px solid #d8e3ec; border-radius: 999px; background: #f4f7f9; color: #64798d; font-size: 9px; font-weight: 850; white-space: nowrap; }
.planeo-mini-badge.is-ok { color: #24704d; background: #e9f7f0; border-color: #cce9d9; }
.planeo-help { margin: 0 0 12px; color: var(--p-muted); font-size: 11px; line-height: 1.45; }
.planeo-label,.planeo-field-row label { display: grid; gap: 5px; color: #546b80; font-size: 11px; font-weight: 800; }
.planeo-project-panel .planeo-label { margin-bottom: 11px; }
#planeo-app input,#planeo-app select { width: 100%; min-height: 39px; padding: 7px 10px; border: 1px solid #cfdbe5; border-radius: 9px; outline: none; background: #f8fbfd; color: var(--p-text); font: inherit; font-size: 13px; }
#planeo-app input:focus,#planeo-app select:focus { border-color: #8ab0d9; box-shadow: 0 0 0 3px rgba(31,102,193,.09); }
.planeo-metrics { margin: 0; display: grid; gap: 8px; }
.planeo-metrics div { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.planeo-metrics dt { color: var(--p-muted); }
.planeo-metrics dd { margin: 0; font-weight: 800; text-align: right; }
.planeo-project-metrics { padding-top: 10px; border-top: 1px solid #edf2f6; }
.planeo-grid-state { margin-bottom: 12px; padding: 8px 9px; border: 1px solid #e0e8ef; border-radius: 9px; background: #f8fafc; color: #77899a; font-size: 10px; font-weight: 800; }
.planeo-grid-state.is-active { color: #2d6b50; background: #eef8f3; border-color: #d6ebdf; }
.planeo-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.planeo-input-unit { position: relative; }
.planeo-input-unit input { padding-right: 36px !important; }
.planeo-input-unit span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: #8695a3; pointer-events: none; font-size: 10px; font-weight: 800; }
.planeo-input-unit-large input { min-height: 46px !important; font-size: 16px !important; font-weight: 800 !important; }
.planeo-colors { display: grid; grid-template-columns: repeat(6,1fr); gap: 7px; }
.planeo-color { position: relative; width: 100%; aspect-ratio: 1; border: 2px solid #fff; border-radius: 9px; outline: 1px solid rgba(35,62,85,.16); cursor: pointer; }
.planeo-color.is-active::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 900; text-shadow: 0 1px 2px rgba(0,0,0,.55); }
.planeo-inline-note { margin-top: 8px; color: var(--p-muted); font-size: 10px; }
.planeo-inspector-actions { display: flex; gap: 8px; margin-top: 12px; }
.planeo-inspector-actions .planeo-button { flex: 1; padding-inline: 8px; }

.planeo-footer { min-width: 0; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 6px 12px; background: #fff; border-top: 1px solid var(--p-line); box-shadow: 0 -3px 14px rgba(35,62,85,.035); }
.planeo-footer-left,.planeo-footer-center,.planeo-footer-right { min-width: 0; display: flex; align-items: center; gap: 8px; }
.planeo-footer-center { justify-content: center; overflow: hidden; }
.planeo-footer-center span { padding: 0 8px; color: #6a7e91; font-size: 10px; white-space: nowrap; }
.planeo-footer-center #planeo-status { max-width: 380px; overflow: hidden; text-overflow: ellipsis; color: #3f5870; font-weight: 750; }
.planeo-footer-state { color: #687d91; font-size: 10px; white-space: nowrap; }
.planeo-footer-zoom { display: inline-flex; align-items: center; gap: 4px; }
.planeo-footer-zoom > span { min-width: 52px; text-align: center; font-size: 11px; font-weight: 850; }
.planeo-footer-button { min-width: 30px; height: 30px; border-radius: 8px; padding: 0 8px; }
.planeo-fit-button { font-size: 10px; }
.planeo-version-badge { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border: 1px solid #d7e1e9; border-radius: 999px; background: #f7faff; color: #1f66c1; font-size: 10px; font-weight: 900; letter-spacing: .05em; }

.planeo-modal-backdrop { position: fixed; z-index: 999999; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(17,31,43,.48); backdrop-filter: blur(8px); }
.planeo-modal-backdrop[hidden] { display: none; }
.planeo-modal { width: min(430px,100%); padding: 22px; background: #fff; border: 1px solid rgba(255,255,255,.8); border-radius: 16px; box-shadow: 0 28px 80px rgba(0,0,0,.24); }
.planeo-modal-kicker { margin-bottom: 7px; color: var(--p-accent); font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.planeo-modal h2 { margin: 0 0 7px; font-size: 20px; }
.planeo-modal p { margin: 0 0 16px; color: var(--p-muted); font-size: 13px; }
.planeo-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.planeo-reference-confirm { margin: 0 0 16px; padding: 11px 12px; border: 1px solid #cbdde6; border-radius: 10px; background: #f3f8fa; color: #163f53; font-size: 14px; font-weight: 800; text-align: center; }

#planeo-app.is-locked .planeo-shell { filter: blur(5px) saturate(.92); pointer-events: none; user-select: none; }
.planeo-login-screen { position: fixed; inset: 0; z-index: 1000000; display: grid; place-items: center; padding: 22px; background: rgba(15,29,41,.55); backdrop-filter: blur(11px); }
.planeo-login-screen[hidden] { display: none; }
.planeo-login-card { width: min(440px,100%); padding: 28px; border-radius: 20px; background: #fff; border: 1px solid #d8e3ec; box-shadow: 0 32px 90px rgba(8,23,34,.28); }
.planeo-login-brand { display: block; width: 215px; height: 68px; object-fit: contain; object-position: left center; margin: -8px 0 8px; }
.planeo-login-kicker { color: #1f66c1; font-size: 10px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; margin-bottom: 8px; }
.planeo-login-card h2 { margin: 0 0 7px; font-size: 26px; letter-spacing: -.03em; }
.planeo-login-card p { margin: 0 0 18px; color: var(--p-muted); line-height: 1.5; }
.planeo-login-error { margin-top: 10px; color: var(--p-danger); font-size: 12px; font-weight: 800; }

html.planeo-fullscreen-html,html.planeo-fullscreen-html body.planeo-fullscreen-page { width: 100% !important; height: 100% !important; min-width: 0 !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; overflow: hidden !important; background: var(--p-bg,#eef4f8) !important; }
body.planeo-fullscreen-page { position: fixed !important; inset: 0 !important; max-width: none !important; }
body.planeo-fullscreen-page #planeo-app { position: fixed; z-index: 2147483000; inset: 0; width: 100vw; height: 100dvh; min-width: 0; min-height: 0; margin: 0 !important; padding: 0 !important; overflow: hidden; }
body.planeo-fullscreen-page #planeo-app .planeo-shell { width: 100%; height: 100%; min-height: 0; margin: 0; }

@media (max-width: 1280px) {
  .planeo-main { grid-template-columns: 82px minmax(0,1fr) 310px; }
  .planeo-brand { width: 184px; flex-basis: 184px; }
  .planeo-product-title span { display: none; }
  .planeo-top-actions { gap: 6px; }
  .planeo-button { padding-inline: 11px; font-size: 12px; }
}
@media (max-width: 1020px) {
  .planeo-main { grid-template-columns: 72px minmax(0,1fr); }
  .planeo-inspector { position: absolute; z-index: 20; right: 10px; top: 94px; bottom: 56px; width: 300px; padding: 0; }
  .planeo-header-divider,.planeo-product-title { display: none; }
  .planeo-brand { width: 170px; flex-basis: 170px; }
  .planeo-tool small { display: none; }
  .planeo-tool { min-height: 52px; }
}

/* SVG drawing */
.planeo-overlay-rect,
.planeo-draft-rect,
.planeo-reference-line,
.planeo-dimension-line,
.planeo-extension-line,
.planeo-measure-line,
.planeo-measure-hit { vector-effect: non-scaling-stroke; }

.planeo-overlay-rect { stroke-width: 1.75; stroke: rgba(30, 45, 55, .66); cursor: pointer; }
.planeo-overlay-rect.is-selected { stroke: #173f54; stroke-width: 3; }
.planeo-resize-handle { fill: #fff; stroke: #173f54; stroke-width: 2; vector-effect: non-scaling-stroke; cursor: nwse-resize; }
.planeo-draft-rect { stroke: #173f54; stroke-width: 2; stroke-dasharray: 7 5; }
.planeo-draft-label,
.planeo-dimension-text,
.planeo-reference-text,
.planeo-measure-text {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 800; paint-order: stroke; stroke: #fff; stroke-linejoin: round;
}
.planeo-draft-label { fill: #173f54; stroke-width: 5; }
.planeo-reference-line { stroke: #1e607f; stroke-width: 2.2; stroke-dasharray: 9 6; }
.planeo-reference-line.is-draft { stroke-width: 2.5; }
.planeo-reference-point { fill: #fff; stroke: #1e607f; stroke-width: 2.5; vector-effect: non-scaling-stroke; cursor: move; }
.planeo-draft-point { fill: #fff; stroke: #1e607f; stroke-width: 2; vector-effect: non-scaling-stroke; }
.planeo-reference-text { fill: #163f53; stroke-width: 5; }
.planeo-dimension-line { stroke: #293740; stroke-width: 1.15; fill: none; }
.planeo-dimension-line.level-2 { stroke-width: 1.5; }
.planeo-extension-line { stroke: #65727b; stroke-width: .85; fill: none; }
.planeo-dimension-text { fill: #26323b; stroke-width: 5; }
.planeo-measure-line { stroke: #b05b28; stroke-width: 1.7; }
.planeo-measure-hit { stroke: transparent; stroke-width: 14; cursor: pointer; }
.planeo-measure-text { fill: #87431f; stroke-width: 5; }
.planeo-measure-point { fill: #fff; stroke: #b05b28; stroke-width: 2; vector-effect: non-scaling-stroke; }
.is-selected-measure .planeo-measure-line { stroke: #7d3415; stroke-width: 2.4; }

.planeo-print-root { display: none; }

@media (max-width: 1100px) {
  .planeo-main { grid-template-columns: 76px minmax(0, 1fr) 290px; }
  .planeo-tool small { display: none; }
  .planeo-tool { min-height: 48px; }
}

@media (max-width: 880px) {
  .planeo-main { grid-template-columns: 68px minmax(0, 1fr); }
  .planeo-inspector {
    position: absolute; z-index: 8; right: 12px; top: 84px; width: 280px; max-height: calc(100% - 100px);
    border: 1px solid var(--p-line); border-radius: 14px; box-shadow: 0 16px 40px rgba(22, 35, 44, .18);
  }
  .planeo-shell { position: relative; }
  .planeo-brand span { display: none; }
  .planeo-stage-hint { display: none; }
}


@media print {
  @page { size: A4 landscape; margin: 0; }
  body * { visibility: hidden !important; }
  #planeo-print-root,
  #planeo-print-root * { visibility: visible !important; }
  #planeo-print-root {
    display: block !important; position: absolute !important; left: 0; top: 0;
    width: 297mm; height: 210mm; overflow: hidden; background: #fff;
  }
  #planeo-print-root .planeo-print-sheet {
    position: relative; width: 297mm; height: 210mm; display: flex; align-items: center; justify-content: center; background: #fff;
  }
  #planeo-print-root svg { display: block; overflow: visible; }
  #planeo-print-root .planeo-print-meta {
    position: absolute; right: 8mm; bottom: 5mm; color: #555; font: 8pt/1.2 Arial, sans-serif;
  }
}


/* Planeo 0.2.2 · precise object handles */
.planeo-move-handle { pointer-events: none; }
.planeo-move-handle-hit {
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
  cursor: move;
}
.planeo-move-handle-circle {
  fill: rgba(255,255,255,.94);
  stroke: #173f54;
  stroke-width: 1.8;
  vector-effect: non-scaling-stroke;
}
.planeo-move-handle-line {
  stroke: #173f54;
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.planeo-resize-side-handle {
  fill: #fff;
  stroke: #173f54;
  stroke-width: 1.8;
  vector-effect: non-scaling-stroke;
}
.planeo-resize-side-handle.is-left,
.planeo-resize-side-handle.is-right { cursor: ew-resize; }
.planeo-resize-side-handle.is-top,
.planeo-resize-side-handle.is-bottom { cursor: ns-resize; }


