*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --primary: #002060;
  --primary-hover: #001845;
  --accent: #4a90d9;
  --accent-soft: #e8f2fc;
  --background: #f8fafc;
  --foreground: #0f172a;
  --muted: #64748b;
  --muted-foreground: #94a3b8;
  --card: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --ring: #4a90d9;
  --success: #166534;
  --success-bg: #f0fdf4;
  --error: #991b1b;
  --error-bg: #fef2f2;
  --info-bg: #eff6ff;
  --info: #1e40af;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --sidebar-width: 256px;
  --header-height: 48px;
  --shadow-sm: 0 1px 2px rgba(0, 32, 96, 0.06);
  --shadow-card: 0 1px 3px rgba(0, 32, 96, 0.08), 0 1px 2px rgba(0, 32, 96, 0.04);
  --font-sans: 'Noto Sans KR', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  display: flex;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 1rem 0.75rem;
}

.sidebar-top {
  padding: 0 0.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 0.75rem;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  width: 100%;
}

.sidebar-brand-main {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-width: 0;
}

.sidebar-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.15);
  font-weight: 800;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.sidebar-brand-mark svg {
  width: 20px;
  height: 20px;
}

.sidebar-brand-title {
  flex: 1;
  min-width: 0;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.sidebar-brand-subtitle {
  width: 100%;
  margin: 0;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.sidebar-brand-text strong {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.sidebar-brand-text span {
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 400;
  line-height: 1.35;
}

.sidebar-active-file {
  margin-top: 0.85rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-active-file-label {
  display: block;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 0.2rem;
}

.sidebar-active-file-name {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0 0.25rem;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
}

.nav-item:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-weight: 600;
}

.nav-item.active .nav-icon {
  opacity: 1;
}

.nav-item:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.sidebar-version {
  margin: 0.75rem 0.5rem 0;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.45);
}

.app-body {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--background);
}

.app-header {
  flex-shrink: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.app-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  min-width: 0;
}

.app-breadcrumb-root {
  color: var(--muted);
  font-weight: 500;
}

.app-breadcrumb-sep {
  color: var(--muted-foreground);
}

.app-breadcrumb-current {
  color: var(--foreground);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header-meta {
  flex-shrink: 0;
  max-width: 40%;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main {
  flex: 1;
  padding: 1.25rem 1.5rem 1.5rem;
  overflow: auto;
  min-height: 0;
}

.main.main--result-full {
  padding: 0;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.is-split-resizing {
  user-select: none;
  cursor: col-resize;
}

body.is-split-resizing * {
  cursor: col-resize !important;
}

.page-header h1,
.result-topbar h1,
.frame-topbar-main h1 {
  margin: 0 0 0.35rem;
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--foreground);
  letter-spacing: -0.02em;
}

.page-header p,
.quantity-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.page-header {
  margin-bottom: 1.25rem;
}

.hidden {
  display: none !important;
}

.status {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  border: 1px solid transparent;
}

.status.loading,
.status.info {
  background: var(--info-bg);
  color: var(--info);
  border-color: #bfdbfe;
}

.status.error {
  background: var(--error-bg);
  color: var(--error);
  border-color: #fecaca;
}

.status.success {
  background: var(--success-bg);
  color: var(--success);
  border-color: #bbf7d0;
}

.upload-card,
.config-panel,
.layer-panel,
.result-panel {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
}

.upload-card {
  padding: 1.5rem;
  max-width: 720px;
}

.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2.5rem;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  cursor: pointer;
  background: var(--background);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.file-drop:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.file-drop input {
  display: none;
}

.selected-file {
  margin: 1rem 0;
  color: var(--primary);
  font-weight: 500;
}

.primary-btn,
.toolbar-btn,
.secondary-btn {
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.primary-btn {
  padding: 0.625rem 1.125rem;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
}

.primary-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.primary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.toolbar-btn {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--foreground);
}

.toolbar-btn:hover:not(:disabled) {
  background: var(--background);
  border-color: var(--accent);
  color: var(--primary);
}

.toolbar-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.floor-split-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem 1rem;
  align-items: end;
  margin-bottom: 1rem;
  padding: 1rem 1.125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.floor-split-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.floor-label-layer-label {
  margin-top: 0.65rem;
}

.floor-split-field label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
}

.title-block-input,
.floor-split-field select,
.beam-extension-field input,
.config-search,
.panel-search,
.viewer-search,
#layerSearch {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--foreground);
  font-family: inherit;
  font-size: 0.875rem;
}

.title-block-input {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.55rem 0.75rem;
}

.title-block-input:focus,
.floor-split-field select:focus,
.beam-extension-field input:focus,
.config-search:focus,
.panel-search:focus,
.viewer-search:focus,
#layerSearch:focus {
  outline: 2px solid rgba(74, 144, 217, 0.35);
  border-color: var(--accent);
}

.title-block-input:disabled,
.floor-split-field select:disabled {
  background: #f1f5f9;
  color: #94a3b8;
}

.floor-split-field select:not(:disabled),
.title-block-input:not(:disabled) {
  background: #fff;
  color: #1f2937;
}

.floor-split-summary {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.85rem;
  color: #5b6b7f;
}

.secondary-btn {
  padding: 0.625rem 1rem;
  border: 1px solid var(--primary);
  background: var(--card);
  color: var(--primary);
}

.secondary-btn:hover:not(:disabled) {
  background: var(--accent-soft);
}

.secondary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.floor-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.floor-tab {
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.floor-tab:hover {
  border-color: var(--accent);
  color: var(--primary);
}

.floor-tab.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
}

.beam-extension-field {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.beam-extension-field input {
  width: 5.5rem;
  padding: 0.45rem 0.55rem;
}

.config-search,
.panel-search,
.viewer-search,
#layerSearch {
  width: 100%;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.75rem;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.config-panel,
.layer-panel {
  padding: 1rem;
}

.layer-panel.full-width {
  margin-top: 0;
}

.config-panel-header h3,
.layer-panel h2 {
  margin: 0 0 0.25rem;
}

.config-hint {
  font-size: 0.82rem;
  color: #7a8a9e;
}

.config-search,
.panel-search,
.viewer-search,
#layerSearch {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #c5d0dc;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

.selected-layer-list {
  min-height: 120px;
  max-height: 220px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.selected-layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
}

.layer-hint-banner {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  background: #fffbeb;
  color: #92400e;
  font-size: 0.875rem;
  line-height: 1.5;
}

#pageResult .result-table-wrap--detail , #pageWinResult .result-table-wrap--detail {
  overflow: auto;
}

#pageResult .result-detail-table thead , #pageWinResult .result-detail-table thead {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--primary);
}

#pageResult .result-detail-table .detail-header-row th , #pageWinResult .result-detail-table .detail-header-row th {
  background: var(--primary);
  color: #fff;
  white-space: nowrap;
}

.result-panel.is-live-view #quantityDetailTable {
  table-layout: fixed;
}

.result-panel.is-live-view #quantityDetailTable .detail-header-row--live th {
  position: relative;
  overflow: visible;
}

.result-panel.is-live-view #quantityDetailTable td,
.result-panel.is-live-view #quantityDetailTable .detail-filter-row th {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-panel.is-live-view #quantityDetailTable td:has(.unlabeled-kind-select),
.result-panel.is-live-view #quantityDetailTable td:has(.unlabeled-schedule-select),
.result-panel.is-live-view #quantityDetailTable td:has(.member-kind-select) {
  overflow: visible;
}

.result-panel.is-live-view #quantityDetailTable .detail-code-input,
.result-panel.is-live-view #quantityDetailTable .unlabeled-kind-select,
.result-panel.is-live-view #quantityDetailTable .unlabeled-schedule-select,
.result-panel.is-live-view #quantityDetailTable .member-kind-select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.col-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 4;
  touch-action: none;
}

.col-resize-handle::after {
  content: '';
  position: absolute;
  top: 18%;
  bottom: 18%;
  left: 4px;
  width: 1px;
  background: rgba(255, 255, 255, 0.55);
}

#pageResult .result-detail-table .detail-filter-row th , #pageWinResult .result-detail-table .detail-filter-row th {
  position: sticky;
  top: 2.05rem;
  z-index: 2;
  background: #f8fafc;
  padding: 0.25rem 0.35rem;
  border-bottom: 1px solid var(--border);
}

.detail-col-filter {
  width: 100%;
  min-width: 0;
  padding: 0.2rem 0.35rem;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.72rem;
  background: #fff;
}

.result-topbar-main {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.result-topbar-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.85rem;
  min-width: 0;
}

.result-topbar-title-row h1 {
  margin: 0;
  font-size: 1rem;
  white-space: nowrap;
}

.result-topbar-title-row .quantity-subtitle {
  margin: 0;
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.steel-results-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 14px 0;
  flex-shrink: 0;
}

#steelResultsPanelContent,
.result-panel-content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.steel-metric-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.steel-metric-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.steel-metric-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
}

.steel-results-empty {
  margin: 12px 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: #eef5fc;
  border: 1px solid #c5d9ef;
  color: #355272;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.result-panel.is-db-view .detail-header-row--live,
.result-panel.is-db-view .detail-filter-row,
.result-panel.is-db-view .detail-only-filter {
  display: none;
}

.result-panel.is-live-view .detail-header-row--db {
  display: none;
}

.result-panel.is-live-view .summary-header-row--db {
  display: none;
}

.result-panel.is-db-view .summary-header-row--live {
  display: none;
}

/* 구버전 상단 고정 3D 패널 — PiP(3D 버튼)만 사용 */
.steel-3d-viewer-panel {
  display: none !important;
}

.result-panel:not(.is-db-view):not(.is-both-view) .summary-header-row--db,
.result-panel:not(.is-db-view):not(.is-both-view) .detail-header-row--db {
  display: none;
}

.result-viewer-stack {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.result-viewer-stack > .viewer-shell {
  flex: 1 1 auto;
  min-height: 240px;
}

.result-stats {
  padding: 0.85rem;
  border-top: 1px solid var(--border);
  background: var(--background);
}

.result-stats div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.result-stats span {
  font-size: 0.75rem;
  color: var(--muted);
}

.result-stats--split {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.result-stats-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.result-stats-group-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
}

.result-stats-table {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.result-stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  text-align: center;
}

.result-stats-row--head span {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.result-stats-row--values strong {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary);
}

.mini-btn {
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--border-strong);
  border-radius: calc(var(--radius) - 2px);
  background: var(--card);
  font-size: 0.72rem;
  cursor: pointer;
  font-family: inherit;
}

.mini-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--primary);
}

.selected-layer-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.remove-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1px solid #d7dee8;
  border-radius: 6px;
  background: #fff;
  color: #7a8a9e;
  cursor: pointer;
  font-size: 0.85rem;
}

.remove-btn:hover {
  border-color: #e53e3e;
  color: #e53e3e;
  background: #fff5f5;
}

.layer-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
}

.layer-badge.member {
  background: #fff3e6;
  color: #c05621;
}

.layer-badge.label {
  background: #e8f4ff;
  color: #2c5f8a;
}

.layer-badge.deferred {
  background: #f1f5f9;
  color: #64748b;
}

.layer-badge.background {
  background: #ecfeff;
  color: #0e7490;
}

.layer-badge.column {
  background: #e8ffe8;
  color: #1f7a3f;
}

.mini-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.layer-badge.steel-label {
  background: #e8fff4;
  color: #1f7a4f;
}

.layer-badge.rc-label {
  background: #fff8e6;
  color: #9a6700;
}

.layer-hint-banner code {
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.8);
  font-size: 0.85rem;
}

.result-table-wrap tbody tr {
  cursor: pointer;
}

.result-table-wrap tbody tr.selected {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}

.result-table-wrap tbody tr.selected td {
  color: var(--primary);
  font-weight: 600;
}

.result-table-wrap tbody tr:hover:not(.selected) {
  background: #f8fafc;
}

.panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.panel-toolbar .panel-search {
  flex: 1;
  min-width: 160px;
  margin-bottom: 0;
}

.layer-checkbox-list,
.layer-table-wrap {
  max-height: 280px;
  overflow: auto;
}

.layer-checkbox-item {
  display: flex;
  gap: 0.6rem;
  padding: 0.45rem;
  border-radius: 6px;
}

.layer-checkbox-item:hover {
  background: #f7fafc;
}

.layer-checkbox-name {
  font-family: Consolas, monospace;
  font-size: 0.82rem;
}

.layer-checkbox-meta {
  font-size: 0.75rem;
  color: #7a8a9e;
}

.config-selection-summary {
  margin: 0.75rem 0 0;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.8125rem;
}

.result-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

#pageResult.page-result , #pageWinResult.page-result , #pageRcResult.page-result {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

#pageResult .result-topbar , #pageWinResult .result-topbar , #pageRcResult .result-topbar {
  flex-shrink: 0;
  margin-bottom: 0;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.result-topbar-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  align-items: center;
}

.save-final-results-btn {
  white-space: nowrap;
}

.result-split {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

.result-split-pane--viewer {
  flex: 1 1 auto;
  min-width: 320px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #0f141c;
}

.result-split-resizer:hover,
.result-split-resizer.is-dragging,
.result-split-resizer:focus-visible {
  background: var(--primary);
  outline: none;
}

.result-split-resizer {
  flex: 0 0 5px;
  width: 5px;
  cursor: col-resize;
  background: var(--border);
  transition: background 0.15s ease;
  position: relative;
  z-index: 4;
}

.result-split-pane--panel,
#pageResult .result-panel , #pageWinResult .result-panel , #pageRcResult .result-panel {
  width: 400px;
  flex: 0 0 auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border-radius: 0;
  border-left: none;
  box-shadow: none;
  background: #fff;
}

.result-panel-header {
  flex-shrink: 0;
  border-bottom: 1px solid #e2e8f0;
}

.result-panel-header-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  padding: 0.35rem 0.5rem 0.35rem 0;
}

.result-panel-header .tabs {
  flex-wrap: nowrap;
  width: 100%;
}

.result-panel-header .tab {
  flex: 1 0 auto;
  white-space: nowrap;
  padding: 0.7rem 0.4rem;
  font-size: 0.75rem;
}

.result-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#pageResult .tab-panel--table , #pageWinResult .tab-panel--table {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0.65rem 0.75rem 0.75rem;
}

#pageResult .tab-panel--table .panel-toolbar, #pageWinResult .tab-panel--table .panel-toolbar,
#pageResult .tab-panel--table .panel-search , #pageWinResult .tab-panel--table .panel-search {
  flex-shrink: 0;
  margin-bottom: 0.5rem;
}

#pageResult .tab-panel--stats , #pageWinResult .tab-panel--stats {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.85rem;
}

.result-stats--tab {
  border-top: none;
  padding: 0;
  background: transparent;
}

.result-stats--tab .result-stats-group {
  min-height: 120px;
}

#quantityDetailBody tr.detail-row--plate td,
#quantitySummaryBody tr.summary-row--plate td {
  background: #ecfeff;
  font-weight: 700;
}

#pageResult .result-summary-table thead , #pageWinResult .result-summary-table thead {
  position: sticky;
  top: 0;
  z-index: 3;
}

#pageResult .result-summary-table thead th , #pageWinResult .result-summary-table thead th {
  background: var(--primary);
  color: #fff;
  white-space: nowrap;
}

.tab-context-menu {
  position: fixed;
  z-index: 12000;
  min-width: 140px;
  padding: 0.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
}

.tab-context-menu button {
  display: block;
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  border-radius: calc(var(--radius) - 2px);
}

.tab-context-menu button:hover {
  background: #f1f5f9;
}

#pageResult .viewer-shell , #pageWinResult .viewer-shell , #pageRcResult .viewer-shell {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0.5rem 0.5rem 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
}

#pageResult .viewer-stage , #pageWinResult .viewer-stage , #pageRcResult .viewer-stage {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

#pageResult .viewer-canvas-wrap , #pageWinResult .viewer-canvas-wrap , #pageRcResult .viewer-canvas-wrap {
  flex: 1 1 auto;
  min-height: 320px;
  height: auto;
  max-height: none;
  border-radius: 8px;
}

#pageResult .tab-panel , #pageWinResult .tab-panel , #pageRcResult .tab-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#pageResult .result-table-wrap , #pageWinResult .result-table-wrap , #pageRcResult .result-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

#pageWinResult .win-ref-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted, #9aa8b8);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

#pageWinResult .win-ref-toggle input {
  margin: 0;
  cursor: pointer;
}

#pageWinResult tr.is-reference-row {
  opacity: 0.72;
}

#pageWinResult .excluded-note {
  color: #f0a060;
  font-size: 0.82rem;
}

#pageWinResult .note-cell {
  font-size: 0.82rem;
  color: var(--text-muted, #9aa8b8);
}

#pageWinResult .ref-toggle-cell {
  text-align: center;
  width: 5.5rem;
}

#pageRcResult .rc-dimension-check {
  color: #f0a060;
  font-size: 0.82rem;
  font-style: italic;
}

#pageResult .viewer-toolbar , #pageWinResult .viewer-toolbar , #pageRcResult .viewer-toolbar {
  flex-shrink: 0;
  margin-bottom: 0.5rem;
}

/* legacy aliases kept for compatibility */
.result-layout {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.result-viewer-column {
  flex: 1 1 auto;
  min-width: 320px;
  overflow: hidden;
}

.viewer-shell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  min-height: 0;
}

.result-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
}

#pageResult .result-panel , #pageWinResult .result-panel , #pageRcResult .result-panel {
  border: none;
  border-left: 1px solid var(--border);
  border-radius: 0;
}

.rc-results-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 1200px) {
  .rc-results-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.viewer-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.viewer-search {
  flex: 1;
  min-width: 180px;
  margin-bottom: 0;
}

.toggle-inline {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.viewer-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  padding-bottom: 8px;
  padding-right: 8px;
}

.viewer-canvas-wrap {
  position: relative;
  width: 100%;
  height: clamp(480px, 68vh, 720px);
  min-height: 360px;
  max-height: calc(100vh - 220px);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #253041;
  background: #101820;
}

.preview-3d-open-btn {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 18;
  min-width: 44px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid #3d4f66;
  border-radius: 999px;
  background: rgba(12, 18, 28, 0.92);
  color: #d8e6ff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.preview-3d-open-btn:hover,
.preview-3d-open-btn:focus-visible {
  background: rgba(24, 36, 54, 0.96);
  border-color: #5b8cff;
  transform: translateY(-1px);
}

.preview-3d-open-btn.hidden {
  display: none;
}

.preview-3d-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(8, 12, 20, 0.55);
  backdrop-filter: blur(2px);
}

.preview-3d-overlay.hidden {
  display: none;
}

.preview-3d-pip {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 19;
  width: min(400px, calc(100% - 28px));
  height: 300px;
  min-width: 300px;
  min-height: 200px;
  max-width: calc(100% - 16px);
  max-height: calc(100% - 16px);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #334155;
  background: linear-gradient(180deg, rgba(16, 22, 32, 0.98), rgba(10, 14, 22, 0.98));
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
}

.preview-3d-pip.preview-3d-pip--maximized {
  position: fixed;
  left: 50%;
  top: 50%;
  right: auto;
  bottom: auto;
  z-index: 1210;
  transform: translate(-50%, -50%);
  width: min(80vw, calc(100vw - 32px));
  height: min(80vh, calc(100vh - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
}

.preview-3d-pip.preview-3d-pip--maximized .preview-3d-resize-handle {
  display: none;
}

body.is-preview3d-resizing {
  user-select: none;
  cursor: nwse-resize;
}

body.is-preview3d-resizing * {
  cursor: nwse-resize !important;
}

.preview-3d-pip.hidden {
  display: none;
}

.preview-3d-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

.preview-3d-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.preview-3d-title-wrap strong {
  color: #eef4ff;
  font-size: 13px;
}

.preview-3d-caption {
  color: #8fa3bf;
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-3d-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.preview-3d-icon-btn {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #c6d4ea;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.preview-3d-icon-btn:hover,
.preview-3d-icon-btn:focus-visible {
  background: rgba(255, 255, 255, 0.12);
}

.preview-3d-close-btn {
  font-size: 18px;
}

.preview-3d-canvas-host {
  flex: 1 1 auto;
  min-height: 0;
  background: #0b1018;
}

.preview-3d-canvas-host canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.preview-3d-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 6px 12px 0;
  color: #9eb1cb;
  font-size: 11px;
}

.preview-3d-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 4px;
  border-radius: 2px;
  vertical-align: -1px;
}

.preview-3d-swatch.column {
  background: #f472b6;
}

.preview-3d-swatch.girder {
  background: #52d052;
}

.preview-3d-swatch.beam {
  background: #4da3ff;
}

.preview-3d-hint {
  margin: 0;
  padding: 4px 12px 8px;
  color: #6f839c;
  font-size: 10px;
}

.preview-3d-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  touch-action: none;
}

.preview-3d-resize-handle::after {
  content: '';
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(255, 255, 255, 0.35);
  border-bottom: 2px solid rgba(255, 255, 255, 0.35);
  border-bottom-right-radius: 2px;
}

.viewer-resize-handle {
  position: absolute;
  z-index: 6;
  padding: 0;
  border: none;
  background: transparent;
}

.viewer-resize-handle::after {
  content: '';
  position: absolute;
  background: #7b8ea3;
  border-radius: 999px;
  opacity: 0.45;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.viewer-resize-handle:hover::after,
.viewer-resize-handle:focus-visible::after {
  opacity: 1;
  background: #2c5f8a;
}

.viewer-resize-handle-column {
  top: 0;
  right: -2px;
  width: 12px;
  height: 100%;
  cursor: col-resize;
}

.viewer-resize-handle-column::after {
  top: 12%;
  bottom: 12%;
  left: 4px;
  width: 3px;
}

.viewer-resize-handle-bottom {
  left: 0;
  right: 8px;
  bottom: 0;
  height: 12px;
  cursor: row-resize;
}

.viewer-resize-handle-bottom::after {
  left: 12%;
  right: 12%;
  top: 4px;
  height: 3px;
}

.viewer-resize-handle-corner {
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
}

.viewer-resize-handle-corner::after {
  right: 4px;
  bottom: 4px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: linear-gradient(135deg, transparent 0 44%, #7b8ea3 44% 56%, transparent 56% 100%);
  opacity: 0.8;
}

body.is-resizing-column {
  cursor: col-resize;
  user-select: none;
}

body.is-resizing-row {
  cursor: row-resize;
  user-select: none;
}

body.is-resizing-both {
  cursor: nwse-resize;
  user-select: none;
}

#dxfCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

#dxfCanvas.is-panning {
  cursor: grabbing;
}

.viewer-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 220px;
  padding: 0.85rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  font-size: 0.82rem;
}

.viewer-overlay h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
}

.type-filters {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 160px;
  overflow: auto;
  margin-bottom: 0.75rem;
}

.type-filter-item {
  display: grid;
  grid-template-columns: auto 12px 1fr;
  gap: 0.25rem 0.5rem;
  align-items: center;
  cursor: pointer;
}

.type-filter-item input[type="checkbox"] {
  margin: 0;
}

.type-filter-name {
  font-size: 0.85rem;
}

.type-filter-item small {
  grid-column: 2;
  color: #7a8a9e;
  font-size: 0.72rem;
}

.type-color {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.slider-row {
  display: grid;
  grid-template-columns: 70px 1fr;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.viewer-coords {
  margin: 0.5rem 0 0;
  color: #5a6a7e;
  font-size: 0.75rem;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--background);
}

.tab {
  flex: 1;
  padding: 0.75rem 0.5rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--muted);
  font-family: inherit;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab:hover {
  color: var(--primary);
}

.tab.active {
  background: var(--card);
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-panel {
  padding: 0.85rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

thead {
  background: var(--primary);
}

thead th {
  color: #fff;
  font-weight: 600;
  font-size: 0.8125rem;
  border-bottom: none;
}

th,
td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.length-cell,
.drawable-count,
.layer-count {
  text-align: right;
  font-weight: 600;
}

.code-cell,
.layer-name {
  font-family: Consolas, monospace;
}

.detail-code-input {
  width: 100%;
  min-width: 4.5rem;
  max-width: 8rem;
  padding: 0.2rem 0.35rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  font-family: inherit;
  font-size: inherit;
}

.detail-code-input:hover,
.detail-code-input:focus {
  border-color: var(--accent, #4da3ff);
  background: rgba(77, 163, 255, 0.08);
  outline: none;
}

.unlabeled-kind-select,
.unlabeled-schedule-select {
  max-width: none;
  cursor: pointer;
}

.unlabeled-kind-select option[value="delete"],
.member-kind-select option[value="delete"] {
  color: #b91c1c;
}

.unlabeled-schedule-select {
  min-width: 0;
  max-width: 100%;
}

tr.selected .detail-code-input {
  background: rgba(255, 255, 255, 0.08);
}

.num-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.empty-row,
.empty-config {
  text-align: center;
  color: #7a8a9e;
  padding: 1.5rem;
}

.frame-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem 1.125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.frame-topbar-main {
  min-width: 0;
}

.frame-topbar-main h1 {
  margin: 0 0 0.45rem;
  font-size: 1.35rem;
}

.frame-file-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
}

.frame-file-name {
  display: inline-flex;
  max-width: min(100%, 42rem);
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(74, 144, 217, 0.25);
  color: var(--primary);
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.frame-file-note {
  color: #6b7c90;
  font-size: 0.84rem;
}

.frame-topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}

.frame-floor-select {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #355272;
}

.frame-floor-select select {
  min-width: 140px;
  padding: 0.5rem 0.65rem;
  border: 1px solid #c5d0dc;
  border-radius: 8px;
  background: #fff;
}

.frame-split-panel {
  grid-template-columns: minmax(150px, 180px) minmax(0, 1fr) auto;
  align-items: end;
  margin-bottom: 1rem;
}

.frame-split-panel--inline {
  display: block;
}

.frame-split-inline-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  overflow-x: auto;
}

.frame-inline-field {
  min-width: 140px;
}

.frame-inline-field--grow {
  flex: 1 1 180px;
  min-width: 180px;
}

.frame-inline-field .title-block-input {
  margin-top: 0;
}

.frame-block-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  flex: 1 1 auto;
}

.frame-block-inline.hidden {
  display: none;
}

.frame-layer-inline {
  display: contents;
}

.frame-layer-inline.hidden {
  display: none;
}

.frame-layer-fields.hidden {
  display: none;
}

.frame-split-panel--inline .frame-split-btn {
  flex: 0 0 auto;
  align-self: flex-end;
}

.frame-split-panel--inline .floor-split-summary {
  margin-top: 0.65rem;
}

.frame-layer-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

.frame-split-btn {
  white-space: nowrap;
}

.frame-block-field {
  min-width: 0;
}

.frame-mode-field select {
  width: 100%;
}

.frame-view-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.frame-view-modes {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  overflow: hidden;
}

.frame-view-mode {
  padding: 0.5rem 0.9rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8125rem;
  cursor: pointer;
  font-family: inherit;
  border-radius: calc(var(--radius) - 2px);
}

.frame-view-mode.active {
  background: var(--primary);
  color: #fff;
}

.frame-view-hint {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.82rem;
  color: #64748b;
}

.frame-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.8fr);
  gap: 1rem;
  min-height: 680px;
}

.frame-viewer-shell {
  min-height: 680px;
}

.frame-layer-overlay {
  max-height: calc(100% - 24px);
  overflow: auto;
}

.win-bg-layer-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.win-bg-layer-search {
  flex: 1 1 140px;
  min-width: 120px;
}

.win-bg-layer-list {
  max-height: 320px;
}

.frame-select-all {
  margin-bottom: 0.5rem;
}

.frame-side-panel {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  min-height: 680px;
  overflow: auto;
}

.frame-side-panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.frame-floor-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.frame-floor-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.frame-floor-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.frame-floor-item.active {
  border-color: var(--primary);
  background: var(--accent-soft);
}

.frame-floor-item strong {
  font-size: 0.875rem;
  color: var(--primary);
}

.frame-floor-item span {
  font-size: 0.78rem;
  color: #64748b;
}

#frameCanvas {
  cursor: crosshair;
}

#frameCanvas.is-panning {
  cursor: grabbing;
}

@media (max-width: 1100px) {
  .frame-layout {
    grid-template-columns: 1fr;
  }

  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid #dde4ec;
  }

  .main.main--result-full {
    height: 100vh;
    min-height: 0;
  }

  .result-split {
    flex-direction: column;
  }

  .result-split-resizer {
    display: none;
  }

  .result-split-pane--panel,
  #pageResult .result-panel , #pageWinResult .result-panel {
    width: 100% !important;
    max-height: 42vh;
    border-left: none;
    border-top: 1px solid #dbe4ef;
  }

  .result-viewer-column {
    width: 100%;
    max-width: none;
    min-height: 52vh;
  }

  #pageResult .viewer-canvas-wrap , #pageWinResult .viewer-canvas-wrap , #pageRcResult .viewer-canvas-wrap {
    min-height: 360px;
  }

  .config-grid {
    grid-template-columns: 1fr;
  }
}

/* ─────────────────────────────────────────────────────
   APS Viewer 페이지
───────────────────────────────────────────────────── */
.aps-viewer-header {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.aps-viewer-header > div:first-child {
  flex: 1 1 auto;
}
.aps-viewer-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.aps-urn-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.aps-urn-input {
  width: 340px;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: var(--font-mono, monospace);
  background: var(--bg-card);
  color: var(--text);
}
.aps-urn-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.aps-status-banner {
  margin: 0.5rem 1.5rem;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 500;
}
.aps-status-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.aps-status-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.aps-status-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.aps-forge-viewer {
  margin: 0.5rem 1.5rem 1.5rem;
  flex: 1 1 0;
  min-height: 0;
  height: calc(100vh - 200px);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #1a1a2e;
}

#pageApsviewer {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.layer-badge.column-label {
  background: #fff0e0;
  color: #c45a00;
}

.config-grid--rc-layers {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.config-grid--steel-layers {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.config-grid--window-layers {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.config-grid--window-layers > .config-panel {
  display: flex;
  flex-direction: column;
  height: 340px;
  min-height: 0;
  box-sizing: border-box;
}

.config-grid--window-layers .win-mark-pane {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0.9rem;
}

.config-grid--window-layers .win-mark-pane.hidden {
  display: none;
}

.config-grid--window-layers .selected-layer-list,
.config-grid--window-layers .win-block-candidate-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  height: auto;
}

.win-mark-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.win-mark-mode-btn {
  padding: 0.38rem 0.5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.win-mark-mode-btn:hover {
  border-color: var(--accent);
  color: var(--primary);
}

.win-mark-mode-btn.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.config-panel--block-candidates table {
  font-size: 0.78rem;
}

.config-panel--block-candidates th,
.config-panel--block-candidates td {
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .config-grid--window-layers {
    grid-template-columns: 1fr;
  }
}

.layer-badge.slab {
  background: #e8eeff;
  color: #3b5ccc;
}

.config-panel--beam-group .beam-group-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.config-panel--beam-group .beam-group-section h4 {
  margin: 0 0 0.25rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.page--mapping #rcScheduleMappingContent:not(.hidden) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 0.75rem;
}

.page--mapping #rcScheduleMappingContent .schedule-mapping-grid {
  flex: 1 1 auto;
  min-height: 0;
}

.boq-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.boq-header-text {
  min-width: 0;
}

.boq-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.boq-excel-btn {
  flex-shrink: 0;
  margin-top: 0.15rem;
  padding: 0.45rem 0.8rem;
  font-size: 0.8125rem;
  font-weight: 700;
}

.boq-setup {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.7rem;
  margin: 0 0 0.9rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
}

.boq-setup-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1.1rem;
}

.boq-setup-label {
  min-width: 5.5rem;
  font-weight: 700;
}

.boq-method-option,
.boq-rate {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
}

.boq-rate input {
  width: 4.4rem;
  padding: 0.28rem 0.4rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-weight: 500;
  text-align: right;
}

.boq-setup-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.boq-generate-btn {
  margin-top: 0;
}

.boq-generate-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.boq-meta {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.main:has(#pageBoq:not(.hidden)) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main:has(#pageBoq:not(.hidden)) > #status,
.main:has(#pageBoq:not(.hidden)) > .flow-tabs-bar {
  flex-shrink: 0;
}

#pageBoq.page:not(.hidden) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#pageBoq .boq-header,
#pageBoq .boq-setup,
#pageBoq .boq-meta {
  flex-shrink: 0;
}

.boq-table-wrap {
  flex: 1 1 auto;
  min-height: 12rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  background: var(--card);
}

.boq-table {
  width: 1488px;
  min-width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8125rem;
}

.boq-col-name { width: 156px; }
.boq-col-spec { width: 184px; }
.boq-col-unit { width: 72px; }
.boq-col-qty { width: 96px; }
.boq-col-price { width: 104px; }
.boq-col-note { width: 148px; }

.boq-table th,
.boq-table td {
  border-color: var(--border);
  border-style: solid;
  border-width: 0 1px 1px 0;
  padding: 0.45rem 0.5rem;
  vertical-align: middle;
  background: #fff;
}

.boq-table tr > :first-child {
  border-left-width: 1px;
}

.boq-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  border-color: rgba(255, 255, 255, 0.18);
  border-top-width: 1px;
}

.boq-table thead tr:nth-child(2) th {
  top: var(--boq-head-row, 2.15rem);
  z-index: 2;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border-top-width: 0;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.18);
}

.boq-table td.boq-name,
.boq-table td.boq-spec {
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.boq-table td.boq-unit,
.boq-table td.boq-qty,
.boq-table td.boq-money {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.boq-table td.boq-unit,
.boq-table td.boq-note {
  text-align: center;
}

.boq-table .boq-input--note {
  width: 100%;
  box-sizing: border-box;
  padding: 0.28rem 0.4rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  font: inherit;
  text-align: left;
}

.boq-table tr.boq-section td {
  background: #f1f5f9;
  color: var(--primary);
  font-weight: 700;
  text-align: left;
}

.boq-table tfoot td {
  background: #f8fafc;
  font-weight: 600;
  border-top: 1px solid var(--border);
}

.boq-table tfoot .boq-foot-label {
  text-align: center;
}

.sidebar-user {
  margin-top: auto;
  padding: 0.85rem 0.5rem 0;
}

.sidebar-user-hello {
  margin: 0 0 0.55rem;
  font-size: 0.84rem;
  font-weight: 700;
}

.sidebar-logout {
  width: 100%;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 20px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.sidebar-logout:hover {
  background: rgba(255, 255, 255, 0.12);
}

.login-screen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #f5f7fb;
}

body.auth-locked {
  overflow: hidden;
}

body.auth-locked .app {
  display: none;
}

body.auth-locked .login-screen {
  display: flex;
}

.login-card {
  width: min(420px, 100%);
  padding: 36px 32px 28px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(0, 32, 96, 0.08);
}

.login-kicker {
  margin: 0 0 8px;
  color: #00b0f0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.login-card h1 {
  margin: 0;
  color: #002060;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.login-lead {
  margin: 8px 0 18px;
  color: #64748b;
  font-size: 14px;
}

.login-notice,
.login-error {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.45;
}

.login-notice {
  background: #fff7ed;
  color: #9a3412;
}

.login-error {
  background: #fef2f2;
  color: #991b1b;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.login-form input {
  height: 42px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #0f172a;
  font: inherit;
  font-weight: 400;
}

.login-form input:focus {
  outline: 2px solid rgba(0, 32, 96, 0.25);
  border-color: #002060;
}

.login-submit {
  height: 42px;
  margin-top: 4px;
  border: none;
  border-radius: 20px;
  background: #002060;
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.login-submit:hover {
  background: #001845;
}

.login-submit:disabled {
  opacity: 0.6;
  cursor: default;
}
