/* 인증 화면의 좌측 사이드바 셸. 820px 미만에서는 상단 그룹 랩으로 전환한다.
   **떠 있는 판(uiux B 안, 율미님 2026-10-06).** 바탕 위에 사이드바와 본문이 각각 둥근 흰 판으로 뜬다.
   본문 판에 `overflow` 를 걸지 마라 — 걸면 판 안의 `position: sticky`(상세 패널·폼 바닥 단추 줄)가 죽는다.
   **본문 폭은 판을 띄우기 전과 같다.** 사이드바 216 + 바깥 여백 8 × 3 + 판 안쪽 여백 20 × 2 = 280px 로,
   예전(사이드바 240 + 본문 좌우 20 × 2)과 같다. 처음엔 사이드바 240 · 여백 12 · 판 안쪽 28px 이었는데
   1440 에서 본문이 1160 → 1108px 로 줄어 한 줄이던 칸이 두 줄로 감기고(요청 상세 요약 · 임가공 신청 표 머리)
   1024 에서 코드 칸이 1px 씩 모자랐다 — 시험들이 칸 폭을 실측해 맞춰 둔 화면이라 본문 폭을 지킨다. */
.app-shell-authenticated { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: var(--space-4); min-height: 100vh; padding: var(--space-4); }
.app-shell-authenticated > main { min-width: 0; width: auto; margin: 0; padding: var(--space-card); border-radius: var(--radius-sheet); background: var(--surface); box-shadow: var(--shadow); }
.shell-sidebar { position: sticky; top: var(--space-4); z-index: 20; align-self: start; display: flex; flex-direction: column; width: 216px; height: calc(100vh - 2 * var(--space-4)); padding: 24px 16px 16px; border-radius: var(--radius-sheet); background: var(--surface); box-shadow: var(--shadow); }
.brand { flex: 0 0 auto; color: var(--text-strong); font: 600 18px/1 var(--font-display); letter-spacing: -.02em; text-decoration: none; }
/* 좌우로 판 가장자리까지 넓혀 둔다 — 현재 자리 막대(아래 `::before`)가 판 끝에 붙는데, 이 상자의
   `overflow-y: auto` 가 제 테두리 밖을 잘라서 넓히지 않으면 막대가 안 보인다. */
.shell-nav { position: relative; display: flex; flex: 1 1 auto; flex-direction: column; gap: 16px; min-height: 0; margin: 28px -16px 0; padding: 0 16px 24px; overflow-y: auto; scrollbar-color: var(--line-strong) transparent; scrollbar-width: thin; }
/* 아래쪽 흰 페이드 띠는 **없다** (율미님 2026-10-08 「여기 하얀줄 하나 있던데」, [[F144]]).
   2026 초 `5d13954` 가 넣었는데, 그때는 바로 앞 커밋(`88da4a2`)이 `scrollbar-width: none` 으로
   스크롤바를 **숨겨** 두어 이 띠가 유일한 「더 있다」 신호였다. 그 뒤 얇은 스크롤바가 되살아나
   신호는 둘이 됐는데 띠만 남아 **메뉴 글자를 지웠다** — 가운데쯤 스크롤하면 두 줄이 반쯤 하얗게
   날아가 「고장난 글자」로 읽힌다(율미님이 그렇게 보셨다). 잘린 줄은 그 자체가 「더 있다」이다.
   **다시 넣지 마라** — `tests/test_nav_no_fade.py` 가 글자 위에 덮는 것이 없는지 본다. */
.shell-nav::-webkit-scrollbar { width: 6px; }
.shell-nav::-webkit-scrollbar-track { background: transparent; }
.shell-nav::-webkit-scrollbar-thumb { border-radius: var(--radius); background: var(--line-strong); }
/* `interpolate-size` 는 상속된다 — 아래 `::details-content` 의 `height: 0 → auto` 를
   이을 수 있게 여기에 둔다. 이 성질을 모르는 브라우저는 선언을 그냥 버린다. */
.nav-group { display: flex; flex-direction: column; gap: 2px; interpolate-size: allow-keywords; }
/* 묶음 이름은 12px 이다. 11px 이던 것을 올렸다 — `ui_sweep` 의 글자 크기 검사가
   12px 미만을 잡는데 묶음이 넷일 때 이미 80건이었고, 임가공을 더하자 100건이
   되면서 게이트 4 가 「신규 20」으로 불합격했다(게이트1 판정 2026-09-07 §8).
   「원래 있던 스타일을 그대로 썼다」는 면제 사유가 아니다 — 그것을 허용하면
   새 버튼·새 화면마다 같은 결함을 늘려도 통과하게 되고 「신규 0」 계약이 사라진다. */
.nav-group-label { display: flex; align-items: center; gap: var(--space-4); padding: 6px 10px; border-radius: 8px; color: var(--text-muted); font: 600 13px/1.3 var(--font-body); letter-spacing: .02em; white-space: nowrap; cursor: pointer; list-style: none; }
/* 손잡이의 손닿음. 마우스를 올리면 배경이 은근히 밝아지고, 누를 때 한 단계 더 진해진다
   (R-059 오너 결정). 색은 링크가 쓰던 `--surface-hi` 와 `--line` 을 그대로 쓴다 — 같은
   자리에서 밝기를 새로 만들지 않는다. **이 둘은 움직임이 아니라 상태 표시다** — 움직임을
   끈 사람에게도 그대로 보여야 하므로 아래 `prefers-reduced-motion` 묶음 밖에 둔다. */
.nav-group-label:hover { color: var(--text-strong); background: var(--surface-hi); }
.nav-group-label:active { color: var(--text-strong); background: var(--line); }
/* 묶음 접기 표시. `<summary>` 의 기본 삼각형을 끄고 ▶ 를 직접 그린다 — 오너가 본 화면의
   모양이고, 브라우저마다 다른 기본 표식에 맡기지 않는다. `\FE0E` 는 글자 모양을 강제한다
   (없으면 윈도우 크롬이 ▶ 를 그림문자로 그려 색·크기가 따로 논다).

   **글자를 갈아끼우지 않고 돌린다(R-059).** ▶ 를 90도 돌리면 ▼ 가 된다. 갈아끼우면
   바뀌는 순간이 뚝 끊기는데, 돌리면 그 사이가 이어진다. **돌아간 결과는 움직임이 아니라
   모양이므로 여기 둔다** — 움직임을 끈 사람에게도 펼친 묶음은 ▼ 로 보여야 한다. 아래
   묶음으로 내려가는 것은 그 사이를 이어 주는 `transition` 뿐이다. */
.nav-group-label::-webkit-details-marker { display: none; }
.nav-group-label::before { flex: 0 0 auto; color: var(--text-muted); font-size: 8px; line-height: 1; content: "\25B6 \FE0E"; transform: rotate(0deg); }
.nav-group[open] > .nav-group-label::before { transform: rotate(90deg); }
/* 접기 표시는 오른쪽 끝으로 보내고, 왼쪽에는 묶음 아이콘을 둔다(B 안). 아이콘은 **템플릿에 넣지 않는다** —
   시험 셋이 `<summary>` 안쪽 글자를 묶음 이름으로 읽는다(`test_nav_collapse` 등). 그래서 묶음 이름
   (`data-nav-group`)으로 고른 선 그림을 가면(mask)으로 칠한다. 색은 글자색을 따른다. 그림은 이 파일 안의
   데이터라 네트워크 요청이 없다(`xmlns` 는 SVG 이름표일 뿐 주소를 부르지 않는다). */
.nav-group-label::before { order: 2; margin-left: auto; }
.nav-group-label::after { flex: 0 0 auto; order: -1; width: 16px; height: 16px; background: currentColor; content: ""; -webkit-mask: var(--nav-icon) center / 16px 16px no-repeat; mask: var(--nav-icon) center / 16px 16px no-repeat; }
.nav-group[data-nav-group="물류 대시보드"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1.5'/%3E%3C/svg%3E"); }
.nav-group[data-nav-group="임가공"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 3 8l9 5 9-5-9-5Z'/%3E%3Cpath d='m3 13 9 5 9-5'/%3E%3C/svg%3E"); }
.nav-group[data-nav-group="재고"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7.5 12 3l9 4.5v9L12 21l-9-4.5v-9Z'/%3E%3Cpath d='m3 7.5 9 4.5 9-4.5M12 12v9'/%3E%3C/svg%3E"); }
.nav-group[data-nav-group="오프라인"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 10v10h16V10'/%3E%3Cpath d='M3 10 5 4h14l2 6H3Z'/%3E%3Cpath d='M10 20v-5h4v5'/%3E%3C/svg%3E"); }
.nav-group[data-nav-group="수출"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3c3 3.5 3 14.5 0 18M12 3c-3 3.5-3 14.5 0 18'/%3E%3C/svg%3E"); }
.nav-group[data-nav-group="중국"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 21V3m0 1h15l-3 5 3 5H4'/%3E%3C/svg%3E"); }
.nav-group[data-nav-group="물류 코스트"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M8 12h8M12 8v8'/%3E%3C/svg%3E"); }
.nav-group[data-nav-group="데이터"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cellipse cx='12' cy='6' rx='8' ry='3'/%3E%3Cpath d='M4 6v12c0 1.7 3.6 3 8 3s8-1.3 8-3V6M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3'/%3E%3C/svg%3E"); }
.nav-group[open] > .nav-group-label { color: var(--text-strong); }
/* 링크를 담는 상자. `.nav-group` 이 아니라 여기에 정렬을 건다 — `<details>` 안쪽에
   브라우저가 끼워 넣는 상자(`::details-content`) 때문에 `.nav-group` 에 건 세로 정렬이
   링크에 닿지 않는다. 링크 사이 간격은 접기 전과 같다(2px). */
.nav-group-items { display: flex; flex-direction: column; gap: 2px; }

/* 항목이 살짝 떠오르며 차례로 나타난다(R-059). 자리 번호를 쓰는 것은 CSS 에 「몇 번째
   항목」 말고 세는 수단이 없어서다 — 이름으로 골라야 하는 것은 묶음이지 링크의 차례가
   아니다(R-024 는 기억·판정에 걸린 규칙이다). 여섯째부터는 한 값으로 묶어 끝을 막는다. */
@keyframes nav-item-rise { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
/* 여기서부터가 움직임이다. **CSS 만 쓴다 — 스크립트를 늘리지 않는다.**

   묶음 전체가 `prefers-reduced-motion: no-preference` 안에 있다. 움직임을 끈 사람에게는
   이 규칙이 통째로 안 걸리므로 `::details-content` 의 `height: 0` 도 같이 사라진다 —
   **즉시 열린다.** 사파리·구형 브라우저처럼 `::details-content` 를 모르는 곳에서도 같다:
   그 선택자를 못 읽으면 규칙이 버려지고 내용은 원래대로 즉시 열린다. 여닫는 일 자체는
   `<details>` 가 하므로 **움직임이 하나도 안 걸려도 메뉴는 그대로 돈다.** */
/* **화면을 옮길 때 되살린 묶음은 움직이지 않는다** (배치01 R34, 율미님 2026-09-16 「품번
   누를때마다 css가 작동하는데 ? … 굳이 정신없이 그렇게 작동할 이유가 있어 ?」). `base.html` 의
   기억 스크립트가 되살린 묶음에 `[data-nav-restored]` 를 달고, 사람이 그 손잡이를 누르는 순간
   걷는다. 그래서 아래 **여닫힘 움직임 셋(미끄러짐·▶ 회전·떠오름)은 그 표식이 없을 때만** 건다 —
   사람이 직접 누를 때는 전과 같이 돈다. 표식이 달린 동안도 `height: auto` 는 그대로라 열린
   모습은 첫 그림부터 같다. 손잡이 색·눌림은 여닫힘이 아니라 손닿음이라 표식과 무관하다.
   되살린 뒤 표식을 **스크립트가 스스로 걷지 않는** 까닭: 걷는 순간 `animation` 이 새로 걸려
   떠오름이 한 박자 늦게 그대로 재생된다. */
@media (prefers-reduced-motion: no-preference) {
  .nav-group-label { transition: background-color 140ms ease, color 140ms ease, transform 90ms ease; }
  .nav-group-label:active { transform: translateY(1px); }
  .nav-group:not([data-nav-restored]) > .nav-group-label::before { transition: transform 220ms cubic-bezier(.2, .7, .3, 1); }
  .nav-group::details-content { height: 0; overflow: hidden; }
  .nav-group:not([data-nav-restored])::details-content { transition: height 220ms cubic-bezier(.2, .7, .3, 1), content-visibility 220ms allow-discrete; }
  .nav-group[open]::details-content { height: auto; }
  .nav-group[open]:not([data-nav-restored]) > .nav-group-items > a { animation: nav-item-rise 260ms cubic-bezier(.2, .7, .3, 1) both; }
  .nav-group[open] > .nav-group-items > a:nth-child(2) { animation-delay: 35ms; }
  .nav-group[open] > .nav-group-items > a:nth-child(3) { animation-delay: 70ms; }
  .nav-group[open] > .nav-group-items > a:nth-child(4) { animation-delay: 105ms; }
  .nav-group[open] > .nav-group-items > a:nth-child(5) { animation-delay: 140ms; }
  .nav-group[open] > .nav-group-items > a:nth-child(n + 6) { animation-delay: 175ms; }
}
.shell-nav a { position: relative; padding: 7px 10px 7px 34px; border-radius: 8px; color: var(--text-muted); font-size: 13px; font-weight: 600; text-decoration: none; }
.shell-nav a:hover { color: var(--text-strong); background: var(--surface-hi); }
/* 현재 자리는 **색 · 바탕 · 판 끝 막대** 세 겹으로 알린다. 색을 못 가려도 막대 모양이 남는다. */
.shell-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.shell-nav a[aria-current="page"]::before { position: absolute; top: 50%; left: -16px; width: 4px; height: 22px; margin-top: -11px; border-radius: 0 4px 4px 0; background: var(--accent); content: ""; }
main a:not([class]) { color: var(--accent); }
main a:not([class]):hover { color: var(--accent-hover); }
button.primary-action, .button.primary-action, .button-link.primary-action { border-color: var(--accent); background: var(--accent); color: var(--accent-contrast); }
button.primary-action:hover, .button.primary-action:hover, .button-link.primary-action:hover { border-color: var(--accent-hover); background: var(--accent-hover); color: var(--accent-contrast); }
.account { display: flex; flex: 0 0 auto; flex-direction: column; align-items: stretch; gap: var(--space-4); margin-top: var(--space-7); padding-top: 16px; border-top: 1px solid var(--line); }
.account > a { color: var(--text); font-size: 12px; }
.account button { width: 100%; }
.user-meta { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.user-meta strong { display: block; color: var(--text-strong); font-size: 13px; }
@media (max-width: 820px) {
  /* 좁은 폭에서 메뉴는 예전처럼 **폭 가득 · 맨 위에 붙는 띠**다. 띄우지 않는 까닭: 수출 상세(`export.js`)가
     「위에 붙은 띠가 화면 폭 가득이면 그 높이만큼 비켜 스크롤한다」로 재는데, 띠를 띄우면 그 판정이
     빗나가 수정 구획 제목을 덮었다(시험 `test_pressing_edit_brings_the_form_into_view…[390]`). 본문만 판으로 뜬다. */
  .app-shell-authenticated { display: block; padding: 0; }
  .app-shell-authenticated > main { margin: var(--space-4); padding: var(--space-7) var(--space-6); border-radius: var(--radius); }
  .shell-sidebar { position: sticky; top: 0; width: 100%; height: auto; padding: 12px 18px; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; flex-direction: row; align-items: flex-start; flex-wrap: wrap; gap: var(--space-4) var(--space-5); }
  .shell-nav { order: 3; flex: 1 0 100%; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 4px; min-height: auto; margin: 0; padding: 0; overflow: visible; }
  /* 가로 띠에서는 판 끝이 없으니 막대 대신 밑줄로 — 색 말고 모양 하나는 남긴다. */
  .shell-nav a { padding: 7px 10px; }
  .shell-nav a[aria-current="page"]::before { display: none; }
  .shell-nav a[aria-current="page"] { box-shadow: inset 0 -2px var(--accent); }
  /* `max-width` 가 없으면 묶음이 제 링크만큼 넓어져 화면 밖으로 샌다. 480 에서 「재고」의
     링크 다섯이 한 줄에 서면서 오른쪽이 497px 까지 나갔다(실측). 폭을 화면 안으로 묶으면
     안쪽 링크가 알아서 다음 줄로 넘어간다 — 넓은 화면의 가로 띠 배치는 그대로다. */
  .nav-group { flex: 0 0 auto; max-width: 100%; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 2px; padding: 3px 5px; border: 1px solid var(--line); border-radius: var(--radius-control); }
  .nav-group-items { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .nav-group + .nav-group { margin-left: 6px; }
  .nav-group-label { padding: 3px 8px; }
  .account { flex-direction: row; align-items: center; gap: var(--space-4); margin: 0 0 0 auto; padding: 0; border-top: 0; }
  .account button { width: auto; }
}
@media (max-width: 640px) {
  .user-meta { display: none; }
  .shell-sidebar { padding-inline: 14px; }
  .nav-group + .nav-group { margin-left: 0; }
}
