/* ───────── 토큰 ───────── */
:root {
  --bg: #090c14;
  --panel: #0e1220;
  --raise: #161b2d;
  --raise-2: #1c2237;
  --card: #131829;
  --line: #222a41;
  --line-2: #33405f;
  --text: #e7eaf4;
  --muted: #8b94ad;
  --faint: #5b6684;
  --accent: #a9bbff;
  --accent-ink: #0a0f22;
  --danger: #ff6b78;
  --ok: #5fd3b0;
  --warn: #f0b45a;
  --dot: #1b2237;
  --serif: "Noto Serif KR", "Nanum Myeongjo", "Batang", serif;
  --sans: "Noto Sans KR", "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: #3a4a86; }

/* 스크롤바 */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }

.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ───────── 레이아웃 ───────── */
#app {
  display: grid;
  height: 100dvh;
  grid-template-columns: 284px minmax(0, 1fr) 348px;
  grid-template-rows: 54px minmax(0, 1fr);
  grid-template-areas: "top top top" "list stage insp";
}
.topbar {
  grid-area: top;
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 30;
}
.spacer { flex: 1; }
.brand { display: flex; align-items: center; gap: 9px; font: 700 18px/1 var(--serif); letter-spacing: .02em; padding-right: 4px; }

.list-panel { grid-area: list; display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.stage { grid-area: stage; position: relative; overflow: hidden; min-width: 0;
  background:
    radial-gradient(900px 560px at 15% -8%, #131a34 0%, transparent 62%),
    radial-gradient(760px 520px at 108% 108%, #1a1231 0%, transparent 58%),
    var(--bg);
}
.inspector { grid-area: insp; min-height: 0; overflow-y: auto; background: var(--panel); border-left: 1px solid var(--line); }

/* ───────── 버튼 · 메뉴 ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 9px;
  background: var(--raise); border: 1px solid var(--line-2); color: var(--text); font-weight: 500;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--raise-2); border-color: #45557d; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn.primary:hover { background: #bfccff; }
.btn.danger { color: var(--danger); border-color: #4a2a35; background: #1a1220; }
.btn.danger:hover { background: #26141f; border-color: #6b3345; }
.btn.small { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--raise); }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: transparent; border: 1px solid transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--raise); color: var(--text); }
.only-narrow { display: none; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60; min-width: 240px; max-height: 70vh; overflow: auto;
  padding: 6px; background: var(--raise); border: 1px solid var(--line-2); border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .55);
}
.menu.right { left: auto; right: 0; }
.menu button {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left;
}
.menu button:hover, .menu button:focus-visible { background: var(--raise-2); }
.menu button small { color: var(--faint); font-size: 12px; }
.menu button.on { color: var(--accent); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }

.board-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; max-width: 280px; padding: 0 12px 0 14px;
  border-radius: 9px; background: var(--raise); border: 1px solid var(--line-2); font-weight: 500;
}
.board-btn::after { content: ""; width: 7px; height: 7px; border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted); transform: translateY(-2px) rotate(45deg); flex: none; }
.board-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-btn:hover { border-color: #45557d; }

.save-state { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.save-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); transition: background .2s; }
.save-state[data-state="dirty"] i, .save-state[data-state="saving"] i { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.save-state[data-state="error"] { color: var(--danger); }
.save-state[data-state="error"] i { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.save-state[data-state="local"] i { background: #7f9bc4; box-shadow: none; }

/* ───────── 목록 패널 ───────── */
.search { display: flex; align-items: center; gap: 8px; margin: 14px 14px 10px; padding: 0 12px; height: 38px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; color: var(--muted); }
.search:focus-within { border-color: var(--accent); color: var(--text); }
.search input { flex: 1; min-width: 0; height: 100%; background: transparent; border: 0; outline: 0; }
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { filter: invert(.6); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 12px; border-bottom: 1px solid var(--line); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px;
  background: transparent; border: 1px solid var(--line-2); color: var(--muted); font-size: 12.5px;
}
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--faint)); }
.chip:hover { color: var(--text); border-color: #45557d; }
.chip.on { background: var(--raise-2); color: var(--text); border-color: var(--accent); }
.chip b { font-weight: 500; color: var(--faint); }

.people { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; }
.people li { margin: 0; }
.person {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 1px solid transparent; border-radius: 11px; background: transparent; text-align: left;
}
.person:hover { background: var(--raise); }
.person.on { background: var(--raise-2); border-color: var(--line-2); }
.person .who { min-width: 0; display: grid; }
.person .nm { font: 700 14px/1.3 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .rl { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people .none { padding: 26px 16px; color: var(--faint); text-align: center; font-size: 13px; }

.av {
  --s: 34px;
  width: var(--s); height: var(--s); flex: none; border-radius: 50%; position: relative; overflow: hidden;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--nc, #7aa2ff) 16%, #10152a);
  box-shadow: 0 0 0 2px var(--nc, #7aa2ff);
  font: 700 calc(var(--s) * .42)/1 var(--serif); color: var(--nc, #7aa2ff);
}
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ───────── 캔버스 ───────── */
#svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#svg.panning { cursor: grabbing; }
#svg text { user-select: none; -webkit-user-select: none; }

.node { cursor: pointer; transition: opacity .16s; }
.node .card { fill: var(--card); stroke: var(--nc); stroke-opacity: .42; stroke-width: 1.2; transition: stroke-opacity .15s; }
.node:hover .card { stroke-opacity: .85; }
.node.sel .card { stroke-opacity: 1; stroke-width: 1.8; }
.node .halo { fill: var(--nc); opacity: 0; transition: opacity .2s; pointer-events: none; }
.node:hover .halo { opacity: .16; }
.node.sel .halo { opacity: .42; }
.node .ring { fill: none; stroke: var(--nc); stroke-width: 2; }
.node .disc { fill: color-mix(in srgb, var(--nc) 16%, #10152a); }
.node .ini { font: 700 18px var(--serif); fill: var(--nc); }
.node .nm { font: 700 15px var(--serif); fill: var(--text); }
.node .rl { font: 500 11.5px var(--sans); fill: var(--muted); }
.node.link-target .card { stroke: var(--accent); stroke-opacity: 1; stroke-width: 2.2; }
.node.link-target .halo { fill: var(--accent); opacity: .4; }
.port { opacity: 0; transition: opacity .12s; cursor: crosshair; }
.port .port-hit { fill: transparent; pointer-events: all; }
.port .port-dot { fill: var(--bg); stroke: var(--nc); stroke-width: 2; }
.port:hover .port-dot { fill: var(--nc); }
.node:hover .port, .node.sel .port { opacity: 1; }
.dragging .node { transition: none; }
.dim { opacity: .18; }

.edge .line { fill: none; stroke: var(--ec); stroke-width: 1.8; stroke-linecap: round; opacity: .78; transition: opacity .15s; }
.edge .hit { fill: none; stroke: transparent; stroke-width: 18; pointer-events: stroke; cursor: pointer; }
.edge .halo { fill: none; stroke: var(--ec); stroke-width: 11; stroke-linecap: round; opacity: 0; pointer-events: none; }
.edge:hover .line { opacity: 1; stroke-width: 2.6; }
.edge.rel .line { opacity: 1; }
.edge.sel .halo { opacity: .2; }
.edge.sel .line { opacity: 1; stroke-width: 3; }
.edge.dash .line { stroke-dasharray: 7 6; }
.edge { transition: opacity .16s; }
.elabel { cursor: pointer; }
.elabel rect { fill: var(--bg); stroke: var(--ec); stroke-opacity: .55; }
.elabel text { font: 500 12px var(--sans); fill: var(--text); text-anchor: middle; }
.edge.sel .elabel rect { stroke-opacity: 1; }
.link-temp { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 5; pointer-events: none; }

.dock {
  position: absolute; left: 16px; bottom: 16px; z-index: 5; display: flex; align-items: center; gap: 2px; padding: 4px;
  background: rgba(14, 18, 32, .82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line-2); border-radius: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
}
.dock .tool { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); }
.dock .tool:hover:not(:disabled) { background: var(--raise-2); color: var(--text); }
.dock .tool:disabled { opacity: .35; cursor: default; }
.dock .tool[aria-pressed="true"] { background: var(--raise-2); color: var(--accent); }
.dock .zoom { min-width: 46px; text-align: center; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.dock .sep { width: 1px; height: 20px; background: var(--line-2); margin: 0 4px; }

.empty { position: absolute; inset: 0; z-index: 4; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; pointer-events: none; padding: 24px; }
.empty > * { pointer-events: auto; }
.empty h2 { margin: 0; font: 700 22px/1.3 var(--serif); }
.empty p { margin: 0; color: var(--muted); max-width: 30ch; }
.empty .sub { color: var(--faint); font-size: 13px; }
.empty .btn { margin-top: 6px; height: 38px; padding: 0 20px; }

/* ───────── 인스펙터 ───────── */
.insp { display: grid; gap: 22px; padding: 20px 18px 28px; }
.insp-close { display: none; }
.hd { display: flex; gap: 14px; align-items: center; }
.hd-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.avatar-btn { position: relative; padding: 0; border: 0; background: none; border-radius: 50%; flex: none; }
.avatar-btn .av { --s: 64px; }
.avatar-btn .cam { position: absolute; right: -2px; bottom: -2px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--raise-2); border: 1px solid var(--line-2); color: var(--muted); }
.avatar-btn .cam .ico { width: 13px; height: 13px; }
.avatar-btn:hover .cam { color: var(--text); border-color: var(--accent); }

.in {
  width: 100%; padding: 8px 11px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; outline: 0;
  transition: border-color .12s, background .12s;
}
.in:hover { border-color: var(--line-2); }
.in:focus { border-color: var(--accent); background: #0b0f1b; }
.in::placeholder { color: var(--faint); }
textarea.in { resize: none; line-height: 1.6; display: block; }
.in.big { font: 700 20px/1.3 var(--serif); padding: 4px 8px; margin: 0 -8px; border-color: transparent; background: transparent; }
.in.big:hover { border-color: var(--line); }
.in.big:focus { background: var(--bg); }
.in.sub-in { padding: 3px 8px; margin: 0 -8px; width: calc(100% + 16px); border-color: transparent; background: transparent; color: var(--muted); font-size: 13.5px; }
.in.sub-in:hover { border-color: var(--line); }
.in.sub-in:focus { background: var(--bg); color: var(--text); }

.field { display: grid; gap: 6px; }
.lbl { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.sec { display: grid; gap: 10px; }
.sec-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sec-hd h3 { margin: 0; font-size: 13px; font-weight: 700; color: var(--text); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; background: var(--c); padding: 0; box-shadow: inset 0 0 0 2px var(--panel); }
.swatch:hover { transform: scale(1.1); }
.swatch.on { border-color: var(--text); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; }
.tags:focus-within { border-color: var(--accent); }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 4px 0 9px; border-radius: 12px; background: var(--raise-2); font-size: 12.5px; }
.tag button { display: grid; place-items: center; width: 18px; height: 18px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.tag button:hover { background: var(--line-2); color: var(--text); }
.tag button .ico { width: 11px; height: 11px; }
.tags input { flex: 1; min-width: 80px; height: 24px; border: 0; outline: 0; background: transparent; padding: 0 4px; }

.frow { display: grid; grid-template-columns: 84px 1fr 26px; gap: 6px; align-items: start; }
.frow .in { padding: 6px 9px; }
.frow .k { color: var(--muted); }
.frow .rm { display: grid; place-items: center; width: 26px; height: 32px; border: 0; background: transparent; color: var(--faint); border-radius: 6px; }
.frow .rm:hover { color: var(--danger); background: var(--raise); }
.frow .rm .ico { width: 14px; height: 14px; }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; }
.suggest button { height: 24px; padding: 0 9px; border-radius: 12px; border: 1px dashed var(--line-2); background: transparent; color: var(--muted); font-size: 12.5px; }
.suggest button:hover { color: var(--text); border-color: var(--accent); }

.rels { display: grid; gap: 4px; }
.rel-item { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); text-align: left; }
.rel-item:hover { border-color: var(--line-2); background: var(--raise); }
.rel-item i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.rel-item .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--serif); font-weight: 600; }
.rel-item .who em { font-style: normal; color: var(--muted); font-family: var(--sans); font-weight: 400; margin-right: 6px; }
.rel-item .lb { font-size: 12.5px; color: var(--muted); max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel-add { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.rel-add select.in { padding-right: 6px; }
.hint { color: var(--faint); font-size: 13px; margin: 0; }

.meta { color: var(--faint); font-size: 12px; display: grid; gap: 2px; }
.foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding-top: 4px; border-top: 1px solid var(--line); padding-top: 16px; }

/* 관계 편집 */
.pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.pair .end { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); text-align: left; }
.pair .end:hover { border-color: var(--line-2); background: var(--raise); }
.pair .end .av { --s: 30px; }
.pair .end span.t { font: 700 13.5px/1.3 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pair .mid { display: grid; place-items: center; color: var(--ec); }
.pair .mid .ico { width: 22px; height: 22px; stroke-width: 1.8; }

.kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.kind { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border-radius: 9px; background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.kind i { width: 16px; height: 3px; border-radius: 2px; background: var(--c); }
.kind:hover { color: var(--text); border-color: var(--line-2); }
.kind.on { color: var(--text); background: color-mix(in srgb, var(--c) 16%, var(--card)); border-color: var(--c); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.seg button { height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--raise-2); color: var(--text); box-shadow: 0 0 0 1px var(--line-2); }

/* 개요 */
.overview h2 { margin: 0 0 4px; font: 700 21px/1.3 var(--serif); overflow-wrap: anywhere; }
.overview .count { margin: 0; color: var(--muted); }
.legend { display: grid; gap: 2px; }
.legend div { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px; padding: 5px 0; color: var(--muted); }
.legend i { height: 0; border-top: 2.5px solid var(--c); border-radius: 2px; }
.legend i.dash { border-top-style: dashed; }
.legend b { font-weight: 500; color: var(--faint); font-variant-numeric: tabular-nums; }
.tips { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; color: var(--muted); font-size: 13.5px; }
.tips li { padding-left: 14px; position: relative; }
.tips li::before { content: ""; position: absolute; left: 0; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: var(--line-2); }
.tips kbd { font: 500 12px var(--sans); padding: 1px 6px; border-radius: 5px; background: var(--raise-2); border: 1px solid var(--line-2); color: var(--text); }
.hub { display: grid; gap: 4px; }

/* ───────── 토스트 · 모달 ───────── */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: var(--raise-2); border: 1px solid var(--line-2); border-radius: 11px; box-shadow: 0 14px 40px rgba(0, 0, 0, .55); animation: pop .18s ease-out; }
.toast button { border: 0; background: transparent; color: var(--accent); font-weight: 700; padding: 2px 4px; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }

.backdrop { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: rgba(4, 6, 12, .66); backdrop-filter: blur(3px); }
.dialog { width: min(420px, 100%); padding: 22px; background: var(--raise); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); display: grid; gap: 14px; }
.dialog h2 { margin: 0; font: 700 18px/1.35 var(--serif); }
.dialog p { margin: 0; color: var(--muted); }
.dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dialog .btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #1a0a0e; font-weight: 700; }

/* ───────── 반응형 ───────── */
@media (max-width: 1180px) {
  #app { grid-template-columns: 250px minmax(0, 1fr) 320px; }
}
@media (max-width: 900px) {
  #app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "stage"; }
  .only-narrow { display: inline-grid; }
  .save-state span { display: none; }
  .list-panel {
    position: fixed; z-index: 40; top: 54px; bottom: 0; left: 0; width: min(320px, 88vw);
    transform: translateX(-102%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .6);
  }
  body.list-open .list-panel { transform: none; }
  .inspector {
    position: fixed; z-index: 35; left: 0; right: 0; bottom: 0; height: 58dvh; border-left: 0; border-top: 1px solid var(--line-2);
    border-radius: 18px 18px 0 0; transform: translateY(102%); transition: transform .2s; box-shadow: 0 -20px 50px rgba(0, 0, 0, .5);
  }
  body.has-sel .inspector { transform: none; }
  body.has-sel .dock { bottom: calc(58dvh + 12px); }
  .insp-close { display: grid; place-items: center; position: sticky; top: 0; margin: 0 0 -6px auto; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--raise-2); color: var(--muted); z-index: 2; }
  .brand span { display: none; }
  .board-btn { max-width: 40vw; }
  .btn.primary { padding: 0 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ───────── 로그인 ───────── */
.dotc { fill: var(--dot); }
.form-err { margin: 0; color: var(--danger); font-size: 13.5px; }
.login-body {
  overflow: auto; display: grid; place-items: center; min-height: 100dvh; padding: 24px; position: relative;
  background:
    radial-gradient(900px 560px at 15% -8%, #131a34 0%, transparent 62%),
    radial-gradient(760px 520px at 108% 108%, #1a1231 0%, transparent 58%),
    var(--bg);
}
.login-bg { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: .7; }
.login-bg .l { fill: none; stroke: #33405f; stroke-width: 1.2; opacity: .6; }
.login {
  position: relative; width: min(388px, 100%); padding: 34px 30px 28px; display: grid; gap: 18px;
  background: color-mix(in srgb, var(--panel) 90%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line-2); border-radius: 20px; box-shadow: 0 30px 90px rgba(0, 0, 0, .55);
}
.login-mark { width: 46px; height: 46px; }
.login h1 { margin: 0; font: 700 27px/1.2 var(--serif); letter-spacing: .01em; }
.login-sub { margin: -10px 0 4px; color: var(--muted); }
.login form { display: grid; gap: 14px; }
.login .btn.wide { width: 100%; height: 44px; font-size: 15px; margin-top: 4px; }
.login .btn:disabled { opacity: .6; cursor: default; }

/* 좁은 화면에서 상단 버튼이 찌그러지지 않게 */
.btn { white-space: nowrap; }
.save-state, .brand, .icon-btn, #btnAddNode { flex: none; }
.board-wrap { min-width: 0; flex: 0 1 auto; }
.board-wrap .board-btn { max-width: 100%; }
