/* 컴포넌트 (#145, docs/11.design-system.md §4)
 * 이름은 모두 ui- 로 시작한다 - 예전 .card·.btn·.stat 과 섞이지 않게. 짝이 되는 매크로는 templates/ui/_macros.html.
 * 색·크기는 tokens.css 의 변수만 쓴다.
 */
@layer components {

/* ── 아이콘 (Lucide 스프라이트 static/icons.svg) ── */
.ui-icon { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; fill: none; }
.ui-icon--sm { width: 14px; height: 14px; }
.ui-icon--lg { width: 20px; height: 20px; }

/* ── 단추 ── */
.ui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--ctl-md); padding: 0 12px; border-radius: var(--r-md);
  font: 500 var(--fs-md)/1 var(--font-sans); white-space: nowrap; cursor: pointer; text-decoration: none;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); box-shadow: var(--sh-1);
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1);
}
.ui-btn:hover { background: var(--surface-2); text-decoration: none; }
.ui-btn:active { background: var(--surface-3); }
.ui-btn:disabled, .ui-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.ui-btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.ui-btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.ui-btn--primary:active { background: var(--accent); }
.ui-btn--ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-muted); }
.ui-btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.ui-btn--danger { color: var(--danger); }
.ui-btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.ui-btn--sm { height: var(--ctl-sm); padding: 0 10px; font-size: var(--fs-sm); }
.ui-btn--lg { height: var(--ctl-lg); padding: 0 16px; }
.ui-btn--icon { width: var(--ctl-md); padding: 0; }
.ui-btn--icon.ui-btn--sm { width: var(--ctl-sm); }

/* ── 입력칸 ── */
.ui-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-4); }
.ui-field__label { font-size: var(--fs-sm); font-weight: 500; color: var(--text); }
.ui-field__help { font-size: var(--fs-xs); color: var(--text-subtle); }
.ui-input, .ui-select, .ui-textarea {
  width: 100%; height: var(--ctl-md); padding: 0 10px; border-radius: var(--r-md);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 400 var(--fs-md)/1.4 var(--font-sans); box-shadow: none;
  transition: border-color var(--dur-1), box-shadow var(--dur-1);
}
.ui-textarea { height: auto; min-height: 88px; padding: 8px 10px; line-height: 1.6; resize: vertical; }
/* 체크박스·라디오 + 글 - 상자와 글을 한 줄에, 글이 길면 글만 줄바꿈 */
.ui-check { display: inline-flex; align-items: flex-start; gap: 8px; margin: 0; font-size: var(--fs-md); color: var(--text); cursor: pointer; line-height: 1.45; }
.ui-check > input { margin-top: 1px; }
.ui-check__hint { display: block; font-size: var(--fs-xs); color: var(--text-subtle); }
.ui-input::placeholder, .ui-textarea::placeholder { color: var(--text-subtle); }
.ui-input:focus, .ui-select:focus, .ui-textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }

/* ── 카드 ── */
.ui-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.ui-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5) 0; }
.ui-card__title { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.ui-card__sub { margin: 2px 0 0; font-size: var(--fs-sm); color: var(--text-subtle); }
.ui-card__body { padding: var(--sp-4) var(--sp-5); }
/* 머리·몸을 나누지 않는 단순 카드 - 안에 h2 와 설명(.muted)을 바로 쓴다(올린 문서·양식·구성원 쪽이 따로 만들던 것을 합쳤다, #166) */
.ui-card--pad { padding: var(--sp-5); margin-bottom: var(--sp-4); }
.ui-card--pad > h2, .ui-card--pad > div > h2, .ui-card--pad > div > div > h2 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.ui-card--pad .muted { color: var(--text-muted); font-size: var(--fs-md); }
.ui-card--pad > .ui-card__title { margin: 0 0 4px; }
.ui-card--pad > .ui-card__sub { margin: 0 0 14px; color: var(--text-muted); }
/* 수치 카드 묶음 */
.ui-stat--warn .ui-stat__value { color: var(--danger); }
.ui-stat-grid--fill { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }   /* 칸 수가 적을 때 폭을 채운다 */

/* ── 수치 ── */
.ui-stat-grid { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.ui-stat { padding: var(--sp-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.ui-stat__label { font-size: var(--fs-sm); color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.ui-stat__value { margin-top: 4px; font-size: var(--fs-2xl); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }

/* ── 표 ── */
.ui-table-wrap { overflow-x: auto; }
.ui-table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.ui-table th, .ui-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ui-table th { font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); background: var(--bg-subtle); white-space: nowrap; }
.ui-table tbody tr:hover { background: var(--surface-2); }
.ui-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.ui-table--compact th, .ui-table--compact td { padding: 6px 10px; }

/* ── 배지·칩 ── */
.ui-badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: var(--r-sm);
  font-size: var(--fs-xs); font-weight: 500; line-height: 1; white-space: nowrap;
  background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.ui-badge--accent  { background: var(--accent-soft);  color: var(--accent);  border-color: transparent; }
.ui-badge--success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.ui-badge--warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.ui-badge--danger  { background: var(--danger-soft);  color: var(--danger);  border-color: transparent; }
.ui-badge--info    { background: var(--info-soft);    color: var(--info);    border-color: transparent; }

.ui-chip { --c: var(--text-muted);
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: var(--r-md);
  font-size: var(--fs-xs); font-weight: 500; white-space: nowrap; color: var(--c);
  background: color-mix(in srgb, var(--c) 10%, transparent); border: 1px solid color-mix(in srgb, var(--c) 22%, transparent); }
.ui-chip--toggle { cursor: pointer; }
.ui-chip--toggle[aria-pressed="false"] { opacity: .45; }
.ui-chip--org { --c: var(--t-org); } .ui-chip--person { --c: var(--t-person); } .ui-chip--industry { --c: var(--t-industry); }
.ui-chip--tech { --c: var(--t-tech); } .ui-chip--problem { --c: var(--t-problem); } .ui-chip--deliv { --c: var(--t-deliv); }
.ui-chip--other { --c: var(--t-other); }
.ui-chip--c1 { --c: var(--t-c1); } .ui-chip--c2 { --c: var(--t-c2); } .ui-chip--c3 { --c: var(--t-c3); } .ui-chip--c4 { --c: var(--t-c4); } .ui-chip--c5 { --c: var(--t-c5); } .ui-chip--c6 { --c: var(--t-c6); } .ui-chip--c7 { --c: var(--t-c7); } .ui-chip--c8 { --c: var(--t-c8); }

/* ── 탭·분할 단추 ── */
.ui-tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-4); overflow-x: auto; }
.ui-tab { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; margin-bottom: -1px;
  font-size: var(--fs-md); font-weight: 500; color: var(--text-muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.ui-tab:hover { color: var(--text); text-decoration: none; }
.ui-tab--active { color: var(--text); border-bottom-color: var(--accent); }
.ui-segmented { display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); }
.ui-segmented > button, .ui-segmented > a {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 26px; padding: 0 8px;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-muted);
  font: 500 var(--fs-sm)/1 var(--font-sans); cursor: pointer; box-shadow: none; }
.ui-segmented > button:hover, .ui-segmented > a:hover { color: var(--text); text-decoration: none; }
.ui-segmented > [aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }

/* ── 풀다운 메뉴 - 상단 메뉴·프로필·테마·행 동작이 같이 쓴다. details 로 열어 스크립트 없이도 된다 ── */
.ui-dd { position: relative; }
.ui-dd > summary { list-style: none; cursor: pointer; }
.ui-dd > summary::-webkit-details-marker { display: none; }
.ui-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-2);
  animation: ui-pop var(--dur-2) var(--ease);
}
.ui-menu--right { left: auto; right: 0; }
.ui-menu--wide { width: 320px; }
.ui-menu__group { padding: 8px 10px 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-subtle); }
/* 묶음 안의 소제목(#399) - 성격이 다른 항목을 한 줄로 늘어놓지 않는다. 첫 소제목 위에는 선을 긋지 않는다 */
.ui-menu__section { padding: 8px 10px 2px; margin-top: 4px; border-top: 1px solid var(--border); font-size: 11px; font-weight: 600; color: var(--text-subtle); letter-spacing: .02em; }
.ui-menu > .ui-menu__section:first-child { margin-top: 0; border-top: 0; padding-top: 4px; }
.ui-drawer__panel .ui-menu__section { border-top: 0; margin-top: 0; padding-left: 14px; }
/* 공간 줄 - 옮기기 버튼 옆에 데모 제거 버튼(#352) */
.ui-menu__row { display: flex; align-items: center; gap: 2px; }
.ui-menu__row > form:first-child { flex: 1; min-width: 0; }
.ui-menu__row form { margin: 0; }
.ui-menu__remove { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: var(--r-md);
  background: none; color: var(--text-subtle); cursor: pointer; box-shadow: none; }
.ui-menu__remove:hover, .ui-menu__remove:focus-visible { background: var(--danger-soft); color: var(--danger); }
.ui-menu__item {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--r-md);
  border: 0; background: none; color: var(--text); font: 400 var(--fs-md)/1.35 var(--font-sans); text-align: left;
  cursor: pointer; text-decoration: none; box-shadow: none;
}
.ui-menu__item:hover, .ui-menu__item:focus-visible { background: var(--surface-2); text-decoration: none; outline: none; }
.ui-menu__item > .ui-icon { margin-top: 1px; color: var(--text-muted); }
.ui-menu__item--active { background: var(--accent-soft); }
.ui-menu__item--active > .ui-icon, .ui-menu__item--active .ui-menu__label { color: var(--accent); }
.ui-menu__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.ui-menu__label { font-weight: 500; }
.ui-menu__desc { font-size: var(--fs-xs); color: var(--text-subtle); }
.ui-menu__meta { margin-left: auto; font-size: var(--fs-xs); color: var(--text-subtle); white-space: nowrap; align-self: center; }
.ui-menu__sep { height: 1px; margin: 6px 4px; background: var(--border); }
.ui-menu form { margin: 0; }
@keyframes ui-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ── 상단 막대 ── */
.ui-topbar {
  position: sticky; top: 0; z-index: 40; flex-shrink: 0; height: var(--topbar-h);
  background: var(--surface); border-bottom: 1px solid var(--border);
  /* backdrop-filter 를 쓰지 않는다 - 쓰면 이 막대가 fixed 자손(서랍)의 기준 상자가 되어 서랍이 막대 높이에 갇힌다 */
}
.ui-topbar__inner { height: 100%; display: flex; align-items: center; gap: var(--sp-2); padding: 0 var(--gutter); }
.ui-topbar__brand { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: var(--sp-4); color: var(--text); }
.ui-topbar__brand:hover { text-decoration: none; }
.ui-topbar__mark { width: 24px; height: 24px; position: relative; flex-shrink: 0; }
.ui-topbar__mark .mark-canvas { width: 100%; height: 100%; display: block; }
.ui-topbar__name { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.ui-topbar__title { font-size: var(--fs-md); font-weight: 600; white-space: nowrap; }
.ui-topbar__space { font-size: var(--fs-xs); color: var(--text-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.ui-topbar__nav { display: flex; align-items: center; gap: 2px; min-width: 0; }
.ui-topbar__end { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }
.ui-topbar__burger { display: none; }

/* 주 메뉴 항목 - 단독 링크와 풀다운 머리가 같은 모양 */
.ui-nav-item {
  display: inline-flex; align-items: center; gap: 6px; height: var(--ctl-md); padding: 0 10px; border-radius: var(--r-md);
  font-size: var(--fs-md); font-weight: 500; color: var(--text-muted); white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background var(--dur-1), color var(--dur-1);
}
.ui-nav-item:hover, .ui-dd[open] > .ui-nav-item { color: var(--text); background: var(--surface-2); text-decoration: none; }
.ui-nav-item { position: relative; }
.ui-nav-item > .ui-icon:first-child { color: var(--text-subtle); transition: color var(--dur-1); }
.ui-nav-item:hover > .ui-icon:first-child { color: var(--text-muted); }
/* 지금 메뉴(#195) - 글자·아이콘을 강조색으로, 굵게, 아래에 강조 막대. 마우스를 올린 것(회색 바탕)과 섞이지 않게 */
.ui-nav-item--active, .ui-nav-item--active:hover { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.ui-nav-item--active > .ui-icon:first-child, .ui-nav-item--active:hover > .ui-icon:first-child { color: var(--accent); }
.ui-topbar__nav .ui-nav-item--active::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: calc((var(--topbar-h) - var(--ctl-md)) / -2);
  height: 2px; border-radius: 2px 2px 0 0; background: var(--accent);
}
.ui-nav-item .ui-caret { width: 14px; height: 14px; color: var(--text-subtle); transition: transform var(--dur-2) var(--ease); }
.ui-dd[open] > .ui-nav-item .ui-caret { transform: rotate(180deg); }
@media (hover: hover) and (min-width: 1024px) {
  /* 넓은 화면은 마우스를 올려도 열린다 - 머리와 메뉴 사이 틈을 메워 내려가는 길에 닫히지 않게 */
  .ui-topbar__nav .ui-dd:hover > .ui-menu { display: block; }
  .ui-topbar__nav .ui-dd > .ui-menu::before { content: ''; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
}
.ui-topbar__nav .ui-dd:not([open]) > .ui-menu { display: none; }

/* 좁은 화면(S·M) - 주 메뉴는 햄버거 → 서랍 */
@media (max-width: 1023px) {
  .ui-topbar__nav { display: none; }
  .ui-topbar__burger { display: inline-flex; }
}
.ui-drawer > summary { list-style: none; }
.ui-drawer > summary::-webkit-details-marker { display: none; }
.ui-drawer__panel {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0; z-index: 70; width: min(320px, 86vw); overflow-y: auto;
  padding: var(--sp-3); background: var(--surface); border-right: 1px solid var(--border); box-shadow: var(--sh-3);
  animation: ui-slide var(--dur-2) var(--ease);
}
.ui-drawer[open]::after { content: ''; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 65; background: var(--scrim); }
.ui-drawer__panel .ui-menu__group { padding-top: 14px; }
@keyframes ui-slide { from { transform: translateX(-12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 프로필 */
.ui-avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-full); flex-shrink: 0;
  font-size: var(--fs-sm); font-weight: 600; color: var(--on-accent); background: var(--accent); }
.ui-avatar--lg { width: 36px; height: 36px; font-size: var(--fs-lg); }
.ui-profile > summary { display: flex; align-items: center; gap: 8px; height: var(--ctl-md); padding: 0 6px 0 2px; border-radius: var(--r-full); }
.ui-profile > summary:hover, .ui-profile[open] > summary { background: var(--surface-2); }
.ui-profile__who { display: flex; flex-direction: column; line-height: 1.2; max-width: 180px; }
.ui-profile__who b { font-size: var(--fs-sm); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-profile__who small { font-size: var(--fs-xs); color: var(--text-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-profile__head { display: flex; gap: 10px; align-items: center; padding: 8px 10px 10px; }
/* 사용량(#321, _usage_panel.html) - 프로필 메뉴 안. 한도가 있으면 막대와 남은 양 */
.ui-usage { padding: 2px 10px 8px; min-height: 96px; min-width: 248px; font-size: var(--fs-sm); }
.ui-fold__sum { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; border-radius: var(--r-sm); }
.ui-fold__sum::-webkit-details-marker { display: none; }
.ui-fold__sum:hover { color: var(--text); }
.ui-fold__sum .ui-caret { transition: transform .15s; }
.ui-fold[open] > .ui-fold__sum .ui-caret { transform: rotate(180deg); }
.ui-fold__btn { width: 100%; border: 0; background: none; font: inherit; font-size: var(--fs-xs); font-weight: 600; text-align: left; }
.ui-fold__btn[aria-expanded="true"] .ui-caret { transform: rotate(180deg); }
.ui-fold__more { display: none; margin-left: 6px; margin-right: auto; font-weight: 400; color: var(--text-subtle); }
.ui-fold__btn[aria-expanded="false"] .ui-fold__more { display: inline; }
.ui-fold__btn .ui-caret { margin-left: auto; }
.ui-fold-rows[data-folded] .ui-fold-rows__extra { display: none; }
.ui-usage__retry { margin-left: 4px; white-space: nowrap; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.ui-usage__wait { display: flex; gap: 8px; align-items: center; color: var(--text-muted); padding: 8px 0; }
.ui-usage__plan { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.ui-usage__plan > span { font-weight: 600; color: var(--accent); }
.ui-usage__plan > a { font-size: var(--fs-xs); }
.ui-usage__row { margin-bottom: 8px; }
.ui-usage__line { display: flex; justify-content: space-between; gap: 12px; color: var(--text-muted); }
.ui-usage__line > b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-usage__line > b > em { font-style: normal; font-weight: 400; color: var(--text-subtle); font-size: var(--fs-xs); }
.ui-usage__row > small { display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--text-subtle); }
.ui-usage__bar { height: 4px; margin-top: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.ui-usage__bar > i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
.ui-usage__bar.is-high > i { background: var(--warning); }
.ui-usage__bar.is-full > i { background: var(--danger); }
.ui-profile__head div { min-width: 0; }
.ui-profile__head b { display: block; font-size: var(--fs-md); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-profile__head small { font-size: var(--fs-xs); color: var(--text-subtle); }
.ui-profile .ui-menu { width: 300px; }
@media (max-width: 639px) {
  .ui-profile .ui-profile__who, .ui-profile .ui-caret { display: none; }
  .ui-profile .ui-menu { position: fixed; top: calc(var(--topbar-h) + 4px); left: var(--sp-3); right: var(--sp-3); width: auto; }
}
.ui-menu .ui-segmented { display: flex; margin: 4px 6px 6px; }
.ui-menu .ui-segmented > button { flex: 1; }
/* 아이콘만 쓰는 분할 단추 - 상단 막대 테마 전환 */
.ui-segmented--icons > button, .ui-segmented--icons > a { width: 28px; padding: 0; }
@media (max-width: 639px) { .ui-theme-switch > [data-theme-choice="system"] { display: none; } }   /* 좁은 화면은 라이트·다크 둘만 */

/* ── 쪽 머리 ── */
.ui-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap;
  margin: 0 0 var(--sp-6); }
/* 제목 쪽이 남는 폭을 쓰고 설명이 길면 그 안에서 줄을 바꾼다 - 주 동작 단추는 늘 오른쪽에 남는다(#305). 좁은 화면에서는 단추가 아래로 내려간다 */
.ui-page-head > div:first-child { flex: 1 1 320px; min-width: 0; }
.ui-page-head__crumbs { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; font-size: var(--fs-sm); color: var(--text-subtle); }
.ui-page-head__crumbs a { color: var(--text-muted); }
.ui-page-head__title { margin: 0; font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.ui-page-head__desc { margin: 4px 0 0; font-size: var(--fs-md); color: var(--text-muted); }
.ui-page-head__actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; flex: 0 0 auto; max-width: 100%; }

/* ── 바닥글 ── */
.ui-footer { flex-shrink: 0; margin-top: auto; border-top: 1px solid var(--border); background: var(--bg-subtle);
  font-size: var(--fs-xs); color: var(--text-subtle); }
.ui-footer__inner { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap;
  padding: var(--sp-5) var(--gutter); max-width: calc(var(--page-max) + 2 * var(--gutter)); margin-inline: auto; line-height: 1.7; }
.ui-footer a { color: var(--text-muted); }
.ui-footer__links { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.app-version { font: 500 var(--fs-xs)/1.4 var(--font-mono); color: var(--text-subtle); white-space: nowrap; }

/* ── 알림 ── */
.ui-alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; margin-bottom: var(--sp-4);
  border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); font-size: var(--fs-md); color: var(--text); }
.ui-alert > .ui-icon { margin-top: 2px; }
.ui-alert--info    { background: var(--info-soft);    border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.ui-alert--info > .ui-icon { color: var(--info); }
.ui-alert--success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.ui-alert--success > .ui-icon { color: var(--success); }
.ui-alert--warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.ui-alert--warning > .ui-icon { color: var(--warning); }
.ui-alert--danger  { background: var(--danger-soft);  border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.ui-alert--danger > .ui-icon { color: var(--danger); }
.ui-banner { padding: 8px var(--gutter); font-size: var(--fs-sm); text-align: center; color: var(--text-muted);
  background: var(--accent-soft); border-bottom: 1px solid var(--border); }
.ui-banner b { color: var(--text); }
.ui-banner--warning { background: var(--warning-soft); }
.ui-banner--info { background: var(--accent-soft); }
/* 링크처럼 보이는 단추(폼으로 보내야 하는 동작 - 띠 안의 '이 공간 숨기기' 등) */
.ui-linklike { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
.ui-linklike:hover { color: var(--accent-hover); }

/* 다음 단계 한 줄(#315) - 이 화면에서 할 일이 끝난 뒤 어디로 가는지. 이름표 + 설명 + 단추 */
.ui-next { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: var(--sp-4);
  border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); font-size: var(--fs-sm); color: var(--text-muted); }
.ui-next__label { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--text); }
.ui-next__text { flex: 1 1 220px; min-width: 0; }
.ui-next__actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── 빈 상태 ── */
.ui-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: var(--sp-12) var(--sp-6); }
.ui-empty__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-lg);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); }
.ui-empty__title { margin: 4px 0 0; font-size: var(--fs-lg); font-weight: 600; }
.ui-empty__desc { margin: 0; max-width: 46ch; font-size: var(--fs-md); color: var(--text-muted); }

/* ── 진행 ── */
.ui-spinner { width: 16px; height: 16px; border-radius: var(--r-full); flex-shrink: 0;
  border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: ui-spin .7s linear infinite; }
@keyframes ui-spin { to { transform: rotate(360deg); } }
/* 기다리는 상태(#219) - 올리는 중·읽는 중·대기·분석 중 표시의 글자 앞에 작은 스피너. 서버·스크립트 어디서 그려도 클래스 하나만 붙인다 */
/* 바깥 display(쪽의 .pill 등)와 상관없이 같은 모양이 되게 스피너 자체를 inline-block 으로 */
.ui-wait::before { content: ''; display: inline-block; box-sizing: border-box; width: 10px; height: 10px; margin-right: 5px; vertical-align: -1px;
  border-radius: var(--r-full); border: 2px solid currentColor; border-right-color: transparent; animation: ui-spin .8s linear infinite; }
.ui-wait > .ui-icon { display: none; }   /* 단추 아이콘 자리를 스피너가 대신한다 */


/* ── 로그인·가입·계정 같은 가운데 상자 쪽(#145 3단계) - 단순 틀(_base_admin)의 머리 줄 + 상자 ── */
.ui-plainbar { height: var(--topbar-h); flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: 0 var(--gutter); background: var(--surface); border-bottom: 1px solid var(--border); }
.ui-plainbar .ui-topbar__brand { margin: 0; }
.ui-plainbar__end { display: flex; align-items: center; gap: var(--sp-2); }
.ui-auth-card { width: min(var(--w, 440px), 100%); margin: var(--sp-12) auto 0; padding: var(--sp-8);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--sh-2); }
.ui-auth-card + .ui-auth-card { margin-top: var(--sp-4); }
.ui-auth-card--danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.ui-auth-card h1 { margin: 0 0 4px; font-size: var(--fs-xl) !important; font-weight: 700; }
.ui-auth-card h2 { margin: 0 0 8px; font-size: var(--fs-lg); font-weight: 600; }
.ui-auth-card .ui-auth-card__sub { margin: 0 0 var(--sp-6); color: var(--text-muted); font-size: var(--fs-md); }
.ui-auth-card .ui-btn, .ui-auth-card .gsi-btn { width: 100%; }
.ui-divider-text { display: flex; align-items: center; gap: 10px; margin: var(--sp-4) 0 var(--sp-3); color: var(--text-subtle); font-size: var(--fs-xs); }
.ui-divider-text::before, .ui-divider-text::after { content: ''; flex: 1; height: 1px; background: var(--border); }
/* 가입 유형 선택(#364) */
.signup-type { display: grid; gap: 8px; margin: 0 0 16px; padding: 0; border: 0; }
.signup-type legend { padding: 0; margin-bottom: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); }
.signup-type label { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); cursor: pointer; }
.signup-type label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.signup-type input { width: auto; margin-top: 3px; }
.signup-type small { display: block; margin-top: 2px; color: var(--text-muted); font-size: var(--fs-sm); }
/* 로그인 화면의 아이디·비밀번호 영역(#333·#352) - 사전에 만든 계정 전용이라 접어 둔다 */
.auth-pw { margin-top: var(--sp-6); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
.auth-pw > summary { display: flex; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer; list-style: none;
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); border-radius: var(--r-lg); }
.auth-pw > summary::-webkit-details-marker { display: none; }
.auth-pw > summary:hover { color: var(--text); background: var(--surface-3); }
.auth-pw__caret { transition: transform var(--dur-2) var(--ease); transform: rotate(-90deg); }
.auth-pw[open] .auth-pw__caret { transform: none; }
.auth-pw[open] > summary { color: var(--text); border-bottom: 1px solid var(--border); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.auth-restricted { margin: var(--sp-4) 14px 0; font-size: var(--fs-sm); line-height: 1.6; color: var(--text-muted); }
.auth-pw__form { display: grid; gap: var(--sp-3); padding: var(--sp-4) 14px 14px; }
.auth-pw__form .ui-field { margin: 0; }
.auth-input { height: 44px; padding: 0 14px; font-size: var(--fs-md); border-radius: var(--r-md); background: var(--surface); }
.auth-input::placeholder { color: var(--text-subtle); }
@media (max-width: 639px) { .ui-auth-card { margin-top: var(--sp-6); padding: var(--sp-6); } }

/* ── 로딩 표시(#194, static/js/ui.js NW.loading) ─────────────────────────────── */
.nw-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 1000; pointer-events: none; overflow: hidden;
  opacity: 0; transition: opacity var(--dur-2) var(--ease); }
.nw-progress.is-on { opacity: 1; }
.nw-progress::before { content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; background: var(--accent);
  border-radius: 0 3px 3px 0; box-shadow: 0 0 8px var(--accent); animation: nw-progress 1.1s var(--ease) infinite; }
@keyframes nw-progress { 0% { left: -40%; width: 40%; } 60% { left: 40%; width: 50%; } 100% { left: 100%; width: 30%; } }
.nw-loading { position: fixed; top: calc(var(--topbar-h, 56px) + 10px); left: 50%; transform: translate(-50%, -6px); z-index: 1000;
  display: inline-flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px); padding: 7px 14px 7px 10px;
  border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--sh-2);
  font-size: var(--fs-sm); color: var(--text); opacity: 0; pointer-events: none; transition: opacity var(--dur-2), transform var(--dur-2); }
.nw-loading.is-on { opacity: 1; transform: translate(-50%, 0); }
/* 누른 단추 - 글자를 가리고 가운데 스피너. 다시 누를 수 없다 */
.is-busy { position: relative; pointer-events: none; color: transparent !important; }
.is-busy > * { visibility: hidden; }
.is-busy::after { content: ''; position: absolute; top: 50%; left: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: var(--r-full); border: 2px solid currentColor; border-color: var(--text-subtle); border-top-color: var(--accent);
  animation: ui-spin .7s linear infinite; }
.ui-btn--primary.is-busy::after { border-color: color-mix(in srgb, var(--on-accent) 40%, transparent); border-top-color: var(--on-accent); }
@media (prefers-reduced-motion: reduce) {
  .nw-progress::before { animation: none; left: 0; width: 100%; opacity: .6; }
  .is-busy::after { animation-duration: 2s; }
}
}

/* ── 화면 폭(#215, static/js/layout.js · ui/_macros col·split·layout_menu) ──────────────────────
 * 좌우 나눈 화면은 왼쪽 30~70%, 표는 고정 열(폭이 있는 열 - 끌어서 조절)과 가변 열(남는 폭)로 나눈다.
 * 표 폭이 폴더·내용마다 바뀌지 않게 table-layout: fixed. 좁은 화면에서는 덜 중요한 열(.col-lo)부터 숨긴다 */
[data-split] { display: grid; grid-template-columns: clamp(30%, var(--split, 60%), 70%) 9px minmax(0, 1fr); min-height: 0; }
[data-split] > * { min-width: 0; }
.ui-split__handle { position: relative; cursor: col-resize; touch-action: none; outline: none; }
.ui-split__handle::before { content: ''; position: absolute; top: 0; bottom: 0; left: 4px; width: 1px; background: var(--border); transition: background var(--dur-1), left var(--dur-1), width var(--dur-1); }
.ui-split__handle:hover::before, .ui-split__handle:focus-visible::before, .is-resizing .ui-split__handle::before { left: 3px; width: 3px; background: var(--accent); }
.is-resizing, .is-resizing * { cursor: col-resize !important; user-select: none; }
.ui-table-wrap:has(> .ui-cols) { container-type: inline-size; }
.ui-cols { table-layout: fixed; width: 100%; min-width: 640px; }
.ui-cols th, .ui-cols td { padding-left: 8px; padding-right: 8px; }
.ui-cols th[data-col] { position: relative; }
.ui-cols td { overflow-wrap: anywhere; }
/* 고정 열 손잡이 - 머리 칸 오른쪽 끝 8px(js 가 그 자리 누름을 본다) */
.ui-cols th[data-col][style*="width"]::after { content: ''; position: absolute; top: 0; bottom: 0; right: 0; width: 8px; cursor: col-resize;
  background: linear-gradient(var(--border-strong), var(--border-strong)) center / 2px 56% no-repeat; opacity: 0; transition: opacity var(--dur-1); }
.ui-cols thead:hover th[data-col][style*="width"]::after { opacity: .7; }
.ui-cols th[data-col][style*="width"]:hover::after { opacity: 1; }
@container (max-width: 1080px) { .ui-cols .col-lo { display: none; } }
@container (max-width: 820px) { .ui-cols .col-mid { display: none; } }
@media (max-width: 760px) {
  [data-split] { grid-template-columns: 1fr; }
  .ui-split__handle { display: none; }
}
.ui-layout-menu { position: relative; display: inline-block; margin-left: auto; }  /* 머리 줄 오른쪽 끝 - 창이 왼쪽으로 열린다 */
.ui-layout-menu > summary { list-style: none; display: inline-flex; align-items: center; gap: 4px; }
.ui-layout-menu > summary::-webkit-details-marker { display: none; }
.ui-layout-menu__pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; width: 260px; padding: 12px;
  display: grid; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-2); font-size: var(--fs-sm); }
.ui-layout-menu__pop p { margin: 0; color: var(--text-muted); font-size: var(--fs-xs); line-height: 1.5; }
.ui-layout-menu__pop label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.ui-layout-menu__pop input[type=radio] { width: auto; margin: 0; }
@media (max-width: 760px) { .ui-layout-menu { display: none; } }      /* 좁은 화면은 열·좌우 폭을 조절할 자리가 없다(#315) */

/* ── 문서 처리 진행 띠(#248, _processing.html) ── */
.ui-processing { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 var(--sp-4); padding: 12px 16px; border-radius: var(--r-lg);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); background: var(--accent-soft); font-size: var(--fs-sm); color: var(--text); }
.ui-processing[hidden] { display: none; }
.ui-processing.is-done { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); background: color-mix(in srgb, var(--success) 10%, var(--surface)); }
.ui-processing__link { margin-left: auto; font-size: var(--fs-xs); }
.ui-graph-empty { position: absolute; inset: 0; display: grid; place-items: center; z-index: 5; pointer-events: none; }
.ui-graph-empty > div { pointer-events: auto; max-width: 440px; text-align: center; padding: 24px 28px; border-radius: var(--r-xl);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--sh-2); }
.ui-graph-empty b { display: block; font-size: var(--fs-lg); margin-bottom: 8px; }
.ui-graph-empty p { margin: 0 0 14px; color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.6; }
.graph-float-band { position: absolute; top: 76px; left: 50%; transform: translateX(-50%); z-index: 12; width: min(760px, calc(100% - 32px)); }
.graph-float-band .ui-processing { margin: 0; box-shadow: var(--sh-2); }
/* 파일 칸 아래 안내(#258) - 크기를 넘었거나 올리기가 실패했을 때 */
.ui-file-error { margin: 6px 0 0; font-size: var(--fs-sm); color: var(--danger); }

/* 파일 업로드 영역(#283) - 끌어다 놓는 영역 + 옆의 실행 버튼. 좁은 화면에서는 버튼이 아래로 */
.ui-drop { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: stretch; }
.ui-drop__zone { position: relative; display: flex; align-items: center; gap: 14px; margin: 0; padding: 18px 20px; min-height: 76px; cursor: pointer;
                 border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--surface-2); color: var(--text);
                 transition: border-color .12s, background .12s; }
.ui-drop__zone:hover, .ui-drop__zone:focus-within { border-color: var(--accent); }
.ui-drop.is-over .ui-drop__zone { border-color: var(--accent); border-style: solid; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.ui-drop.has-file .ui-drop__zone { border-style: solid; background: var(--surface); }
.ui-drop__zone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.ui-drop__icon { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%;
                 background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.ui-drop__text { display: grid; gap: 2px; min-width: 0; }
.ui-drop__text b { font-weight: 600; font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-drop__text small { color: var(--text-muted); font-size: var(--fs-sm); }
.ui-drop__text small:empty { display: none; }
.ui-drop__go { align-self: stretch; height: auto; min-width: 132px; justify-content: center; }
.ui-drop--compact .ui-drop__zone { padding: 12px 16px; min-height: 60px; }
.ui-drop--stack { grid-template-columns: minmax(0, 1fr); }
.ui-drop--stack .ui-drop__zone { min-height: 120px; flex-direction: column; justify-content: center; text-align: center; }
.ui-drop--stack .ui-drop__go { min-height: 48px; }
.ui-drop + .ui-file-error { margin-top: 8px; }
@media (max-width: 639px) { .ui-drop { grid-template-columns: minmax(0, 1fr); } .ui-drop__go { min-height: 46px; } }

@layer components {
/* ── AI 챗봇 패널(#414) - 오른쪽에 열고 닫는다. 넓은 화면에서는 본문을 밀고, 좁은 화면에서는 본문 위에 뜬다 ── */
.nw-chat { display: none; position: fixed; z-index: 39; top: var(--topbar-h); right: 0; bottom: 0; width: min(400px, 100vw); flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--sh-2); }
.nw-chat[data-open] { display: flex; }
/* 열면 본문 위에 덮지 않고 본문을 옆으로 민다(사장님 2026-10-09) - 화면의 내용을 다 보면서 묻는다. 밀고 남는 폭이 너무 좁아지는
   1200px 아래에서만 본문 위에 뜬다. 패널 폭(--chat-w)은 1440px 아래에서 조금 줄인다.
   상단 막대는 화면 폭으로 모양을 정하므로, 밀고 남은 폭이 좁으면(화면 1424px 아래) 주 메뉴를 햄버거로 바꾸고 판 번호를 접는다 */
.nw-chat { --chat-w: 400px; }
@media (max-width: 1439px) { .nw-chat { --chat-w: 360px; } }
@media (min-width: 1200px) {
  .nw-chat { top: 0; z-index: 41; box-shadow: none; width: var(--chat-w); }
  body:has(.nw-chat[data-open]) { padding-right: 400px; }
}
@media (min-width: 1200px) and (max-width: 1439px) { body:has(.nw-chat[data-open]) { padding-right: 360px; } }
@media (min-width: 1200px) and (max-width: 1423px) {
  body:has(.nw-chat[data-open]) .ui-topbar__nav { display: none; }
  body:has(.nw-chat[data-open]) .ui-topbar__burger { display: inline-flex; }
}
@media (min-width: 1200px) and (max-width: 1679px) { body:has(.nw-chat[data-open]) .env-badge--inline .ver, body:has(.nw-chat[data-open]) .env-badge--inline .sep { display: none; } }
.nw-chat__head { display: flex; align-items: center; gap: 6px; height: var(--topbar-h); padding: 0 10px 0 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.nw-chat__head b { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; font-size: var(--fs-md); }
.nw-chat__x { display: inline-flex; padding: 6px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-muted); cursor: pointer; }
.nw-chat__x:hover { background: var(--surface-2); color: var(--text); }
.nw-chat__log { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.nw-chat__intro { color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.6; }
.nw-chat__intro[hidden] { display: none; }
.nw-chat__intro p { margin: 0 0 10px; }
.nw-chat__resume { display: grid; gap: 2px; justify-items: start; width: 100%; margin: 0 0 10px; padding: 9px 12px; text-align: left; border: 1px solid var(--accent); border-radius: var(--r-md); background: var(--accent-soft); color: var(--text); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.nw-chat__resume[hidden] { display: none; }
.nw-chat__resume b { color: var(--accent); }
.nw-chat__resume.is-empty { border-color: var(--border); background: var(--surface-2); cursor: default; }
.nw-chat__resume.is-empty b { color: var(--text-muted); }
.nw-chat__resume small { color: var(--text-muted); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nw-chat__chips { display: grid; gap: 6px; }
.nw-chat__chips button { text-align: left; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); color: var(--text); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.nw-chat__chips button:hover { border-color: var(--accent); color: var(--accent); }
.nw-chat__msg { max-width: 92%; padding: 8px 12px; border-radius: var(--r-lg); font-size: var(--fs-sm); line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.nw-chat__msg--user { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: var(--r-sm); }
.nw-chat__msg--assistant { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: var(--r-sm); }
.nw-chat__msg.is-error { color: var(--danger); }
.nw-chat__msg code { font-family: var(--font-mono); font-size: .92em; }
.nw-chat__dots { display: inline-flex; gap: 4px; padding: 4px 0; }
.nw-chat__dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-subtle); animation: nw-chat-dot 1s ease-in-out infinite; }
.nw-chat__dots i:nth-child(2) { animation-delay: .15s; } .nw-chat__dots i:nth-child(3) { animation-delay: .3s; }
@keyframes nw-chat-dot { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .nw-chat__dots i { animation: none; } }
.nw-chat__form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; padding: 10px 14px 6px; border-top: 1px solid var(--border); flex-shrink: 0; }
.nw-chat__form textarea { min-height: 56px; max-height: 160px; }
.nw-chat__note { margin: 0; padding: 0 14px 10px; color: var(--text-subtle); font-size: 11px; line-height: 1.5; flex-shrink: 0; }
.nw-chat-toggle[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
/* 답에서 가리킨 화면 요소 - 이름을 누르면 그 요소로 가서 강조한다. 표시는 body 위에 떠서 요소를 따라다닌다(static/js/chat_panel.js) */
.nw-chat__ref { display: inline; padding: 0 1px; margin: 0; border: 0; border-radius: 3px; background: none; color: var(--accent); font: inherit; font-weight: 600; line-height: inherit; text-align: left; white-space: normal;
  text-decoration: underline dashed; text-underline-offset: 3px; cursor: pointer; }
.nw-chat__ref:hover, .nw-chat__ref.is-on { background: var(--accent-soft); text-decoration-style: solid; }
.nw-chat__ref.is-gone { color: var(--text-muted); text-decoration-color: var(--border-strong); cursor: default; }
.nw-point { position: absolute; z-index: 60; pointer-events: none; border: 2px solid var(--accent); border-radius: var(--r-md); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); animation: nw-point 1.2s ease-in-out 3; }
.nw-point__tag { position: absolute; left: -2px; bottom: calc(100% + 8px); max-width: 260px; padding: 3px 10px; border-radius: var(--r-md); background: var(--accent); color: var(--on-accent);
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: var(--sh-2); }
.nw-point__tag::after { content: ''; position: absolute; left: 14px; top: 100%; border: 6px solid transparent; border-top-color: var(--accent); }
.nw-point--below .nw-point__tag { bottom: auto; top: calc(100% + 8px); }
.nw-point--below .nw-point__tag::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--accent); }
@keyframes nw-point { 0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); } 50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--accent) 10%, transparent); } }
@media (prefers-reduced-motion: reduce) { .nw-point { animation: none; } }
/* 단추의 글자는 자리가 넉넉할 때만. 1280px 아래에서는 상단 메뉴가 꽉 차서(단추 하나에 메뉴가 겹친다) 오른쪽 아래에 뜬 단추로 둔다.
   열려 있으면 숨긴다 - 패널에 닫기가 있다 */
@media (max-width: 1439px) { .nw-chat-toggle span { display: none; } }
.nw-chat-toggle[aria-expanded="true"] span { display: none; }
@media (max-width: 1279px) {
  .nw-chat-toggle { position: fixed; right: 16px; bottom: 16px; z-index: 38; width: 48px; height: 48px; padding: 0; justify-content: center; border-radius: 50%;
    background: var(--accent); color: var(--on-accent); border-color: transparent; box-shadow: var(--sh-2); }
  .nw-chat-toggle[aria-expanded="true"] { display: none; }
  .nw-chat-toggle .ui-icon { width: 22px; height: 22px; }
}
@media print { .nw-chat, .nw-chat-toggle { display: none !important; } }
}
