/* 도면 작업실: a full-screen workspace where the drawing is the main thing. Minimal, Swiss-style tool chrome (UI/UX Pro
   Max: canvas-focused tools — neutral canvas, a quiet tool panel, pan/zoom with visible controls), the app's own tokens
   (formind-design.css), an 8 px spacing scale, 24 px+ targets, visible focus. */
.plan-studio { position: fixed; inset: 0; z-index: 80; display: grid; grid-template-rows: auto 1fr; background: var(--fi-canvas, #f4f5f6); color: var(--fi-ink, #1d252b); font-size: 14px; }
.plan-studio[hidden] { display: none; }
body.plan-studio-open { overflow: hidden; }
.plan-studio button { font: inherit; cursor: pointer; }
.plan-studio :focus-visible { outline: 3px solid var(--fi-focus, #286caa); outline-offset: 2px; }

/* Top bar: back · title · sheet pager · export · close. */
.ps-bar { display: flex; align-items: center; gap: 16px; min-height: 56px; padding: 8px 16px; background: var(--fi-surface, #fff); border-bottom: 1px solid var(--fi-line, #dfe4e7); }
.ps-title { min-width: 0; flex: 1 1 auto; }
.ps-title h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.ps-meta { margin: 2px 0 0; color: var(--fi-secondary, #53616a); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-bar > button, .ps-export > summary { min-height: 36px; padding: 0 14px; border: 1px solid var(--fi-line, #dfe4e7); border-radius: var(--fi-radius-control, .6875rem); background: var(--fi-surface, #fff); color: inherit; }
.ps-bar > button:hover, .ps-export > summary:hover { border-color: var(--fi-line-strong, #bac5cc); }
.ps-back { font-weight: 600; }
.ps-sheetnav { display: flex; align-items: center; gap: 6px; padding: 4px; border: 1px solid var(--fi-line, #dfe4e7); border-radius: 999px; background: var(--fi-canvas, #f4f5f6); }
.ps-sheetname { min-width: 180px; text-align: center; font-variant-numeric: tabular-nums; }
.ps-sheetname small { color: var(--fi-secondary, #53616a); }
.ps-icon { display: inline-grid; place-items: center; min-width: 32px; min-height: 32px; padding: 0 6px; border: 0; border-radius: 999px; background: transparent; color: inherit; font-size: 18px; line-height: 1; }
.ps-icon:hover:not(:disabled) { background: var(--fi-tint, #e8f0ec); }
.ps-icon:disabled { opacity: .38; cursor: default; }
.ps-styles { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--fi-line, #dfe4e7); border-radius: 999px; background: var(--fi-canvas, #f4f5f6); }
.ps-styles > button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: inherit; font-size: 13px; }
.ps-styles > button:hover { background: var(--fi-surface, #fff); }
.ps-styles > button.is-on { background: var(--fi-surface, #fff); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); font-weight: 600; }
.ps-facade { min-height: 36px; padding: 0 10px; border: 1px solid var(--fi-line, #dfe4e7); border-radius: var(--fi-radius-control, .6875rem); background: var(--fi-surface, #fff); color: inherit; font: inherit; font-size: 13px; }
.ps-export { position: relative; }
.ps-export > summary { display: inline-flex; align-items: center; list-style: none; background: var(--fi-accent, #245b4b); border-color: var(--fi-accent, #245b4b); color: #fff; font-weight: 600; }
.ps-export > summary::-webkit-details-marker { display: none; }
.ps-export > summary::after { content: '▾'; margin-left: 8px; font-size: 11px; }
.ps-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 2; display: grid; min-width: 220px; padding: 6px; background: var(--fi-surface, #fff); border: 1px solid var(--fi-line, #dfe4e7); border-radius: var(--fi-radius-small, .5rem); box-shadow: var(--fi-shadow-floating, 0 16px 48px #192d3c14); }
.ps-menu button { min-height: 36px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; text-align: left; color: inherit; }
.ps-menu button:hover { background: var(--fi-tint, #e8f0ec); }

/* Main: side panel and canvas. */
.ps-main { display: grid; grid-template-columns: minmax(300px, 360px) 1fr; min-height: 0; }
.plan-studio.is-side-closed .ps-main { grid-template-columns: 48px 1fr; }
.ps-side { display: grid; grid-template-rows: auto 1fr; min-height: 0; background: var(--fi-sidebar, #f8f9fa); border-right: 1px solid var(--fi-line, #dfe4e7); }
.ps-tabs { display: flex; gap: 4px; align-items: center; padding: 8px; border-bottom: 1px solid var(--fi-line, #dfe4e7); }
.ps-tabs [role=tab] { position: relative; flex: 1 1 0; min-height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--fi-secondary, #53616a); font-weight: 600; }
.ps-tabs [role=tab]:hover { background: var(--fi-surface, #fff); color: var(--fi-ink, #1d252b); }
.ps-tabs [role=tab].is-on { background: var(--fi-surface, #fff); color: var(--fi-ink, #1d252b); box-shadow: var(--fi-shadow-small, 0 1px 3px #192d3c08); }
.ps-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px; border-radius: 999px; background: var(--fi-danger, #923d35); color: #fff; font-size: 11px; }
.plan-studio.is-side-closed .ps-tabs { flex-direction: column; border-bottom: 0; }
.plan-studio.is-side-closed .ps-tabs [role=tab], .plan-studio.is-side-closed .ps-panel { display: none; }
.ps-panel { overflow: auto; padding: 16px; overscroll-behavior: contain; }

/* Sheet list. */
.ps-sheets h4 { margin: 16px 0 6px; color: var(--fi-secondary, #53616a); font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.ps-sheets h4:first-child { margin-top: 0; }
.ps-sheets ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.ps-sheets button { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; width: 100%; min-height: 36px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent; color: inherit; text-align: left; }
.ps-sheets button small { color: var(--fi-secondary, #53616a); font-variant-numeric: tabular-nums; }
.ps-sheets button:hover { background: var(--fi-surface, #fff); }
.ps-sheets button.is-on { background: var(--fi-tint, #e8f0ec); box-shadow: inset 3px 0 0 var(--fi-accent, #245b4b); font-weight: 600; }

/* Setup and review sections. */
.ps-section { padding: 0 0 16px; margin: 0 0 16px; border-bottom: 1px solid var(--fi-line, #dfe4e7); }
.ps-section:last-child { border-bottom: 0; }
.ps-section h3 { margin: 0 0 8px; font-size: 15px; }
.ps-muted { margin: 6px 0; color: var(--fi-secondary, #53616a); font-size: 13px; line-height: 1.55; }
.ps-summary { margin: 6px 0; font-weight: 600; line-height: 1.5; }
.ps-field { display: grid; gap: 4px; margin: 8px 0; font-size: 13px; color: var(--fi-secondary, #53616a); }
.ps-field select, .plan-studio .space-programme input, .plan-studio .space-programme select, .plan-studio textarea { min-height: 36px; padding: 6px 8px; border: 1px solid var(--fi-line, #dfe4e7); border-radius: 8px; background: var(--fi-surface, #fff); color: var(--fi-ink, #1d252b); font: inherit; }
.plan-studio textarea { width: 100%; box-sizing: border-box; }
.ps-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ps-tools button, .ps-review > button { min-height: 36px; padding: 0 12px; border: 1px solid var(--fi-line, #dfe4e7); border-radius: 8px; background: var(--fi-surface, #fff); color: inherit; }
.plan-studio button.is-primary { background: var(--fi-accent, #245b4b); border-color: var(--fi-accent, #245b4b); color: #fff; font-weight: 600; }
.plan-studio button.is-primary:hover { background: var(--fi-accent-hover, #194b3d); }
.ps-disclosure { margin: 8px 0; }
.ps-disclosure > summary { min-height: 32px; display: flex; align-items: center; cursor: pointer; font-weight: 600; color: var(--fi-accent, #245b4b); }
.ps-segment { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--fi-canvas, #f4f5f6); border: 1px solid var(--fi-line, #dfe4e7); }
.ps-segment button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--fi-secondary, #53616a); }
.ps-segment button.is-on { background: var(--fi-surface, #fff); color: var(--fi-ink, #1d252b); font-weight: 600; box-shadow: var(--fi-shadow-small, 0 1px 3px #192d3c08); }
.ps-tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--fi-canvas, #f4f5f6); font-size: 12px; font-weight: 600; }
.ps-tag.is-on { background: var(--fi-tint, #e8f0ec); color: var(--fi-accent, #245b4b); }
.ps-list { margin: 8px 0; padding-left: 18px; font-size: 13px; line-height: 1.5; }
.ps-list .is-warn { color: var(--fi-warning, #805114); }
.ps-list .is-ok { color: var(--fi-accent, #245b4b); font-weight: 600; list-style: none; margin-left: -18px; }
.plan-studio .space-option { padding: 12px; margin: 10px 0; border: 1px solid var(--fi-line, #dfe4e7); border-radius: 12px; background: var(--fi-surface, #fff); }
.plan-studio .space-option.is-chosen { border-color: var(--fi-accent, #245b4b); box-shadow: 0 0 0 1px var(--fi-accent, #245b4b); }
.plan-studio .space-option-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.plan-studio .space-programme { width: 100%; border-collapse: collapse; font-size: 13px; }
.plan-studio .space-programme td, .plan-studio .space-programme th { padding: 3px 2px; text-align: left; }
.plan-studio .space-programme input { width: 100%; box-sizing: border-box; }
.ps-checks { margin: 8px 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.ps-checks li { padding: 10px 12px; border-radius: 10px; background: var(--fi-surface, #fff); border: 1px solid var(--fi-line, #dfe4e7); }
.ps-checks li strong { margin-left: 8px; }
.ps-checks li p { margin: 6px 0 0; font-size: 13px; line-height: 1.55; color: var(--fi-secondary, #53616a); }
.ps-checks li.is-error { border-left: 4px solid var(--fi-danger, #923d35); }
.ps-checks li.is-error .ps-tag { background: #f8e3e1; color: var(--fi-danger, #923d35); }
.ps-checks li.is-warn { border-left: 4px solid var(--fi-warning, #805114); }
.ps-checks li.is-warn .ps-tag { background: #fbefdc; color: var(--fi-warning, #805114); }
.ps-checks li.is-ok .ps-tag { background: var(--fi-tint, #e8f0ec); color: var(--fi-accent, #245b4b); }

/* Canvas: the sheet on a neutral ground, zoomed and panned. */
.ps-canvas { position: relative; overflow: hidden; min-width: 0; background: #e9ebed radial-gradient(#d3d8dc 1px, transparent 1px) 0 0 / 24px 24px; cursor: grab; touch-action: none; user-select: none; }
.ps-canvas.is-panning { cursor: grabbing; }
.ps-canvas:focus-visible { outline-offset: -3px; }
.ps-paper { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: #fff; box-shadow: 0 1px 2px #192d3c14, 0 12px 40px #192d3c1f; }
.ps-paper > svg { display: block; width: 100%; height: 100%; }
.ps-zoom { position: absolute; right: 16px; bottom: 16px; display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 12px; background: var(--fi-surface, #fff); border: 1px solid var(--fi-line, #dfe4e7); box-shadow: var(--fi-shadow-floating, 0 16px 48px #192d3c14); cursor: default; }
.ps-zoom button:not(.ps-icon) { min-height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: inherit; }
.ps-zoom button:not(.ps-icon):hover { background: var(--fi-tint, #e8f0ec); }
.ps-zoom-value { min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.ps-wait { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; pointer-events: none; }
.ps-wait[hidden], .ps-zoom[hidden] { display: none; }
.ps-wait thinking-orb { flex: none; }
.ps-wait p { margin: 0; color: var(--fi-secondary, #53616a); font-size: 14px; }
.ps-status { position: absolute; left: 16px; bottom: 16px; margin: 0; padding: 6px 10px; border-radius: 8px; background: #ffffffd9; color: var(--fi-secondary, #53616a); font-size: 12px; pointer-events: none; }
.ps-empty { grid-column: 1 / -1; align-self: center; justify-self: center; max-width: 520px; padding: 32px; text-align: center; }
.ps-empty h3 { margin: 0 0 8px; font-size: 20px; }
.ps-empty .ps-tools { justify-content: center; }
.ps-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 81; max-width: min(640px, calc(100vw - 32px)); margin: 0; padding: 10px 16px; border-radius: 10px; background: var(--fi-ink, #1d252b); color: #fff; box-shadow: var(--fi-shadow-floating, 0 16px 48px #192d3c14); }

/* Narrow screens: the panel becomes a drawer over the canvas. */
@media (max-width: 900px) {
  .ps-main { grid-template-columns: 1fr; position: relative; }
  .plan-studio.is-side-closed .ps-main { grid-template-columns: 1fr; }
  .ps-side { position: absolute; z-index: 3; inset: 0 auto 0 0; width: min(360px, 92vw); box-shadow: var(--fi-shadow-floating, 0 16px 48px #192d3c14); }
  .plan-studio.is-side-closed .ps-side { width: auto; height: auto; bottom: auto; background: transparent; border: 0; box-shadow: none; }
  .ps-meta, .ps-sheetname small { display: none; }
  .ps-sheetname { min-width: 0; }
  .ps-bar { gap: 8px; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: no-preference) {
  .ps-tabs [role=tab], .ps-sheets button, .ps-icon, .plan-studio button.is-primary { transition: background-color 120ms ease, color 120ms ease, box-shadow 120ms ease; }
}
