@font-face {
  font-family: Pretendard; font-weight: 400; font-display: swap;
  src: url("./fonts/Pretendard-Regular.subset.woff2") format("woff2");
}
@font-face {
  font-family: Pretendard; font-weight: 600; font-display: swap;
  src: url("./fonts/Pretendard-SemiBold.subset.woff2") format("woff2");
}
@font-face {
  font-family: Pretendard; font-weight: 700; font-display: swap;
  src: url("./fonts/Pretendard-Bold.subset.woff2") format("woff2");
}
:root {
  color-scheme: light;
  font-family: Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: var(--ink);
  background: var(--page);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  --page: #f2f4f6;
  --surface: #fff;
  --ink: #191f28;
  --muted: #8b95a1;
  --fill: #f2f4f6;
  --control-fill: var(--fill);
  --line: var(--fill);
  --blue: #3182f6;
  --blue-text: #1765cb;
  --blue-soft: #eaf3ff;
  --red: #f04452;
  --red-text: #bd2536;
  --r-lg: 20px;
  --r-md: 14px;
  --r-pill: 999px;
  --h-primary: 52px;
  --h-btn: 44px;
  --h-icon: 40px;
  --h-input: 52px;
  --float-shadow: 0 5px 20px #191f2814;
  --shadow: var(--float-shadow);
  --bottom-nav-height: 58px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.genealogy-content { display: contents; }
body { margin: 0; min-width: 0; line-height: 1.5; font-family: inherit; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: 26px; letter-spacing: -.04em; }
h2 { font-size: 20px; letter-spacing: -.025em; }
h3 { font-size: 17px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; min-width: 0; }
button, .button, summary { cursor: pointer; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--h-btn); border: 0; border-radius: var(--r-md);
  background: var(--control-fill); padding: 7px 14px; font-weight: 600; text-align: center;
}
button:hover, .button:hover { background: #e8ecef; }
button:disabled { opacity: .48; cursor: default; }
.primary { min-height: var(--h-primary); background: var(--blue); color: #fff; }
.primary:hover { background: #2175eb; }
.danger { color: var(--red-text); background: transparent; }
.danger:hover { background: #fff1f2; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
:is(input:not([type="checkbox"], [type="radio"], [type="range"]), select, textarea) {
  min-height: var(--h-input); padding: 8px 12px; border: 0; border-radius: var(--r-md);
  background-color: var(--control-fill); max-width: 100%;
}
:is(input:not([type="checkbox"], [type="radio"], [type="range"]), select, textarea):focus { outline: 2px solid var(--blue); outline-offset: -2px; }
:is(input, select, textarea)[aria-invalid="true"]:not(:focus) { outline: 2px solid var(--red); outline-offset: -2px; }
input:is([type="checkbox"], [type="radio"]) { width: 20px; height: 20px; accent-color: var(--blue); }
.button-with-icon { gap: 7px; }
.icon-button {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: var(--h-icon); min-height: var(--h-icon); height: var(--h-icon); padding: 0;
  border-radius: var(--r-pill); background: var(--control-fill);
}
.icon-button[aria-pressed="true"] { color: #fff; background: var(--blue); }
.icon-button > svg { flex: none; }
.icon-tooltip {
  position: absolute; z-index: 1; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  visibility: hidden; border-radius: 8px; padding: 4px 8px; background: var(--ink); color: #fff;
  font-size: 12px; font-weight: 600; white-space: nowrap; pointer-events: none;
}
.icon-button:focus-visible > .icon-tooltip { visibility: visible; }
@media (hover: hover) {
  .icon-button:hover > .icon-tooltip { visibility: visible; }
}
.menu-button > [aria-expanded="true"] > .icon-tooltip { visibility: hidden; }
.floating-menu {
  position: fixed; z-index: 5; display: grid; gap: 2px; width: max-content;
  min-width: min(175px, calc(100vw - 12px)); max-width: calc(100vw - 12px); overflow: auto;
  overscroll-behavior: contain; padding: 6px; border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--float-shadow);
}
.floating-menu button { gap: 8px; justify-content: start; text-align: left; background: transparent; }
.floating-menu button:hover, .floating-menu button[aria-checked="true"] { background: var(--fill); }
.floating-menu button:focus-visible { outline-offset: -2px; }
.muted { color: var(--muted); }
.text-link { color: var(--blue-text); font-weight: 700; }
.text-link:hover { text-decoration: underline; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.release-banner { justify-content: center; padding: 6px 16px; background: var(--blue-soft); color: var(--blue-text); }
.billing-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 12px; }
.billing-details dt { color: var(--muted); font-size: 14px; }
.billing-details dd { font-weight: 700; overflow-wrap: anywhere; }
.member-quota { appearance: none; width: 100%; height: 7px; border: 0; border-radius: var(--r-pill); background: var(--fill); }
.member-quota::-webkit-progress-bar { border-radius: var(--r-pill); background: var(--fill); }
.member-quota::-webkit-progress-value { border-radius: var(--r-pill); background: var(--blue); }
.member-quota::-moz-progress-bar { border-radius: var(--r-pill); background: var(--blue); }
.admin-nav { margin-bottom: 16px; }
.admin-nav a[aria-current] { color: var(--blue-text); background: var(--blue-soft); }
.admin-message { display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
.surface, .notice, .section-card { border: 0; border-radius: var(--r-lg); background: var(--surface); }
.notice { padding: 20px; display: grid; gap: 8px; justify-items: start; }
.loading { color: var(--muted); }
.main { width: min(100%, 1400px); min-width: 0; margin: 0 auto; padding: 26px clamp(16px, 4vw, 42px) 38px; }
:where(.main, .rank-legs) { --control-fill: var(--surface); }
:where(.surface, .section-card, .notice, .member-card, .tree-move-banner) { --control-fill: var(--fill); }
.app-header { background: var(--surface); position: relative; z-index: 3; padding-top: env(safe-area-inset-top); }
.org-header { position: sticky; top: 0; }
.app-header.scrolled { box-shadow: 0 2px 8px #191f280d; }
.header-inner {
  width: min(100%, 1520px); margin: auto; padding: 12px clamp(16px, 3vw, 34px);
  display: flex; align-items: center; gap: 14px 24px; min-width: 0;
}
.org-header .header-inner {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 0 clamp(8px, 2vw, 24px); padding-block: 0;
}
.header-identity { display: flex; gap: 13px; align-items: center; min-width: 0; }
.brand { display: inline-flex; gap: 8px; align-items: center; flex: none; font-size: 18px; font-weight: 700; letter-spacing: -.03em; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; background: var(--blue-soft); color: var(--blue-text); border-radius: 10px; }
.brand-mark svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.org-menu { min-width: 0; position: relative; }
.org-menu .menu-trigger { background: transparent; padding-inline: 8px; }
.org-name { max-width: 28ch; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-menu .menu-popover { left: 0; right: auto; max-height: min(60dvh, 400px); overflow: auto; }
.menu-popover a[aria-current] { color: var(--blue-text); font-weight: 700; }
.header-controls { display: flex; justify-content: flex-end; align-items: center; gap: 8px; min-width: 0; }
.header-controls > select { max-width: min(200px, 100%); min-height: var(--h-icon); border-radius: var(--r-pill); }
.header-controls .account-menu { margin-left: 0; }
.header-context { display: flex; justify-content: flex-end; align-items: center; gap: 8px; grid-column: 1 / -1; }
.header-context:has(> :not([hidden])) { padding-bottom: 6px; }
.period-status { font-size: 13px; }
.switch { display: inline-flex; flex: none; gap: 2px; padding: 3px; border-radius: 12px; background: var(--page); }
.switch button { min-height: 36px; background: transparent; padding: 4px 9px; white-space: nowrap; }
.switch button[aria-pressed="true"] { color: var(--blue-text); background: #fff; }
.search-toggle[aria-expanded="true"] { color: var(--blue-text); background: var(--blue-soft); }
.account-menu { position: relative; margin-left: auto; min-width: 0; }
.menu-trigger {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--h-btn);
  padding: 7px 12px; border-radius: var(--r-md); background: var(--fill); font-weight: 600; list-style: none;
}
.menu-trigger.icon-button { min-height: var(--h-icon); padding: 0; border-radius: var(--r-pill); }
.menu-trigger::-webkit-details-marker { display: none; }
.menu-trigger:hover, details[open] > .menu-trigger { background: #e4ebf3; }
.menu-chevron { flex: none; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); }
.account-menu .icon-tooltip { left: auto; right: 0; transform: none; }
.account-menu[open] .icon-tooltip { visibility: hidden; }
.menu-popover {
  position: absolute; z-index: 5; right: 0; top: 100%; width: min(260px, 85vw); padding: 14px;
  display: grid; gap: 8px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--float-shadow);
  overflow-wrap: anywhere;
}
.desktop-nav { display: flex; align-items: stretch; gap: clamp(8px, 2.2vw, 32px); }
.desktop-nav > a, .desktop-more > summary {
  position: relative; white-space: nowrap; display: grid; place-items: center; min-height: 64px;
  padding: 0 4px; border-radius: 0; color: #4e5968; font-weight: 400; background: transparent;
}
.desktop-nav [aria-current] { color: var(--ink); font-weight: 700; }
.desktop-nav > a[aria-current]::after, .desktop-more > summary[aria-current]::after {
  position: absolute; inset: auto 0 0; height: 2px; background: var(--blue); content: "";
}
.bottom-nav { display: none; }
.search { position: relative; min-width: 0; max-width: 430px; flex: 1; }
.org-header .header-inner > .search { grid-column: 1 / -1; justify-self: end; width: min(100%, 480px); max-width: none; padding-bottom: 8px; }
.search-form { display: flex; gap: 6px; }
.search-form input { width: 100%; min-width: 0; }
.search-form button { white-space: nowrap; }
.search-results {
  position: absolute; z-index: 4; top: calc(100% + 5px); right: 0; width: min(410px, max(100%, 220px));
  max-height: min(440px, 55vh); overflow: auto; padding: 10px;
  border-radius: var(--r-md); background: var(--surface); box-shadow: var(--float-shadow);
}
.search-results .result-button { display: flex; width: 100%; margin-top: 4px; background: #f7f9fb; justify-content: start; overflow-wrap: anywhere; }
.search-results .result-button:hover { background: var(--blue-soft); }
.page-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.auth-main { display: grid; justify-items: center; padding-top: clamp(30px, 9vh, 96px); }
.invite-name { min-width: 0; overflow-wrap: anywhere; }
.auth-card, .wizard { padding: clamp(20px, 5vw, 36px); }
.auth-card { width: min(100%, 400px); display: grid; gap: 18px; overflow-wrap: anywhere; }
.wizard { width: min(100%, 560px); }
.auth-heading { display: grid; gap: 14px; }
.auth-heading h1 { font-size: clamp(28px, 5vw, 36px); line-height: 1.18; }
.wizard { margin: 0 auto; display: grid; gap: 14px; }
.form { display: grid; gap: 13px; min-width: 0; }
.field { display: grid; gap: 5px; min-width: 0; font-size: 15px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; font-weight: 400; }
.field textarea { resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.consent { display: grid; gap: 8px; font-size: 14px; }
.consent .check { align-items: flex-start; }
.consent input { flex: none; margin: 2px 0 0; }
.site-footer {
  width: min(100%, 1400px); margin: auto; padding: 16px clamp(16px, 4vw, 42px) 24px;
  display: grid; gap: 6px; color: var(--muted); font-size: 13px;
}
.site-footer .actions { gap: 8px 16px; }
.site-footer .text-link { color: inherit; }
.legal-main { max-width: 720px; }
.legal-document { display: grid; gap: 24px; padding: clamp(18px, 5vw, 38px); overflow-wrap: anywhere; }
.legal-document h1 { font-size: clamp(28px, 5vw, 36px); }
.legal-document .text-link { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.legal-document header, .legal-document section { display: grid; gap: 9px; }
.legal-document ul { margin: 0; padding-inline-start: 1.35em; }
.legal-document li + li { margin-top: 6px; }
.legal-document [role="tab"][aria-selected="true"] { color: var(--blue-text); background: var(--blue-soft); }
.legal-fields { border: 0; margin: 0; padding: 0; }
.legal-status:empty { display: none; }
.legal-status { margin-top: 8px; }
.field-error, .form-error { color: var(--red-text); overflow-wrap: anywhere; }
.quiet-link { justify-self: start; color: #626d79; font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.quiet-button { justify-self: center; background: transparent; }
.auth-links { justify-content: center; gap: 8px 18px; }
.org-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr)); gap: 16px; }
.org-card { display: grid; align-content: start; gap: 8px; min-height: 140px; padding: 22px; overflow-wrap: anywhere; }
.org-card h2 { font-size: 20px; font-weight: 700; }
.org-card > .muted { font-size: 13px; }
.org-card:hover { background: #f8fbff; }
.org-create-card { place-content: center; justify-items: center; font-weight: 700; }
.step-indicator {
  display: flex; flex-wrap: wrap; gap: 7px 12px; margin: 0; padding: 0;
  color: #626d79; list-style: none; font-size: 13px; font-weight: 600;
}
.step-indicator li { display: flex; align-items: center; gap: 5px; }
.step-indicator li > span {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: var(--r-pill); background: var(--fill);
}
.step-indicator [aria-current="step"] { color: var(--blue-text); font-weight: 700; }
.step-indicator [aria-current="step"] > span { color: white; background: var(--blue-text); }
.structure-preview { text-align: center; padding: 12px 4px; background: var(--page); border-radius: 12px; font-size: 14px; }
.structure-parent, .structure-children span { display: inline-flex; justify-content: center; padding: 4px; border-radius: 7px; background: var(--surface); }
.structure-parent { padding-inline: 14px; }
.structure-children { position: relative; display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 2px; padding: 12px 4px 0; }
.structure-children::before { content: ""; position: absolute; inset: 0 8% 50%; border-top: 1px solid #a6b9d6; top: 6px; }
.structure-children span { position: relative; min-width: 0; padding-inline: 0; }
.tree-shell { display: flex; flex-direction: column; height: 100dvh; }
.tree-shell .main { display: flex; flex: 1; flex-direction: column; width: 100%; min-height: 0; padding: 0; }
.tree-shell .main > .notice, .genealogy-content > .notice { margin: 16px; }
.tree-page { display: flex; flex: 1; flex-direction: column; min-height: 0; min-width: 0; }
.tree-page > .empty-org { margin: 8px 16px 0; padding: 12px 16px; }
.tree-board {
  position: relative; isolation: isolate; flex: 1; min-height: 0; min-width: 0;
  --tree-left: max(16px, env(safe-area-inset-left));
  --tree-right: max(16px, env(safe-area-inset-right));
  --tree-bottom: max(16px, env(safe-area-inset-bottom));
  --tree-tool-size: 40px;
  --tree-tool-width: calc(var(--tree-tool-size) + 8px);
  --tree-tool-clearance: calc(var(--tree-tool-width) + 8px);
}
.tree-top { display: contents; }
.tree-toolbar { position: absolute; z-index: 2; top: 16px; right: var(--tree-right); display: flex; align-items: center; gap: 8px; }
.tree-kind {
  flex: none; padding: 4px 10px; border-radius: var(--r-pill); background: var(--surface);
  box-shadow: var(--float-shadow); color: #4e5968; font-size: 13px; font-weight: 600;
}
.tree-tool-group {
  display: flex; flex: none; align-items: center; gap: 2px; padding: 4px; border-radius: var(--r-pill);
  background: var(--surface); box-shadow: var(--float-shadow);
}
.tree-tool-group .icon-button { --h-icon: var(--tree-tool-size); }
.tree-tool-group .icon-button:not([aria-pressed="true"]) { background: transparent; }
.tree-tool-group .icon-button:hover:not([aria-pressed="true"]) { background: var(--fill); }
.tree-path-area {
  position: absolute; z-index: 2; top: 16px; left: var(--tree-left); right: calc(var(--tree-right) + 310px);
  display: grid; grid-template-columns: minmax(0, 1fr); justify-items: start; gap: 6px; pointer-events: none;
}
.tree-path-area :is(.tree-path, .tree-rank-legend, .tree-move-banner) { pointer-events: auto; }
.tree-path-area .tree-rank-legend { position: static; max-width: 100%; }
.tree-path-area .tree-move-banner { position: static; transform: none; max-width: 100%; }
.tree-path { z-index: 2; max-width: 100%; min-width: 0; padding-inline-end: 12px; }
.tree-path ol, .tree-path li {
  display: flex; align-items: center; min-width: 0; gap: 4px; margin: 0; padding: 0; list-style: none;
}
.tree-path li:has(.menu-button), .tree-path li > span { flex: none; }
.tree-path li > span { color: var(--muted); }
.tree-path :is(a, strong) {
  display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px;
}
.tree-path a { padding: 10px 2px; border-radius: 6px; }
.tree-path > button .icon-tooltip {
  left: 0; transform: none; width: max-content; max-width: min(260px, calc(100dvw - 48px));
  white-space: normal; overflow-wrap: anywhere;
}
.tree-up-pill { overflow: visible; pointer-events: none; }
.tree-up-pill > div { display: flex; justify-content: center; }
.tree-up-pill-side > div { justify-content: end; }
.tree-up-pill button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; max-width: 100%;
  padding: 4px 10px; border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--float-shadow);
  color: var(--blue-text); font-size: 14px; pointer-events: auto;
}
.tree-up-pill button:hover { background: var(--fill); }
.tree-up-pill button > svg { flex: none; }
.tree-up-pill button > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-toolbar .menu-button .icon-tooltip, .tree-zoom .icon-tooltip { left: auto; right: 0; transform: none; }
.tree-zoom { position: absolute; z-index: 1; bottom: var(--tree-bottom); right: var(--tree-right); flex-direction: column; }
.tree-zoom .icon-tooltip { right: calc(100% + 10px); top: 50%; transform: translateY(-50%); }
.tree-move { position: absolute; z-index: 1; bottom: var(--tree-bottom); left: var(--tree-left); }
.tree-move .icon-tooltip { top: auto; bottom: calc(100% + 10px); }
.tree-progress { min-width: 0; max-width: 14ch; overflow-wrap: anywhere; font-size: 12px; line-height: 1.25; text-align: right; color: #4e5968; }
.tree-context {
  position: absolute; z-index: 1; left: calc(var(--tree-left) + var(--tree-context-start, 0px));
  right: calc(var(--tree-right) + var(--tree-tool-clearance)); bottom: var(--tree-bottom);
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; max-width: 400px;
  color: #4e5968; font-size: 12px; pointer-events: none;
}
.tree-context span {
  justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--surface); padding: 3px 8px; border-radius: var(--r-pill);
}
.tree-board:has(.tree-move) .tree-context { --tree-context-start: var(--tree-tool-clearance); }
.tree-context:empty, .tree-progress:empty { display: none; }
.tree-field-form { display: grid; gap: 12px; }
.tree-field-form fieldset {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px;
  min-width: 0; margin: 0; padding: 6px 10px 10px; border: 1px solid var(--line); border-radius: 10px;
}
.tree-field-form .tree-field-modes { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.tree-field-form .check { min-height: 34px; overflow-wrap: anywhere; }
.tree-field-form input { flex: none; accent-color: var(--blue); }
.tree-field-form input[type="radio"] { min-height: 0; width: 18px; height: 18px; margin: 0; }
.tree-field-options:disabled { color: var(--muted); }
.tree-viewport {
  position: absolute; inset: 0; overflow: hidden; background: var(--page);
}
.tree-viewport > svg { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.tree-viewport > svg:active { cursor: grabbing; }
.tree-frame { height: 100%; width: 100%; }
.tree-frame > * { height: 100%; }
/* 멀리 축소해도 선 굵기가 화면 기준으로 남도록 non-scaling-stroke 를 쓴다. */
.tree-link { fill: none; stroke: #c9d1db; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
/* 축소 보기(배율 0.23 미만): 흰 카드가 연한 배경에 묻히지 않게 진한 파랑으로 채운다. */
/* 직급 없음(흰 네모)만 테두리를 둔다. 아주 작은 배율에서 테두리가 직급 색을 덮지 않게. */
.tree-overview path[fill="#ffffff"] { stroke: #9aa8ba; stroke-width: 0.6; vector-effect: non-scaling-stroke; }
.tree-overview-vacant { fill: #e9edf1; stroke: #c9d1db; stroke-width: .6; vector-effect: non-scaling-stroke; }
.tree-rank-legend {
  position: absolute; z-index: 1; top: 16px; left: var(--tree-left); right: calc(var(--tree-right) + 310px);
  display: flex; flex-wrap: wrap; gap: 5px; max-height: 52px; overflow: auto; margin: 0; padding: 0;
  list-style: none; color: #4e5968; font-size: 12px;
}
.tree-rank-legend li {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--surface); overflow-wrap: anywhere;
}
.rank-swatch { flex: 0 0 8px; height: 8px; border-radius: 50%; }
.highlighted .member-card { outline: 3px solid var(--blue); outline-offset: -3px; }
.member-card {
  min-width: 0; padding: 14px; border: 1px solid #d1d5d9;
  border-color: color-mix(in srgb, var(--rank, #8b95a1) 40%, white);
  border-top: 6px solid var(--rank, #8b95a1); border-radius: 16px;
  background: #fff;
  background: var(--rank-bg, color-mix(in srgb, var(--rank, white) 12%, white));
  box-shadow: var(--shadow); display: grid; align-content: start; gap: 6px;
}
.selectable { cursor: pointer; }
.member-title { display: flex; flex-wrap: wrap; gap: 3px 9px; align-items: baseline; min-width: 0; overflow-wrap: anywhere; }
.member-title strong, .member-name { font-size: 17px; font-weight: 800; }
.member-name { border: 0; padding: 0; min-height: auto; background: transparent; color: var(--blue-text); text-align: left; overflow-wrap: anywhere; }
.member-name:hover { text-decoration: underline; background: transparent; }
.member-code, .member-rank { font-size: 14px; color: var(--muted); }
.member-rank-line, .member-rank-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.member-rank-controls select { width: auto; max-width: 100%; }
.tree-rank-trigger {
  display: inline-flex; align-items: center; gap: 4px; vertical-align: top; max-width: 100%;
}
.tree-rank-chip {
  display: inline-flex; align-items: center; max-width: 100%; padding: 0 8px; min-height: 0;
  border-radius: var(--r-pill); color: var(--ink); font-weight: 600; line-height: 21px;
}
.tree-rank-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tree-rank-menu {
  position: fixed; z-index: 20; display: grid; gap: 3px; width: max-content; min-width: min(10rem, calc(100vw - 12px));
  max-width: calc(100vw - 12px); overflow: auto; overscroll-behavior: contain; padding: 5px;
  border-radius: var(--r-md); background: var(--surface); box-shadow: var(--float-shadow);
}
.tree-rank-menu > span { padding: 4px 8px; }
.tree-rank-menu button {
  display: flex; align-items: center; gap: 7px; padding: 4px 8px; text-align: left; overflow-wrap: anywhere;
}
.tree-rank-menu button[aria-checked="true"] { background: var(--blue-soft); font-weight: 700; }
.tree-rank-menu button[aria-disabled="true"] { opacity: .48; cursor: default; }
.member-stats { display: contents; }
.metrics { display: grid; gap: 3px; }
.metrics > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 8px; }
.metrics dt { color: var(--muted); }
.metrics dd { font-weight: 700; }
.legs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 12px; font-size: 13px; }
.leg { display: grid; grid-template-columns: auto minmax(10px, 1fr) auto; align-items: center; gap: 4px; min-width: 0; }
.leg-label { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.small-leg-label { color: var(--blue-text); font-weight: 700; }
.leg strong { overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.leg-track { display: block; overflow: hidden; background: var(--line); border-radius: 4px; height: 5px; }
.leg-track > span { display: block; height: 100%; background: #aab7c7; }
.small-leg .leg-track { height: 8px; background: var(--blue-soft); }
.small-leg .leg-track > span { background: var(--blue); }
.tree-frame .member-card {
  position: relative; display: flex; flex-direction: column; padding: 14px 13px 10px; font-size: 13px; gap: 0;
  border: 1px solid #eef1f4; border-radius: 16px; box-shadow: none;
  background: linear-gradient(var(--tree-rank-stripe, transparent), var(--tree-rank-stripe, transparent)) top / 100% 4px no-repeat border-box, var(--rank-bg, var(--surface));
}
.tree-frame .member-title { flex-wrap: nowrap; align-items: center; min-height: 24px; padding-right: 36px; }
.tree-frame .member-title > *, .tree-frame .member-rank { display: inline-block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-frame .member-code { flex-shrink: 0; max-width: 50%; }
.tree-frame .member-name, .tree-frame .member-title strong { min-height: 0; font-size: 17px; font-weight: 700; color: var(--ink); }
.tree-frame .member-name:focus-visible { outline-offset: -2px; }
.tree-frame .member-rank, .tree-frame .member-code { font-size: 13px; }
.tree-frame .member-rank { flex: none; height: var(--tree-field-row); overflow: visible; }
.tree-frame .tree-rank-chip:not(button) { display: inline-block; overflow: hidden; text-overflow: ellipsis; }
.tree-frame .metrics { grid-template-columns: minmax(0, 1fr); grid-auto-rows: var(--tree-field-row); gap: 0; }
.tree-frame .metrics > div { flex-wrap: nowrap; align-items: center; }
.tree-frame .metrics dt { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tree-frame .metrics dd { font-size: 15px; font-weight: 600; }
.tree-frame .legs { grid-auto-rows: var(--tree-field-row); gap: 0 10px; font-size: 13px; align-content: start; }
.tree-frame .leg-track { height: 4px; border-radius: var(--r-pill); }
.tree-frame .leg strong { font-weight: 600; }
.tree-card-actions { justify-content: center; margin-top: auto; padding-top: 6px; gap: 5px; }
.tree-branch { width: auto; min-width: 34px; min-height: 28px; height: 28px; padding-inline: 7px; gap: 3px; font-size: 13px; }
.tree-branch > svg { width: 16px; height: 16px; }
.tree-branch .icon-tooltip { top: auto; bottom: calc(100% + 4px); }
.tree-card-focus { position: absolute; top: 8px; right: 8px; --h-icon: 32px; opacity: 0; }
.tree-card-focus .icon-tooltip { left: auto; right: 0; transform: none; }
.tree-frame .member-card:hover .tree-card-focus, .tree-frame .member-card:focus-within .tree-card-focus { opacity: 1; }
@media (pointer: coarse), (width < 720px) {
  .tree-card-focus { opacity: 1; }
  .tree-branch { min-width: 44px; min-height: 44px; }
  .tree-board { --tree-tool-size: 44px; }
}
.vacant {
  display: grid; align-content: center; justify-items: center; gap: 7px;
  min-height: 112px; text-align: center; padding: 12px; color: var(--muted);
  border: 2px dashed #9caec3; border-radius: 16px; background: #f8fafc;
}
.tree-frame .vacant { width: 100%; min-height: 0; padding-block: 6px; border: 1.5px dashed #d1d6db; background: transparent; color: var(--muted); }
.tree-frame button.vacant:hover { background: #ffffff99; border-color: #b0b8c1; }
.tree-frame button.vacant:focus-visible { outline-offset: -3px; }
.tree-move-banner {
  position: absolute; z-index: 1; top: 16px; left: 50%; transform: translateX(-50%); width: max-content;
  max-width: calc(100% - 32px); display: flex; align-items: center; gap: 8px;
  padding: 4px 5px 4px 12px; border-radius: var(--r-pill); background: var(--surface);
  box-shadow: var(--float-shadow); font-size: 13px; font-weight: 600;
}
.tree-move-banner button { min-height: 34px; padding: 4px 10px; border-radius: var(--r-pill); white-space: nowrap; }
.tree-move-banner small { display: block; font-size: inherit; font-weight: 400; }
.tree-board:has(.tree-move-banner:not([hidden])) .tree-top > .tree-rank-legend { right: calc(50% + 150px); }
@media (720px <= width < 1050px) {
  .tree-top:has(.tree-move-banner:not([hidden])) .tree-progress { position: absolute; top: calc(100% + 6px); right: 0; }
}
.tree-move-mode .member-card { cursor: default; }
.tree-move-mode:not(.tree-compact) .tree-movable { cursor: grab; }
.tree-move-mode .member-title > strong, .tree-drag-preview .member-title > strong {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tree-move-mode .tree-movable { user-select: none; }
.tree-dragging > svg, .tree-dragging:not(.tree-compact) .member-card { cursor: grabbing; }
.tree-drag-ghost {
  position: fixed; z-index: 21; pointer-events: none; transform: translate(-50%, -50%);
}
.tree-drag-preview { transform-origin: top left; opacity: .85; filter: drop-shadow(0 6px 10px #191f2833); }
.tree-drop-reason {
  position: absolute; top: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  padding: 4px 8px; border-radius: 8px; background: #982d3b; color: white; white-space: nowrap;
}
.tree-frame > .drop-ok { outline: 5px solid #16834b; outline-offset: -5px; }
.tree-frame > .drop-no { outline: 5px solid #c72d42; outline-offset: -5px; }
.breadcrumbs { display: flex; align-items: center; gap: 6px; padding: 4px; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; }
.crumb {
  flex-shrink: 0; max-width: min(24ch, 80%); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 5px 10px; border-radius: 9px; color: var(--blue-text); background: var(--blue-soft);
}
.list-page { display: grid; gap: 14px; min-width: 0; }
.list-results { min-width: 0; }
.list-th-label {
  max-width: var(--list-text-width, none); white-space: normal; word-break: keep-all; overflow-wrap: break-word;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.list-ellipsis { display: block; max-width: var(--list-text-width); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-page .page-heading { margin-bottom: 0; }
.list-heading-actions { min-width: 0; max-width: 100%; }
.list-heading-actions .icon-tooltip { left: auto; right: 0; transform: none; }
.list-page :is(.member-name, .list-upline) {
  display: inline-flex; align-items: center; max-width: 100%; min-width: 0; min-height: auto;
  border: 0; padding: 0; border-radius: 4px; background: transparent;
  color: var(--ink); font-weight: 600; text-align: left; overflow-wrap: anywhere;
}
.list-page :is(.member-name, .list-upline):hover { text-decoration: underline; background: transparent; }
.list-tree-button { --h-icon: 32px; }
.list-tree-button > svg { width: 17px; height: 17px; }
.list-tree-button .icon-tooltip {
  left: auto; right: 0; transform: none; width: max-content; max-width: min(260px, calc(100dvw - 32px));
  white-space: normal; overflow-wrap: anywhere;
}
.view-table tr:last-child .list-tree-button .icon-tooltip { top: auto; bottom: calc(100% + 6px); }
.list-tree-cell { width: 1%; }
.list-sort-notice { font-size: 14px; }
.list-mobile-tools { display: none; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #f8fafc; }
th button { justify-content: start; background: transparent; padding-inline: 0; }
td .member-name, td .list-upline { font-size: 15px; }
tr:last-child td { border-bottom: 0; }
.list-cards { display: none; }
.pagination { justify-content: center; padding-block: 12px; }
dialog { border: 0; padding: 0; color: var(--ink); box-shadow: var(--float-shadow); }
dialog::backdrop { background: #17294155; }
.panel { margin: auto auto 0; width: min(560px, 100%); max-height: min(90dvh, 100%); max-width: 100%; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.confirm { width: min(440px, calc(100% - 30px)); max-height: calc(100% - 30px); border-radius: var(--r-lg); }
@media (prefers-reduced-motion: no-preference) {
  :is(button, .button, summary) { transition: transform 120ms ease-out; }
  :is(button:enabled, .button, summary):active { transform: scale(.97); }
  .panel[open] { animation: panel-enter 170ms ease-out; }
  @keyframes panel-enter { from { transform: translateY(24px); opacity: .5; } }
}
.dialog-header { position: sticky; top: 0; background: var(--surface); z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px; }
.dialog-body { padding: 17px; display: grid; gap: 14px; min-width: 0; overflow-wrap: anywhere; }
.dialog-body .search { width: 100%; }
.dialog-body .search-results { position: static; width: 100%; }
.dialog-body details > .form { margin-top: 8px; }
.print-fields { min-width: 0; margin: 0; padding: 0; border: 0; }
.print-fields legend { padding: 0; font-weight: 700; }
.print-fields p { margin-bottom: 6px; }
.print-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
.print-grid input[type="checkbox"] { flex: none; }
.print-dialog, .png-preview { width: min(760px, calc(100% - 30px)); }
.print-preview, .print-preview-body { display: grid; gap: 8px; min-width: 0; }
.print-preview-body > button { justify-self: center; }
.print-pages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.print-page-button { min-width: 0; padding: 5px; border-radius: 8px; display: grid; gap: 4px; }
.print-page-image { display: block; min-width: 0; background: white; border: 1px solid var(--line); }
.print-page-image > svg { display: block; width: 100%; height: auto; }
.print-page-nav { justify-content: center; }
.png-preview-image { display: block; margin-inline: auto; max-width: 100%; max-height: 65dvh; object-fit: contain; }
@media (width < 720px) {
  .print-pages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.detail-section { display: grid; gap: 5px; min-width: 0; }
.memo { white-space: pre-wrap; }
.moves { display: grid; gap: 7px; padding-left: 19px; margin: 0; }
.moves p { color: var(--muted); }
#toasts { position: fixed; z-index: 10; inset: auto 16px calc(16px + env(safe-area-inset-bottom)); display: grid; justify-items: center; gap: 6px; pointer-events: none; }
.toast { border-radius: var(--r-pill); background: var(--ink); color: white; padding: 10px 16px; box-shadow: var(--float-shadow); }
.danger-toast { background: #521c27; }
.desktop-more, .mobile-more { position: relative; }
.desktop-more .menu-popover { left: 0; right: auto; }
.desktop-more .menu-popover a, .mobile-more .menu-popover a { padding: 5px 10px; }

@media (width < 720px) {
  .main { padding: 16px 14px 28px; }
  .org-footer { padding-bottom: calc(var(--bottom-nav-height) + 16px + env(safe-area-inset-bottom)); }
  .header-inner { padding: 8px 14px; gap: 8px; }
  .org-header .header-inner {
    grid-template-columns: minmax(0, 1fr) minmax(0, auto);
    gap: 0 8px; min-height: 56px; padding-inline: max(14px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-right));
  }
  .org-header :is(.brand, .account-menu), .desktop-nav { display: none; }
  .org-header .header-inner > .search { width: 100%; }
  .header-controls > select { max-width: 38vw; }
  .header-controls .icon-button { --h-icon: 44px; }
  .org-menu .menu-trigger { justify-content: start; min-width: 44px; padding-left: 0; }
  .tree-shell { height: calc(100dvh - var(--bottom-nav-height) - env(safe-area-inset-bottom)); }
  .tree-top {
    position: absolute; z-index: 2; top: 10px; left: var(--tree-left); right: var(--tree-right);
    display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; pointer-events: none;
  }
  .tree-toolbar { position: static; justify-content: flex-end; }
  .tree-path-area { position: static; }
  .tree-path-top { flex: none; max-width: 8ch; }
  .tree-top :is(.tree-tool-group, .tree-rank-legend, .tree-move-banner) { pointer-events: auto; }
  .tree-rank-legend { position: static; flex-wrap: nowrap; scrollbar-width: thin; }
  .tree-rank-legend li { flex: none; }
  .tree-move-banner { position: static; transform: none; width: 100%; max-width: none; justify-content: space-between; }
  .tree-top:has(.tree-move-banner:not([hidden])) .tree-rank-legend { display: none; }
  .switch button { min-height: 44px; min-width: 44px; padding-inline: 12px; }
  .bottom-nav {
    position: fixed; z-index: 3; inset: auto 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom)); gap: 2px;
    padding: 3px max(7px, env(safe-area-inset-right)) calc(3px + env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left));
    background: var(--surface); text-align: center;
  }
  .bottom-nav > a, .mobile-more > summary {
    display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px;
    height: 100%; padding: 0 3px; background: transparent; font-size: 12px; color: #4e5968;
  }
  .bottom-nav [aria-current] { color: var(--blue-text); font-weight: 700; }
  .menu-popover a, a.crumb { min-height: 44px; min-width: 44px; }
  .menu-popover a { display: flex; align-items: center; }
  a.crumb { display: block; line-height: 34px; }
  .mobile-more .menu-popover { top: auto; bottom: calc(100% + 6px); right: 0; text-align: left; }
  .table-wrap, .list-sort-notice { display: none; }
  .list-cards { display: grid; gap: 12px; }
  .list-mobile-tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .list-mobile-tools > * { padding-inline: 8px; }
  .tree-frame .member-name { min-height: 24px; }
  .panel { width: 100%; }
  .dialog-body { padding-bottom: calc(15px + env(safe-area-inset-bottom)); }
  #app:has(.bottom-nav) ~ #toasts { bottom: calc(var(--bottom-nav-height) + 8px + env(safe-area-inset-bottom)); }
}

@media (pointer: coarse), (width < 720px) {
  .site-footer nav a, .menu-popover a { display: inline-flex; align-items: center; min-height: 44px; }
  .switch button, .menu-popover button { min-height: 44px; }
}

.management-page, .period-items, .rank-items, .record-results, .import-controls, .invite-result {
  display: grid; gap: 14px; min-width: 0;
}
.narrow-page { width: min(100%, 680px); }
.section-card { display: grid; align-content: start; gap: 12px; min-width: 0; padding: clamp(14px, 3vw, 23px); overflow-wrap: anywhere; }
.section-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.management-heading { display: grid; gap: 3px; }
.management-heading > p, .management-card > p.muted { font-size: 14px; }
.management-card > h2, .period-item h2 { font-size: 17px; font-weight: 700; }
.management-card > h2 + p.muted { margin-top: -6px; }
.management-row-info { min-width: 0; overflow-wrap: anywhere; }
.management-row-info > .muted { display: block; font-size: 13px; }
.management-row-actions { display: flex; flex: none; gap: 6px; align-items: center; }
.management-row-actions .status-chip, .compact-button { white-space: nowrap; }
.management-row-actions .icon-tooltip, .rank-actions .icon-tooltip { right: 0; left: auto; transform: none; }
.management-row-actions .icon-tooltip { max-width: min(260px, calc(100dvw - 32px)); white-space: normal; overflow-wrap: anywhere; }
.period-status-line .status-chip { --control-fill: var(--surface); flex-wrap: wrap; }
.period-status-line .status-chip:has(button) { border-radius: var(--r-md); }
.period-item, .account-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; }
.period-status-line:has(.period-progress:empty), .invite-result:empty, .drop-zone [role="status"]:empty { display: none; }
.period-status-line { margin-top: 5px; }
.period-status-line button { min-height: 30px; }
.compact-button { min-height: 40px; padding-inline: 10px; font-size: 13px; }
.account-list { list-style: none; margin: 0; padding: 0; }
.account-row { min-height: 64px; padding: 8px 0; }
.account-row + .account-row { border-top: 1px solid var(--line); }
.account-profile { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.account-profile > .management-row-info { flex: 1 1 120px; }
.account-profile h2 { line-height: 1.2; }
.invite-panel .form > .secondary-submit { width: 100%; }
.record-table { min-width: 0; max-width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.record-table td { white-space: normal; overflow-wrap: anywhere; }
.record-table th { white-space: nowrap; }
.record-table select { max-width: min(100%, 480px); width: 100%; }
.flat-record-table { border-radius: 0; }
.flat-record-table table:has(th:nth-child(5)) { min-width: 520px; }
.flat-record-table :is(th, td):first-child { padding-inline-start: 4px; }
.flat-record-table :is(th, td):last-child { padding-inline-end: 4px; }
.billing-current h2 { font-size: 24px; }
.billing-amount { font-size: 32px; line-height: 1.2; font-weight: 700; }
.billing-amount small { font-size: 14px; font-weight: 600; }
.billing-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 8px; }
.billing-controls:empty { display: none; }
.billing-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 195px), 1fr)); gap: 12px; }
.billing-plan {
  --control-fill: var(--surface); display: grid; align-content: start; gap: 6px;
  padding: 16px; border: 2px solid transparent; border-radius: var(--r-md); background: var(--fill);
}
.billing-plan-current { border-color: var(--blue); }
.billing-plan-price { font-size: 20px; font-weight: 700; }
.billing-choices { min-width: 0; padding: 0; margin: 0; border: 0; }
.billing-choices .billing-plan { cursor: pointer; }
.billing-choices .billing-plan:has(:checked) { border-color: var(--blue); }
.billing-choice-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.billing-choice-title input { flex: none; margin: 0; }
.record-results > .pagination { padding-block: 0; }
.negative { color: var(--red-text); }
.rank-editor, .import-controls, .pv-entry-controls { min-width: 0; margin: 0; padding: 0; border: 0; }
.pv-entry-controls { display: grid; gap: 12px; }

.view-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.view-heading-meta { font-size: 13px; }
.view-panel { --control-fill: var(--fill); background: var(--surface); }
.view-panel .dialog-header h2 { font-size: 22px; }
.view-panel .dialog-header .icon-tooltip { left: auto; right: 0; transform: none; }
.view-panel .dialog-body > .primary, .view-panel .form > .primary { width: 100%; }
.view-panel .dialog-body > button:not(.primary), .view-panel .form > button:not(.primary) { justify-self: center; }
.view-panel .destructive { background: var(--red-text); }
.view-panel .destructive:hover { background: #a72030; }
.search-input { display: flex; flex: 1; position: relative; min-width: 0; }
.search-input > svg { position: absolute; left: 14px; top: 17px; color: var(--muted); pointer-events: none; }
.search-input > input[type="search"] { width: 100%; padding-inline-start: 41px; }
.search-input > .search-submit {
  position: absolute; left: 6px; top: 6px; color: var(--muted); background: transparent;
}
.search-input > .search-submit:hover { color: var(--ink); background: var(--fill); }
.search-submit > svg { width: 18px; height: 18px; }
.search-submit .icon-tooltip { left: 0; transform: none; }
.search-input:has(.search-submit) > input[type="search"] { padding-inline-start: 48px; }
.rank-chip, .status-chip {
  display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%;
  padding: 3px 9px; border-radius: var(--r-pill); background: var(--rank-chip, var(--fill));
  font-size: 13px; font-weight: 600;
}
.rank-chip-select { position: relative; }
.rank-chip-select > select { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; opacity: 0; cursor: pointer; }
.rank-chip-select:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
.rank-chip-select:has(select:disabled) { opacity: .6; }
.rank-chip-select:has(select:disabled) > select { cursor: default; }
.status-chip[data-status="active"] { color: #087f5b; background: #e5f5ef; }
.status-chip[data-status="left"] { color: var(--red-text); background: #fff1f2; }
.status-chip.accent-chip { color: var(--blue-text); background: var(--blue-soft); }
.status-chip.error-chip { color: var(--red-text); background: #fff1f2; }
.node-detail > .dialog-header { align-items: flex-start; padding: 20px 22px 10px; }
.node-detail > .dialog-body { gap: 18px; padding: 0 22px 22px; }
.node-detail-title { display: grid; gap: 1px; min-width: 0; overflow-wrap: anywhere; }
.node-detail-title h2 { font-weight: 700; line-height: 1.25; }
.node-detail-title .member-code { font-size: 13px; }
.node-detail-tools, .node-detail-meta { display: flex; align-items: center; gap: 6px; }
.node-detail-meta { flex-wrap: wrap; font-size: 13px; }
.node-detail-stats { display: grid; gap: 12px; min-width: 0; }
.node-detail-stats .metrics, .card-metrics {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px;
}
.node-detail-stats .metrics > div, .card-metrics > div { display: grid; gap: 2px; align-content: start; }
.node-detail-stats .metrics > div { justify-content: stretch; }
.node-detail-stats dt, .card-metrics dt { color: var(--muted); font-size: 13px; }
.node-detail-stats dd { font-size: 22px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.node-detail-sections { border-top: 1px solid var(--line); }
.node-detail-row + .node-detail-row { border-top: 1px solid var(--line); }
.node-detail-row > summary { display: flex; align-items: center; gap: 8px; min-height: 52px; list-style: none; }
.node-detail-row > summary::-webkit-details-marker { display: none; }
.node-detail-row > summary > svg { flex: none; color: var(--muted); }
.node-detail-row[open] > summary > svg:last-child { transform: rotate(180deg); }
.node-detail-row-title { flex: none; font-weight: 600; }
.node-detail-summary {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: end; font-size: 13px;
}
.node-detail-row-body { padding-bottom: 12px; }
.node-detail-row .breadcrumbs { flex-wrap: wrap; overflow: visible; }
.node-detail-row .crumb { display: inline-block; min-height: 36px; border-radius: var(--r-pill); }
.node-detail-row a.crumb { line-height: 26px; }
.node-detail-row .crumb[aria-current] { color: var(--ink); background: var(--fill); }
.list-search { display: flex; align-items: center; gap: 8px; }
.list-search > .search-input { max-width: 460px; }
.list-search > .icon-button .icon-tooltip { left: auto; right: 0; transform: none; }
.list-filter-count {
  position: absolute; top: -3px; right: -3px; min-width: 18px; padding-inline: 3px;
  border-radius: var(--r-pill); color: white; background: var(--blue-text); font-size: 11px; line-height: 18px;
}
.list-filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.list-filter-chips:empty { display: none; }
.list-filter-chip {
  --control-fill: var(--fill);
  display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%;
  padding: 2px 4px 2px 11px; border-radius: var(--r-pill); background: var(--surface); font-size: 13px;
}
.list-filter-chip > span { overflow-wrap: anywhere; }
.list-filter-chip .icon-button { --h-icon: 28px; }
.list-filter-chip .icon-button > svg { width: 14px; height: 14px; }
.list-filter-fields, .list-column-form { display: grid; gap: 12px; }
.list-rank-fields { display: contents; }
.list-filter-fields, .list-column-form fieldset { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.list-column-form fieldset {
  display: grid; min-width: 0; margin: 0; padding: 0; border: 0; gap: 2px 8px; overflow-wrap: anywhere;
}
.list-column-form legend { padding: 0; font-weight: 700; }
.list-column-form .check { min-height: 36px; }
.list-column-form input { flex: none; }
.view-table { border: 0; overflow: auto; }
.view-table :is(th, td) { border-color: var(--line); }
.view-table th, .view-table th button {
  color: var(--muted); font-size: 13px; font-weight: 600; background: transparent;
}
.view-table th button:hover { color: var(--ink); }
.view-table td { height: 52px; }
.view-table tbody tr:hover { background: #f9fafb; }
.view-table .number-cell, .pv-record-table :is(th, td):nth-child(2) { text-align: right; }
.list-member-card, .pv-record-card { display: grid; gap: 10px; padding: 14px; min-width: 0; overflow-wrap: anywhere; }
.list-member-card { cursor: pointer; }
.list-card-header, .pv-record-title { display: flex; align-items: start; justify-content: space-between; gap: 8px; min-width: 0; }
.pv-record-title > strong { flex: none; white-space: nowrap; }
.list-card-title, .pv-record-title > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 7px; min-width: 0; }
.list-card-title .list-ellipsis, .list-card-upline .list-ellipsis { max-width: 100%; }
.list-card-upline { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 6px; font-size: 13px; }
.list-card-upline button { justify-self: start; }
.card-metrics dd { margin: 0; font-weight: 700; }
.list-member-card > p { font-size: 13px; }

.pv-entry-controls legend { padding: 0 0 6px; font-weight: 700; }
.pv-entry-controls .field-heading { margin: 0; padding: 0 0 6px; font-size: 15px; font-weight: 700; }
.pv-entry-controls .search { max-width: none; }
.pv-entry-controls .search-results, .pv-record-filter .search-results { position: static; width: 100%; }
.pv-entry-fields { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.pv-selection {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: var(--h-input);
  padding: 4px 6px 4px 14px; border-radius: var(--r-pill); background: var(--control-fill);
}
.pv-selection-member { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }
.pv-selection .icon-tooltip { left: auto; right: 0; transform: none; }
.pv-amount { grid-template-columns: minmax(0, 1fr); }
.pv-amount input, .pv-unit { grid-area: 2 / 1; }
.pv-amount input { font-size: 28px; font-weight: 700; min-height: 62px; padding-inline-end: 90px; }
.pv-unit { align-self: center; justify-self: end; max-width: 72px; margin-inline-end: 14px; pointer-events: none; font-size: 13px; }
.switch-control { display: flex; justify-content: space-between; gap: 12px; align-items: center; min-height: 44px; cursor: pointer; }
.switch-control input {
  appearance: none; flex: none; width: 46px; height: 28px; margin: 0; padding: 3px;
  border-radius: var(--r-pill); background: #b0b8c1; cursor: pointer;
}
.switch-control input::before { display: block; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); content: ""; }
.switch-control input:checked { background: var(--blue-text); }
.switch-control input:checked::before { transform: translateX(18px); }
.settings-structure:disabled .switch-control, .settings-structure:disabled input { cursor: default; }
.settings-structure:disabled .switch-control input { opacity: .5; }
.pv-record-cards { display: none; }

@media (width >= 720px) {
  .node-detail { margin: auto; border-radius: var(--r-lg); }
}
@media (width < 720px) {
  .view-panel.panel, .list-filter-dialog { width: 100dvw; max-width: 100dvw; }
  .node-detail > .dialog-header, .node-detail > .dialog-body {
    padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right));
  }
  .node-detail > .dialog-body { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .node-detail-tools { gap: 4px; }
  .node-detail-tools .icon-button { --h-icon: 36px; }
  .node-detail-stats .metrics { grid-template-columns: minmax(0, .8fr) minmax(0, 1.4fr) minmax(0, .8fr); }
  .node-detail-stats .legs { grid-template-columns: minmax(0, 1fr); }
  .list-filter-dialog {
    margin: auto 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0;
  }
  .list-filter-dialog .dialog-body { padding-inline: max(17px, env(safe-area-inset-left)) max(17px, env(safe-area-inset-right)); }
  .list-page, .pv-page { margin-inline: max(0px, calc(env(safe-area-inset-left) - 14px)) max(0px, calc(env(safe-area-inset-right) - 14px)); }
  .list-page .page-heading { flex-wrap: nowrap; }
  .list-filter-chip .icon-button { --h-icon: 36px; }
  .card-metrics:has(> :nth-child(3)) { grid-template-columns: minmax(0, .8fr) minmax(0, 1.4fr) minmax(0, .8fr); }
  .pv-entry-fields { grid-template-columns: minmax(0, 1fr); }
  .pv-entry-controls .form > .primary {
    position: sticky; bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + 8px);
  }
  .pv-recent { --control-fill: var(--surface); padding: 0; background: transparent; }
  .pv-record-filter > .search { flex-basis: 100%; }
  .pv-record-table { display: none; }
  .pv-record-cards { display: grid; gap: 12px; }
}
@media (width < 720px) and (prefers-reduced-motion: no-preference) {
  .list-filter-dialog[open] { animation: panel-enter 170ms ease-out; }
}

.rank-editor { display: grid; gap: 12px; }
.rank-summary { display: flex; gap: 10px; align-items: center; min-height: 44px; list-style: none; }
.rank-summary::-webkit-details-marker { display: none; }
.rank-summary .rank-swatch { flex-basis: 12px; height: 12px; }
.rank-summary > svg { flex: none; color: var(--muted); }
.rank-item details[open] .rank-summary > svg { transform: rotate(180deg); }
.rank-summary-text { flex: 1; min-width: 0; }
.rank-summary-text strong { display: block; font-size: 17px; }
.rank-summary-conditions { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; }
.rank-detail { display: grid; gap: 14px; padding-top: 14px; }
.rank-identity, .rank-conditions, .rank-legs { display: grid; gap: 10px; min-width: 0; }
.rank-identity { grid-template-columns: minmax(65px, 1fr) minmax(100px, 3fr) minmax(62px, 1fr); }
.rank-conditions { grid-template-columns: repeat(auto-fit, minmax(min(100%, 205px), 1fr)); }
.rank-legs { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px; border-radius: 11px; background: var(--page); }
.rank-legs > small { grid-column: 1 / -1; }
.rank-field { min-width: 0; }
.rank-field input[type="color"] { width: 44px; height: 44px; min-height: 44px; padding: 5px; border-radius: 50%; cursor: pointer; }
.rank-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.rank-field input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.rank-field input[type="color"]::-moz-color-swatch { border: 0; border-radius: 50%; }
.rank-changes ul { display: grid; gap: 9px; margin: 0 0 10px; padding-left: 23px; }
.settings-structure { display: grid; gap: 8px; min-width: 0; border: 0; margin: 0; padding: 0; }
.settings-structure:disabled { color: var(--muted); }
.drop-zone {
  position: relative; display: grid; justify-items: center; gap: 8px; padding: 26px 12px;
  border-radius: var(--r-md); background: var(--fill); text-align: center; cursor: pointer;
}
.drop-zone > input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: inherit; }
.drop-zone:hover { background: #e8ecef; }
.drop-zone:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
.drop-zone:has(input:disabled) { cursor: default; }
.drop-zone .muted { font-size: 13px; }
.upload-progress { display: grid; gap: 6px; }
.upload-progress progress { width: 100%; accent-color: var(--blue); }
.import-messages { display: grid; gap: 6px; }
.import-page > :empty { display: none; }
.import-controls .flat-record-table td:first-child { width: 55%; }
.drawn-preview { gap: 18px; }
.drawn-summary { display: grid; gap: 8px; }
.drawn-grid, .drawn-comparison { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.drawn-comparison { min-width: 0; align-content: start; gap: 12px; }
.drawn-tree-pane, .drawn-warning-pane { min-width: 0; display: grid; align-content: start; gap: 8px; }
.drawn-sketch { display: grid; gap: 4px; }
.drawn-sketch-viewport { min-width: 0; max-height: 640px; overflow: auto; background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; }
.drawn-sketch-viewport svg { display: block; }
.drawn-sketch path, .drawn-sketch rect { stroke: #8795a5; }
.drawn-sketch path { fill: none; }
.drawn-sketch rect { fill: white; }
.drawn-sketch .drawn-sketch-connected { stroke: #273d58; stroke-width: 2.5; }
.drawn-sketch .drawn-sketch-contact { fill: #e7f0fc; stroke: #273d58; stroke-width: 1.5; }
.drawn-sketch .drawn-sketch-selected { fill: #fff0db; stroke: #c65f17; stroke-width: 3; }
.drawn-sketch text { fill: #28374a; font-size: 14px; white-space: pre; pointer-events: none; }
.drawn-sketch .drawn-sketch-fold { stroke-dasharray: 4 4; }
.drawn-sketch .drawn-sketch-omission { stroke: #f8fafc; stroke-width: 6; paint-order: stroke; }
.drawn-sketch-contacts { overflow-wrap: anywhere; }
.drawn-viewport {
  height: clamp(310px, 52vh, 600px); overflow: auto; border: 1px solid var(--line);
  border-radius: 12px; background: #f8fafc;
}
.drawn-board { position: relative; }
.drawn-board > svg { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.drawn-person {
  position: absolute; width: 162px; height: 62px; padding: 5px 9px; display: grid;
  align-content: center; justify-items: stretch; text-align: left; justify-content: stretch;
  background: var(--surface); border: 1px solid #9caec3;
}
.drawn-person strong, .drawn-person small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.drawn-person small { color: var(--muted); }
.drawn-person-warning { border: 2px solid #c65f17; background: #fff7eb; }
.drawn-actions { min-width: 0; border: 0; padding: 0; margin: 0; }
.drawn-warnings { display: grid; gap: 8px; list-style: none; margin: 0; padding: 0; }
.drawn-warning { display: grid; gap: 6px; padding: 8px 0 10px; }
.drawn-warning + .drawn-warning { border-top: 1px solid var(--line); }
.drawn-warning-location { justify-self: start; text-align: left; }
.drawn-exclude { color: var(--red-text); }
.drawn-pagination { margin-top: 10px; }
.drawn-commit, .drawn-commit .drawn-actions { display: grid; gap: 10px; }
@media (width >= 800px) {
  .drawn-warnings { max-height: clamp(310px, 52vh, 600px); overflow: auto; padding: 4px; }
  .drawn-grid { grid-template-columns: minmax(0, 1fr) minmax(260px, 30%); }
}
@media (width >= 1050px) {
  .drawn-comparison { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
}
@media (width < 800px) {
  .drawn-viewport { height: clamp(250px, 42vh, 420px); }
}
@media (pointer: coarse) {
  .drawn-preview button, .drawn-edit-panel button, .print-page-nav button { min-height: 44px; }
}
@media (width < 720px) {
  .mobile-more .menu-popover { max-height: min(70dvh, 420px); overflow: auto; }
  .rank-legs { grid-template-columns: minmax(0, 1fr); }
  .main:has(.management-heading, .auth-card, .wizard, .legal-document), .legal-main + .site-footer {
    padding-inline: max(14px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-right));
  }
  .legal-main + .site-footer { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
  .management-form > .primary {
    position: sticky; z-index: 2; bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + 8px);
  }
  #app:has(.management-form):has(.bottom-nav) ~ #toasts {
    bottom: calc(var(--bottom-nav-height) + var(--h-primary) + env(safe-area-inset-bottom) + 16px);
  }
  .period-item { flex-wrap: wrap; }
  .period-item > .management-row-info { flex: 1 1 150px; }
  .period-item > .management-row-actions { margin-inline-start: auto; }
}
