/* 어두운 작업 화면(캐드: 리본·명령줄·특성 창 / 사진: 메뉴·옵션 막대·도구 상자·패널) */
:root {
  --ui-0: #1b1f24;      /* 가장 어두운 바탕(도면 주변) */
  --ui-1: #262b32;      /* 창 바탕 */
  --ui-2: #2f353d;      /* 리본·패널 */
  --ui-3: #3a414b;      /* 버튼 위에 올렸을 때 */
  --ui-line: #454d58;
  --ui-text: #e6e9ed;
  --ui-dim: #a3acb7;
  --ui-accent: #3d8bd9;
  --ui-accent-2: #2a6fb5;
  --ui-mark: #e03131;
  --ps-0: #262626;
  --ps-1: #323232;
  --ps-2: #3c3c3c;
  --ps-3: #4a4a4a;
  --ps-line: #1e1e1e;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  display: flex; flex-direction: column; min-height: 100vh;
  background: var(--ui-0); color: var(--ui-text);
  font-family: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  font-size: 13px; word-break: keep-all; overflow-wrap: anywhere;
}
button, input, select, textarea { font: inherit; color: inherit; }
.hidden, [hidden] { display: none !important; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ── 맨 위 막대(도구 바꾸기) ── */
.app-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px;
  padding: 4px 10px; background: #15181c; border-bottom: 1px solid #000;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-logo {
  width: 24px; height: 24px; border-radius: 5px; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #4ba8dd, #0b6fa4);
}
.brand-ko { font-weight: 700; font-size: 13px; }
.app-tabs { display: flex; gap: 2px; }
.nav-tab {
  padding: 5px 14px; border: none; border-radius: 4px; background: transparent; color: var(--ui-dim);
  font-weight: 600; cursor: pointer; white-space: nowrap;
}
.nav-tab:hover { background: var(--ui-2); color: var(--ui-text); }
.nav-tab.is-active { background: var(--ui-3); color: #fff; }
.key-banner { margin: 0; font-size: 12px; color: #ffd8a8; }
.link-btn { border: none; background: none; padding: 0; color: #74c0fc; font-weight: 700; text-decoration: underline; cursor: pointer; }
.install-btn { margin-left: auto; }

.main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.view-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; outline: none; }

/* 공통 작은 버튼 */
.mini-btn {
  padding: 4px 10px; border: 1px solid var(--ui-line); border-radius: 4px; background: var(--ui-3); color: var(--ui-text);
  cursor: pointer; white-space: nowrap; font-size: 12px;
}
.mini-btn:hover { border-color: var(--ui-accent); }
.mini-btn.is-primary { background: var(--ui-accent-2); border-color: var(--ui-accent); color: #fff; }
.mini-btn.is-primary:hover { background: var(--ui-accent); }
.mini-btn:disabled { opacity: 0.5; cursor: wait; }

/* ── 캐드 ── */
.qa-bar { display: flex; align-items: center; gap: 2px; padding: 3px 8px; background: #20252b; border-bottom: 1px solid #111; }
.qa-app {
  width: 26px; height: 22px; margin-right: 6px; border-radius: 3px; display: grid; place-items: center;
  background: #c92a2a; color: #fff; font-weight: 800; font-size: 11px;
}
.qa-btn { padding: 2px 8px; border: 1px solid transparent; border-radius: 3px; background: none; color: var(--ui-text); cursor: pointer; font-size: 12px; }
.qa-btn:hover { background: var(--ui-3); border-color: var(--ui-line); }
.qa-title { flex: 1; text-align: center; color: var(--ui-dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ribbon-tabs { display: flex; gap: 0; padding: 0 8px; background: #20252b; }
.ribbon-tab {
  padding: 4px 16px; border: 1px solid transparent; border-bottom: none; background: none; color: var(--ui-dim);
  cursor: pointer; border-radius: 3px 3px 0 0;
}
.ribbon-tab:hover { color: #fff; }
.ribbon-tab.is-active { background: var(--ui-2); border-color: var(--ui-line); color: #fff; }
.ribbon {
  display: flex; flex-wrap: wrap; align-items: stretch; gap: 0;
  padding: 4px 6px 0; background: var(--ui-2); border-top: 1px solid var(--ui-line); border-bottom: 1px solid #111;
}
.ribbon-group { display: flex; flex-direction: column; padding: 0 8px; border-right: 1px solid var(--ui-line); }
.ribbon-btns { display: flex; gap: 2px; flex: 1; align-items: flex-start; }
.ribbon-group > .ribbon-btns + .ribbon-btns { margin-top: 0; }
.rb-stack { flex-direction: column; align-items: stretch; gap: 1px; }
.rb-btn {
  display: flex; align-items: center; gap: 6px; padding: 3px 8px; border: 1px solid transparent; border-radius: 3px;
  background: none; color: var(--ui-text); cursor: pointer; white-space: nowrap; font-size: 12px; text-align: left;
}
.rb-btn:hover { background: var(--ui-3); border-color: var(--ui-line); }
.rb-btn.is-active { background: #24476b; border-color: var(--ui-accent); }
.rb-big { flex-direction: column; gap: 2px; min-width: 50px; padding: 4px 6px; text-align: center; }
.rb-big svg { width: 26px; height: 26px; color: #9fd0ff; }
.rb-accent svg { color: #ff8787; }
.ribbon-label { display: block; padding: 2px 0 3px; text-align: center; color: var(--ui-dim); font-size: 11px; }

.acad-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 290px; min-height: 0; }
.acad-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.doc-tabs { display: flex; gap: 2px; padding: 3px 6px 0; background: var(--ui-1); border-bottom: 1px solid #111; }
.doc-tab {
  max-width: 320px; padding: 4px 14px; border-radius: 4px 4px 0 0; background: var(--ui-2); color: var(--ui-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px;
}
.doc-tab.is-active { background: #212830; color: #fff; border-top: 2px solid var(--ui-accent); }
.acad-canvas-wrap { position: relative; flex: 1; min-height: 300px; background: #212830; overflow: hidden; }
.cad-canvas, .cad-overlay { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cad-overlay { cursor: none; touch-action: none; }
.app-cad.is-light .acad-canvas-wrap, .app-cad.is-light .doc-tab.is-active { background: #fff; color: #222; }

.cmdline { background: var(--ui-1); border-top: 1px solid #111; }
.cmd-history {
  height: 92px; overflow: auto; padding: 4px 8px; font-family: Consolas, "D2Coding", "Malgun Gothic", monospace; font-size: 12px; line-height: 1.45;
  color: #cfd6de; background: #1d2228;
}
.cmd-log { white-space: pre-wrap; }
.cmd-log.is-op { color: #a9e34b; }
.cmd-log.is-err { color: #ff8787; }
.cmd-log.is-ai { color: #74c0fc; }
.cmd-log.is-me { color: #fff; }
.cmd-log.is-wait { color: var(--ui-dim); font-style: italic; }
.cmd-row { display: flex; align-items: center; gap: 6px; padding: 3px 8px; border-top: 1px solid var(--ui-line); background: #f1f3f5; color: #212529; }
.cmd-prompt { white-space: nowrap; font-family: Consolas, "D2Coding", "Malgun Gothic", monospace; font-size: 12px; color: #1c4f82; font-weight: 700; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.cmd-input { flex: 1; min-width: 0; padding: 3px 4px; border: none; background: transparent; color: #212529; outline: none; font-family: Consolas, "D2Coding", "Malgun Gothic", monospace; font-size: 12px; }

.palettes { display: flex; flex-direction: column; gap: 0; min-width: 0; min-height: 0; overflow: auto; background: var(--ui-2); border-left: 1px solid #111; }
.palette { display: flex; flex-direction: column; min-height: 0; border-bottom: 1px solid #111; }
.palette-title {
  display: flex; align-items: center; gap: 6px; margin: 0; padding: 5px 8px; background: #3a414b; font-size: 12px; font-weight: 700;
}
.palette-check { margin-left: auto; display: flex; align-items: center; gap: 4px; font-weight: 400; color: var(--ui-dim); cursor: pointer; }
.badge { min-width: 20px; padding: 0 6px; border-radius: 9px; background: var(--ui-mark); color: #fff; font-size: 11px; text-align: center; }
.palette-list { overflow: auto; padding: 4px; }
.palette-pad { display: flex; flex-direction: column; gap: 6px; padding: 6px 8px 8px; }
.props-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 6px; align-items: center; font-size: 12px; }
.props-row select, .props-row input { min-width: 0; padding: 2px 4px; font-size: 12px; color: #212529; background: #fff; border: 1px solid var(--ui-line); border-radius: 3px; }
.props-row .btn { padding: 2px 8px; font-size: 12px; color: #e9ecef; background: #495057; border: 1px solid #111; border-radius: 3px; cursor: pointer; }
.props-sum { font-size: 12px; color: var(--ui-dim); line-height: 1.4; word-break: keep-all; }
.palette-empty { margin: 4px; color: var(--ui-dim); font-size: 12px; line-height: 1.5; }
.layer-list { max-height: 34vh; }
.layer-row { display: grid; grid-template-columns: 30px 16px minmax(0, 1fr) auto; gap: 6px; align-items: center; padding: 2px 4px; border-radius: 3px; }
.layer-row:hover { background: var(--ui-3); }
.layer-row.is-deleted { opacity: 0.45; text-decoration: line-through; }
.layer-bulb { justify-self: center; width: 18px; height: 18px; padding: 0; border: none; border-radius: 50%; background: #555; cursor: pointer; box-shadow: inset 0 0 0 2px #333; }
.layer-bulb.is-on { background: #ffd43b; box-shadow: 0 0 5px #ffd43b88; }
.layer-swatch { width: 14px; height: 14px; padding: 0; border: 1px solid #000; border-radius: 2px; cursor: pointer; }
.layer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.layer-count { color: var(--ui-dim); font-size: 11px; font-variant-numeric: tabular-nums; }
.comment-list { max-height: 34vh; display: flex; flex-direction: column; gap: 4px; }
.comment-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto auto; gap: 6px; align-items: start; padding: 5px; border-radius: 4px; background: var(--ui-1); }
.comment-num {
  width: 22px; height: 22px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: var(--ui-mark); color: #fff;
  font-size: 11px; font-weight: 800; cursor: pointer;
}
.comment-body { min-width: 0; }
.comment-text { margin: 0; font-size: 12px; line-height: 1.45; white-space: pre-wrap; }
.comment-xy { margin: 2px 0 0; color: var(--ui-dim); font-size: 11px; font-variant-numeric: tabular-nums; }

/* 지적 메모 창(누른 자리 옆) */
.note-pop {
  position: absolute; z-index: 5; width: 256px; padding: 8px; border-radius: 6px;
  background: #fff9db; color: #212529; border: 1px solid #fab005; box-shadow: 0 6px 20px rgba(0,0,0,0.45);
}
.note-pop textarea { width: 100%; padding: 6px; border: 1px solid #e9c46a; border-radius: 4px; background: #fff; color: #212529; resize: vertical; }
.note-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
.note-pop .mini-btn { background: #fff; color: #212529; border-color: #ced4da; }
.note-pop .mini-btn.is-primary { background: var(--ui-mark); color: #fff; border-color: var(--ui-mark); }

.status-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; padding: 3px 10px;
  background: #20252b; border-top: 1px solid #111; font-size: 12px; color: var(--ui-dim);
}
.sb-coords { font-family: Consolas, "D2Coding", monospace; color: var(--ui-text); min-width: 18em; font-variant-numeric: tabular-nums; }
.sb-item { padding: 0 6px; border-left: 1px solid var(--ui-line); }
.sb-toggle { padding: 1px 8px; border: 1px solid var(--ui-line); border-radius: 3px; background: none; color: var(--ui-dim); cursor: pointer; font-size: 12px; }
.sb-toggle.is-on { background: #24476b; border-color: var(--ui-accent); color: #fff; }
.sb-msg { flex: 1; min-width: 0; margin: 0; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 사진(포토샵식) ── */
.app-photo { background: var(--ps-0); }
.ps-menubar, .ps-options {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; padding: 3px 8px; background: var(--ps-2); border-bottom: 1px solid var(--ps-line);
}
.ps-options { min-height: 36px; background: var(--ps-1); }
.ps-menu {
  padding: 3px 10px; border: 1px solid transparent; border-radius: 3px; background: none; color: #ddd; cursor: pointer; white-space: nowrap; font-size: 12px;
}
.ps-menu:hover { background: var(--ps-3); border-color: #555; }
.ps-save { display: inline-flex; align-items: center; gap: 2px; }
.ps-select, .ps-input, .ps-num { padding: 2px 6px; border: 1px solid #555; border-radius: 3px; background: #262626; color: #eee; font-size: 12px; }
.ps-input { width: min(320px, 60vw); }
.ps-num { width: 62px; }
.ps-check, .ps-opt label { display: inline-flex; align-items: center; gap: 4px; color: #ccc; font-size: 12px; white-space: nowrap; }
.ps-sep { width: 1px; height: 18px; margin: 0 4px; background: #555; }
.ps-opt-name { padding-right: 10px; margin-right: 4px; border-right: 1px solid #555; font-weight: 700; color: #fff; white-space: nowrap; }
.ps-opt { display: none; align-items: center; gap: 8px; }
.ps-opt.is-shown { display: inline-flex; flex-wrap: wrap; max-width: 100%; }
.ps-hint { color: #aaa; font-size: 12px; }
.ps-zoom { margin-left: auto; display: inline-flex; gap: 2px; }
.ps-body { flex: 1; display: grid; grid-template-columns: 42px minmax(0, 1fr) 290px; min-height: 0; }
.ps-tools { display: flex; flex-direction: column; gap: 2px; padding: 6px 4px; background: var(--ps-2); border-right: 1px solid var(--ps-line); }
.ps-tool { width: 34px; height: 32px; display: grid; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 3px; background: none; color: #ddd; cursor: pointer; }
.ps-tool svg { width: 20px; height: 20px; }
.ps-tool:hover { background: var(--ps-3); }
.ps-tool.is-active { background: #1f1f1f; border-color: #6b6b6b; color: #fff; }
.ps-tool-accent svg { color: #ff8787; }
.ps-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.app-photo .doc-tabs { background: var(--ps-1); }
.app-photo .doc-tab { background: var(--ps-2); }
.app-photo .doc-tab.is-active { background: var(--ps-0); border-top-color: #999; }
.ps-stage { position: relative; flex: 1; min-height: 320px; overflow: auto; background: #1f1f1f; display: flex; }
.photo-canvas {
  display: block; margin: auto; flex: none; touch-action: none; box-shadow: 0 0 0 1px #000, 0 4px 18px rgba(0,0,0,0.6);
  background: repeating-conic-gradient(#ccc 0% 25%, #fff 0% 50%) 50% / 16px 16px;
}
.ps-empty { margin: auto; padding: 20px; color: #999; text-align: center; line-height: 1.7; }
.ps-panels { background: var(--ps-2); border-left-color: var(--ps-line); }
.ps-panels .palette { border-bottom-color: var(--ps-line); }
.ps-panels .palette-title { background: var(--ps-1); }
.ps-panels .comment-row { background: var(--ps-1); }
.ps-range { display: grid; grid-template-columns: 2.6em minmax(0, 1fr) 2.6em; align-items: center; gap: 6px; font-size: 12px; color: #ccc; }
.ps-range output { text-align: right; font-variant-numeric: tabular-nums; }
.ops-list { margin: 0; padding: 4px 6px 4px 26px; max-height: 18vh; color: #ccc; font-size: 12px; line-height: 1.6; }
.ops-list:empty::before { content: "아직 없음"; margin-left: -20px; color: #888; }
.ops-list li.is-last { color: #fff; font-weight: 700; }
.ai-log { max-height: 22vh; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.ai-log:empty { display: none; }
.ai-log p { margin: 0; padding: 5px 7px; border-radius: 4px; white-space: pre-wrap; }
.ai-log-me { background: #24476b; align-self: flex-end; }
.ai-log-ai { background: #3a3f46; }
.ai-log-ops { background: #2b2b2b; color: #a9e34b; font-size: 11px; }
.ai-log-wait { color: #aaa; font-style: italic; }
.ai-log-err { background: #4a1f1f; color: #ffa8a8; }
.ai-input { width: 100%; padding: 6px; border: 1px solid #555; border-radius: 4px; background: #262626; color: #eee; resize: vertical; }

/* ── 설정 ── */
.app-settings { padding: 16px; overflow: auto; }
.card { max-width: 720px; margin: 0 0 14px; padding: 16px 18px; background: var(--ui-2); border: 1px solid var(--ui-line); border-radius: 8px; }
.card-title { margin: 0 0 8px; font-size: 15px; }
.card-desc { margin: 0 0 12px; color: var(--ui-dim); line-height: 1.65; }
.card-desc code { padding: 1px 4px; border-radius: 3px; background: var(--ui-0); color: var(--ui-text); }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-weight: 600; }
.field input, .field select { width: 100%; padding: 7px 8px; border: 1px solid var(--ui-line); border-radius: 4px; background: var(--ui-0); color: var(--ui-text); }
.tool-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.app-settings .tool-status { margin: 8px 2px; color: var(--ui-dim); min-height: 1.3em; }
.help { margin-top: 8px; color: var(--ui-dim); }
.help summary { cursor: pointer; font-weight: 700; color: var(--ui-text); }

/* ── 캐드 화면 세부(데스크톱 캐드 프로그램 배치) ── */
.qa-bar { gap: 2px; padding: 2px 6px; background: #2a2e35; }
.qa-app { border: none; width: 30px; height: 24px; margin-right: 8px; cursor: pointer; font-size: 14px; background: linear-gradient(135deg, #e8590c, #c92a2a); }
.qa-btn { display: grid; place-items: center; width: 26px; height: 24px; padding: 0; }
.qa-btn svg { width: 16px; height: 16px; }
.ribbon-tabs { background: #2a2e35; padding: 0 6px; }
.ribbon-tab { padding: 3px 14px; font-size: 12px; }
.ribbon { background: #3b4049; padding: 3px 4px 0; }
.ribbon-group { padding: 0; border-right: 1px solid #2a2e35; }
.ribbon-group > .ribbon-btns { padding: 0 6px; }
.ribbon-label { margin-top: 3px; padding: 2px 0; background: #343941; color: #b9c1cb; border-top: 1px solid #2a2e35; }
.rb-big { min-width: 46px; font-size: 11.5px; line-height: 1.2; }
.rb-big svg { width: 30px; height: 30px; }
.rb-stack { display: flex; flex-direction: column; gap: 1px; }
.rb-stack .rb-btn svg { width: 16px; height: 16px; color: #9fd0ff; }
.rb-combo { display: flex; align-items: center; gap: 4px; padding: 2px 4px; border: 1px solid #555d69; border-radius: 2px; background: #2a2e35; min-width: 150px; }
.rb-combo select { flex: 1; min-width: 0; border: none; background: transparent; color: var(--ui-text); font-size: 12px; }
.rb-combo select option { background: #2a2e35; }
.rb-combo-sw { width: 12px; height: 12px; border: 1px solid #000; background: #fff; flex: none; }
.doc-tabs { background: #2a2e35; }
.doc-start { color: var(--ui-dim); }
.acad-canvas-wrap { background: #1d2127; }
.vp-label { position: absolute; left: 8px; top: 6px; z-index: 2; font-size: 12px; color: #a5d8ff; pointer-events: none; font-family: Consolas, "D2Coding", "Malgun Gothic", monospace; }
.app-cad.is-light .vp-label { color: #1c4f82; }
.layout-tabs { display: flex; gap: 2px; padding: 2px 6px 0; background: #2a2e35; border-top: 1px solid #111; }
.layout-tab { padding: 2px 12px; border-radius: 0 0 3px 3px; background: #343941; color: var(--ui-dim); font-size: 12px; }
.layout-tab.is-active { background: #1d2127; color: #fff; }
.cmdline { background: #2a2e35; }
.cmd-history { background: rgba(29, 33, 39, 0.92); height: 84px; }
.cmd-row { background: #1d2127; color: var(--ui-text); border-top: 1px solid #454d58; }
.cmd-icon { color: var(--ui-dim); font-family: Consolas, monospace; font-size: 12px; }
.cmd-prompt { color: #ffd43b; }
.cmd-input { color: #fff; }
.layer-head { display: grid; grid-template-columns: 30px 16px minmax(0, 1fr) auto; gap: 6px; padding: 3px 8px; white-space: nowrap; background: #2a2e35; color: var(--ui-dim); font-size: 11px; border-bottom: 1px solid #111; }
.status-bar { background: #2a2e35; }

/* ── 사진 화면 세부(데스크톱 사진 편집 프로그램 배치) ── */
.ps-menubar { gap: 0; padding: 0 6px; min-height: 30px; background: #2b2b2b; border-bottom: 1px solid #1a1a1a; }
.ps-logo { display: grid; place-items: center; width: 24px; height: 22px; margin-right: 8px; border-radius: 3px; background: #0b2a3f; color: #4fc3f7; border: 1px solid #4fc3f7; font-weight: 800; font-size: 11px; }
.ps-menu-item { position: relative; }
.ps-menu-item .ps-menu { padding: 5px 10px; border: none; border-radius: 0; }
.ps-menu-item.is-open .ps-menu { background: #4a4a4a; }
.ps-drop {
  display: none; position: absolute; left: 0; top: 100%; z-index: 20; min-width: 250px; padding: 4px 0;
  background: #2f2f2f; border: 1px solid #1a1a1a; box-shadow: 0 8px 22px rgba(0,0,0,0.55);
}
.ps-menu-item.is-open .ps-drop { display: block; }
.ps-drop button, .ps-drop-check {
  display: flex; justify-content: space-between; gap: 24px; width: 100%; padding: 5px 18px; border: none; background: none; color: #e8e8e8; text-align: left; cursor: pointer; font-size: 12px; white-space: nowrap;
}
.ps-drop button:hover, .ps-drop-check:hover { background: #1473e6; color: #fff; }
.ps-drop-check { justify-content: flex-start; gap: 6px; }
.ps-drop kbd { color: #9a9a9a; font: inherit; }
.ps-drop button:hover kbd { color: #e6f0ff; }
.ps-drop hr { margin: 4px 0; border: none; border-top: 1px solid #444; }
.ps-options { min-height: 34px; background: #323232; border-bottom: 1px solid #1a1a1a; gap: 4px 10px; }
.ps-opt-icon svg { width: 20px; height: 20px; color: #ddd; }
.ps-opt-name { font-weight: 600; }
.ps-body { grid-template-columns: 40px minmax(0, 1fr) 300px; }
.ps-tools { align-items: center; background: #323232; padding: 6px 3px; border-right: 1px solid #1a1a1a; }
.ps-tool { width: 32px; height: 30px; }
.ps-tool.is-active { background: #1e1e1e; border-color: #5a5a5a; }
.ps-tools-sep { width: 22px; height: 1px; margin: 3px 0; background: #4a4a4a; }
.ps-colors { position: relative; width: 32px; height: 34px; margin-top: 8px; }
.ps-colors input[type=color] { position: absolute; width: 20px; height: 20px; padding: 0; border: 1px solid #000; outline: 1px solid #bbb; background: none; cursor: pointer; }
.ps-colors input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.ps-colors input[type=color]::-webkit-color-swatch { border: none; }
.ps-fg { left: 2px; top: 2px; z-index: 2; }
.ps-bg { left: 11px; top: 12px; z-index: 1; }
.ps-swap { position: absolute; right: -4px; top: -6px; padding: 0; border: none; background: none; color: #bbb; font-size: 10px; cursor: pointer; }
.app-photo .doc-tabs { background: #2b2b2b; padding: 0; }
.app-photo .doc-tab { display: inline-flex; gap: 10px; align-items: center; border-radius: 0; background: #3a3a3a; border-top: none; padding: 5px 12px; }
.app-photo .doc-tab.is-active { background: #323232; color: #fff; border-top: none; }
.doc-x { color: #999; }
.ps-stage { background: #282828; }
.ps-status { justify-content: flex-start; gap: 14px; background: #323232; border-top: 1px solid #1a1a1a; }
.ps-zoom-val { border-left: none; padding-left: 0; color: #ddd; }
.ps-panels { background: #323232; border-left: 1px solid #1a1a1a; gap: 0; }
.ps-group { border-bottom: 2px solid #1e1e1e; }
.ps-tabs { display: flex; gap: 0; background: #282828; }
.ps-tab { padding: 5px 12px; border: none; background: none; color: #a0a0a0; font-size: 12px; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.ps-tab.is-active { background: #323232; color: #fff; }
.ps-tabpane { display: flex; flex-direction: column; min-height: 0; }
.ps-tabpane[hidden] { display: none !important; }
.ps-color-panel { flex-direction: row; align-items: center; gap: 8px; }
.ps-color-big { width: 56px; height: 40px; padding: 0; border: 1px solid #111; background: none; cursor: pointer; }
.ps-swatches { display: grid; grid-template-columns: repeat(5, 18px); gap: 3px; }
.ps-swatch { width: 18px; height: 18px; padding: 0; border: 1px solid #111; cursor: pointer; }
.ps-layer-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 8px; color: #bbb; font-size: 12px; border-bottom: 1px solid #262626; }
.ps-layer-list { max-height: 28vh; padding: 0; }
.ps-layer { display: grid; grid-template-columns: 26px 34px minmax(0, 1fr) auto; align-items: center; gap: 6px; padding: 3px 6px; border-bottom: 1px solid #2a2a2a; font-size: 12px; }
.ps-layer:hover { background: #3d3d3d; }
.ps-layer.is-hidden .ps-eye { opacity: 0.25; }
.ps-layer.is-hidden .ps-layer-name { color: #888; }
.ps-eye { padding: 0; border: none; background: none; cursor: pointer; font-size: 13px; filter: grayscale(1) brightness(1.6); }
.ps-eye:disabled { cursor: default; }
.ps-thumb { width: 32px; height: 24px; display: grid; place-items: center; border: 1px solid #111; background: repeating-conic-gradient(#bbb 0% 25%, #eee 0% 50%) 50% / 8px 8px; color: #222; font-weight: 800; font-size: 13px; }
.ps-thumb-base { background: linear-gradient(#9cc8e8 50%, #8aa678 50%); }
.ps-thumb-rect::after { content: ""; width: 18px; height: 12px; border: 2px solid #e03131; }
.ps-thumb-comment::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: #e03131; border: 2px solid #fff; }
.ps-layer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-lock { font-size: 11px; filter: grayscale(1); }
.ps-group-grow .palette-list { max-height: 30vh; }

/* 좁은 화면: 오른쪽 창을 아래로 */
@media (max-width: 900px) {
  body { min-height: 0; }
  .main, .view-panel, .acad-body, .ps-body { flex: none; }
  .acad-body, .ps-body { grid-template-columns: minmax(0, 1fr); }
  .ps-body { grid-template-columns: 40px minmax(0, 1fr); }
  .ps-menubar { overflow-x: auto; flex-wrap: nowrap; }
  .ps-drop { position: fixed; left: 8px; right: 8px; top: auto; min-width: 0; }
  .ps-panels { grid-column: 1 / -1; }
  .palettes { border-left: none; border-top: 1px solid #111; overflow: visible; }
  .acad-canvas-wrap { min-height: 52vh; }
  .ps-stage { min-height: 46vh; }
  .install-btn { margin-left: 0; }
  .sb-coords { min-width: 0; }
  .sb-msg { flex-basis: 100%; text-align: left; white-space: normal; }
  .qa-title { display: none; }
  .ps-input { width: 100%; }
  .ps-opt[data-opt="text"].is-shown { flex-basis: 100%; }
}

/* 경관 탭 */
.app-landscape { background: var(--ui-1); }
.ls-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 12px; background: var(--ui-2); border-bottom: 1px solid var(--ui-line); }
.ls-files { color: var(--ui-dim); font-size: 12px; max-width: 30ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-cell { font-size: 12px; color: var(--ui-dim); display: inline-flex; gap: 6px; align-items: center; }
.ls-cell input { width: 70px; background: var(--ui-0); color: var(--ui-text); border: 1px solid var(--ui-line); border-radius: 4px; padding: 3px 6px; }
.ls-body { flex: 1; display: flex; min-height: 0; }
.ls-side { width: 360px; max-width: 45%; display: flex; flex-direction: column; gap: 6px; padding: 10px; border-right: 1px solid var(--ui-line); overflow: auto; }
.ls-h { margin: 4px 0 0; font-size: 13px; }
.ls-hint { margin: 0; font-size: 12px; color: var(--ui-dim); }
.ls-layers { width: 100%; border-collapse: collapse; font-size: 12px; }
.ls-layers th, .ls-layers td { padding: 3px 4px; border-bottom: 1px solid var(--ui-line); text-align: left; }
.ls-layers td:nth-child(n+2) { text-align: right; }
.ls-layers td:first-child { word-break: break-all; }
.ls-log { flex: 1; min-height: 120px; overflow: auto; font: 12px/1.5 ui-monospace, Consolas, monospace; background: var(--ui-0); border: 1px solid var(--ui-line); border-radius: 4px; padding: 6px; white-space: pre-wrap; }
.ls-log .is-err { color: #ff8787; }
.ls-view { flex: 1; min-width: 0; position: relative; }
.ls-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.ls-status { margin: 0; padding: 4px 12px; font-size: 12px; background: var(--ui-2); border-top: 1px solid var(--ui-line); }
@media (max-width: 760px) { .ls-body { flex-direction: column; } .ls-side { width: auto; max-width: none; max-height: 45%; border-right: none; border-bottom: 1px solid var(--ui-line); } .ls-view { min-height: 300px; } }

/* 에코렌즈 화면 안 탭으로 열렸을 때: 위쪽 제목 줄을 낮게(에코렌즈 상단 메뉴가 이미 있음) */
.is-embedded .app-bar .brand { display: none; }
