/* 왼쪽 세로 사이드바 — app.py inject_side_nav 가 모든 페이지에 넣음. 색은 각 페이지의 CSS 변수(--bg2 등)를 그대로 써서 라이트 모드도 따라감
   ≥1024px 펼침(기본, 접기 버튼 → 아이콘 막대) · 769~1023px 아이콘 막대(마우스 올리면 펼침) · ≤768px 서랍 */
html[data-side]{--md-w:256px;--md-rail:64px}
html[data-side] body{padding-left:var(--md-w);box-sizing:border-box}
html[data-side].md-rail{--md-w:var(--md-rail)}

/* 옛 가로 네비 관련(탭 접기 버튼, 모바일 드로어 배경)은 숨김 */
html[data-side] #navToggleBtn,html[data-side] .nav-toggle-btn{display:none!important}
html[data-side] body.nav-open::before{display:none!important;content:none!important}

.md-side{position:fixed;top:0;left:0;bottom:0;width:var(--md-w);z-index:150;display:flex;flex-direction:column;
  background:var(--bg2,#141722);border-right:1px solid var(--border,#2d3150);color:var(--text,#f0f2ff);
  font-family:var(--sans,"Pretendard","IBM Plex Sans KR",system-ui,sans-serif);transition:width .18s ease,box-shadow .18s ease;box-sizing:border-box}
.md-sh{height:52px;flex:0 0 52px;display:flex;align-items:center;justify-content:space-between;padding:0 10px 0 16px;border-bottom:1px solid var(--border,#2d3150)}
.md-cap{font-family:var(--mono,monospace);font-size:11px;letter-spacing:.18em;color:var(--muted,#6b7299)}
.md-fold,.md-x{width:32px;height:32px;border:1px solid var(--border,#2d3150);border-radius:8px;background:transparent;color:var(--text2,#b8bdd8);cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0}
.md-fold::before{content:"";width:14px;height:12px;border:1.5px solid currentColor;border-radius:2px;box-shadow:inset 4px 0 0 -2.5px currentColor}
.md-fold:hover,.md-x:hover{color:var(--accent,#818cf8);border-color:var(--accent,#818cf8)}
.md-x{display:none;font-size:14px}
.md-list{flex:1;overflow-y:auto;overflow-x:hidden;padding:8px 10px 24px;display:flex;flex-direction:column;gap:1px;scrollbar-width:thin}

.md-a{display:flex;align-items:center;gap:10px;padding:4px 10px;border-radius:8px;color:var(--text,#f0f2ff);text-decoration:none;min-width:0}
.md-a:hover{background:rgba(129,140,248,.08)}
.md-a.on{background:rgba(129,140,248,.15)}
.md-a.on b{color:var(--accent,#818cf8)}
.md-ic{font-style:normal;flex:0 0 20px;width:20px;text-align:center;font-size:15px;line-height:1}
.md-tx{display:flex;flex-direction:column;min-width:0;flex:1}
.md-tx b{font-size:13.5px;font-weight:600;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.md-tx small{font-size:10.5px;line-height:1.3;color:var(--muted,#6b7299);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.md-sub .md-tx b{font-size:13px;font-weight:500}
.md-new{font-style:normal;flex:0 0 auto;font-size:9px;font-weight:700;letter-spacing:.05em;background:var(--red,#f87171);color:#fff;border-radius:8px;padding:1px 6px}

.md-g{margin-top:3px;display:flex;flex-direction:column}
.md-gh{display:flex;align-items:center;gap:10px;width:100%;padding:4px 10px;border:0;background:transparent;color:var(--text2,#b8bdd8);font:inherit;text-align:left;cursor:pointer;border-radius:8px}
.md-gh:hover{background:rgba(129,140,248,.06)}
.md-gh .md-tx b{font-size:12px;font-weight:700;letter-spacing:.03em}
.md-g.has-on .md-gh .md-tx b{color:var(--text,#f0f2ff)}
.md-dot{flex:0 0 6px;width:6px;height:6px;border-radius:50%;background:var(--red,#f87171)}
.md-cv{flex:0 0 7px;width:7px;height:7px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(45deg) translate(-2px,-2px);transition:transform .15s}
.md-g.closed .md-cv{transform:rotate(-45deg)}
.md-gl{display:flex;flex-direction:column;margin-left:19px;padding-left:8px;border-left:1px solid var(--border,#2d3150)}
.md-g.closed .md-gl{display:none}

.md-burger{display:none}
.md-scrim{display:none}

/* ── 아이콘 막대: 접기 버튼(md-rail) 또는 769~1023px. 마우스를 올리면 그 위로 펼쳐짐 ── */
html.md-rail .md-side:hover,html.md-rail .md-side:focus-within{width:256px;box-shadow:8px 0 32px rgba(0,0,0,.45)}
html.md-rail .md-side:not(:hover):not(:focus-within) .md-tx,
html.md-rail .md-side:not(:hover):not(:focus-within) .md-new,
html.md-rail .md-side:not(:hover):not(:focus-within) .md-cap,
html.md-rail .md-side:not(:hover):not(:focus-within) .md-gh{display:none}
html.md-rail .md-side:not(:hover):not(:focus-within) .md-sh{padding:0;justify-content:center}
html.md-rail .md-side:not(:hover):not(:focus-within) .md-list{padding:10px 8px 28px}
html.md-rail .md-side:not(:hover):not(:focus-within) .md-a{justify-content:center;padding:9px 0;position:relative}
html.md-rail .md-side:not(:hover):not(:focus-within) .md-g{border-top:1px solid var(--border,#2d3150);padding-top:4px}
html.md-rail .md-side:not(:hover):not(:focus-within) .md-gl{display:flex;margin:0;padding:0;border:0}
html.md-rail .md-side:not(:hover):not(:focus-within) .md-a .md-new{display:none}
html.md-rail .md-fold{transform:scaleX(-1)}

@media (min-width:769px) and (max-width:1023px){
  html[data-side]{--md-w:var(--md-rail)}
  html[data-side] .md-fold{display:none}
  html[data-side] .md-side:hover,html[data-side] .md-side:focus-within{width:256px;box-shadow:8px 0 32px rgba(0,0,0,.45)}
  html[data-side] .md-side:not(:hover):not(:focus-within) .md-tx,
  html[data-side] .md-side:not(:hover):not(:focus-within) .md-new,
  html[data-side] .md-side:not(:hover):not(:focus-within) .md-cap,
  html[data-side] .md-side:not(:hover):not(:focus-within) .md-gh{display:none}
  html[data-side] .md-side:not(:hover):not(:focus-within) .md-sh{padding:0;justify-content:center}
  html[data-side] .md-side:not(:hover):not(:focus-within) .md-list{padding:10px 8px 28px}
  html[data-side] .md-side:not(:hover):not(:focus-within) .md-a{justify-content:center;padding:9px 0}
  html[data-side] .md-side:not(:hover):not(:focus-within) .md-g{border-top:1px solid var(--border,#2d3150);padding-top:4px}
  html[data-side] .md-side:not(:hover):not(:focus-within) .md-gl{display:flex;margin:0;padding:0;border:0}
}

/* ── 모바일: '☰ 메뉴' 버튼 → 왼쪽 서랍 ── */
@media (max-width:768px){
  html[data-side] body{padding-left:0}
  html[data-side] .md-side{width:min(84vw,300px);transform:translateX(-100%);transition:transform .22s ease;box-shadow:none}
  html.md-open .md-side{transform:translateX(0);box-shadow:8px 0 32px rgba(0,0,0,.5)}
  html.md-open .md-scrim{display:block;position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:140}
  html.md-open,html.md-open body{overflow:hidden}
  .md-fold{display:none}
  .md-x{display:flex}
  .md-a,.md-gh{min-height:44px}
  .md-sub .md-tx small{display:none}
  .md-burger{display:flex;align-items:center;justify-content:center;gap:6px;width:100%;padding:9px 0;margin-top:8px;background:var(--bg2,#141722);
    border:1px solid var(--border,#2d3150);border-radius:8px;color:var(--text2,#b8bdd8);font-family:var(--mono,monospace);font-size:12px;letter-spacing:.05em;cursor:pointer}
}
@media print{.md-side,.md-scrim,.md-burger{display:none!important}html[data-side] body{padding-left:0}}
