/* Naver Ontology Lab — design tokens + components (OWNER: shell)
   Visual target: "Neon Graph" — a knowledge web glowing in the dark.
   Dense, 13px base, neon-green accent + lime secondary, dual theme
   (dark is the signature, light is independently tuned, not inverted).
   No CDN, no webfonts fetched at runtime. */

/* ============================================================== tokens === */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --fs: 13px;
  --fs-sm: 12px;
  --fs-xs: 11px;
  --fs-lg: 15px;
  --fs-title: 19px;

  /* page background is green-tinted so white panels read as a layer above it
     (pure-white-on-white made the light theme look flat) */
  --bg: #f3f7f4;
  --bg-alt: #eaf2ec;
  --bg-sunken: #e0ebe2;
  --bg-hover: #e9f1ea;
  --bg-active: #dce9df;
  --panel: #ffffff;

  --border: #dde5de;
  --border-strong: #c2cfc5;
  --border-soft: #e9efe9;

  --text: #17201a;
  --text-muted: #5c6b60;
  --text-subtle: #8c998f;
  --text-invert: #ffffff;

  --accent: #0c9d52;
  --accent-hover: #0a8746;
  --accent-soft: #e5f6ec;
  --accent-border: #aee0c4;
  --lime: #84cc16;
  --lime-soft: #f3fade;

  --success: #1c8f63;
  --success-soft: #e6f4ee;
  --warning: #bd6b12;
  --warning-soft: #fbf1e2;
  --danger: #c9383c;
  --danger-soft: #fbeceb;
  --purple: #6c56c4;
  --purple-soft: #efecfa;
  --teal: #0e8fa3;
  --teal-soft: #e4f4f7;

  --topbar-bg: #0e1813;
  --topbar-bg-2: #1a2a1f;
  --topbar-text: #d7e2d9;
  --topbar-text-dim: #93a698;
  --topbar-border: #24382b;

  --radius: 6px;
  --radius-lg: 10px;
  --shadow-1: 0 1px 2px rgba(16, 24, 18, .10), 0 0 0 1px rgba(16, 24, 18, .06);
  --shadow-2: 0 4px 14px rgba(16, 24, 18, .14), 0 0 0 1px rgba(16, 24, 18, .07);
  --shadow-3: 0 12px 36px rgba(16, 24, 18, .20), 0 0 0 1px rgba(16, 24, 18, .07);
  --glow: 0 0 0 1px rgba(12, 157, 82, .28), 0 0 10px rgba(12, 157, 82, .12);

  --topbar-h: 44px;
  --sidebar-w: 228px;
  --rail-w: 320px;
}

[data-theme="dark"] {
  --bg: #0b120e;
  --bg-alt: #121d16;
  --bg-sunken: #080d0a;
  --bg-hover: #18251c;
  --bg-active: #1f2f24;
  --panel: #101913;

  --border: #223328;
  --border-strong: #31483a;
  --border-soft: #182619;

  --text: #e8f2ea;
  --text-muted: #9fb3a5;
  --text-subtle: #6f8276;
  --text-invert: #0b120e;

  --accent: #2ee66b;
  --accent-hover: #57f08a;
  --accent-soft: #11301d;
  --accent-border: #1e5b35;
  --lime: #a3e635;
  --lime-soft: #26330f;

  --success: #4ac490;
  --success-soft: #16302a;
  --warning: #eca53c;
  --warning-soft: #34281a;
  --danger: #e26f72;
  --danger-soft: #3a2223;
  --purple: #a48ff0;
  --purple-soft: #2a2440;
  --teal: #4bc0d3;
  --teal-soft: #163037;

  --topbar-bg: #080d0a;
  --topbar-bg-2: #121d16;
  --topbar-text: #d7e2d9;
  --topbar-text-dim: #8ca092;
  --topbar-border: #1c2a20;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .45), 0 0 0 1px rgba(46, 230, 107, .06);
  --shadow-2: 0 4px 14px rgba(0, 0, 0, .5), 0 0 0 1px rgba(46, 230, 107, .08);
  --shadow-3: 0 12px 36px rgba(0, 0, 0, .6), 0 0 0 1px rgba(46, 230, 107, .09);
  --glow: 0 0 0 1px rgba(46, 230, 107, .35), 0 0 14px rgba(46, 230, 107, .18);
}

/* ============================================================== base ==== */

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  font-size: var(--fs);
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0 0 8px; }
p:last-child { margin-bottom: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: var(--fs-sm); }
::selection { background: var(--accent-soft); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.grow { flex: 1 1 auto; }
.pad-8 { padding: 8px; }
.row-strong { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.row-strong .icon { color: var(--text-muted); }

.icon { flex: none; vertical-align: middle; }

/* ============================================================== app ===== */

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.boot, .boot-error {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; color: var(--text-muted); gap: 10px;
}
.boot-inner { display: inline-flex; align-items: center; gap: 10px; font-size: var(--fs); }
.boot-error { flex-direction: column; }
.boot-error pre { font-size: var(--fs-sm); color: var(--danger); }

/* ============================================================ topbar ==== */

.topbar {
  flex: none;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 0 12px;
  background: var(--topbar-bg);
  color: var(--topbar-text);
  border-bottom: 1px solid var(--topbar-border);
  position: relative;
  z-index: 40;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 6px; min-width: 0; }
.topbar-left { flex: 0 0 auto; }
.topbar-right { flex: 0 0 auto; margin-left: auto; }
.topbar-center { flex: 1 1 auto; display: flex; justify-content: center; min-width: 0; padding: 0 12px; }
.topbar-sep { width: 1px; height: 20px; background: var(--topbar-border); margin: 0 2px; }

.brand {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--topbar-text); text-decoration: none; padding: 4px 6px; border-radius: var(--radius);
}
.brand:hover { text-decoration: none; background: var(--topbar-bg-2); }
.brand-mark { display: inline-flex; width: 22px; height: 22px; filter: drop-shadow(0 0 5px rgba(163, 230, 53, .35)); }
.brand:hover .brand-mark { filter: drop-shadow(0 0 8px rgba(163, 230, 53, .55)); }
.brand-name { font-weight: 600; font-size: 13px; letter-spacing: .01em; }
.brand-sub { font-size: 12px; color: var(--topbar-text-dim); }

.topbar-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 8px;
  background: transparent; color: var(--topbar-text);
  border: 1px solid transparent; border-radius: var(--radius);
  font: inherit; font-size: var(--fs-sm); cursor: pointer; white-space: nowrap;
}
.topbar-btn:hover { background: var(--topbar-bg-2); }
.dd.open > .topbar-btn { background: var(--topbar-bg-2); border-color: var(--topbar-border); }
.topbar-icon-btn { padding: 0 7px; position: relative; }
.project-switcher .ps-name { max-width: 190px; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.proj-dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

.branch-selector { border-color: var(--topbar-border); background: rgba(255,255,255,.04); }
.branch-selector.on-branch { border-color: #2b6a44; background: rgba(46,230,107,.14); }
.branch-name { font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.branch-state { display: inline-flex; align-items: center; gap: 4px; }
.branch-count { font-size: var(--fs-xs); color: var(--topbar-text-dim); }

.bell-count {
  position: absolute; top: 1px; right: 0;
  min-width: 15px; height: 15px; padding: 0 3px;
  background: var(--danger); color: #fff; border-radius: 8px;
  font-size: 9px; font-weight: 700; line-height: 15px; text-align: center;
  border: 1px solid var(--topbar-bg);
}
.topbar-btn.has-unread { color: #fff; }

.user-chip { display: inline-flex; align-items: center; gap: 6px; }
.user-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.user-role {
  font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--topbar-text-dim); border: 1px solid var(--topbar-border);
  padding: 0 4px; border-radius: 2px;
}
/* the account chip lives on the (always-dark) topbar — override the light pill
   `.user-chip` rule used by in-form user chips so the name stays readable. */
.topbar .user-chip { background: transparent; border: 0; padding: 0; border-radius: 0; }
.topbar .user-name { color: var(--topbar-text); }

/* top-bar search */
.topbar-search {
  position: relative; display: flex; align-items: center; gap: 7px;
  width: 100%; max-width: 520px; height: 28px; padding: 0 9px;
  background: rgba(255,255,255,.07); border: 1px solid transparent; border-radius: var(--radius);
  color: var(--topbar-text-dim);
}
.topbar-search:focus-within { background: var(--bg); border-color: var(--accent); color: var(--text-muted); box-shadow: var(--glow); }
.search-kbd {
  flex: none; padding: 1px 5px; border: 1px solid var(--topbar-border); border-radius: 4px;
  font-size: 10px; font-family: var(--mono); color: var(--topbar-text-dim); background: rgba(255,255,255,.04);
}
.topbar-search:focus-within .search-kbd { display: none; }
.search-input {
  flex: 1 1 auto; min-width: 0; height: 100%;
  background: transparent; border: 0; outline: none;
  font: inherit; font-size: var(--fs-sm); color: var(--topbar-text);
}
.topbar-search:focus-within .search-input { color: var(--text); }
.search-input::placeholder { color: var(--topbar-text-dim); }
.search-input::-webkit-search-cancel-button { display: none; }

.search-results {
  position: absolute; top: calc(100% + 5px); left: 0; right: 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-2); max-height: 460px; overflow: auto; z-index: 60; padding: 4px;
}
.search-note { padding: 10px 10px; color: var(--text-muted); font-size: var(--fs-sm); }
.search-result {
  display: flex; align-items: center; gap: 9px; padding: 6px 8px;
  color: var(--text); border-radius: var(--radius); text-decoration: none;
}
.search-result:hover { background: var(--bg-hover); text-decoration: none; }
.search-result .icon { color: var(--text-muted); }
.sr-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.sr-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-sub { font-size: var(--fs-xs); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-kind { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-subtle); }

/* ========================================================== dropdowns === */

.dd { position: relative; }
.menu {
  position: absolute; top: calc(100% + 5px); left: 0;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-2); padding: 4px; z-index: 70;
  max-height: 70vh; overflow: auto;
}
.menu-right { left: auto; right: 0; }
.menu-head {
  padding: 6px 8px 5px; font-size: 10px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-subtle);
}
.menu-sep { height: 1px; background: var(--border-soft); margin: 4px 0; }
.menu-empty, .menu-note { padding: 8px; color: var(--text-muted); font-size: var(--fs-sm); }
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 6px 8px; background: transparent; border: 0; border-radius: var(--radius);
  font: inherit; font-size: var(--fs-sm); color: var(--text); text-align: left; cursor: pointer;
}
.menu-item:hover { background: var(--bg-hover); }
.menu-item.active { background: var(--accent-soft); color: var(--accent-hover); }
.menu-item.danger { color: var(--danger); }
.menu-item > .icon { color: var(--text-muted); }
.menu-icon-space { width: 14px; flex: none; }
.menu-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.menu-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.menu-sub { font-size: var(--fs-xs); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-right { display: inline-flex; }

.notif {
  display: flex; gap: 8px; width: 100%; padding: 8px; text-align: left;
  background: transparent; border: 0; border-radius: var(--radius); cursor: pointer; font: inherit; color: var(--text);
}
.notif:hover { background: var(--bg-hover); }
.notif-dot { width: 6px; height: 6px; border-radius: 50%; background: transparent; margin-top: 6px; flex: none; }
.notif.unread .notif-dot { background: var(--accent); }
.notif-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.notif-title { font-weight: 600; font-size: var(--fs-sm); }
.notif.unread .notif-title { color: var(--text); }
.notif-body { font-size: var(--fs-sm); color: var(--text-muted); }
.notif-meta { font-size: var(--fs-xs); color: var(--text-subtle); }

/* ============================================================ layout === */

.layout { flex: 1 1 auto; display: flex; min-height: 0; }

.sidebar {
  flex: none; width: var(--sidebar-w);
  background: var(--bg-alt); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
.sidebar-head {
  padding: 12px 14px 8px; font-size: 10px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-subtle);
}
.sidebar-nav { flex: 1 1 auto; overflow-y: auto; padding: 0 8px 12px; }
.sidebar-group {
  padding: 12px 6px 4px; font-size: 10px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-subtle);
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px; margin-bottom: 1px; border-radius: var(--radius);
  color: var(--text); text-decoration: none; font-size: var(--fs); line-height: 1.3;
}
.nav-item:hover { background: var(--bg-hover); text-decoration: none; }
.nav-item .icon { color: var(--text-muted); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-hover); font-weight: 600; box-shadow: inset 2px 0 0 0 var(--accent); }
.nav-item.active .icon { color: var(--accent); filter: drop-shadow(0 0 4px color-mix(in srgb, var(--accent) 55%, transparent)); }
.nav-item.disabled { opacity: .45; cursor: default; }
.nav-label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-badge {
  font-size: 10px; font-weight: 700; background: var(--bg-active); color: var(--text-muted);
  padding: 0 5px; border-radius: 8px;
}
.sidebar-empty { padding: 10px; font-size: var(--fs-sm); color: var(--text-subtle); }
.sidebar-foot {
  flex: none; border-top: 1px solid var(--border); padding: 8px 12px;
  display: flex; flex-direction: column; gap: 3px;
}
.sf-line { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-muted); }
.sf-line .icon { color: var(--text-subtle); }

.content { flex: 1 1 auto; min-width: 0; overflow: auto; background: var(--bg); }
.route-loading { padding: 40px; display: flex; justify-content: center; }

/* ============================================================== page === */

.page { display: flex; flex-direction: column; min-height: 100%; }
.page-head {
  padding: 14px 20px 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 20;
}
.page-title-row { display: flex; align-items: center; gap: 9px; min-height: 30px; }
.page-icon { display: inline-flex; color: var(--text-muted); }
.page-title { font-size: var(--fs-title); font-weight: 600; letter-spacing: -.02em; }
.page-badges { display: inline-flex; gap: 5px; align-items: center; }
.page-subtitle { color: var(--text-muted); font-size: var(--fs-sm); margin: 3px 0 0; max-width: 900px; }
.page-actions { display: inline-flex; gap: 6px; align-items: center; }
.page-head .tabs { margin-top: 10px; }
.page-head:not(:has(.tabs)) { padding-bottom: 12px; }

.page-layout { flex: 1 1 auto; display: flex; align-items: flex-start; min-height: 0; }
.page-sidebar {
  flex: none; width: 210px; padding: 14px 10px 20px 16px;
  border-right: 1px solid var(--border); align-self: stretch;
}
.page-main { flex: 1 1 auto; min-width: 0; padding: 16px 20px 40px; display: flex; flex-direction: column; gap: 14px; }
.page-rail {
  flex: none; width: var(--rail-w); align-self: stretch;
  border-left: 1px solid var(--border); background: var(--bg-alt);
  padding: 14px 16px 24px; display: none;
}
.page.rail-open .page-rail { display: block; }
.btn-help { color: var(--text-muted); }
.page.rail-open .btn-help { background: var(--accent-soft); color: var(--accent-hover); }

.crumbs { display: flex; align-items: center; gap: 4px; font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: 3px; }
.crumb { color: var(--text-muted); }
.crumb:hover { color: var(--accent); }
.crumb-current { color: var(--text-muted); }
.crumb-sep { display: inline-flex; color: var(--text-subtle); }

/* ============================================================ buttons == */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 28px; padding: 0 10px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  font: inherit; font-size: var(--fs-sm); font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .08s ease, border-color .08s ease;
}
.btn:hover { background: var(--bg-hover); }
.btn:active { background: var(--bg-active); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .icon { color: currentColor; opacity: .85; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
/* dark: the neon accent is too loud as a solid fill — use a deep, muted green
   with light text so the primary action reads calm (glow stays for focus/active). */
[data-theme="dark"] .btn-primary { background: #1c8049; border-color: #1c8049; color: #eafff1; }
[data-theme="dark"] .btn-primary:hover { background: #22914f; border-color: #22914f; color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.94); }
.btn-minimal { background: transparent; border-color: transparent; }
.btn-minimal:hover { background: var(--bg-hover); }
.btn-sm { height: 24px; padding: 0 7px; font-size: var(--fs-xs); }
.btn-icon { padding: 0 6px; }

/* ============================================================== tabs === */

.tabs { display: flex; align-items: center; gap: 2px; }
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 10px; background: transparent; border: 0;
  border-bottom: 2px solid transparent; color: var(--text-muted);
  font: inherit; font-size: var(--fs); font-weight: 500; cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab .icon { opacity: .8; }
.tab-count {
  font-size: 10px; font-weight: 700; background: var(--bg-sunken); color: var(--text-muted);
  padding: 1px 5px; border-radius: 8px;
}
.tab.active .tab-count { background: var(--accent-soft); color: var(--accent-hover); }

.tabs-pill { gap: 4px; }
.tabs-pill .tab { border: 1px solid transparent; border-radius: 12px; padding: 4px 11px; }
.tabs-pill .tab.active { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-hover); }

.tabs-segmented { gap: 0; background: var(--bg-sunken); border-radius: var(--radius); padding: 2px; display: inline-flex; }
.tabs-segmented .tab { border: 0; border-radius: 2px; padding: 4px 12px; }
.tabs-segmented .tab.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-1); }

.subnav { display: flex; flex-direction: column; gap: 1px; }
.subnav-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 6px 8px; background: transparent; border: 0; border-radius: var(--radius);
  font: inherit; font-size: var(--fs); color: var(--text-muted); text-align: left; cursor: pointer;
}
.subnav-item:hover { background: var(--bg-hover); color: var(--text); }
.subnav-item.active { background: var(--accent-soft); color: var(--accent-hover); font-weight: 600; }
.subnav-label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subnav-count { font-size: var(--fs-xs); color: var(--text-subtle); }

/* ============================================================= cards === */

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}
.card-head {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--border-soft);
}
.card-heads { flex: 1 1 auto; min-width: 0; }
.card-title { font-size: var(--fs-lg); font-weight: 600; }
.card-subtitle { font-size: var(--fs-sm); color: var(--text-muted); margin: 2px 0 0; }
.card-actions { display: inline-flex; gap: 6px; flex: none; }
.card-body { padding: 12px; }
.card-body-flush { padding: 0; }
.card-info { border-color: var(--accent-border); }
.card-warning { border-color: color-mix(in srgb, var(--warning) 40%, var(--border)); }
.card-danger { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }

.section { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; align-items: flex-start; gap: 12px; }
.section-title { font-size: var(--fs-lg); font-weight: 600; }
.section-desc { font-size: var(--fs-sm); color: var(--text-muted); margin: 2px 0 0; max-width: 760px; }
.section-actions { margin-left: auto; display: inline-flex; gap: 6px; }

/* ============================================================ keyvalue = */

.kv { margin: 0; display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 0; }
.kv-row { display: contents; }
.kv-key {
  padding: 6px 12px 6px 0; color: var(--text-muted); font-size: var(--fs-sm);
  border-bottom: 1px solid var(--border-soft);
}
.kv-val {
  margin: 0; padding: 6px 0; border-bottom: 1px solid var(--border-soft);
  overflow-wrap: anywhere;
}
.kv-row:last-child .kv-key, .kv-row:last-child .kv-val { border-bottom: 0; }
/* compact: 좁은 카드(갤러리 등)에서 키 열이 값 열을 눌러 세로로 줄바꿈되는 걸 막는다 — 라벨을 값 위에 쌓는다 */
.kv.kv-compact { grid-template-columns: 1fr; gap: 0; }
.kv.kv-compact .kv-key { padding: 4px 0 0; border-bottom: 0; }
.kv.kv-compact .kv-val { padding: 0 0 4px; border-bottom: 1px solid var(--border-soft); }
.kv.kv-compact .kv-row:last-child .kv-val { border-bottom: 0; }

/* =========================================================== badges === */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 6px; border-radius: 2px;
  font-size: var(--fs-xs); font-weight: 600; line-height: 16px;
  background: var(--bg-sunken); color: var(--text-muted); border: 1px solid transparent;
  white-space: nowrap;
}
.badge-info { background: var(--accent-soft); color: var(--accent-hover); border-color: var(--accent-border); }
.badge-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.badge-purple { background: var(--purple-soft); color: var(--purple); border-color: color-mix(in srgb, var(--purple) 30%, transparent); }
.badge-teal { background: var(--teal-soft); color: var(--teal); border-color: color-mix(in srgb, var(--teal) 30%, transparent); }
.badge-neutral { border-color: var(--border); }

.pill {
  display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 10px;
  font-size: var(--fs-xs); font-weight: 600;
}
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: 2px; padding: 1px 4px 1px 7px; font-size: var(--fs-xs); color: var(--text);
  max-width: 100%;
}
.tag-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-remove {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; padding: 0; border: 0; border-radius: 2px;
  background: transparent; color: var(--text-muted); cursor: pointer;
}
.tag-remove:hover { background: var(--bg-active); color: var(--danger); }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff; font-weight: 700; letter-spacing: .01em;
  flex: none; user-select: none;
}
/* 비공개(마스킹) 사용자 — 열람 권한 밖이라 실명을 가린 계정(SECVUL-14081) */
.avatar-masked { color: #fff; opacity: .9; }
.avatar-masked svg { width: 62%; height: 62%; }

/* 멤버 추가용 사용자 검색 드롭다운(SECVUL-14081 — 전체 명단 대신 owner 검색) */
.user-search-results {
  position: absolute; top: calc(100% + 2px); left: 0; right: 0; z-index: 30;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  max-height: 260px; overflow-y: auto; box-shadow: 0 6px 20px rgba(0,0,0,.14);
}
.user-search-row {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 7px 10px; background: none; border: 0; cursor: pointer; font-size: var(--fs);
  color: var(--text);
}
.user-search-row:hover { background: var(--bg-alt); }
.user-chip {
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 6px 3px 4px;
  background: var(--bg-alt);
}

/* ============================================================ table === */

.table-wrap {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); overflow: auto; max-width: 100%;
}
.card-body-flush > .table-wrap { border: 0; border-radius: 0; }
.table-scroll { overflow-y: auto; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs); }
.tbl th {
  text-align: left; font-weight: 600; font-size: var(--fs-xs);
  letter-spacing: .03em; text-transform: uppercase; color: var(--text-muted);
  background: var(--bg-alt); padding: 7px 10px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl-sticky thead th { position: sticky; top: 0; z-index: 2; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--text); background: var(--bg-hover); }
.th-inner { display: inline-flex; align-items: center; gap: 3px; }
.sort-caret { display: inline-flex; opacity: 0; color: var(--text-subtle); }
.tbl th.sortable:hover .sort-caret { opacity: .45; }
.sort-caret.on { opacity: 1; color: var(--accent); }
.tbl td { padding: 6px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--bg-hover); }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.selected { background: var(--accent-soft); }
.tbl-dense td { padding: 3px 8px; }
.tbl-dense th { padding: 5px 8px; }
.tbl .align-right { text-align: right; }
.tbl .align-center { text-align: center; }
.tbl-select { width: 30px; padding-right: 0 !important; }
.tbl-empty { padding: 0 !important; }
.tbl-empty .empty { border: 0; }

.ckbox { width: 13px; height: 13px; accent-color: var(--accent); cursor: pointer; margin: 0; }

/* ============================================================ empty === */

.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 36px 20px; text-align: center; color: var(--text-muted);
}
.empty-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--bg-sunken); color: var(--text-subtle); margin-bottom: 2px;
}
.empty-title { font-size: var(--fs-lg); font-weight: 600; color: var(--text); }
.empty-body { font-size: var(--fs-sm); max-width: 460px; }
.empty-action { margin-top: 6px; }
/* AI wizard header banner (ontologyBuilder / appBuilderAI) */
.ai-banner {
  display: flex; justify-content: center; padding: 10px 16px;
  border: 1px solid var(--accent-border); border-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--accent-soft), transparent 70%);
  overflow: hidden;
}
.ai-banner img { height: 110px; max-width: 100%; object-fit: contain; }
[data-theme="dark"] .ai-banner img { filter: invert(.88) hue-rotate(180deg) saturate(1.2); }

/* project / object-type emblems — white outline (no fill) on an accent-color
   plate. The glyph is inset (background-size < 100%) so it breathes on the plate. */
.proj-emblem {
  display: inline-block; flex: none; border-radius: 7px;
  background-image: var(--emblem);
  background-size: contain; background-position: center; background-repeat: no-repeat;
}
.proj-emblem.plated {
  background-size: 68%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
}
/* legacy wrappers kept as transparent pass-throughs (emblem now self-plates) */
.ot-glyph, .proj-emblem-tile {
  display: inline-flex; flex: none; align-items: center; justify-content: center;
}

/* project cards get the woven-web cover texture */
.proj-card { position: relative; isolation: isolate; }
.proj-card::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: url('/assets/brand/cover-a-light.webp') center / cover no-repeat;
  opacity: .55; border-radius: inherit;
}
.proj-card:nth-child(even)::before { background-image: url('/assets/brand/cover-b-light.webp'); }
[data-theme="dark"] .proj-card::before { background-image: url('/assets/brand/cover-a.webp'); opacity: .5; }
[data-theme="dark"] .proj-card:nth-child(even)::before { background-image: url('/assets/brand/cover-b.webp'); }

.empty-art { width: 150px; max-width: 60%; margin-bottom: 4px; opacity: .95; }
.tbl-empty .empty-art { width: 96px; }
/* the illustrations are dark monoline strokes drawn for light surfaces —
   invert+rotate keeps them green and makes them readable on the dark theme */
[data-theme="dark"] .empty-art { filter: invert(.88) hue-rotate(180deg) saturate(1.2); }

.spinner-wrap { display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: var(--fs-sm); }
.spinner {
  width: 15px; height: 15px; flex: none; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.errorstate {
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border));
  background: var(--danger-soft); border-radius: var(--radius); padding: 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.errorstate-head { display: flex; align-items: center; gap: 7px; color: var(--danger); }
.errorstate-msg { color: var(--text); margin: 0; }
.errorstate-code { color: var(--danger); }

/* =========================================================== overlays == */

#overlay-root { position: relative; z-index: 100; }
.overlay {
  position: fixed; inset: 0; background: rgba(17, 20, 24, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 64px 16px 16px; z-index: 100; animation: fade .12s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--panel); border-radius: var(--radius-lg); box-shadow: var(--shadow-3);
  max-width: 100%; max-height: calc(100vh - 96px); display: flex; flex-direction: column;
  animation: pop .12s ease;
}
@keyframes pop { from { transform: translateY(-6px); opacity: .6; } }
.modal-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 14px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: var(--fs-lg); font-weight: 600; flex: 1 1 auto; }
.modal-subtitle { font-size: var(--fs-sm); color: var(--text-muted); margin: 3px 0 0; }
.modal-head > div:first-child { flex: 1 1 auto; min-width: 0; }
.modal-body { padding: 14px; overflow: auto; flex: 1 1 auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 10px 14px; border-top: 1px solid var(--border); background: var(--bg-alt);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.confirm-body { color: var(--text-muted); }

.overlay-drawer { padding: 0; align-items: stretch; justify-content: flex-end; }
.drawer {
  background: var(--panel); box-shadow: var(--shadow-3); height: 100vh;
  display: flex; flex-direction: column; max-width: 100vw; animation: slide .14s ease;
}
@keyframes slide { from { transform: translateX(24px); opacity: .5; } }
.drawer-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.drawer-title { font-size: var(--fs-lg); font-weight: 600; flex: 1 1 auto; }
.drawer-body { padding: 14px; overflow: auto; flex: 1 1 auto; }

/* ============================================================ toasts === */

.toasts {
  position: fixed; top: 54px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 7px; z-index: 200; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  background: var(--topbar-bg); color: #f0f3f6;
  border-radius: var(--radius); box-shadow: var(--shadow-2);
  padding: 8px 10px; font-size: var(--fs-sm); pointer-events: auto;
  max-width: 560px; animation: toastin .16s ease;
}
@keyframes toastin { from { transform: translateY(-8px); opacity: 0; } }
.toast.leaving { opacity: 0; transition: opacity .2s ease; }
.toast-msg { flex: 1 1 auto; }
.toast-x { background: transparent; border: 0; color: #99a3b0; cursor: pointer; padding: 2px; display: inline-flex; }
.toast-x:hover { color: #fff; }
.toast-success { background: #0f6848; }
.toast-warning { background: #935610; }
.toast-danger, .toast-error { background: #a82a2e; }
.toast-info .icon { color: #6fe3a0; }

/* ============================================================== form === */

.form { display: grid; gap: 14px; }
.form-cols-2 { grid-template-columns: 1fr 1fr; }
.form-cols-3 { grid-template-columns: repeat(3, 1fr); }
.field-full { grid-column: 1 / -1; }
.form-divider {
  grid-column: 1 / -1; border-top: 1px solid var(--border); padding-top: 10px;
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-subtle);
}
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { display: flex; align-items: center; gap: 3px; font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.field-label .req { color: var(--danger); }
.field-help { font-size: var(--fs-xs); color: var(--text-muted); margin: 0; }
.field-error { font-size: var(--fs-xs); color: var(--danger); margin: 0; }

/* App Builder — Add widget 다이얼로그: 설명은 선택한 위젯 하나만, 전체는 ? Help 토글 */
.add-widget-pick { display: flex; align-items: flex-end; gap: 8px; }
.add-widget-pick .form { flex: 1 1 auto; }
.widget-desc { margin-top: 8px; min-height: 1.2em; }
.widget-help-list { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); max-height: 230px; overflow: auto; display: grid; gap: 6px; }
.widget-help-item { display: grid; grid-template-columns: 116px 1fr; gap: 10px; font-size: var(--fs-xs); line-height: 1.35; }
.widget-help-name { font-weight: 600; color: var(--text); }
.widget-help-desc { color: var(--text-muted); }
.field.has-error .input, .field.has-error .typeahead .ta-input { border-color: var(--danger); }

.input {
  width: 100%; height: 28px; padding: 0 8px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  font: inherit; font-size: var(--fs); outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.input:disabled { background: var(--bg-sunken); color: var(--text-muted); cursor: not-allowed; }
.input::placeholder { color: var(--text-subtle); }
textarea.input, .textarea { height: auto; min-height: 60px; padding: 6px 8px; line-height: 1.5; resize: vertical; }
select.input, .select { appearance: none; padding-right: 24px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 12px, calc(100% - 9px) 12px;
  background-size: 4px 4px, 4px 4px; background-repeat: no-repeat; }
.input.mono { font-family: var(--mono); font-size: var(--fs-sm); }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch-input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 30px; height: 17px; border-radius: 9px; background: var(--border-strong);
  display: inline-flex; align-items: center; padding: 2px; transition: background .12s ease;
}
.switch-thumb { width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: transform .12s ease; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch-input:checked + .switch-track { background: var(--accent); }
.switch-input:checked + .switch-track .switch-thumb { transform: translateX(13px); }
.switch-text { font-size: var(--fs-sm); color: var(--text-muted); }

.multiselect {
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  max-height: 168px; overflow: auto; padding: 3px; background: var(--bg);
}
.ms-item { display: flex; align-items: center; gap: 7px; padding: 4px 6px; border-radius: 2px; cursor: pointer; }
.ms-item:hover { background: var(--bg-hover); }
.ms-label { font-size: var(--fs); }
.ms-desc { font-size: var(--fs-xs); color: var(--text-subtle); margin-left: auto; }

.chips {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 4px; min-height: 28px; background: var(--bg);
}
.chips:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.chips-input { flex: 1 1 80px; min-width: 80px; border: 0; outline: none; background: transparent; font: inherit; font-size: var(--fs); color: var(--text); }

.md-field { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.md-preview {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 10px; background: var(--bg-alt); overflow: auto; min-height: 60px; font-size: var(--fs);
}
.md h3, .md h4, .md h5 { margin: 6px 0 3px; }
.md ul, .md ol { margin: 4px 0; padding-left: 18px; }
.md code { background: var(--bg-sunken); padding: 0 3px; border-radius: 2px; }
.md pre { background: var(--bg-sunken); margin: 6px 0; padding: 8px 10px; border-radius: var(--radius); overflow-x: auto; white-space: pre; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; margin: 6px 0; }
.md th, .md td { border: 1px solid var(--border); padding: 3px 8px; text-align: left; }
.md th { background: var(--bg-alt); }

.colorpick { display: flex; align-items: center; gap: 8px; }
.color-swatches { display: flex; flex-wrap: wrap; gap: 4px; }
.color-swatch { width: 20px; height: 20px; border-radius: 3px; border: 1px solid rgba(0,0,0,.15); cursor: pointer; padding: 0; }
.color-swatch.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.color-native { width: 28px; height: 24px; padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg); cursor: pointer; }

.iconpick {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 3px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 5px;
  max-height: 150px; overflow: auto; background: var(--bg);
}
.icon-choice {
  display: inline-flex; align-items: center; justify-content: center;
  height: 28px; border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; color: var(--text-muted); cursor: pointer;
}
.icon-choice:hover { background: var(--bg-hover); color: var(--text); }
.icon-choice.on { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }

/* emblem picker (project / object-type) — renders the Higgsfield picons */
.emblempick {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 7px;
  max-height: 240px; overflow: auto; background: var(--bg);
}
/* chips show the white outline on a neutral slate so the shape reads before an
   accent color is picked (the Accent color field paints the real plate on the card). */
.emblem-choice {
  height: 44px; border: 1px solid var(--border); border-radius: 8px;
  background-color: #33403a; background-image: var(--emblem);
  background-size: 66%; background-position: center; background-repeat: no-repeat;
  cursor: pointer;
}
.emblem-choice:hover { border-color: var(--accent-border); }
.emblem-choice.on { border-color: var(--accent); box-shadow: var(--glow); }

/* typeahead (objectRef / user) */
.typeahead { display: flex; flex-direction: column; gap: 5px; }
.ta-selected { display: flex; flex-wrap: wrap; gap: 4px; }
.ta-selected:empty { display: none; }
.ta-chosen {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-soft); border: 1px solid var(--accent-border);
  border-radius: var(--radius); padding: 2px 4px 2px 7px; font-size: var(--fs-sm); color: var(--accent-hover);
}
.ta-clear { background: transparent; border: 0; color: inherit; cursor: pointer; display: inline-flex; padding: 1px; }
.ta-inputwrap { position: relative; display: flex; align-items: center; }
.ta-inputwrap > .icon { position: absolute; left: 8px; color: var(--text-subtle); pointer-events: none; }
.ta-input { padding-left: 26px; }
.ta-menu {
  position: absolute; top: calc(100% + 3px); left: 0; right: 0; z-index: 90;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-2); max-height: 240px; overflow: auto; padding: 3px;
}
.ta-item { display: flex; align-items: center; gap: 8px; padding: 5px 7px; border-radius: 2px; cursor: pointer; }
.ta-item:hover { background: var(--bg-hover); }
.ta-item > .icon { color: var(--text-muted); }
.ta-item-text { flex: 1 1 auto; min-width: 0; }
.ta-item-label { font-size: var(--fs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ta-item-desc { font-size: var(--fs-xs); color: var(--text-muted); }
.ta-item-value { font-size: 10px; color: var(--text-subtle); }
.ta-note { padding: 8px; font-size: var(--fs-sm); color: var(--text-muted); }

/* ============================================================ charts == */

.chart { width: 100%; min-width: 0; max-width: 100%; position: relative; overflow: hidden; }
.chart-svg { display: block; max-width: 100%; }
.chart .grid { stroke: var(--border-soft); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis { stroke: var(--border); stroke-width: 1; shape-rendering: crispEdges; }
.axis-label { font-size: 10px; fill: var(--text-muted); font-family: var(--font); }
.bar-value { font-size: 10px; fill: var(--text-muted); font-family: var(--font); }
.bar { transition: opacity .1s ease; }
.bar:hover { opacity: .78; }
.slice { stroke: var(--panel); stroke-width: 1.5; }
.slice:hover { opacity: .85; }
.donut-total { font-size: 17px; font-weight: 700; fill: var(--text); font-family: var(--font); }
.donut-total-label { font-size: 9px; fill: var(--text-subtle); text-transform: uppercase; letter-spacing: .06em; font-family: var(--font); }
.legend-label { font-size: 11px; fill: var(--text); font-family: var(--font); }
.legend-value { font-size: 11px; fill: var(--text-muted); font-family: var(--font); }
.sparkline { display: inline-block; vertical-align: middle; }

/* link graph */
.linkgraph-wrap { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-alt); overflow: hidden; }
.lg-edge { fill: none; stroke: var(--border-strong); stroke-width: 1.2; }
.lg-edge-label { font-size: 10px; fill: var(--text-muted); font-family: var(--font); }
.lg-edge-labelbg { fill: var(--bg-alt); }
.lg-edge-card { font-size: 9px; fill: var(--text-subtle); font-family: var(--font); letter-spacing: .02em; }
.lg-node-box { fill: var(--panel); stroke: var(--border-strong); stroke-width: 1; }
.lg-node.clickable { cursor: pointer; }
.lg-node.clickable:hover .lg-node-box { stroke: var(--accent); fill: var(--accent-soft); }
.lg-node-icon { color: var(--text-muted); }
.lg-node-label { font-size: 12px; font-weight: 600; fill: var(--text); font-family: var(--font); }
.lg-node-count { font-size: 9.5px; fill: var(--text-subtle); font-family: var(--font); }

/* ============================================================== code == */

.code-block { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-alt); }
.code-head {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px;
  background: var(--bg-sunken); border-bottom: 1px solid var(--border);
}
.code-lang { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-subtle); font-weight: 700; }
.code-hint { font-size: var(--fs-xs); color: var(--text-subtle); padding-right: 6px; }
.code-pre { margin: 0; padding: 10px 12px; overflow: auto; line-height: 1.55; background: var(--bg-alt); color: var(--text); max-height: 520px; }
.code-editor {
  display: block; width: 100%; border: 0; outline: none; resize: vertical;
  padding: 10px 12px; background: var(--bg-alt); color: var(--text);
  font-family: var(--mono); font-size: var(--fs-sm); line-height: 1.55; tab-size: 4;
}
.tok-kw { color: #a626a4; font-weight: 600; }
.tok-str { color: #1c8f63; }
.tok-num { color: #b5730d; }
.tok-com { color: var(--text-subtle); font-style: italic; }
[data-theme="dark"] .tok-kw { color: #d08ee8; }
[data-theme="dark"] .tok-str { color: #7ad3a6; }
[data-theme="dark"] .tok-num { color: #e6b271; }

/* =============================================================== json = */

.jsonview { font-size: var(--fs-sm); line-height: 1.6; overflow: auto; }
.json-node { padding-left: 0; }
.json-children { padding-left: 15px; border-left: 1px dotted var(--border); margin-left: 5px; }
.json-row { display: flex; align-items: baseline; gap: 3px; white-space: pre-wrap; }
.json-branch { cursor: pointer; }
.json-branch:hover { background: var(--bg-hover); }
.json-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 13px; height: 13px; padding: 0; border: 0; background: transparent;
  color: var(--text-subtle); cursor: pointer; transition: transform .1s ease; flex: none;
}
.json-toggle.open { transform: rotate(90deg); }
.json-key { color: var(--purple); }
.json-str { color: var(--success); }
.json-num { color: var(--warning); }
.json-bool { color: var(--accent); }
.json-null { color: var(--text-subtle); font-style: italic; }
.json-brace { color: var(--text-muted); }
.json-count { color: var(--text-subtle); font-size: 10px; padding: 0 3px; }

/* =============================================================== diff = */

.diff { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-size: var(--fs-sm); }
.diff-head, .diff-row { display: grid; grid-template-columns: minmax(120px, 1fr) 1.4fr 1.4fr; }
.diff-head { background: var(--bg-alt); border-bottom: 1px solid var(--border); }
.diff-head .diff-col-head:first-child { grid-column: 2; }
.diff-col-head { padding: 5px 10px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-subtle); }
.diff-row { border-bottom: 1px solid var(--border-soft); }
.diff-row:last-child { border-bottom: 0; }
.diff-key { padding: 5px 10px; color: var(--text-muted); font-family: var(--mono); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.diff-side { padding: 5px 10px; overflow-wrap: anywhere; border-left: 1px solid var(--border-soft); }
.diff-mod .diff-before { background: var(--warning-soft); }
.diff-mod .diff-after { background: var(--accent-soft); }
.diff-add .diff-after { background: var(--success-soft); }
.diff-del .diff-before { background: var(--danger-soft); }
.diff-same { color: var(--text-muted); }
.diff-foot { padding: 5px 10px; background: var(--bg-alt); border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-muted); }

/* =========================================================== timeline = */

.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.tl-item { position: relative; display: flex; gap: 10px; padding: 0 0 14px 0; }
.tl-item:not(:last-child)::before {
  content: ''; position: absolute; left: 8px; top: 18px; bottom: 0; width: 1px; background: var(--border);
}
.tl-dot {
  flex: none; width: 17px; height: 17px; border-radius: 50%;
  background: var(--bg-sunken); border: 1px solid var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); z-index: 1;
}
.tl-info .tl-dot { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }
.tl-success .tl-dot { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.tl-warning .tl-dot { background: var(--warning-soft); border-color: var(--warning); color: var(--warning); }
.tl-danger .tl-dot { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.tl-content { flex: 1 1 auto; min-width: 0; }
.tl-head { display: flex; align-items: baseline; gap: 8px; }
.tl-title { font-weight: 600; }
.tl-meta { font-size: var(--fs-xs); color: var(--text-subtle); margin-left: auto; white-space: nowrap; }
.tl-subtitle { font-size: var(--fs-sm); color: var(--text-muted); }
.tl-body { margin-top: 5px; }
.tl-empty { padding: 8px 0; list-style: none; }

/* =============================================================== help = */

.help-panel { position: sticky; top: 14px; display: flex; flex-direction: column; gap: 8px; }
.help-head { display: flex; align-items: center; gap: 7px; color: var(--text); padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.help-head .icon { color: var(--accent); }
.help-title { font-size: var(--fs); font-weight: 700; }
.help-sub { font-size: var(--fs-sm); font-weight: 700; color: var(--text); margin-top: 4px; }
.help-p { font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.65; margin: 0; }
.help-p strong { color: var(--text); }
.help-ul { margin: 0; padding-left: 17px; display: flex; flex-direction: column; gap: 3px; }
.help-ul li { font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.6; }
.help-panel code { background: var(--bg-sunken); border: 1px solid var(--border-soft); border-radius: 2px; padding: 0 3px; color: var(--text); }
.help-link { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-sm); }
.help-foot { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--border-soft); font-size: 10px; color: var(--text-subtle); }

/* ========================================================= responsive = */

@media (max-width: 1280px) {
  :root { --rail-w: 280px; }
}
@media (max-width: 1100px) {
  .page.rail-open .page-rail { display: none; }
  .topbar-search { max-width: 320px; }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 64px; }
  .nav-label, .sidebar-head, .sidebar-foot, .sidebar-group { display: none; }
  .nav-item { justify-content: center; }
  .brand-sub, .user-name, .user-role { display: none; }
}

/* ====================================================== OntologyMap === */
/* 지위만 색으로: 활성=선명+글로우, 비활성=흐림, 변경/마킹/활성은 기호(✎/🔒/✓)를 함께 단다. */
.om-root { display: flex; flex-direction: column; gap: 6px; }
.om-bar { display: flex; align-items: center; gap: 8px; }
.om-bar-spacer { flex: 1; }
.om-seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.om-seg .btn { border: 0; border-radius: 0; }
.om-seg .btn + .btn { border-left: 1px solid var(--border); }
.om-seg .btn.is-on { background: var(--accent-soft); color: var(--accent-hover); font-weight: 600; }
.om-status { font-size: var(--fs-xs); color: var(--text-subtle); }
.om-canvas { position: relative; border: 1px solid var(--border); border-radius: var(--radius);
             background: var(--bg-alt); overflow: hidden; cursor: grab; }
.om-canvas.panning { cursor: grabbing; }
.om-svg { display: block; user-select: none; }

/* 전체 화면 모드 — 같은 DOM을 fixed 오버레이로 확장한다(렌즈·근거 상태 유지).
 * z-index 95: 드로어/모달(100)·토스트(200)보다 아래, 페이지 요소들보다는 위. */
.om-root.om-fullscreen { position: fixed; inset: 0; z-index: 95; margin: 0;
                         background: var(--bg); padding: 14px 18px 18px; gap: 10px; }
.om-root.om-fullscreen .om-canvas { flex: 1; min-height: 0; }
body.om-lock-scroll { overflow: hidden; }
.om-empty { font-size: var(--fs-sm); fill: var(--text-subtle); font-family: var(--font); }

.om-arrow-fill { fill: var(--border-strong); }
.om-arrow-fill-on { fill: var(--accent); }

.om-edge { fill: none; stroke: var(--border-strong); stroke-width: 1.2; transition: opacity .18s, stroke-width .18s; }
.om-edge.dim { opacity: .25; }
.om-edge.on { stroke: var(--accent); stroke-width: 2.2; }
.om-edge.pulse { stroke: var(--purple); stroke-width: 2.6; animation: om-pulse .7s ease-out; }
.om-edge-label { font-size: 10px; fill: var(--text-muted); font-family: var(--font); }
.om-edge-label.on { fill: var(--accent-hover); font-weight: 600; }
.om-edge-label.dim { opacity: .3; }
.om-edge-labelbg { fill: var(--bg-alt); }
.om-edge-labelbg.on { fill: var(--accent-soft); }
.om-edge-labelbg.dim { opacity: .3; }

.om-node { cursor: pointer; transition: opacity .18s; }
.om-node-box { fill: var(--panel); stroke: var(--border-strong); stroke-width: 1; }
.om-node.dim { opacity: .28; }
.om-node.on .om-node-box { stroke: var(--accent); stroke-width: 2; filter: drop-shadow(0 0 6px rgba(45,114,210,.35)); }
.om-node.pulse .om-node-box { stroke: var(--purple); stroke-width: 2.4; animation: om-pulse .7s ease-out; }
.om-node:hover .om-node-box { fill: var(--accent-soft); }
.om-node-icon { color: var(--text-muted); }
.om-node-label { font-size: 12px; font-weight: 600; fill: var(--text); font-family: var(--font); }
.om-node-count { font-size: 9.5px; fill: var(--text-subtle); font-family: var(--font); }
.om-node-check { font-size: 11px; fill: var(--accent); font-family: var(--font); }
.om-node-edit { font-size: 11px; fill: var(--warning); font-family: var(--font); }
.om-node-lock { font-size: 10px; font-family: var(--font); }

.om-lens { cursor: pointer; }
.om-lens-bg { fill: var(--accent-soft); stroke: var(--accent-border); stroke-width: 1; }
.om-lens.open .om-lens-bg { fill: var(--accent); }
.om-lens-text { font-size: 9.5px; font-weight: 700; fill: var(--accent-hover); font-family: var(--font); }
.om-lens.open .om-lens-text { fill: var(--text-invert); }

.om-sat-link { stroke: var(--accent-border); stroke-width: 1; stroke-dasharray: 3 3; }
.om-sat-edge { stroke: var(--purple); stroke-width: 1.4; opacity: .75; }
.om-sat-dot { fill: var(--panel); stroke: var(--accent); stroke-width: 1.6; }
.om-sat.edited .om-sat-dot { stroke: var(--warning); fill: var(--warning-soft); }
.om-sat.clickable { cursor: pointer; }
.om-sat.clickable:hover .om-sat-dot { fill: var(--accent-soft); }
.om-sat-mark { font-size: 11px; fill: var(--warning); font-family: var(--font); }
.om-sat-label { font-size: 9.5px; fill: var(--text-muted); font-family: var(--font); }
.om-sat-more { font-size: 10px; fill: var(--text-subtle); font-family: var(--font); }

@keyframes om-pulse {
  0%   { stroke-opacity: .35; stroke-width: 6; }
  100% { stroke-opacity: 1; }
}

/* ------------------------------------------------ EvidenceMiniGraph --- */
.emg { border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--bg-alt); }
.emg-empty { padding: 10px 12px; font-size: var(--fs-xs); color: var(--text-subtle);
             border: 1px dashed var(--border); border-radius: var(--radius); }
.emg-edge { fill: none; stroke: var(--purple); stroke-width: 1.3; opacity: .8; }
.emg-box { fill: var(--panel); stroke: var(--accent); stroke-width: 1.2; }
.emg-node.edited .emg-box { stroke: var(--warning); fill: var(--warning-soft); }
.emg-node.clickable { cursor: pointer; }
.emg-node.clickable:hover .emg-box { fill: var(--accent-soft); }
.emg-label { font-size: 10.5px; font-weight: 600; fill: var(--text); font-family: var(--font); }
.emg-sub { font-size: 8.5px; fill: var(--text-subtle); font-family: var(--font); }
.emg-edit { font-size: 10px; fill: var(--warning); font-family: var(--font); }
.emg-more { font-size: 9.5px; fill: var(--text-subtle); font-family: var(--font); }

/* ====================================================== Agent 화면 ==== */
.ag-layout { display: grid; grid-template-columns: minmax(340px, 38%) 1fr; gap: 14px;
             align-items: start; }
@media (max-width: 1100px) { .ag-layout { grid-template-columns: 1fr; } }

.ag-chat { display: flex; flex-direction: column; gap: 8px; min-width: 0;
           border: 1px solid var(--border); border-radius: var(--radius);
           background: var(--panel); padding: 10px; }
.ag-chat-head { display: flex; align-items: center; gap: 6px; }
.ag-conv-select { max-width: 210px; font: inherit; font-size: var(--fs-sm);
                  padding: 3px 6px; border: 1px solid var(--border); border-radius: var(--radius);
                  background: var(--bg); color: var(--text); }
.ag-toggle { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs);
             color: var(--text-muted); cursor: pointer; }

.ag-messages { display: flex; flex-direction: column; gap: 10px; overflow-y: auto;
               min-height: 260px; max-height: 46vh; padding: 2px; }
.ag-msg { border-radius: var(--radius); font-size: var(--fs-sm); }
.ag-msg-user { align-self: flex-end; max-width: 88%; background: var(--accent-soft);
               border: 1px solid var(--accent-border); color: var(--text);
               padding: 7px 10px; white-space: pre-wrap; }
.ag-msg-assistant { border: 1px solid var(--border); background: var(--bg-alt);
                    padding: 9px 10px; display: flex; flex-direction: column; gap: 8px;
                    cursor: pointer; }
.ag-msg-assistant:hover { border-color: var(--border-strong); }
.ag-msg-assistant.streaming { border-style: dashed; cursor: default; }
.ag-msg-assistant.reverted .ag-changes { opacity: .55; text-decoration: line-through; }
.ag-msg-head { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.ag-msg-time { font-size: var(--fs-xs); color: var(--text-subtle); }
.ag-msg-text { line-height: 1.55; }
.ag-msg-text .md p { margin: 0 0 4px; }
.ag-msg-text .md > :last-child { margin-bottom: 0; }
.ag-note { margin: 0; font-size: var(--fs-xs); color: var(--text-muted); }

.ag-cite { display: inline-flex; align-items: center; justify-content: center;
           min-width: 17px; height: 16px; margin: 0 1px; padding: 0 4px;
           border: 1px solid var(--accent-border); border-radius: 8px;
           background: var(--accent-soft); color: var(--accent-hover);
           font-size: 10px; font-weight: 700; cursor: pointer; vertical-align: 1px; }
.ag-cite:hover { background: var(--accent); color: var(--text-invert); }

.ag-mini { margin-top: 2px; }
.ag-changes, .ag-pending { border: 1px solid var(--border); border-radius: var(--radius);
                           background: var(--panel); padding: 8px; display: flex;
                           flex-direction: column; gap: 6px; }
.ag-pending { border-color: var(--warning); background: var(--warning-soft); }
.ag-changes-head, .ag-pending-head { display: flex; align-items: center; gap: 6px;
                                     font-size: var(--fs-sm); }
.ag-before { color: var(--text-subtle); text-decoration: line-through; }
.ag-after { color: var(--success); }

.ag-doc-list { margin: 0; padding-left: 18px; font-size: var(--fs-sm);
               display: flex; flex-direction: column; gap: 2px; }
.ag-doc-blocks { color: var(--text-muted); font-size: var(--fs-xs); }

.ag-agent-row { border: 1px solid var(--border); border-radius: var(--radius);
                background: var(--panel); padding: 8px; }
.ag-agent-row-main { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ag-agent-desc { margin: 4px 0 0; font-size: var(--fs-sm); }
.ag-agent-tools { display: flex; flex-direction: column; gap: 4px; margin-top: 6px;
                  max-height: 260px; overflow-y: auto; }
.ag-agent-tool { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm);
                 cursor: pointer; }

/* 실행 환경 가시화 — 목록 요약 줄 + 편집 화면 카드 */
.ag-agent-env { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
                margin-top: 6px; font-size: var(--fs-sm); }
.ag-env-card { border: 1px solid var(--border); border-radius: var(--radius);
               background: var(--panel-2, var(--panel)); padding: 8px 10px; margin-top: 4px; }
.ag-env-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
              font-size: var(--fs-sm); }
.ag-env-key { color: var(--muted); min-width: 92px; }
.ag-env-check { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ag-env-warn { color: var(--warning); font-size: var(--fs-sm); }
.ag-env-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto;
              display: inline-block; background: var(--muted); }
.ag-env-dot.is-live { background: var(--success); }
.ag-env-dot.is-down { background: var(--danger); }
.ag-env-dot.is-fallback { background: var(--muted); }

.ag-eval-run, .ag-eval-result { border: 1px solid var(--border); border-radius: var(--radius);
                                background: var(--panel); padding: 6px 8px; }
.ag-eval-run > summary, .ag-eval-result > summary { cursor: pointer; display: flex;
                                                    align-items: center; gap: 6px; flex-wrap: wrap;
                                                    font-size: var(--fs-sm); }
.ag-eval-run-body { margin-top: 6px; }
.ag-eval-checks { margin: 6px 0 0; padding-left: 4px; list-style: none;
                  display: flex; flex-direction: column; gap: 3px; font-size: var(--fs-xs); }
.ag-eval-checks li { display: flex; align-items: center; gap: 6px; }
.ag-eval-ok { color: var(--success); }
.ag-eval-bad { color: var(--danger); }
.ag-eval-ok .dim, .ag-eval-bad .dim { color: var(--text-muted); }
.ag-eval-content { margin: 6px 0 0; font-size: var(--fs-xs); white-space: pre-wrap; }

.ag-steps > summary, .ag-step > summary { cursor: pointer; font-size: var(--fs-xs);
                                          color: var(--text-muted); }
.ag-steps-body { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.ag-step { border: 1px solid var(--border-soft); border-radius: var(--radius);
           background: var(--panel); padding: 4px 6px; }
.ag-step.failed { border-color: var(--danger); background: var(--danger-soft); }
.ag-step > summary { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ag-step-no { font-weight: 700; color: var(--text-subtle); font-size: var(--fs-xs); }
.ag-step-tool { font-size: var(--fs-xs); }
.ag-step-summary { flex: 1; min-width: 0; color: var(--text); font-size: var(--fs-xs);
                   overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-step-ms { font-size: 10px; color: var(--text-subtle); }
.ag-step-body { padding: 6px 2px 2px; display: flex; flex-direction: column; gap: 3px; }
.ag-step-line { font-size: var(--fs-xs); word-break: break-all; }
.ag-step-line.dim { color: var(--text-subtle); }
.ag-step-error { display: flex; align-items: center; gap: 4px; color: var(--danger);
                 font-size: var(--fs-xs); }

/* 실행 흐름: ①도구 → ②SQL → ③결과 (왼쪽 번호가 세로로 이어진다) */
.ag-flow { display: flex; flex-direction: column; gap: 7px; margin: 7px 0 5px; }
.ag-flow-stage { display: flex; gap: 8px; position: relative; }
.ag-flow-stage::before { content: ''; position: absolute; left: 8px; top: 18px; bottom: -7px;
                         width: 1px; background: var(--border); }
.ag-flow-stage:last-child::before { display: none; }
.ag-flow-no { flex: none; width: 17px; height: 17px; border-radius: 50%; z-index: 1;
              background: var(--accent); color: var(--text-invert);
              font-size: 10px; font-weight: 700; display: flex;
              align-items: center; justify-content: center; }
.ag-flow-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ag-flow-label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); }
.ag-flow-code { font-size: var(--fs-xs); word-break: break-all; color: var(--text); }
.ag-flow-result { font-size: var(--fs-xs); color: var(--text); }
.ag-sql-list { display: flex; flex-direction: column; gap: 4px; }
.ag-sql { border-left: 2px solid var(--accent); background: var(--bg-sunken);
          border-radius: 0 var(--radius) var(--radius) 0; padding: 4px 7px; }
.ag-sql-text { display: block; font-size: 11px; line-height: 1.5; white-space: pre-wrap;
               word-break: break-word; color: var(--text); }
.ag-sql-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 3px; }
.ag-sql-params { display: inline-flex; flex-wrap: wrap; gap: 3px; min-width: 0; }
.ag-param { font-size: 10px; background: var(--bg-active); color: var(--text-muted);
            padding: 0 4px; border-radius: var(--radius); word-break: break-all; }
.ag-sql-val { background: var(--bg-active); color: var(--accent); border-radius: 2px;
              padding: 0 2px; }
.ag-sql-noparam { font-size: 10px; }
.ag-sql-rows { font-size: 10px; font-weight: 700; color: var(--accent); margin-left: auto;
               white-space: nowrap; }

.ag-live-steps { display: flex; flex-direction: column; gap: 3px; }
.ag-live-step { display: flex; align-items: center; gap: 5px; font-size: var(--fs-xs);
                color: var(--text-muted); }

.ag-examples { display: flex; flex-wrap: wrap; gap: 4px; }
.ag-example { border: 1px solid var(--border); border-radius: 12px; background: var(--bg);
              color: var(--text-muted); font: inherit; font-size: var(--fs-xs);
              padding: 3px 9px; cursor: pointer; }
.ag-example:hover { border-color: var(--accent); color: var(--accent-hover);
                    background: var(--accent-soft); }

.ag-composer { display: flex; gap: 6px; align-items: flex-end; }
.ag-input { flex: 1; resize: vertical; font: inherit; font-size: var(--fs-sm);
            padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius);
            background: var(--bg); color: var(--text); }
.ag-input:focus { outline: none; border-color: var(--accent); }
.ag-map { min-width: 0; }
.ag-dim { color: var(--text-subtle); }

/* Model 선택 드로어 */
.ag-model-bar { display: flex; align-items: center; gap: 8px; position: sticky; top: -14px;
                z-index: 2; margin: -14px -2px 0; padding: 12px 2px; background: var(--bg);
                border-bottom: 1px solid var(--border); }
.ag-model-bar-text { font-size: var(--fs-sm); }
.ag-model-row { display: flex; align-items: center; gap: 8px; width: 100%;
                border: 1px solid var(--border); border-radius: var(--radius);
                background: var(--bg); color: var(--text); font: inherit;
                padding: 7px 10px; cursor: pointer; text-align: left; }
.ag-model-row:hover { border-color: var(--accent); background: var(--accent-soft); }
.ag-model-row.active { border-color: var(--accent); background: var(--accent-soft);
                       color: var(--accent-hover); }
.ag-model-row.deprecated { opacity: 0.68; }
.ag-model-check { display: inline-flex; width: 14px; color: var(--accent); }
.ag-model-id { font-size: var(--fs-sm); }
.ag-model-ctx { font-size: var(--fs-xs); white-space: nowrap; }
.ag-model-legacy > summary { cursor: pointer; font-size: var(--fs-xs);
                             color: var(--text-muted); padding: 4px 2px; }

.ag-tool-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px;
                align-items: center; border: 1px solid var(--border-soft);
                border-radius: var(--radius); padding: 8px; }
.ag-tool-side { min-width: 0; border-radius: var(--radius); padding: 7px; }
.ag-tool-side.src { background: var(--warning-soft); border: 1px solid var(--warning); }
.ag-tool-side.dst { background: var(--accent-soft); border: 1px solid var(--accent-border); }
.ag-tool-side > header { font-size: var(--fs-xs); font-weight: 700; margin-bottom: 5px;
                         color: var(--text-muted); }
.ag-tool-side dl { margin: 0; display: grid; grid-template-columns: 92px 1fr; gap: 3px 6px; }
.ag-tool-side dt { font-size: 10px; color: var(--text-subtle); text-transform: uppercase; }
.ag-tool-side dd { margin: 0; font-size: var(--fs-xs); min-width: 0; word-break: break-word; }
.ag-tool-arrow { font-size: var(--fs-xs); color: var(--text-subtle); white-space: nowrap; }

/* Agent — 좁은 칼럼 대응 보정 */
.ag-chat-head { flex-wrap: wrap; }
.ag-toggle { white-space: nowrap; }
.ag-edits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.ag-edits > li { border-left: 2px solid var(--border-strong); padding-left: 7px; }
.ag-edit-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.ag-edit-target { font-size: var(--fs-xs); color: var(--text-muted); word-break: break-all; }
.ag-edit-prop { font-size: var(--fs-xs); font-weight: 700; color: var(--text); }
.ag-edit-delta { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
                 font-size: var(--fs-xs); }
.ag-arrow { color: var(--text-subtle); }
.ag-tool-pair { align-items: stretch; }
.ag-tool-side dd.mono, .ag-dim { word-break: break-all; }
.ag-tool-side dl { grid-template-columns: 84px minmax(0, 1fr); }

/* ============================================== Ontology Explorer ==== */
.oe-layout { display: grid; grid-template-columns: 1fr minmax(320px, 38%); gap: 14px;
             align-items: start; }
@media (max-width: 1100px) { .oe-layout { grid-template-columns: 1fr; } }
.oe-map { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.oe-panel { border: 1px solid var(--border); border-radius: var(--radius);
            background: var(--panel); padding: 10px; min-width: 0;
            max-height: 74vh; overflow-y: auto; }
.oe-trail { display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
            font-size: var(--fs-xs); color: var(--text-muted); min-height: 24px; }
.oe-trail-hint { color: var(--text-subtle); }
.oe-trail-sep { color: var(--text-subtle); }
.oe-trail-step { border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
                 color: var(--text-muted); font: inherit; font-size: var(--fs-xs);
                 padding: 1px 8px; cursor: pointer; }
.oe-trail-step:hover { border-color: var(--accent); color: var(--accent-hover);
                       background: var(--accent-soft); }
.oe-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.oe-head h3 { margin: 0; font-size: var(--fs-lg); }
.oe-pk { font-size: var(--fs-xs); color: var(--text-subtle); }
.oe-search { width: 100%; font: inherit; font-size: var(--fs-sm); padding: 5px 8px;
             border: 1px solid var(--border); border-radius: var(--radius);
             background: var(--bg); color: var(--text); }
.oe-search:focus { outline: none; border-color: var(--accent); }
.oe-note { font-size: var(--fs-xs); color: var(--text-subtle); margin: 0; }
.oe-val { font-size: var(--fs-xs); word-break: break-all; }
.oe-lock { cursor: help; }
.oe-source { display: flex; align-items: center; gap: 5px; font-size: var(--fs-xs);
             color: var(--text-muted); background: var(--bg-alt);
             border: 1px dashed var(--border); border-radius: var(--radius); padding: 5px 7px; }
.oe-actions { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.oe-link { border: 1px solid var(--border-soft); border-radius: var(--radius);
           padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; }
.oe-link-head { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); }
.oe-link-count { font-size: var(--fs-xs); color: var(--text-subtle); }
.oe-link-body { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ================================================ Documents (인제스트) === */
.doc-file { display: none; }
.doc-dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center;
                gap: 4px; text-align: center; padding: 20px 16px; cursor: pointer;
                color: var(--text-muted); border: 1.5px dashed var(--border);
                border-radius: var(--radius); background: var(--bg-alt);
                transition: border-color .12s, background .12s, color .12s; }
.doc-dropzone:hover { border-color: var(--accent); color: var(--text); }
.doc-dropzone:focus-visible { outline: none; border-color: var(--accent); }
.doc-dropzone.is-drag { border-color: var(--accent); border-style: solid;
                        background: var(--accent-soft); color: var(--text); }
.doc-dropzone.is-drag * { pointer-events: none; }
.doc-dropzone-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.doc-work { display: block; }
.doc-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.doc-head h3 { margin: 0; font-size: var(--fs-lg); }
.doc-note { margin: 0; font-size: var(--fs-xs); color: var(--text-subtle); }
.doc-notice { display: flex; align-items: center; gap: 6px; margin: 0 8px;
              font-size: var(--fs-xs); color: var(--warning);
              background: var(--warning-soft); border-radius: var(--radius); padding: 5px 8px; }
.doc-warn { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs);
            color: var(--warning); background: var(--warning-soft);
            border: 1px solid var(--warning); border-radius: var(--radius); padding: 6px 8px; }
.doc-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px;
             align-items: start; }
@media (max-width: 1000px) { .doc-split { grid-template-columns: 1fr; } }

.doc-blocks { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.doc-block { display: flex; align-items: center; gap: 6px; padding: 4px 10px;
             border-bottom: 1px solid var(--border-soft); cursor: pointer;
             font-size: var(--fs-xs); }
.doc-block:hover { background: var(--bg-hover); }
.doc-block.is-table { background: var(--accent-soft); }
.doc-block.is-table:hover { background: var(--bg-active); }
.doc-check-space { display: inline-block; width: 13px; }
.doc-block-kind { color: var(--text-muted); white-space: nowrap; }
.doc-block-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
                  white-space: nowrap; color: var(--text); }
.doc-block-page { color: var(--text-subtle); }
.doc-preview-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
                    font-size: var(--fs-xs); }
.doc-preview-body { margin: 0; padding: 8px; background: var(--bg-alt);
                    border: 1px solid var(--border-soft); border-radius: var(--radius);
                    font-family: var(--mono); font-size: var(--fs-xs);
                    white-space: pre-wrap; max-height: 240px; overflow: auto; }

.doc-grid-wrap { overflow-x: auto; max-height: 380px; }
.doc-grid th { white-space: nowrap; }
.doc-grid-src { min-width: 150px; }
.doc-grid-quote { font-size: 10px; color: var(--text-subtle); overflow: hidden;
                  text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.doc-cell { width: 100%; min-width: 90px; font: inherit; font-size: var(--fs-xs);
            padding: 2px 5px; border: 1px solid transparent; border-radius: var(--radius);
            background: transparent; color: var(--text); }
.doc-cell:hover { border-color: var(--border); }
.doc-cell:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.doc-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.doc-name { font: inherit; font-size: var(--fs-sm); padding: 4px 8px;
            border: 1px solid var(--border); border-radius: var(--radius);
            background: var(--bg); color: var(--text); min-width: 180px; }

/* Agent — step 행: handler는 항상 보이고, 접히는 것은 인자뿐 */
.ag-step-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ag-step-args > summary { cursor: pointer; font-size: 10px; color: var(--text-subtle); }
.ag-step.picked { outline: 2px solid var(--accent); outline-offset: 1px; }

/* 온톨로지 템플릿 — 받아서 채우고 올리는 표 (views/ontologyTemplate.js) */
.tpl-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tpl-label { font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; }
.tpl-select { font: inherit; font-size: var(--fs-sm); padding: 4px 8px;
              border: 1px solid var(--border); border-radius: var(--radius);
              background: var(--bg); color: var(--text); }
.tpl-sheet { border: 1px solid var(--border-soft); border-radius: var(--radius);
             background: var(--bg-alt); }
.tpl-sheet > summary { display: flex; align-items: center; gap: 6px; padding: 6px 10px;
                       cursor: pointer; font-size: var(--fs-sm); }
.tpl-sheet > summary::-webkit-details-marker { display: none; }
.tpl-sheet > summary::before { content: '▸'; color: var(--text-subtle); }
.tpl-sheet[open] > summary::before { content: '▾'; }
.tpl-sheet > p { margin: 0 10px 6px; }
.tpl-sheet-name { font-weight: 600; margin-right: 4px; }
.tpl-grid-wrap { overflow-x: auto; max-height: 340px; }
.tpl-grid th, .tpl-grid td { vertical-align: top; }
.tpl-check { width: 28px; }
.tpl-num { width: 34px; color: var(--text-subtle); text-align: right; }
.tpl-detail { font-size: var(--fs-xs); }
.tpl-row-error { background: var(--danger-soft); }
.tpl-changes { display: flex; flex-direction: column; gap: 2px; }
.tpl-change { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tpl-before { color: var(--text-subtle); text-decoration: line-through; }
.tpl-after { color: var(--text); }
.tpl-msgs { margin: 2px 0 0; padding-left: 16px; font-size: var(--fs-xs); }
.tpl-msgs.is-error { color: var(--danger); }
.tpl-msgs.is-warn { color: var(--warning); }
.tpl-spec { display: flex; flex-direction: column; gap: 6px; }

/* ============================================================ auth (login) ==
   AUTH_ADMIN_PLAN §2.8 — shell-less centered login card + impersonation banner.
   `body.auth-screen` hides the app chrome so the card owns the viewport. */
body.auth-screen .topbar,
body.auth-screen .sidebar,
body.auth-screen .impersonation-banner { display: none !important; }
/* topbar hamburger (shell.js sidebarToggle) */
body.sidebar-hidden .sidebar { display: none; }
body.auth-screen .layout { grid-template-columns: 1fr; height: 100vh; }
body.auth-screen .content { padding: 0; overflow: auto; }

.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: flex-end;
  padding: 32px 8vw 32px 32px;
  background: var(--bg-sunken) url('/assets/brand/hero-light.webp') center / cover no-repeat;
}
[data-theme="dark"] .auth-page { background-image: url('/assets/brand/hero-dark.webp'); }
.auth-card {
  width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-3); padding: 28px 26px;
}
@media (max-width: 900px) {
  .auth-page { justify-content: center; padding: 32px; }
}
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-mark {
  display: inline-flex; width: 40px; height: 40px;
  filter: drop-shadow(0 0 6px rgba(163, 230, 53, .4));
}
.auth-title { font-size: var(--fs-lg); font-weight: 650; color: var(--text); }
.auth-sub { font-size: var(--fs-sm); color: var(--text-muted); }
.auth-error {
  font-size: var(--fs-sm); color: var(--danger);
  background: var(--danger-soft); border: 1px solid var(--danger);
  border-radius: var(--radius); padding: 8px 11px;
}
.auth-sso { justify-content: center; width: 100%; gap: 8px; }
.auth-or {
  display: flex; align-items: center; text-align: center;
  color: var(--text-subtle); font-size: var(--fs-xs);
}
.auth-or::before, .auth-or::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.auth-or span { padding: 0 10px; }
.auth-form, .account-form { display: flex; flex-direction: column; gap: 12px; }
.auth-field { display: flex; flex-direction: column; gap: 5px; }
.auth-label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); }
.auth-pw { position: relative; display: flex; align-items: center; }
.auth-pw .input { flex: 1; padding-right: 34px; }
.auth-reveal {
  position: absolute; right: 6px; border: none; background: transparent;
  color: var(--text-muted); cursor: pointer; padding: 4px; display: inline-flex;
}
.auth-reveal:hover { color: var(--text); }
.auth-submit { justify-content: center; width: 100%; margin-top: 4px; }
.auth-hint {
  display: flex; gap: 7px; align-items: flex-start;
  font-size: var(--fs-xs); color: var(--text-subtle); line-height: 1.5;
}
.auth-hint .icon { flex: none; margin-top: 2px; }
.auth-note { font-size: var(--fs-sm); color: var(--text-muted); }
.auth-toggle {
  background: none; border: none; color: var(--accent); cursor: pointer;
  font-size: var(--fs-sm); text-align: center; padding: 2px; width: 100%;
}
.auth-toggle:hover { text-decoration: underline; }
.auth-forgot {
  display: block; text-align: center; margin-top: 2px;
  color: var(--text-muted); font-size: var(--fs-sm); text-decoration: none;
}
.auth-forgot:hover { color: var(--accent); text-decoration: underline; }
.auth-code-row { display: flex; gap: 6px; align-items: center; }
.auth-code-row .input { flex: 1; min-width: 0; }
.auth-code-row .btn { flex: none; white-space: nowrap; }
.auth-consent {
  display: flex; gap: 8px; align-items: flex-start; cursor: pointer;
  font-size: var(--fs-sm); color: var(--text); line-height: 1.5; font-weight: 600;
}
.auth-consent input { flex: none; margin-top: 2px; accent-color: var(--accent); }
.auth-privacy {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  background: var(--bg-subtle, rgba(0,0,0,.02));
  font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.55;
  max-height: 180px; overflow-y: auto;
}
.auth-privacy-title { font-weight: 700; color: var(--text); margin-bottom: 4px; }
.auth-privacy p { margin: 0 0 6px; }
.auth-privacy ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.auth-privacy b { color: var(--text); font-weight: 600; }

/* impersonation banner */
.impersonation-banner {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 16px; font-size: var(--fs-sm); font-weight: 600;
  color: #7a5b00; background: var(--warning-soft); border-bottom: 1px solid var(--warning);
}
.impersonation-stop { margin-left: auto; color: #7a5b00; text-decoration: underline; }

/* account menu identity block */
.menu-identity { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.menu-identity-text { display: flex; flex-direction: column; min-width: 0; }
.account-body { display: block; }

/* impersonate picker */
.impersonate-list { display: flex; flex-direction: column; max-height: 340px; overflow: auto; }
.impersonate-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; width: 100%;
  border: none; background: transparent; cursor: pointer; text-align: left; border-radius: var(--radius);
}
.impersonate-row:hover { background: var(--bg-hover); }
.impersonate-text { display: flex; flex-direction: column; min-width: 0; }

/* ============================================================ admin console ==
   AUTH_ADMIN_PLAN §4 — tiles, action rows, drawer editors. */
.admin-tiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px;
}
.admin-tile {
  display: flex; flex-direction: column; gap: 3px; padding: 14px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}
.admin-tile-label { font-size: var(--fs-xs); color: var(--text-muted); }
.admin-tile-value { font-size: 24px; font-weight: 650; color: var(--text); }
.admin-tile-sub { font-size: var(--fs-xs); color: var(--text-subtle); }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-role-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 0;
  border-bottom: 1px solid var(--border-soft);
}
.admin-role-row > span:first-child { flex: 1; }
.admin-markings { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow: auto; }
.temp-pw {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius);
}
.temp-pw code { font-size: var(--fs-lg); letter-spacing: 0.5px; }

/* ------------------------------------------------------------------ History (변경 추적) */
.hist-scopes { display: flex; gap: 4px; flex-wrap: wrap; }
.hist-scope { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; font: inherit;
  font-size: var(--fs-sm); color: var(--text-muted); background: var(--bg); border: 1px solid var(--border);
  border-radius: 999px; cursor: pointer; }
.hist-scope:hover { background: var(--bg-hover); color: var(--text); }
.hist-scope.is-on { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); font-weight: 600; }
.hist-day-head { display: flex; justify-content: space-between; font-size: var(--fs-xs); font-weight: 600;
  color: var(--text-muted); padding: 2px 2px 4px; border-bottom: 1px solid var(--border-soft); margin-bottom: 4px; }
.hist-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.hist-item { display: flex; align-items: flex-start; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--border-soft); }
.hist-item:last-child { border-bottom: none; }
.hist-item:hover { background: var(--bg-hover); }
.hist-dot { flex: 0 0 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--bg-sunken); color: var(--text-muted); margin-top: 1px; }
.hist-create .hist-dot { background: var(--success-soft); color: var(--success); }
.hist-modify .hist-dot { background: var(--accent-soft); color: var(--accent); }
.hist-delete .hist-dot { background: var(--danger-soft); color: var(--danger); }
.hist-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.hist-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--fs-sm); }
.hist-kind { color: var(--text-muted); font-size: var(--fs-xs); }
.hist-res { font-size: var(--fs-sm); word-break: break-all; }
.hist-link { color: var(--text); text-decoration: none; }
.hist-link:hover { color: var(--accent); text-decoration: underline; }
.hist-meta { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); color: var(--text-subtle); white-space: nowrap; }
.hist-summary { font-size: var(--fs-xs); color: var(--text-muted); }
.hist-fields { display: flex; flex-wrap: wrap; gap: 4px; }
.hist-field { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; font-size: var(--fs-xs);
  padding: 1px 6px; background: var(--bg-alt); border: 1px solid var(--border-soft); border-radius: var(--radius); }
.hist-field > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.hist-before { color: var(--danger); text-decoration: line-through; }
.hist-after { color: var(--success); }
.hist-diff { flex: 0 0 auto; }
.hist-foot { display: flex; justify-content: center; padding-top: 8px; }
.hist-feed.is-compact .hist-item { padding: 4px 2px; }
.hist-focus { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 8px; font-size: var(--fs-xs);
  background: var(--accent-soft); border: 1px solid var(--accent-border); border-radius: 999px; }
.hist-focus-x { border: none; background: none; cursor: pointer; color: var(--text-muted); padding: 2px; display: inline-flex; }

/* ------------------------------------------------------------ AI Ontology Builder (티켓) */
.aib-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.aib-ticket-chip { font-family: var(--mono); font-size: var(--fs-sm); font-weight: 700; padding: 2px 8px;
  border-radius: var(--radius); background: var(--topbar-bg); color: var(--topbar-text); }
.aib-ticket-no { font-family: var(--mono); font-size: 28px; font-weight: 700; letter-spacing: 1px; text-align: center;
  padding: 10px; border: 1px dashed var(--accent-border); border-radius: var(--radius-lg); background: var(--accent-soft); color: var(--accent); }
.aib-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 0; border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; background: var(--panel); }
.aib-step { flex: 1; display: flex; align-items: center; gap: 8px; padding: 9px 12px; font-size: var(--fs-sm);
  cursor: pointer; color: var(--text-muted); border-right: 1px solid var(--border-soft); }
.aib-step:last-child { border-right: none; }
.aib-step:hover { background: var(--bg-hover); }
.aib-step.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.aib-step.is-locked { cursor: not-allowed; opacity: .5; }
.aib-step-num { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-xs); font-weight: 700; background: var(--bg-sunken); color: var(--text-muted); }
.aib-step.is-active .aib-step-num { background: var(--accent); color: var(--text-invert); }
.aib-step.is-done .aib-step-num { background: var(--success); color: var(--text-invert); }
.aib-mini-steps { display: inline-flex; gap: 3px; }
.aib-mini { width: 22px; height: 5px; border-radius: 3px; background: var(--bg-sunken); }
.aib-mini.is-done { background: var(--success); }
.aib-mini.is-cur { background: var(--accent); }
.aib-q { display: flex; align-items: center; gap: 8px; }
.aib-q-num { flex: 0 0 30px; font-family: var(--mono); font-size: var(--fs-xs); font-weight: 700; color: var(--accent); }
.aib-q-input { flex: 1; }
.aib-running { display: flex; flex-direction: column; gap: 10px; }
.aib-bar { height: 6px; border-radius: 3px; background: var(--bg-sunken); overflow: hidden; position: relative; }
.aib-bar > span { display: block; height: 100%; background: var(--accent); transition: width .4s ease; }
.aib-bar.is-indeterminate > span { width: 30%; position: absolute; animation: aib-slide 1.4s ease-in-out infinite; }
@keyframes aib-slide { 0% { left: -30%; } 100% { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .aib-bar.is-indeterminate > span { animation: none; width: 100%; opacity: .4; } }
.aib-events { list-style: none; margin: 0; padding: 0; font-size: var(--fs-xs); display: flex; flex-direction: column; gap: 2px; }
.aib-events li { display: flex; gap: 8px; }
.aib-events li .muted { flex: 0 0 70px; }
.aib-cov { display: flex; flex-direction: column; gap: 8px; }
.aib-cov-row { display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1px solid var(--border-soft); border-radius: var(--radius); }
.aib-cov-row.is-warn { border-color: var(--warning); background: var(--warning-soft); }
.aib-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.aib-chip { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-family: var(--mono);
  padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-border); }
.aib-chip.is-off { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); text-decoration: line-through; }
.aib-chip.is-check { font-family: inherit; cursor: pointer; background: var(--bg); color: var(--text); border-color: var(--border); }
.aib-chip.is-check.is-off { background: var(--bg-alt); color: var(--text-subtle); border-color: var(--border-soft); }
.aib-ot { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.aib-ot > summary { display: flex; align-items: center; gap: 6px; padding: 7px 10px; cursor: pointer; list-style: none; }
.aib-ot > summary::-webkit-details-marker { display: none; }
.aib-ot.is-off > summary { opacity: .55; }
.aib-ot-body { padding: 6px 10px 10px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border-soft); }
.aib-props td, .aib-props th { vertical-align: middle; }
.aib-props tr.is-off td, .doc-grid tr.is-off td { opacity: .45; }
.aib-props tr.is-off td:first-child, .doc-grid tr.is-off td:first-child { opacity: 1; }
.aib-sel { padding: 2px 4px; font-size: var(--fs-xs); }
.aib-stale { justify-content: flex-start; }
@media (max-width: 800px) {
  .aib-steps { flex-direction: column; }
  .aib-step { border-right: none; border-bottom: 1px solid var(--border-soft); }
}
textarea.input { height: auto; padding: 6px 8px; line-height: 1.5; }

/* ------------------------------------------------------------ Data Connection */
.dc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.dc-card { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 12px; font: inherit; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--text); }
.dc-card:hover { border-color: var(--accent-border); box-shadow: var(--shadow-1); }
.dc-card-head { display: flex; align-items: center; gap: 6px; }
.dc-card-foot { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--text-subtle); margin-top: 4px; }
.dc-cat-head { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: var(--fs-sm); }
.dc-support tr.is-planned td { color: var(--text-subtle); }
.dc-kind-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.dc-kind { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px; font: inherit; text-align: left;
  cursor: pointer; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--text); }
.dc-kind:hover { border-color: var(--accent); background: var(--accent-soft); }
.dc-kind.is-off { opacity: .55; }
.dc-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dc-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 12px; }
.dc-lock { display: inline-flex; margin-left: 4px; color: var(--text-subtle); vertical-align: middle; }
.dc-step { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); }
.dc-step.is-ok { color: var(--success); }
.dc-step.is-fail { color: var(--danger); }
.dc-step > span:last-child { color: var(--text); }
.dc-step-name { font-family: var(--mono); font-size: var(--fs-xs); min-width: 64px; }
.dc-explorer { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 360px; }
.dc-tree { border-right: 1px solid var(--border-soft); padding: 8px; max-height: 620px; overflow: auto; }
.dc-tree-kids { padding-left: 14px; }
.dc-tree-item { display: flex; align-items: center; gap: 6px; width: 100%; padding: 3px 6px; font: inherit; font-size: var(--fs-sm);
  background: none; border: none; border-radius: var(--radius); cursor: pointer; color: var(--text); text-align: left; }
.dc-tree-item:hover { background: var(--bg-hover); }
.dc-tree-item.is-sel { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.dc-tree-item > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.dc-tree-empty { padding: 4px 8px; }
.dc-panel { padding: 12px; min-width: 0; }
.dc-sql { min-height: 90px; font-size: var(--fs-sm); }
.dc-cols { display: flex; flex-wrap: wrap; gap: 4px; }
.dc-col { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; font-size: var(--fs-xs);
  background: var(--bg-alt); border: 1px solid var(--border-soft); border-radius: 999px; }
.dc-col.is-check { cursor: pointer; }
.dc-mode { display: grid; grid-template-columns: auto 90px 1fr; align-items: center; gap: 8px; padding: 6px 8px; cursor: pointer;
  border: 1px solid var(--border-soft); border-radius: var(--radius); }
.dc-mode.is-on { border-color: var(--accent-border); background: var(--accent-soft); }
.dc-sync { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.dc-sync-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; flex-wrap: wrap; }
.dc-sync-head:hover { background: var(--bg-hover); }
.dc-sync-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 0 10px 8px 30px; }
.dc-sync.is-open > div:last-child:not(.dc-sync-meta) { padding: 0 10px 10px; }
.dc-runs td { vertical-align: top; }
.dc-run-msg { max-width: 420px; font-size: var(--fs-xs); }
@media (max-width: 900px) { .dc-explorer { grid-template-columns: 1fr; } .dc-tree { border-right: none; border-bottom: 1px solid var(--border-soft); } }

/* sidebar group hint (navLayout.js GROUP_HINTS) */
.sidebar-group-hint { margin-left: 6px; padding: 0 5px; border-radius: 3px; font-size: 10px; letter-spacing: 0; text-transform: none; background: var(--warning-soft); color: var(--warning); border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent); cursor: help; }
.dc-support { table-layout: fixed; width: 100%; }
.dc-support th:nth-child(1) { width: 22%; } .dc-support th:nth-child(2) { width: 10%; }
.dc-support th:nth-child(3) { width: 16%; } .dc-support th:nth-child(4) { width: 22%; }

/* Data Connection P2 — 열 정책 · 온톨로지 초안 */
.dc-policy { width: 100%; }
.dc-policy td { vertical-align: middle; }
.dc-policy tr.is-planned td { color: var(--text-subtle); text-decoration: line-through; }
.dc-policy tr.is-planned td select { text-decoration: none; }
.dc-policy .tpl-select { min-width: 92px; }
.dc-draft-list { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; padding: 6px; }
.dc-tree-item.is-check { cursor: pointer; }
.dc-tree-item.is-check > span:nth-of-type(1) { flex: 1; }
.dc-crumb { border: 0; background: none; padding: 0 2px; font: inherit; font-size: var(--fs-sm); color: var(--accent); cursor: pointer; }
.dc-crumb:hover { text-decoration: underline; }

/* Ontology Scopes (views/scopes.js) — 규칙 편집기 + 실시간 미리보기 */
.sc-layout { display: block; }
.sc-row { cursor: pointer; }
.sc-row:hover { border-color: var(--accent-border); }
.sc-editor { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px;
             align-items: start; }
@media (max-width: 960px) { .sc-editor { grid-template-columns: minmax(0, 1fr); } }
.sc-preview-col { position: sticky; top: 8px; border: 1px solid var(--border);
                  border-radius: var(--radius); background: var(--panel); padding: 10px;
                  display: flex; flex-direction: column; gap: 8px; }
.sc-field { display: flex; flex-direction: column; gap: 6px; }
.sc-field-head { display: flex; align-items: baseline; gap: 8px; font-size: var(--fs-sm); }
.sc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sc-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px;
           border: 1px solid var(--border); border-radius: 12px; font-size: var(--fs-sm);
           cursor: pointer; background: var(--bg); }
.sc-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.sc-chip-stale { border-style: dashed; }
.sc-chip-count { color: var(--text-muted); font-size: var(--fs-xs); }
.sc-type-list { display: flex; flex-direction: column; gap: 3px; max-height: 180px;
                overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius);
                padding: 6px; }
.sc-picked { display: flex; flex-wrap: wrap; gap: 4px; }
.sc-picked:empty { display: none; }
.sc-sub { font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted);
          text-transform: uppercase; letter-spacing: .02em; margin-bottom: 4px; }
.sc-matched { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.sc-matched-row { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm);
                  padding: 2px 4px; border-radius: 2px; }
.sc-matched-row:hover { background: var(--bg-sunken); }
.sc-reason { font-size: var(--fs-xs); color: var(--text-muted); border: 1px solid var(--border);
             border-radius: 2px; padding: 0 4px; font-family: var(--font-mono, monospace); }
.sc-select { max-width: 320px; }
.sc-scope-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ======================================== Workshop charts: Chart XY · Gantt == */
.axis-title { font-size: 10.5px; font-weight: 600; fill: var(--text-muted); font-family: var(--font); }
.xy-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.xy-band { fill: var(--accent); fill-opacity: .06; pointer-events: none; }
.xy-band.selected { fill-opacity: .12; }
.xy-seg-label { font-size: 9.5px; font-family: var(--font); pointer-events: none; }
.chart-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: var(--fs-xs); color: var(--text); }
.chart-legend-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.chart-legend-sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.chart-legend-line { width: 16px; height: 0; border-top: 2px solid; display: inline-block; }
.chart-legend-line.dashed { border-top-style: dashed; }
.chart-tip {
  position: fixed; z-index: 1000; display: none; pointer-events: none; min-width: 140px; max-width: 320px;
  background: var(--panel); color: var(--text); border-radius: var(--radius); box-shadow: var(--shadow-2);
  padding: 7px 9px; font-size: var(--fs-xs); font-family: var(--font);
}
.chart-tip-title { font-weight: 600; margin-bottom: 4px; }
.chart-tip-rows { border-collapse: collapse; width: 100%; }
.chart-tip-rows td { padding: 1px 0; vertical-align: middle; }
.chart-tip-rows td.num { text-align: right; padding-left: 14px; font-variant-numeric: tabular-nums; font-weight: 600; }
.chart-tip-sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; border: 0 solid; }
.chart-tip-sw.dashed { height: 0; width: 12px; border-top: 2px dashed; border-radius: 0; vertical-align: 3px; }
.gantt { display: flex; flex-direction: column; height: 100%; }
.gantt-body { overflow-y: auto; overflow-x: hidden; }
.gantt-bar { transition: opacity .1s ease; }
.gantt-bar:hover { opacity: .85; }
.gantt-bar.selected { stroke: var(--accent); stroke-width: 2; }
.gantt-label { font-size: 10.5px; font-family: var(--font); }
.gantt-label.outside { fill: var(--text-muted); }
.gantt-group { font-size: 11px; font-weight: 600; fill: var(--text); font-family: var(--font); }
.gantt-stripe { fill: var(--bg-alt); }
.gantt-now { stroke: var(--danger, #cd4246); stroke-width: 1.5; stroke-dasharray: 3 3; }
.wtabs-bar { display: flex; align-items: center; gap: 2px; border-bottom: 1px solid var(--border); margin: -4px 0 10px; }
.wtabs-bar .tab { cursor: pointer; background: none; border: 0; border-bottom: 2px solid transparent; font: inherit; }
.layer-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.layer-card-head { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: var(--fs-sm); }

/* ------------------------------------------------------------------ Vocabulary (용어 제어) */
.vb-layout { display: block; }
.vb-panel { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.vb-panel .input { flex: 1; min-width: 240px; }
.vb-cov { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.vb-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.vb-kpi { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.vb-kpi-value { font-size: 22px; font-weight: 600; line-height: 1.2; }
.vb-kpi-sub { font-size: 11px; }
.vb-kpi-warning .vb-kpi-value { color: var(--warning, #b7791f); }
.vb-kpi-success .vb-kpi-value { color: var(--success, #2f855a); }
.vb-gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.vb-gauge { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; display: flex; flex-direction: column; gap: 6px; }
.vb-gauge-head { display: flex; justify-content: space-between; font-size: 12px; }
.vb-gauge-sub { font-size: 11px; }
.vb-bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.vb-bar-fill { height: 100%; background: var(--accent); transition: width .3s; }
.vb-resolve-out { min-height: 40px; }
.vb-match { padding: 8px 10px; border: 1px solid var(--border); border-left-width: 4px; border-radius: 8px; display: flex; flex-direction: column; gap: 6px; }
.vb-match-exact { border-left-color: var(--success, #2f855a); }
.vb-match-alias { border-left-color: var(--accent); }
.vb-match-fuzzy { border-left-color: var(--warning, #b7791f); border-left-style: dashed; }
.vb-mark { display: inline-flex; width: 18px; height: 18px; align-items: center; justify-content: center; border-radius: 50%; font-size: 11px; font-weight: 700; }
.vb-mark-exact { background: var(--success, #2f855a); color: #fff; }
.vb-mark-alias { background: var(--accent); color: #fff; }
.vb-mark-fuzzy { border: 1px dashed var(--warning, #b7791f); color: var(--warning, #b7791f); }
.vb-miss { display: flex; gap: 6px; align-items: center; padding: 8px 10px; border: 1px dashed var(--warning, #b7791f); border-radius: 8px; font-size: 12px; }
.vb-chip { display: inline-flex; gap: 4px; align-items: center; padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; text-decoration: none; color: inherit; }
.vb-chip:hover { border-color: var(--accent-border, var(--accent)); }
.vb-chip-kind { font-size: 10px; text-transform: uppercase; letter-spacing: .02em; opacity: .7; }
.vb-term { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.vb-term > summary { cursor: pointer; list-style: none; }
.vb-term > summary::-webkit-details-marker { display: none; }
.vb-term-body { display: flex; flex-direction: column; gap: 6px; padding: 8px 0 4px; border-top: 1px solid var(--border); margin-top: 6px; }
