:root {
  /* ABIES TC(abiestc) 와 같은 색 · 간격 기준 */
  --bg: #f4f4f5; --panel: #fff; --line: #e4e4e7; --line-2: #f4f4f5; --text: #18181b; --muted: #71717a; --faint: #a1a1aa;
  --accent: #2563eb; --accent-d: #1d4ed8; --accent-soft: #eff6ff;
  --ok: #059669; --ok-bg: #ecfdf5; --warn: #d97706; --warn-bg: #fffbeb; --bad: #dc2626;
  --shell-bg: #f8fafc; --shell-navy: #00091b; --shell-line: #e2e8f0;
  --header-h: 56px; --sidebar-w: 240px;
  --mono: "Cascadia Mono", "D2Coding", Consolas, "Courier New", monospace;
  --radius: 8px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font: 13px/1.5 "Noto Sans KR", "Inter", "Pretendard", "Malgun Gothic", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--text); background: var(--bg); display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
code { background: #eef1f6; padding: 0 4px; border-radius: 3px; font: 12px var(--mono); }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); font-size: 12px; }
.spacer { flex: 1; }
a { color: var(--accent); }
::selection { background: #cfe0ff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
* { scrollbar-width: thin; scrollbar-color: #c3cad6 transparent; }

/* ---------- 상단 바 ---------- */
.appbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; height: var(--header-h); padding: 0 16px; background: #fff; color: var(--text); border-bottom: 1px solid var(--shell-line); box-shadow: 0 1px 2px rgba(24, 24, 27, .04); flex: none; }
.appbar-start { display: flex; align-items: center; gap: 32px; min-width: 0; flex: 1; }
body:not(.nav-closed) .appbar-start { gap: 0; }
.appbar-lead { display: flex; align-items: center; gap: 10px; flex: 0 0 calc(var(--sidebar-w) - 16px); min-width: 0; }
body.nav-closed .appbar-lead { flex: 0 0 auto; }
.appbar-end { display: flex; align-items: center; gap: 8px; flex: none; }
.shell-brand { display: flex; align-items: center; gap: 6px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; border-radius: 6px; }
.shell-brand:hover .shell-brand-text { opacity: .82; }
.shell-brand-icon { color: var(--shell-navy); flex: none; }
.shell-brand-text { font-size: 16px; font-weight: 900; letter-spacing: -.04em; color: #121c2c; }
.logo { width: 26px; height: 26px; flex: none; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 14px; letter-spacing: .2px; }
.head-tabs { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 6px; min-width: 0; }
.head-tab { padding: 4px 11px; border: 0; border-radius: 8px; background: transparent; color: #64748b; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.head-tab:hover:not(:disabled) { background: #f8fafc; color: #334155; }
.head-tab.active { background: #f1f5f9; color: var(--shell-navy); font-weight: 700; }
.head-tab:disabled { opacity: .45; cursor: not-allowed; }
.head-action { padding: 6px 12px; font-size: 12px; font-weight: 700; letter-spacing: .01em; box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 2px 8px rgba(37, 99, 235, .28); transition: box-shadow .15s, transform .12s; }
.head-action:hover:not(:disabled) { box-shadow: 0 2px 4px rgba(15, 23, 42, .08), 0 4px 14px rgba(37, 99, 235, .35); transform: translateY(-1px); }
.head-action:disabled { box-shadow: none; }
.head-viewer { padding: 6px 12px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.tpl-menu { position: relative; }
.tpl-panel { left: 0; right: auto; width: 240px; }
.head-context .tpl-menu .head-viewer, .head-context .head-files { padding: 5px 10px; }
.tpl-panel .menu-item:disabled { color: var(--faint); cursor: not-allowed; background: transparent; }
.tpl-panel .menu-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-viewer.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
body.model-window { height: 100%; display: flex; flex-direction: column; overflow: hidden; background: #1b1f27; }
.model-window-bar { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 10px 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; }
.model-window-bar strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 48%; }
#mvStatus { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.model-window-stage { position: relative; flex: 1; min-height: 0; display: flex; background: #1b1f27; }
.model-window-stage .viewerbox { flex: 1; min-width: 0; }
/* 모델뷰어 분류체계 패널 */
.mv-class { width: 290px; flex: none; display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line); min-height: 0; }
.mv-class-tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.mv-class-tabs button { border: 0; background: none; padding: 3px 7px; border-radius: 6px; font: inherit; font-size: 12px; color: var(--muted); cursor: pointer; }
.mv-class-tabs button:hover { background: var(--accent-soft); color: var(--text); }
.mv-class-tabs button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.mv-class-opts { display: flex; align-items: center; gap: 4px; padding: 5px 8px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.mv-class-opts label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.mv-class-tree { flex: 1; overflow: auto; padding: 4px 0; font-size: 12px; }
.mv-class-tree ul { list-style: none; margin: 0; padding: 0; }
.mv-node-row { display: flex; align-items: center; gap: 4px; padding: 2px 8px 2px calc(8px + var(--depth, 0) * 14px); cursor: pointer; white-space: nowrap; }
.mv-node-row:hover { background: var(--accent-soft); }
.mv-node-row.sel { background: var(--accent); color: #fff; }
.mv-node-row.sel .mv-node-count, .mv-node-row.sel .mv-node-level { color: rgba(255, 255, 255, .8); }
.mv-node-tog { width: 14px; flex: none; text-align: center; color: var(--muted); }
.mv-node-label { overflow: hidden; text-overflow: ellipsis; }
.mv-node-level { color: var(--faint); font-size: 11px; }
.mv-node-count { margin-left: auto; padding-left: 8px; color: var(--muted); font-size: 11px; }
.model-window-stage.with-class .mv-section, .model-window-stage.with-class .mv-views { left: 300px; }
/* 모델뷰어 도구 */
.mv-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 6px 10px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; }
.mv-group { display: flex; align-items: center; gap: 4px; }
.mv-link { gap: 8px; font-size: 12px; color: var(--text); }
.mv-link-label { color: var(--muted); font-weight: 600; }
.mv-link label { display: flex; align-items: center; gap: 3px; cursor: pointer; white-space: nowrap; }
.mv-tools .btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.mv-select { height: 26px; font-size: 12px; max-width: 180px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; background: #fff; }
.mv-help { margin-left: auto; font-size: 12px; color: var(--muted); cursor: help; border-bottom: 1px dotted var(--muted); }
.viewer-overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.measure-label { position: absolute; left: 0; top: 0; padding: 2px 7px; border-radius: 10px; background: #ffd23f; color: #222; font-size: 12px; font-weight: 600; white-space: nowrap; pointer-events: auto; }
.select-box { position: absolute; border: 1px solid #5b9bff; background: rgba(47, 123, 255, .15); }
.viewcube { position: absolute; top: 8px; right: 8px; width: 104px; height: 104px; cursor: pointer; z-index: 2; }
.mv-float { position: absolute; z-index: 3; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); padding: 8px 10px; font-size: 12px; }
.mv-float-head { font-weight: 600; margin-bottom: 6px; }
.mv-float-foot { display: flex; gap: 4px; margin-top: 6px; }
.mv-section { left: 10px; bottom: 10px; width: 280px; }
.mv-inline { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.mv-inline input[type=range] { width: 90px; }
.mv-sec-opts { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 6px; color: var(--muted); }
.mv-sec-opts label { display: flex; align-items: center; gap: 4px; }
.mv-num { width: 70px; height: 26px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font-size: 12px; }
.mv-sec-row { display: grid; grid-template-columns: 16px 1fr 1fr; gap: 6px; align-items: center; }
.mv-sec-row input { width: 100%; }
.mv-sec-ax { font-weight: 600; color: var(--muted); }
.mv-views { left: 10px; top: 10px; width: 260px; }
.mv-view-form { display: flex; gap: 4px; }
.mv-view-form input { flex: 1; min-width: 0; height: 26px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font-size: 12px; }
.mv-view-form .btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
.mv-view-list { margin: 6px 0; max-height: 220px; overflow: auto; }
.mv-view-item { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 2px 0; }
.mv-view-item .linkish { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-note { color: var(--muted); font-size: 12px; padding: 4px 0; }
.mv-note.err { color: #c62828; }
.mv-props { width: 320px; flex: none; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); min-height: 0; }
.mv-props-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.mv-props-body { flex: 1; overflow: auto; padding: 8px 10px; }
.mv-props-body h3.obj-title { margin: 0 0 2px; font-size: 14px; word-break: break-all; }
.mv-props-body .path { color: var(--muted); font-size: 11.5px; margin-bottom: 8px; word-break: break-all; }
.mv-props-body h4 { margin: 10px 0 4px; font-size: 12px; }
.mv-props-body details { margin-top: 8px; }
.mv-props-body summary { cursor: pointer; font-size: 12px; font-weight: 600; }
.model-window-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; color: #d5dbe6; text-align: center; }
.account { display: flex; align-items: center; gap: 8px; min-width: 0; }
.org-menu { position: relative; }
.avatar { position: relative; width: 32px; height: 32px; border: 1px solid #cbd5e1; border-radius: 50%; background: #e2e8f0; color: #475569; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; display: grid; place-items: center; padding: 0; }
.avatar:hover { background: #cbd5e1; }
.avatar .avatar-badge { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: #ef4444; color: #fff; font-size: 10px; line-height: 16px; font-weight: 700; }
.menu-user { padding: 8px 10px 10px; }
.menu-user b { display: block; font-size: 14px; }
.menu-user span { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); opacity: 1; max-width: none; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.avatar span { opacity: 1; max-width: none; font-size: 12px; color: inherit; }
.org-panel { position: absolute; top: calc(100% + 8px); right: 0; width: 280px; background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 40px rgba(15, 27, 51, .16); padding: 6px; z-index: 50; }
.org-panel .menu-label { font-size: 11px; color: var(--muted); padding: 8px 10px 2px; }
.org-panel .menu-item { display: block; width: 100%; text-align: left; background: transparent; border: 0; color: var(--text); padding: 8px 10px; border-radius: 6px; font: inherit; cursor: pointer; }
.org-panel .menu-item:hover { background: #f1f5f9; }
.org-panel .menu-item.current { font-weight: 700; color: var(--accent); }
.org-panel .invite-row { color: var(--text); }
.invite-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.invite-row span { flex: 1; min-width: 0; }
.member-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.member-row span { flex: 1; min-width: 0; }
.org-panel .btn { background: #fff; color: var(--text); border-color: var(--line); }
.org-panel .btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
.org-panel .btn:hover { background: #f8fafc; }
.org-panel .btn.primary:hover { background: var(--accent); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.login-page {
  position: fixed; inset: 0; z-index: 30; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(37, 99, 235, .09), transparent 50%),
    radial-gradient(ellipse 80% 50% at 100% 100%, rgba(79, 70, 229, .05), transparent 45%),
    var(--bg);
}
.login-page h1 { margin: 0 0 .35rem; font-size: 1.75rem; font-weight: 700; letter-spacing: -.035em; line-height: 1.25; color: var(--text); }
.login-page .subtitle { margin: 0 0 1.25rem; color: var(--muted); font-size: .875rem; }
.login-form {
  width: 100%; max-width: 400px; background: #fff; padding: 2rem 2rem 1.75rem; border-radius: 20px;
  border: 1px solid var(--line); box-shadow: 0 10px 15px -3px rgba(24,24,27,.08), 0 4px 6px -4px rgba(24,24,27,.05), 0 0 0 1px rgba(24,24,27,.04);
}
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: .5rem; font-size: .8125rem; font-weight: 500; color: var(--text); }
.form-group input {
  width: 100%; padding: .625rem .875rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: .9375rem;
  background: #fafafa; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
.btn-block { width: 100%; margin-top: .75rem; padding: .625rem 1rem; height: auto; }
.login-hint { margin: 1.25rem 0 0; text-align: center; font-size: .8125rem; color: var(--faint); line-height: 1.4; }
.btn-link { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
.message.error { margin: 0 0 .75rem; color: var(--bad); font-size: .875rem; min-height: 0; }
.message.error:empty { display: none; }
.social { display: flex; flex-direction: column; gap: 8px; margin-top: 1rem; padding-top: 12px; border-top: 1px solid var(--line); }
.social-label { text-align: center; font-size: 11px; letter-spacing: .4px; margin: 0; color: var(--muted); }
#socialButtons { display: flex; flex-direction: column; gap: 8px; }
#socialButtons:empty { display: none; }
.social-btn { display: flex; align-items: center; justify-content: center; gap: 8px; height: 36px; border-radius: 8px; font-weight: 700; text-decoration: none; }
.social-btn svg { width: 16px; height: 16px; }
.social-btn.kakao { background: #FEE500; color: #191919; }
.social-btn.kakao:hover { background: #f5dc00; }
.social-btn.naver { background: #03C75A; color: #fff; }
.social-btn.naver:hover { background: #02b351; }
.social-btn.google { background: #fff; color: #1f2937; border: 1px solid var(--line); }
.social-btn.google:hover { background: #f8fafc; }
.theme-select {
  padding: .28rem .45rem; font-size: 12px; font-weight: 600; font-family: inherit; border-radius: 6px;
  border: 1px solid #cbd5e1; background: #fff; color: #475569; cursor: pointer; max-width: 6.5rem;
}
.appbar-divider { width: 1px; height: 1.5rem; background: var(--shell-line); flex: none; }
.main-stage { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #f0f2f5; }
.shell-page { background: transparent; }
.home.shell-page { background: #f0f2f5; }
.home-projects { background: transparent; }
.rev-rail { background: #fff; border-left: 1px solid var(--shell-line); }
.statusbar { background: #fff; }
.home-head h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; }
.project-card, .rev-card { border-radius: 14px; box-shadow: 0 1px 2px rgba(24,24,27,.04); }
.project-card:hover, .rev-card:hover { border-color: #93c5fd; box-shadow: 0 4px 12px rgba(37,99,235,.08); }
.project-card.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 4px 12px rgba(37,99,235,.12); }
.btn.primary, button.btn.primary { border-radius: 8px; }
.panel { border-radius: 10px; box-shadow: 0 1px 2px rgba(24,24,27,.04); }
.step { border-radius: 10px; }
.empty-state { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 40px 28px; max-width: 520px; box-shadow: 0 1px 2px rgba(24,24,27,.04); }

[data-theme='dark'] {
  --bg: #0f1419; --panel: #1a2332; --line: #2d3d52; --line-2: #243043; --text: #f1f5f9; --muted: #94a3b8; --faint: #64748b;
  --accent: #3b82f6; --accent-d: #60a5fa; --accent-soft: rgba(59,130,246,.18);
  --ok: #34d399; --ok-bg: rgba(16,185,129,.14); --warn: #fbbf24; --warn-bg: rgba(251,191,36,.14); --bad: #f87171;
  --shell-bg: #0f1419; --shell-navy: #e2e8f0; --shell-line: #2d3d52;
}
/* 다크: 브라우저 기본 컨트롤(입력칸·선택·스크롤바)도 어둡게. 배경을 따로 적지 않은 입력칸은 기본이 흰색이다 */
[data-theme='dark'] { color-scheme: dark; }
[data-theme='dark'] input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), [data-theme='dark'] select, [data-theme='dark'] textarea { background-color: #141b24; color: var(--text); border-color: var(--line); }
[data-theme='dark'] input::placeholder, [data-theme='dark'] textarea::placeholder { color: var(--faint); }
[data-theme='dark'] * { scrollbar-color: #3a4a60 transparent; }
[data-theme='dark'] .appbar, [data-theme='dark'] .stepper { background: #141b24; color: var(--text); }
[data-theme='dark'] .shell-brand-text { color: #f1f5f9; }
[data-theme='dark'] .login-form, [data-theme='dark'] .rev-rail, [data-theme='dark'] .panel,
[data-theme='dark'] .project-card, [data-theme='dark'] .rev-card, [data-theme='dark'] .empty-state,
[data-theme='dark'] .statusbar, [data-theme='dark'] .org-panel { background: var(--panel); }
[data-theme='dark'] .main-stage, [data-theme='dark'] .home.shell-page { background: #0f1419; }
[data-theme='dark'] .form-group input, [data-theme='dark'] .theme-select, [data-theme='dark'] .ctx-select, [data-theme='dark'] .cell-edit { background: #141b24; color: var(--text); border-color: var(--line); }
[data-theme='dark'] .spec-bar { background: rgba(251, 191, 36, .08); }
[data-theme='dark'] .sidebar { background: #141b24; }
[data-theme='dark'] .nav-acc-head { color: #e2e8f0; }
[data-theme='dark'] .nav-acc-head:hover, [data-theme='dark'] .nav-acc-item:hover { background: #1a2332; color: #f1f5f9; box-shadow: none; }
[data-theme='dark'] .nav-acc-item { color: #94a3b8; }
[data-theme='dark'] .nav-acc-item.active, [data-theme='dark'] .nav-acc-item.active:hover { background: #1a2332; color: #f1f5f9; box-shadow: none; }
[data-theme='dark'] .nav-acc-chev, [data-theme='dark'] .ctx-detail, [data-theme='dark'] .ctx-label { color: #94a3b8; }
[data-theme='dark'] .side-logout { background: #1a2332; color: var(--muted); border-color: var(--line); }
[data-theme='dark'] .side-logout:hover { color: #fecaca; border-color: #7f1d1d; }
[data-theme='dark'] .ctx-chip { background: rgba(59,130,246,.18); color: #93c5fd; border-color: transparent; }
/* ---------- 좌측 메뉴 (앱 셸과 같은 밝은 패널) ---------- */
.sidebar { width: var(--sidebar-w); flex: none; display: flex; flex-direction: column; min-height: 0; background: var(--shell-bg); border-right: 1px solid var(--shell-line); color: var(--text); overflow: hidden; }
body.nav-closed .sidebar { display: none; }
.head-context { display: flex; align-items: center; gap: 8px; min-width: 0; margin-right: 8px; }
.ctx-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 320px; min-width: 0; padding: 5px 10px; border: 1px solid rgba(148, 163, 184, .35); border-radius: 8px; background: #e7eeff; color: #475569; font: inherit; font-size: 12px; font-weight: 800; text-align: left; cursor: pointer; }
.ctx-chip:hover { background: #dbe4fb; border-color: #94a3b8; }
.ctx-chip-label { flex: none; }
.ctx-detail { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; color: #334155; }
.ctx-detail.placeholder { color: #94a3b8; font-weight: 600; }
.ctx-label { flex: none; margin: 0; font-size: 12px; font-weight: 800; color: #475569; }
.ctx-select { width: auto; min-width: 108px; max-width: 180px; padding: 5px 8px; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; color: #475569; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.ctx-select:disabled { opacity: .5; cursor: not-allowed; }
.side-nav { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 8px 12px; }
.nav-acc-head { display: flex; align-items: center; gap: 8px; width: 100%; margin-bottom: 2px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: #334155; font: inherit; font-size: 13px; font-weight: 700; text-align: left; cursor: pointer; }
.nav-acc-head:hover { background: #fff; color: var(--shell-navy); box-shadow: 0 1px 2px rgba(24, 24, 27, .04); }
.nav-acc-icon { display: flex; align-items: center; justify-content: center; width: 18px; flex: none; font-size: 13px; font-weight: 800; }
.nav-acc-icon b { font-size: 12px; letter-spacing: -.04em; }
.nav-acc-label { flex: 1; min-width: 0; }
.nav-acc-chev { display: flex; color: #94a3b8; transition: transform .15s; }
.nav-acc:not(.open) .nav-acc-chev { transform: rotate(-90deg); }
.nav-acc-item { display: block; width: 100%; margin-bottom: 2px; padding: 7px 10px 7px 36px; border: 0; border-radius: 8px; background: transparent; color: #64748b; font: inherit; font-size: 13px; font-weight: 600; text-align: left; cursor: pointer; }
.nav-acc-item:hover { background: #fff; color: #334155; box-shadow: 0 1px 2px rgba(24, 24, 27, .04); }
.nav-acc-item.active { background: #fff; color: var(--shell-navy); font-weight: 700; box-shadow: 0 1px 3px rgba(24, 24, 27, .06), 0 1px 2px rgba(24, 24, 27, .04); }
.nav-acc-item.active:hover { background: #fff; color: var(--shell-navy); }
.dash { display: flex; flex-direction: column; gap: 12px; max-width: 1600px; }
.dash-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.dash-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.dash-infos { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1.6fr); gap: 12px; margin-top: 10px; }
.dash-info { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.dash-info.link { cursor: pointer; }
.dash-info.link:hover { border-color: var(--accent); }
.dash-info-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.dash-info-main { margin-top: 4px; font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-info-sub { margin-top: 3px; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-files { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12.5px; }
.dash-files li { display: flex; gap: 8px; padding: 2px 0; }
.dash-files .fn { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-files .fs { color: var(--muted); white-space: nowrap; }
@media (max-width: 1100px) { .dash-infos { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .dash-infos { grid-template-columns: minmax(0, 1fr); } }
.dash-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.dash-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.dash-card h3 { margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.dash-state { font-size: 18px; font-weight: 700; letter-spacing: -.2px; }
.dash-state.ok { color: #15803d; }
.dash-sub { margin-top: 6px; color: var(--muted); font-size: 12.5px; line-height: 1.45; overflow-wrap: anywhere; }
.dash-card .btn { margin-top: 12px; }
@media (max-width: 860px) { .dash-cards { grid-template-columns: 1fr; } }
.side-foot { flex: none; padding: 16px 12px; border-top: 1px solid var(--shell-line); }
.side-logout { width: 100%; padding: 8px 12px; border: 1px solid var(--shell-line); border-radius: 8px; background: #fff; color: #64748b; font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .06em; cursor: pointer; }
.side-logout:hover { color: var(--bad); border-color: #fecaca; }
/* 상단 하위 탭이 같은 역할을 하므로 작업 영역 안의 중복 탭은 숨긴다 (동작은 그대로 유지) */
.workhead .mode, .tabs { display: none !important; }

/* ---------- 레이아웃 ---------- */
.layout { flex: 1; display: flex; min-height: 0; }
.home { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.home-body { flex: 1; display: flex; min-width: 0; min-height: 0; }
.home-projects { flex: 1; min-width: 0; overflow: auto; padding: 22px 24px 32px; }
.home-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.board-tools { display: flex; gap: 8px; margin: -4px 0 16px; }
.board-tools input, .board-tools select { height: 34px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); font: inherit; }
.board-tools input { flex: 1; min-width: 0; padding: 0 10px; }
.board-tools input:focus, .board-tools select:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.board-tools select { flex: none; padding: 0 8px; }
.home-head h2 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.home-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.project-card, .rev-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; text-align: left; }
.project-card { overflow: hidden; }
.project-card:hover, .rev-card:hover { border-color: #bcd2ff; }
.project-card.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.card-art { height: 112px; display: grid; place-items: center; background: linear-gradient(180deg, #e7ebf2, #f7f8fb); color: #8b95a7; overflow: hidden; }
.card-art svg { width: 88px; height: 56px; }
.card-art.has-shot { display: block; }
.card-art img { width: 100%; height: 112px; object-fit: cover; display: block; }
.card-body, .rev-card { padding: 12px 14px 14px; }
.card-top { display: flex; align-items: flex-start; gap: 8px; }
.card-top h3 { margin: 0; flex: 1; min-width: 0; font-size: 14px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-actions { display: flex; gap: 0; }
.card-meta, .card-latest { color: var(--muted); font-size: 12px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.card-latest { margin-top: 6px; }
.rev-rail { width: 320px; flex: none; overflow: auto; padding: 22px 16px 28px; background: var(--panel); border-left: 1px solid var(--line); }
.member-rail { width: 300px; flex: none; overflow: auto; padding: 22px 16px 28px; background: var(--panel); border-left: 1px solid var(--line); }
.member-invite { display: flex; gap: 6px; margin: 0 0 14px; }
.member-invite input { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: var(--bg); color: var(--text); }
.member-invite input:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.member-list { display: flex; flex-direction: column; gap: 8px; }
.member-card { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.member-card .who { flex: 1; min-width: 0; }
.member-card b, .member-card span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-card b { font-size: 13px; }
.member-card span { color: var(--muted); font-size: 12px; }
.member-group { margin: 12px 0 0; font-size: 11px; font-weight: 700; color: var(--faint); }
.rev-rail-name { display: flex; align-items: center; gap: 8px; margin: -8px 0 14px; color: var(--muted); font-size: 12px; }
.lock-note { margin: 0; padding: 8px 18px; background: var(--warn-bg); color: var(--warn); font-size: 12.5px; border-bottom: 1px solid var(--line); }
.snap-note { background: var(--accent-soft); color: var(--accent-d); }
.snap-note .linkish { margin-left: 6px; font-weight: 600; }
.dash-snaps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dash-snaps li { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; }
.dash-snaps li.current { border-color: var(--ok); background: var(--ok-bg); }
.dash-snaps .snap-main { flex: 1; min-width: 0; }
.dash-snaps .snap-main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-snaps .snap-main small { color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-snaps .snap-actions { display: flex; gap: 4px; flex-shrink: 0; }
.rev-cards { display: flex; flex-direction: column; gap: 10px; }
.rev-card .card-top h3 { white-space: normal; }
.empty-state.compact { margin: 28px auto; }
.side { width: 292px; flex: none; overflow: auto; padding: 14px 12px; background: var(--panel); border-right: 1px solid var(--line); }
.res { margin-bottom: 18px; }
.res-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.res-head h2 { margin: 0; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .4px; display: flex; align-items: center; gap: 6px; }
.count { background: #eef1f6; color: var(--muted); border-radius: 9px; padding: 0 7px; font-size: 11px; font-weight: 600; }
.side-note { color: var(--faint); font-size: 11px; margin: 4px 2px; }

.list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow: auto; }
.item { display: flex; align-items: center; gap: 6px; border: 1px solid transparent; border-radius: 6px; padding: 6px 6px 6px 10px; cursor: pointer; background: #fafbfd; }
.item:hover { border-color: var(--line); background: #f3f6fb; }
.item.sel { border-color: #bcd2ff; background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.item-main { flex: 1; min-width: 0; }
.item .nm { font-weight: 600; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-actions { display: flex; gap: 0; opacity: 0; transition: opacity .1s; }
.item:hover .item-actions, .item.sel .item-actions, .item:focus-within .item-actions { opacity: 1; }
.ico { display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 5px; background: none; color: var(--muted); cursor: pointer; }
.ico:hover { background: rgba(37, 99, 235, .1); color: var(--accent); }
.ico.del:hover { background: rgba(192, 54, 44, .1); color: var(--bad); }
.ico.lock-on { color: var(--warn); background: var(--warn-bg); }
.ico.lock-on:hover { color: var(--warn); background: #fbe6b4; }
.ico-svg { display: grid; }
.noitems { color: var(--muted); font-size: 12px; padding: 8px 2px; }
.progress { height: 4px; background: #e4e8ef; border-radius: 2px; margin-top: 8px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .15s; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; font: inherit; color: var(--text); }
.btn:hover { background: #f3f6fb; border-color: #c9d1de; }
.btn.small { padding: 3px 10px; font-size: 12px; }
.btn.ghost { border-color: transparent; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.btn.ghost:hover { background: #dce8ff; }
.btn.icon { padding: 2px 9px; font-size: 15px; line-height: 1.2; }
.btn:disabled, button:disabled { opacity: .45; cursor: not-allowed; }
button.link { border: 0; background: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
button.link:hover { text-decoration: underline; }

/* ---------- 탭 ---------- */
.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.tabs { display: flex; align-items: flex-end; gap: 2px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; }
.tabs button { position: relative; border: 0; background: none; padding: 11px 16px; font: inherit; font-size: 13px; cursor: pointer; color: var(--muted); }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--accent); font-weight: 600; }
.tabs button.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px 2px 0 0; }
.main { position: relative; }
.workhead { display: none !important; }
.mode { display: inline-flex; padding: 3px; background: #eef1f6; border-radius: 9px; flex: none; }
.mode button { border: 0; background: transparent; padding: 6px 16px; border-radius: 7px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.mode button.active { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgba(15, 27, 51, .15); }
.mode button:disabled { opacity: .5; cursor: not-allowed; }
.run-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 18px; min-width: 0; margin-left: auto; font-size: 12px; color: var(--muted); }
.rate { font-size: 13px; }
.rate.ok { color: var(--ok); }
.rate.warn { color: var(--warn); }
.btn.warn-btn { background: var(--warn-bg); color: var(--warn); border-color: #f1d28a; font-weight: 600; }
.btn.warn-btn:hover { background: #fbe6b4; }
.tab-badge { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 6px; border-radius: 9px; background: var(--warn-bg); color: var(--warn); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.drop-hint { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(37, 99, 235, .1); border: 2px dashed var(--accent); border-radius: 10px; pointer-events: none; }
.drop-hint div { padding: 14px 22px; border-radius: 10px; background: #fff; color: var(--accent-d); font-weight: 700; box-shadow: 0 8px 28px rgba(15, 27, 51, .18); }
.rev-next { margin-top: 8px; color: var(--accent-d); font-size: 12px; font-weight: 600; }
.rev-next.done { color: var(--ok); }
.tab { display: none; flex: 1; min-height: 0; padding: 10px 14px 14px; overflow: auto; } /* 모든 화면 같은 여백 (산출결과 기준) */
.tab.active { display: block; }
#tab-model.active, #tab-review.active, #tab-diag.active, #tab-aggregate.active, #tab-compare.active, #tab-adjust.active, #tab-checks.active { display: flex; flex-direction: column; padding: 10px 14px 14px; overflow: hidden; }
#tab-template.tab.active, #tab-files.tab.active, #tab-classys.tab.active, #tab-mcodes.tab.active { display: flex; flex-direction: column; padding: 10px 14px 14px; overflow: hidden; }
#tab-template .workgrid, #tab-files .panel, #tab-classys .cls-page, #tab-mcodes .mc-grid { flex: 1; min-height: 0; }
#tab-classys .cls-page { display: grid; grid-template-rows: minmax(0, 1fr); }
#tab-mcodes #mcBody { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
#tab-mcodes #mcBody[hidden] { display: none; }
#tab-mcodes .mc-tabs { flex: none; }
#tab-mcodes .mc-grid { display: grid; gap: 10px; grid-template-columns: 280px minmax(0, 1fr) 300px; grid-template-rows: minmax(0, 1fr); }
#tab-mcodes .mc-grid[hidden] { display: none; }
#tab-mcodes .mc-grid.detail-off { grid-template-columns: 280px minmax(0, 1fr); }
#tab-mcodes .mc-grid.detail-off > #mcDetailPanel { display: none; }
#tab-mcodes .mc-grid.tree-off { grid-template-columns: 40px minmax(0, 1fr) 300px; }
#tab-mcodes .mc-grid.tree-off.detail-off { grid-template-columns: 40px minmax(0, 1fr); }
#tab-mcodes .mc-grid.tree-off .class-tree-panel .panel-body,
#tab-mcodes .mc-grid.tree-off .class-tree-panel h3,
#tab-mcodes .mc-grid.tree-off .class-tree-panel .head-actions { display: none; }
#tab-mcodes .mc-grid.tree-off .mc-tree-head { flex-direction: column; align-items: center; height: 100%; border-bottom: 0; padding: 8px 0; }
#tab-mcodes .head-actions { margin-left: auto; display: flex; gap: 4px; flex: none; }
.head-actions.tree-fold { margin-left: auto; display: flex; gap: 4px; flex: none; }
.head-actions.char-actions { margin-left: auto; display: flex; gap: 6px; flex: none; }
.char-actions .char-sep { width: 1px; align-self: stretch; background: var(--line); margin: 2px 2px; }
#tab-template #tTable tbody tr.link { user-select: none; }
#tCharTable tbody tr.char-row { cursor: pointer; }
#tCharTable tbody tr.char-sel td { background: rgba(37, 99, 235, .10); }
#tCharTable td.chk-cell, #tCharTable th.chk-cell { width: 28px; text-align: center; }
#mcDetailHide { margin-left: auto; }
#mcTreeFold .rail-label { display: none; }
#tab-mcodes .mc-grid.tree-off #mcTreeFold { display: flex; flex-direction: column; width: 100%; height: 100%; gap: 8px; border-radius: 0; }
#tab-mcodes .mc-grid.tree-off #mcTreeFold .rail-label { display: inline; writing-mode: vertical-rl; font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--text); }
#tab-template .workgrid { gap: 10px; }
#filesDelBtn { margin-left: auto; }
#filesTable th.check, #filesTable td.check { width: 36px; max-width: 36px; text-align: center; }
#filesTable tbody tr { cursor: pointer; }
#filesTable tbody tr.picked td { background: var(--accent-soft); }
#filesTable input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }
.cls-page { flex: 1; min-height: 0; display: flex; }
.cls-sheet { flex: 1; min-width: 0; }
.page-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.page-tab { padding: 5px 10px; border: 0; border-radius: 8px; background: transparent; color: #64748b; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.page-tab:hover { background: #f1f5f9; color: #334155; }
.page-tab.active { background: var(--accent-soft); color: var(--accent-d); font-weight: 700; }
.page-tab:disabled { opacity: .4; cursor: not-allowed; }
[data-theme='dark'] .page-tab:hover { background: #1a2332; color: #f1f5f9; }
[data-theme='dark'] .page-tab.active { background: rgba(59,130,246,.18); color: #93c5fd; }
.model-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.model-split { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr) minmax(260px, 340px); gap: 12px; }
.model-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.model-stage .toolbar { margin-bottom: 8px; flex: none; }
.model-stage .viewwrap { flex: 1; min-height: 0; }
.prop-panel .detail { padding: 10px 12px; }
.prop-panel h3.obj-title { margin: 0 0 2px; font-size: 14px; word-break: break-all; }
.prop-panel .path { color: var(--muted); font-size: 11.5px; margin-bottom: 8px; word-break: break-all; }
.prop-panel h4 { margin: 14px 0 4px; font-size: 12px; color: var(--muted); }
#reviewBody, #diagBody, #aggBody { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.result-page { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.result-split { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 12px; }
.result-split .panel { min-height: 0; }
.err-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr) 280px; gap: 12px; }
.err-grid[hidden] { display: none; }
.err-center { min-height: 0; display: grid; grid-template-rows: minmax(0, 3fr) minmax(0, 2fr); gap: 12px; }
.err-type { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex: none; }
.err-type label { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.err-type select { flex: 1; min-width: 0; }
#errTypeDesc { flex: none; }
#errTable td, #errItems td { white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
#errTable td.err-why { color: var(--warn); }
#errItems tr.fail td { background: var(--warn-bg); }
#errListTitle { white-space: nowrap; }
.tab-badge.err { background: var(--warn-bg); color: var(--warn); }
@media (max-width: 1100px) {
  .err-grid { grid-template-columns: minmax(0, 1fr); grid-auto-rows: 440px; flex: none; }
  .err-center { grid-template-rows: 440px 320px; }
}
.chk-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr) 280px; gap: 12px; }
.panel.chk-tree { flex-direction: row; }
.chk-rail { flex: none; width: 30px; display: flex; flex-direction: column; gap: 2px; padding: 6px 2px; border-right: 1px solid var(--line); background: #fafbfd; }
.chk-rail button { writing-mode: vertical-rl; padding: 10px 4px; border: 0; border-radius: 6px; background: transparent; color: #64748b; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; letter-spacing: .04em; }
.chk-rail button:hover { background: #f1f5f9; color: #334155; }
.chk-rail button.active { background: var(--accent-soft); color: var(--accent-d); font-weight: 700; }
[data-theme='dark'] .chk-rail { background: transparent; }
[data-theme='dark'] .chk-rail button:hover { background: #1a2332; color: #f1f5f9; }
[data-theme='dark'] .chk-rail button.active { background: rgba(59,130,246,.18); color: #93c5fd; }
.chk-tree-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
#chkTop td, #chkBot td { white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
#chkTop tfoot td, #chkBot tfoot td, #chkSide tfoot td { font-weight: 700; background: #fafbfd; position: sticky; bottom: 0; }
[data-theme='dark'] #chkTop tfoot td, [data-theme='dark'] #chkBot tfoot td, [data-theme='dark'] #chkSide tfoot td { background: #111827; }
#chkTopTitle, #chkBotTitle { white-space: nowrap; }
#chkSide table.mini td.num { text-align: right; }
@media (max-width: 1100px) {
  .chk-grid { grid-template-columns: minmax(0, 1fr); grid-auto-rows: 440px; flex: none; }
}
.agg-main { min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr); gap: 12px; }
.agg-main.with-basis { grid-template-rows: minmax(0, 3fr) minmax(0, 2fr); }
.agg-grid { grid-template-columns: minmax(280px, 340px) minmax(0, 1fr) 260px; }
#aggTable td, #aggBasisTable td { white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
#aggTable tfoot td, #aggBasisTable tfoot td, #aggSide tfoot td { font-weight: 700; background: #fafbfd; position: sticky; bottom: 0; }
[data-theme='dark'] #aggTable tfoot td, [data-theme='dark'] #aggBasisTable tfoot td, [data-theme='dark'] #aggSide tfoot td { background: #111827; }
#aggBasisBtn.on { background: var(--accent-soft); color: var(--accent-d); border-color: var(--accent); }
#aggSide .agg-scope { margin: 0 0 4px; font-size: 12px; }
#aggSide .small-note { font-size: 11.5px; margin-top: 10px; }
#aggSide table.mini td.num { text-align: right; }
/* 등록 모델에 없이 템플릿에 코드로만 있는 객체분류 (산출문자·산출항목의 객체분류코드 트리) */
.trow.absent .tn { color: var(--warn); }
.trow.absent .tc { color: var(--warn); opacity: .8; }
#rvTitle { max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#aggBody { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#aggBody .tablewrap { flex: 1; min-height: 0; max-height: none; }
#tab-model .doc, #tab-template .doc { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.empty-state { max-width: 460px; margin: 70px auto; text-align: center; color: var(--muted); word-break: keep-all; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty { color: var(--muted); padding: 30px 10px; text-align: center; }
.empty.small { padding: 16px 8px; font-size: 12.5px; }
.empty.err, .err { color: var(--bad); }

/* ---------- 문서 머리, 지표 ---------- */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 12px; flex: none; }
.page-title { min-width: 0; }
.page-title h2 { margin: 0; font-size: 17px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 4px; color: var(--muted); font-size: 12px; }
.mi { display: inline-flex; gap: 6px; min-width: 0; }
.mi i { font-style: normal; color: var(--faint); }
.mi span { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; flex: none; }
.kpi { display: flex; flex-direction: column; gap: 1px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 14px; min-width: 0; }
.kpi-l { color: var(--muted); font-size: 11.5px; }
.kpi-v { font-size: 19px; font-weight: 700; letter-spacing: -.2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-s { color: var(--faint); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.callout { border: 1px solid var(--line); border-left-width: 3px; border-radius: 6px; padding: 8px 12px; margin-bottom: 12px; background: var(--panel); font-size: 12.5px; flex: none; }
.callout ul { margin: 4px 0 0; padding-left: 18px; }
.callout.warn { border-left-color: #e0a100; background: #fffaf0; }
.callout.ok { border-left-color: var(--ok); background: #f3fbf6; }

/* ---------- 패널 ---------- */
.workgrid { flex: 1; min-height: 380px; display: grid; gap: 12px; grid-template-rows: minmax(0, 1fr); }
.workgrid.three { grid-template-columns: 240px minmax(300px, 1fr) minmax(300px, 400px); }
.workgrid.two { grid-template-columns: minmax(0, 1fr); }
.workgrid.two > .panel:first-child { display: none; }
#tab-template .workgrid.class-on { grid-template-columns: 300px minmax(0, 1fr); }
.class-tree-panel { border-right: 1px solid var(--line); }
.class-tree-panel .trow { cursor: pointer; }
.class-tree-panel .tn { font-size: 12.5px; }
.class-tree-panel .tc { min-width: 36px; text-align: right; }
.panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #fafbfd; flex: none; }
.panel-head h3 { margin: 0; font-size: 12.5px; font-weight: 700; }
.panel-body { flex: 1; min-height: 0; overflow: auto; }
.search { flex: 1; min-width: 120px; max-width: 360px; margin-left: auto; padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #fff; }
.search:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.toolbar .search { margin-left: 0; max-width: 300px; }
select { padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #fff; }

/* 카테고리 분포 */
.cats { padding: 4px; }
.cat { position: relative; display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 5px; cursor: pointer; overflow: hidden; }
.cat:hover { background: #f3f6fb; }
.cat.on { outline: 1.5px solid var(--accent); background: var(--accent-soft); }
.cat-bar { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(37, 99, 235, .09); pointer-events: none; }
.cat-n { position: relative; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-c { position: relative; color: var(--muted); font-size: 12px; }

/* 계층 */
.filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 12px; border-bottom: 1px solid var(--line-2); background: #fbfcfe; flex: none; }
.tree { padding: 4px 0; }
.trow { display: flex; align-items: center; gap: 6px; height: 26px; padding-right: 10px; cursor: default; white-space: nowrap; }
.trow:hover { background: #f3f6fb; }
.trow.sel, .srow.sel { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.tw { width: 14px; flex: none; text-align: center; color: var(--muted); cursor: pointer; font-size: 11px; user-select: none; }
.tw.leaf { cursor: default; }
.tk { flex: none; min-width: 30px; text-align: center; font-size: 10.5px; font-weight: 600; padding: 0 5px; border-radius: 3px; background: #eceff4; color: #5b6578; }
.tk.inst { background: #e6ecf8; color: #34548f; }
.tk.coll { background: #fdf0d2; color: #8a5200; }
.tk.comp { background: #dcf5e5; color: #1c6b3a; }
.tn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tcat { flex: none; font-size: 11px; color: var(--muted); background: #f0f2f6; border-radius: 9px; padding: 0 7px; }
.tc { flex: none; color: var(--faint); font-size: 11px; }
.tmore { display: block; width: 100%; text-align: left; padding: 4px 12px; color: var(--muted); font-size: 12px; background: none; border: 0; }
.tmore.link { color: var(--accent); cursor: pointer; }
.srow { padding: 6px 12px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.srow:hover { background: #f3f6fb; }
.srow-1 { display: flex; align-items: center; gap: 8px; }
.srow-2 { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 속성 패널 */
.detail { padding: 10px 12px; font-size: 12.5px; }
.detail h3.obj-title { margin: 0 0 2px; font-size: 14px; word-break: break-all; }
.detail .path { color: var(--muted); font-size: 11.5px; margin-bottom: 8px; word-break: break-all; }
.detail h4 { margin: 14px 0 4px; font-size: 12px; color: var(--muted); letter-spacing: .3px; }
.obj-pill { margin: 2px 0 8px; }
table.mini { width: 100%; }
table.mini td, table.mini th { white-space: normal; word-break: break-all; padding: 3px 6px; font-size: 12px; }
table.mini.kv th { width: 38%; font-weight: 500; color: var(--muted); background: none; position: static; vertical-align: top; }
table.mini thead th { position: static; }
.hint { color: var(--muted); font-size: 11.5px; margin: 4px 0; }
details summary { cursor: pointer; color: var(--text); font-weight: 600; font-size: 12px; padding: 6px 0; }
.sum-note { margin-left: 8px; font-weight: 400; color: var(--faint); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 11.5px; background: #e8edf5; color: #44506a; }
.pill.ok { background: var(--ok-bg); color: #1c6b3a; }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.accent { background: var(--accent-soft); color: var(--accent-d); font-weight: 600; }

/* 템플릿 시트 */
.sheets { padding: 4px; }
.group-label { padding: 8px 8px 4px; font-size: 11px; font-weight: 700; color: var(--faint); letter-spacing: .3px; }
.sheet { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 5px; cursor: pointer; }
.sheet:hover { background: #f3f6fb; }
.sheet.on { background: var(--accent-soft); color: var(--accent-d); font-weight: 600; }
.sheet.zero { color: var(--faint); }
.sn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.sheet-head { flex-wrap: wrap; }
.sheet-title { display: flex; align-items: center; gap: 8px; }
.pager { display: flex; align-items: center; gap: 8px; }
.sheet-desc { padding: 6px 12px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line-2); background: #fbfcfe; flex: none; }
.spec-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line-2); background: #fff8eb; font-size: 12px; flex: none; }
.spec-bar .spec-gap { margin-left: 10px; }
.spec-bar .spec-preview { color: var(--muted); min-width: 0; max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.grid tbody tr.absent td { background: var(--warn-bg); }
td.rn .pill { margin-left: 6px; }
.tablebox { background: #fff; }
.char-panel { flex: 1; min-height: 168px; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.char-panel[hidden] { display: none; }
.sheet-split > .tablebox { flex: 1.6; }
.sheet-split > .char-panel { flex: 1; max-height: 42%; }
.char-panel .panel-head h3 { flex: none; }
.char-panel .muted { margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.chk-cell { width: 1%; text-align: center; }
.chk { width: 14px; height: 14px; margin: 0; accent-color: #1c6b3a; pointer-events: none; vertical-align: middle; }

/* ---------- 표 ---------- */
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th, td { padding: 5px 10px; border-bottom: 1px solid var(--line-2); text-align: left; white-space: nowrap; }
table.grid th { position: sticky; top: 0; background: #f4f6fa; z-index: 1; font-weight: 600; color: #44506a; border-bottom: 1px solid var(--line); font-size: 12px; }
#mcTable th.filtered { color: var(--accent-d); }
.th-filter { margin-left: 4px; padding: 0 3px; border: 0; border-radius: 4px; background: transparent; color: var(--faint); font: inherit; font-size: 10px; line-height: 16px; cursor: pointer; }
.th-filter:hover, .th-filter.on { background: var(--accent-soft); color: var(--accent-d); }
.col-filter { position: fixed; z-index: 40; display: flex; flex-direction: column; max-height: 320px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(15, 27, 51, .18); }
.col-filter input { margin: 8px 8px 0; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.col-filter input:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.col-filter .hint { padding: 4px 10px 6px; color: var(--faint); font-size: 11px; }
.col-filter .opts { overflow: auto; padding-bottom: 6px; }
.col-filter .opt { display: block; width: 100%; padding: 6px 10px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 12.5px; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-filter .opt:hover, .col-filter .opt.on { background: var(--accent-soft); }
[data-theme='dark'] .col-filter { background: var(--panel); }
[data-theme='dark'] .col-filter input { background: #141b24; color: var(--text); }
[data-theme='dark'] table.grid th { background: #1a2332; color: #cbd5e1; }
table.grid td { max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
table.grid tbody tr:nth-child(even) td { background: #fbfcfe; }
table.grid tbody tr:hover td { background: #eef4ff; }
table.grid tbody tr.pick td { background: var(--accent-soft); }
table.grid tbody tr.link { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.edit { overflow: visible; max-width: none; text-overflow: clip; padding: 2px 6px; }
.cell-edit { width: 100%; min-width: 108px; max-width: 220px; box-sizing: border-box; font: inherit; font-size: 12px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); color: var(--text); }
.cell-edit:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.cell-edit:disabled { opacity: .65; }
#tTable td.spec-rn { cursor: pointer; user-select: none; }
#tTable td.spec-rn:hover { color: var(--accent-d); }
#tTable td.spec-rn:focus { outline: none; }
table.grid tbody tr.spec-row-sel td { background: rgba(37, 99, 235, .10); }
.spec-bar.row-bar { background: rgba(37, 99, 235, .06); }
.spec-bar.row-bar #tRowInfo { font-weight: 600; color: var(--accent-d); }
#tRowClear { margin-left: auto; }
table.grid tbody tr.spec-row-sel td.spec-rn { box-shadow: inset 3px 0 0 var(--accent); color: var(--accent-d); font-weight: 700; }
td.edit.spec-sel { background: rgba(37, 99, 235, .10); box-shadow: inset 0 0 0 1px var(--accent); }
td.wrap { white-space: normal; word-break: break-all; max-width: none; }
.rn { width: 1%; color: var(--faint); text-align: right; font-size: 11px; border-right: 1px solid var(--line-2); }
mark { background: #ffe58a; color: inherit; border-radius: 2px; padding: 0 1px; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: #eaeff6; }
th.sorted { color: var(--accent-d); }
.arr { margin-left: 4px; font-size: 9px; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar .label { color: var(--muted); font-size: 12px; font-weight: 600; }
.info { color: var(--muted); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); border-radius: 14px; padding: 2px 11px; background: #fff; cursor: pointer; font-size: 12px; user-select: none; }
.chip:hover { border-color: #aebbd2; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.fixed { cursor: default; opacity: .85; }
.tablewrap { overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); max-height: calc(100vh - 360px); min-height: 160px; }

/* ---------- 3D ---------- */
.viewbody { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.viewwrap { flex: 1; min-height: 0; position: relative; display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #1b1f27; }
.viewerbox { flex: 1; min-width: 0; position: relative; }
.viewerbox canvas { display: block; }
.legend { position: absolute; left: 10px; bottom: 10px; max-height: 55%; overflow: auto; background: rgba(20, 24, 32, .86); color: #fff; padding: 8px 10px; border-radius: 6px; font-size: 12px; min-width: 150px; }
.legend div { display: flex; align-items: center; gap: 7px; padding: 1px 0; }
.legend i { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legend span.n { margin-left: auto; opacity: .65; padding-left: 12px; font-variant-numeric: tabular-nums; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(20, 24, 32, .75); color: #fff; font-size: 14px; }
.detail-side { width: 320px; flex: none; overflow: auto; background: var(--panel); border-left: 1px solid var(--line); padding: 10px 12px; font-size: 12.5px; }
.detail-side h3.obj-title { margin: 0 0 2px; font-size: 14px; word-break: break-all; }
.detail-side .path { color: var(--muted); font-size: 11.5px; margin-bottom: 8px; word-break: break-all; }
.detail-side h4 { margin: 14px 0 4px; font-size: 12px; color: var(--muted); }

/* ---------- 진단 ---------- */
.panel.diag { margin-bottom: 12px; overflow: visible; }
.panel.diag > .panel-head { border-radius: var(--radius) var(--radius) 0 0; }
.panel.diag td { white-space: normal; word-break: break-all; max-width: none; }
.panel.diag td.num { white-space: nowrap; word-break: normal; }
.panel.diag td:has(> .pill) { width: 1%; white-space: nowrap; }

/* ---------- 상태 표시줄, 알림 ---------- */
.statusbar { display: flex; align-items: center; gap: 16px; height: 26px; padding: 0 16px; background: var(--panel); border-top: 1px solid var(--line); color: var(--muted); font-size: 11.5px; flex: none; }
.toast { position: fixed; right: 18px; bottom: 40px; max-width: 520px; background: #222b3a; color: #fff; padding: 10px 14px; border-radius: 6px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); z-index: 50; white-space: pre-wrap; }
.toast.err { background: var(--bad); }

@media (max-width: 1280px) {
  .workgrid.three { grid-template-columns: 200px minmax(240px, 1fr) minmax(260px, 340px); }
}
@media (max-width: 1000px) {
  .home-body { flex-direction: column; }
  .rev-rail, .member-rail { width: auto; border-left: 0; border-top: 1px solid var(--line); }
  .side { width: 232px; }
  .workgrid.three, .workgrid.two, .model-split, .result-split,
  #tab-mcodes .mc-grid, #tab-mcodes .mc-grid.tree-off, #tab-mcodes .mc-grid.detail-off, #tab-mcodes .mc-grid.tree-off.detail-off { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-rows: 440px; flex: none; }
  #tab-mcodes .mc-grid.tree-off .mc-tree-head { flex-direction: row; height: auto; border-bottom: 1px solid var(--line); padding: 8px 12px; }
  #tab-mcodes .mc-grid.tree-off #mcTreeFold { flex-direction: row; width: auto; height: auto; }
  #tab-mcodes .mc-grid.tree-off #mcTreeFold .rail-label { writing-mode: horizontal-tb; letter-spacing: 0; }
  .detail-side { width: 260px; }
  .stepper { grid-template-columns: 1fr; }
  #tab-review.active, #tab-diag.active { overflow: auto; }
  .review { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-rows: 480px; }
}

/* ---------- 작업 영역, 3단계 ---------- */
.empty-state .btn { margin-top: 14px; }
.work { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.page-crumb { display: flex; align-items: center; gap: 6px; flex: none; height: 34px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.page-crumb b { color: var(--text); font-weight: 700; }
.page-crumb .sep { color: var(--faint); }
.stepper { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--shell-line); flex: none; }
.step { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fafbfd; min-width: 0; }
.step.active { border-color: #bcd2ff; background: var(--accent-soft); }
.step.done { background: #f6fbf8; border-color: #cfe9d8; }
.step.done.active { background: var(--accent-soft); border-color: #bcd2ff; }
.step-n { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: #e4e8ef; color: var(--muted); }
.step.active .step-n { background: var(--accent); color: #fff; }
.step.done .step-n { background: var(--ok); color: #fff; }
.step-b { min-width: 0; flex: 1; }
.step-t { font-weight: 700; font-size: 13px; }
.step-s { color: var(--muted); font-size: 12px; margin: 1px 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-files { display: flex; flex-direction: column; margin: -2px 0 8px; max-height: 132px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.step-file { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; padding: 2px 2px 2px 8px; }
.step-file + .step-file { border-top: 1px solid var(--line-2); }
.step-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-file-size { flex: none; color: var(--muted); font-size: 11px; }
.step-file .ico { width: 22px; height: 22px; }
.step-a { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.step .progress { margin-top: 8px; }
.tabs { padding-top: 4px; }

.btn.primary, button.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--accent-d); border-color: var(--accent-d); }
.btn.primary-s { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary-s:hover { background: var(--accent-d); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 600; }
.btn.danger:hover:not(:disabled) { background: #a52c23; }
.step .ico.del, .step .ico { width: 26px; height: 26px; }

.list.tall { max-height: none; }
.pills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.pills .pill { font-size: 10.5px; padding: 0 7px; }
.pill.none { background: transparent; color: var(--faint); border: 1px dashed #c9d1de; }
.sub-label { font-weight: 400; color: var(--muted); }
.item .nm { display: block; }

/* ---------- 대화상자 ---------- */
dialog.dlg { border: 0; border-radius: 10px; padding: 0; width: min(440px, 92vw); box-shadow: 0 20px 60px rgba(15, 27, 51, .35); color: var(--text); }
dialog.dlg.dlg-wide { width: min(720px, 94vw); }
dialog.dlg.dlg-wide .dlg-body { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; max-height: 70vh; overflow: auto; }
dialog.dlg.dlg-wide .dlg-body > .dlg-msg { grid-column: 1 / -1; }
dialog.dlg::backdrop { background: rgba(15, 27, 51, .45); }
.dlg form { padding: 18px 20px 16px; }
.dlg h3 { margin: 0 0 10px; font-size: 15px; }
.dlg-msg { margin: 0 0 12px; color: var(--muted); line-height: 1.55; white-space: pre-line; }
.dlg-hint { font-weight: 400; color: var(--muted); line-height: 1.45; }
.dlg-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 12px; color: var(--muted); font-weight: 600; }
.dlg-field input, .dlg-field textarea, .dlg-field select { font: inherit; font-weight: 400; color: var(--text); padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; width: 100%; }
.dlg-field input:focus, .dlg-field textarea:focus, .dlg-field select:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.dlg-check { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- 분류별 검토 ---------- */
.review { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(340px, 440px) minmax(0, 1fr); gap: 12px; }
.review-left { display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; }
.cls-panel { flex: 1.25 1 0; }
.node-panel { flex: 1 1 0; }
.review-right { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.review-right .toolbar { margin-bottom: 8px; }
.review-right .viewwrap { flex: 1; min-height: 0; }
.panel-head select { margin-left: auto; max-width: 60%; }
.levelbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px 12px; border-bottom: 1px solid var(--line-2); background: #fbfcfe; flex: none; font-size: 11.5px; }
.lv { padding: 0 8px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-d); font-weight: 600; }
.lv.skip { background: transparent; color: var(--faint); border: 1px dashed #c9d1de; font-weight: 400; text-decoration: line-through; }
.lv-arrow { color: var(--faint); }
.trow.cls .tc { min-width: 56px; text-align: right; }
.trow.loc { box-shadow: inset 3px 0 0 #ff6a1f; background: #fff3ea; }
.trow.cls.sel.loc { background: var(--accent-soft); }
.node-panel table.grid tbody tr { cursor: pointer; }
.node-panel table.grid tbody tr.sel td { background: #ffe9d9; box-shadow: none; }
.node-panel .panel-head h3 { max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 좁은 화면: 위에서 정의한 .review 보다 뒤에 와야 적용된다 */
@media (max-width: 1000px) {
  .review { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-rows: 480px; }
  .review-right .viewwrap { min-height: 0; }
}

/* 자재코드 창: 산출항목 등록용. 화면 위에 떠 있다 (토스트·메뉴보다는 아래). */
.mat-win { position: fixed; z-index: 45; left: calc(100vw - 900px); top: 120px; width: 860px; height: 520px; min-width: 520px; min-height: 280px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 18px 50px rgba(15, 27, 51, .28); resize: both; overflow: hidden; }
.mat-win[hidden] { display: none; }
.mat-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; background: #f4f6fa; border-bottom: 1px solid var(--line); cursor: move; user-select: none; flex: none; }
.mat-head .mat-target { flex: 1; min-width: 0; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mat-tools { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line-2); flex: none; }
.mat-tools .search { margin-left: 0; max-width: none; }
.mat-main { flex: 1; min-height: 0; display: flex; }
.mat-tree-pane { flex: none; width: 210px; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #fbfcfe; min-height: 0; }
.mat-tree-pane[hidden] { display: none; }
.mat-tree-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 6px 6px 10px; border-bottom: 1px solid var(--line-2); font-size: 12px; flex: none; }
.mat-tree { flex: 1; min-height: 0; overflow: auto; }
.mat-body { flex: 1; min-width: 0; min-height: 0; overflow: auto; }
.mat-body tbody tr { cursor: pointer; }
.mat-body tbody tr.mat-sel td { background: rgba(37, 99, 235, .12); }
.mat-body tbody tr.mat-have td { color: var(--muted); }
.mat-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 10px; border-top: 1px solid var(--line); background: #fafbfd; flex: none; font-size: 12px; }
.mat-foot label { display: flex; align-items: center; gap: 4px; }
.mat-foot input { width: 110px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; font: inherit; }
.mat-foot #matFormula { width: 150px; }
.mat-foot #matAdd { margin-left: auto; }
.mat-chars { flex-basis: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 산출비교 ---------- */
#tab-compare #cmpBody[hidden], #tab-adjust #adjBody[hidden], #tab-checks #qcBody[hidden] { display: none; }
.qc-desc { margin: 0; font-size: 12.5px; flex: none; }
.cmp-chip.qc-warn b { color: var(--warn); }
.cmp-chip.qc-zero { opacity: .65; }
.adj-row td { background: var(--warn-bg); }
.adj-tag { margin-left: 4px; font-size: 11px; color: var(--warn); font-weight: 600; white-space: nowrap; }
.adj-reason { max-width: 420px; white-space: normal; }
.cmp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; flex: none; }
.cmp-pick { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.cmp-pick select { min-width: 160px; height: 30px; }
.cmp-arrow { color: var(--muted); }
.cmp-cur { font-size: 13px; font-weight: 700; }
.cmp-meta { margin-left: auto; font-size: 12px; }
.cmp-status { display: flex; flex-wrap: wrap; gap: 6px; flex: none; }
.cmp-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); font: inherit; font-size: 12.5px; cursor: pointer; }
.cmp-chip b { font-weight: 700; color: var(--muted); }
.cmp-chip:hover { border-color: var(--accent); }
.cmp-chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-d); }
.cmp-chip.active b { color: var(--accent-d); }
.cmp-split { flex: 1; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) minmax(180px, 34%); gap: 10px; }
.cmp-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); gap: 12px; }
.cmp-layout > .cmp-split { min-height: 0; }
.cmp-tree .trow .tc { color: var(--muted); }
@media (max-width: 1100px) {
  .cmp-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: 300px auto; }
}
.cmp-split .panel { min-height: 0; }
.cmp-grid td.num, .cmp-grid th.num { text-align: right; white-space: nowrap; }
.cmp-grid th.sortable { cursor: pointer; }
.cmp-grid th.sorted { color: var(--accent-d); }
.cmp-grid td.mono { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; }
.cmp-plus { color: var(--bad); font-weight: 600; }
.cmp-minus { color: var(--accent); font-weight: 600; }
.cmp-badge { display: inline-block; min-width: 34px; padding: 1px 7px; border-radius: 9px; font-size: 11.5px; font-weight: 700; text-align: center; background: var(--line); color: var(--muted); }
.cmp-badge.cmp-added { background: var(--ok-bg); color: var(--ok); }
.cmp-badge.cmp-removed { background: rgba(220, 38, 38, .12); color: var(--bad); }
.cmp-badge.cmp-up { background: var(--warn-bg); color: var(--warn); }
.cmp-badge.cmp-down { background: var(--accent-soft); color: var(--accent-d); }
@media (max-width: 860px) {
  .cmp-layout { flex: none; }
  .cmp-split { grid-template-rows: none; grid-auto-rows: 440px; flex: none; }
  #tab-compare.active { overflow: auto; }
}

/* ---------- 대시보드 (실무자용) ---------- */
.dash-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.dash-card.link { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.dash-card.link:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dash-card h3 { display: flex; align-items: center; gap: 6px; }
.dash-big { font-size: 24px; font-weight: 800; letter-spacing: -.4px; line-height: 1.2; }
.dash-big.ok { color: var(--ok); }
.dash-big.warn { color: var(--warn); }
.dash-big.bad { color: var(--bad); }
.dash-meter { height: 6px; margin-top: 8px; border-radius: 3px; background: var(--line); overflow: hidden; }
.dash-meter i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.dash-panel { min-height: 0; }
.dash-panel .panel-head { justify-content: space-between; }
.dash-panel-body { max-height: 360px; min-height: 140px; overflow: auto; padding: 10px 14px 12px; }
.dash-bars { display: flex; flex-direction: column; gap: 6px; }
.dash-bar { display: grid; grid-template-columns: minmax(90px, 34%) minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 12.5px; padding: 2px 4px; border-radius: 6px; }
.dash-bar.link { cursor: pointer; }
.dash-bar.link:hover { background: var(--accent-soft); }
.dash-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-bar-track { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.dash-bar-track i { display: block; height: 100%; border-radius: 5px; background: var(--accent); }
.dash-bar-track i.warn { background: var(--warn); }
.dash-bar-track i.muted { background: var(--muted); opacity: .55; }
.dash-bar-val { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.dash-bar-val small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; }
.dash-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.dash-todo { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dash-todo li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; }
.dash-todo .todo-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dash-todo .todo-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dash-todo .btn { flex: none; margin: 0; }
.dash-todo .todo-need .todo-dot { background: var(--bad); }
.dash-todo .todo-warn .todo-dot { background: var(--warn); }
.dash-todo .todo-info .todo-dot { background: var(--accent); }
.dash-todo .todo-ok .todo-dot { background: var(--ok); }
.dash-table td, .dash-table th { font-size: 12.5px; }
.dash-table td.num, .dash-table th.num { text-align: right; white-space: nowrap; }
.dash-item { font-weight: 600; }
.dash-empty { padding: 18px 4px; color: var(--muted); font-size: 12.5px; text-align: center; }
.dash-empty.err { color: var(--bad); }
@media (max-width: 860px) {
  .dash-kpis, .dash-grid { grid-template-columns: minmax(0, 1fr); }
}

/* 분류기준·산식문자·자재코드 행 편집 */
.row-actions { display: flex; align-items: center; gap: 6px; }
.row-actions .row-sel-info { font-size: 12px; white-space: nowrap; }
table.grid tbody tr.row-sel td { background: var(--accent-soft); }
table.grid tbody tr.row-sel td.rn { box-shadow: inset 3px 0 0 var(--accent); color: var(--accent-d); font-weight: 700; }
table.grid.row-drag tbody tr[data-n] td.rn { cursor: grab; }
table.grid tbody tr.dragging td { opacity: .45; }
table.grid tbody tr.drop-before td { box-shadow: inset 0 2px 0 var(--accent); }
table.grid tbody tr.drop-after td { box-shadow: inset 0 -2px 0 var(--accent); }
table.grid tbody tr.row-default td.rn { color: var(--accent-d); }
table.grid tbody tr.row-default .pill { margin-left: 6px; }
.dash-info .linkish { margin-top: 4px; border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 12px; }
