/* 연구실 소모품 구매 신청 - 디자인
   레퍼런스: 어두운 남색 왼쪽 메뉴 + 밝은 본문 + 오른쪽 "나의 페이지" 3단 구성 */
:root {
  --pico-font-family: 'Pretendard', system-ui, -apple-system, 'Malgun Gothic', sans-serif;
  --brand: #17408b;
  --brand-dark: #0f2d66;
  --navy: #0f1d40;
  --bg: #f3f6fb;
  --line: #e3e9f4;
  --muted: #6b7a99;
  --soft: #e8eefb;

  /* Pico 기본 색을 우리 색으로 교체 */
  --pico-primary: var(--brand);
  --pico-primary-background: var(--brand);
  --pico-primary-border: var(--brand);
  --pico-primary-underline: rgba(23, 64, 139, .5);
  --pico-primary-hover: var(--brand-dark);
  --pico-primary-hover-background: var(--brand-dark);
  --pico-primary-hover-border: var(--brand-dark);
  --pico-primary-focus: rgba(23, 64, 139, .25);
  --pico-primary-inverse: #fff;
  --pico-secondary: #4b5d84;
  --pico-secondary-background: var(--soft);
  --pico-secondary-border: var(--soft);
  --pico-secondary-underline: rgba(75, 93, 132, .5);
  --pico-secondary-hover: var(--brand);
  --pico-secondary-hover-background: #d6e1f7;
  --pico-secondary-hover-border: #d6e1f7;
  --pico-secondary-focus: rgba(23, 64, 139, .2);
  --pico-secondary-inverse: var(--brand);
  --pico-border-radius: .6rem;
}
body { font-size: 15px; background: var(--bg); color: #1b2540; }
h1, h2, h3, h4 { color: #14224a; }

/* ---------- 3단 틀 ---------- */
.shell { display: grid; grid-template-columns: 230px minmax(0, 1fr) 300px; min-height: 100vh; }

/* 왼쪽: 메뉴 */
.side-nav {
  background: var(--navy); color: #cfd8ee; padding: 1.3rem .9rem;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: .6rem; padding: .2rem .5rem 1.4rem; color: #fff; font-weight: 700; font-size: .95rem; line-height: 1.25; }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; background: #cfe1ff; color: var(--navy); display: grid; place-items: center; flex: none; }
.brand .logo svg { width: 20px; height: 20px; }
.brand small { display: block; font-weight: 400; font-size: .68rem; color: #93a3c9; }
.side-nav .nav-item {
  display: flex; align-items: center; gap: .7rem; width: 100%; margin: 0 0 .2rem; padding: .6rem .85rem;
  border: 0; border-radius: 10px; background: transparent; color: #cfd8ee; font-size: .84rem; text-align: left; box-shadow: none;
}
.side-nav .nav-item:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side-nav .nav-item:focus-visible { outline: 2px solid #cfe1ff; outline-offset: 1px; }
.side-nav .nav-item.active { background: #cfe1ff; color: #0f2a5f; font-weight: 700; }
.side-nav .nav-item svg, .brand svg { stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-nav .nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-section { font-size: .66rem; letter-spacing: .04em; color: #7f90b8; padding: 1rem .9rem .4rem; }
.side-foot { margin-top: auto; padding: .9rem .6rem 0; font-size: .7rem; color: #93a3c9; border-top: 1px solid rgba(255, 255, 255, .1); }

/* 가운데: 현재 페이지 */
.main { padding: 1.5rem 1.7rem 2.5rem; min-width: 0; }
.page-head { margin-bottom: 1.1rem; }
.page-head h2 { font-size: 1.4rem; margin: 0 0 .15rem; }
.page-head p { margin: 0; color: var(--muted); font-size: .9rem; }

/* 오른쪽: 나의 페이지 */
.right {
  background: #fff; border-left: 1px solid var(--line); padding: 1.3rem 1.2rem;
  position: sticky; top: 0; height: 100vh; overflow: auto;
}
.profile { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 1rem; flex: none; }
.profile .nm { font-weight: 700; color: #14224a; font-size: .85rem; }
.profile button { margin: 0; padding: .12rem .55rem; font-size: .7rem; }
.side-card { border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1rem; margin-bottom: .9rem; }
.side-card h4 { font-size: .74rem; color: var(--muted); font-weight: 600; margin: 0 0 .5rem; }
.stat { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .2rem; }
.stat b { font-size: 1.3rem; color: var(--brand); }
.stat span { color: var(--muted); font-size: .72rem; }
.stat-sum { font-size: .8rem; color: #14224a; font-weight: 600; }
.recent { list-style: none; padding: 0; margin: 0; }
.recent li { padding: .5rem 0; border-top: 1px solid var(--line); font-size: .76rem; }
.recent li:first-child { border-top: 0; }
.recent .t { color: #14224a; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent .s { color: var(--muted); font-size: .7rem; }

/* ---------- 공통 부품 ---------- */
.badge { display: inline-block; padding: 0 .55rem; border-radius: 1rem; font-size: .74rem; line-height: 1.7; background: #e8eefb; color: #17408b; white-space: nowrap; font-weight: 600; }
.badge.leader { background: #ffe9a8; color: #5a4300; }
.badge.ai { background: #e3f4e8; color: #1b5e20; }
.badge.pending { background: #e1ecff; color: #17408b; }
.badge.cancelled { background: #eceff4; color: #6b7a99; }
.badge.submitted { background: #d9e4f7; color: #0f2d66; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem 1.2rem; margin-bottom: 1rem; box-shadow: 0 1px 2px rgba(15, 29, 64, .04); }
.panel > h3:first-child { font-size: 1.05rem; margin-bottom: .6rem; }
details.panel > summary { cursor: pointer; font-weight: 700; color: #14224a; list-style: none; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: '▾'; float: right; color: var(--muted); }
details.panel[open] > summary { margin-bottom: .8rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.mini { border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; background: #fafcff; }
.mini b { display: block; font-size: 1.5rem; line-height: 1.2; color: var(--brand); }
.mini span { font-size: .78rem; color: var(--muted); }
/* 설정류 화면: 카드를 2단으로 배치해 화면을 고르게 채움 (좁으면 1단) */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 1.2rem; align-items: stretch; }
.settings-grid.single { grid-template-columns: minmax(0, 1fr); }   /* 칸이 하나뿐인 탭(AI 설정)은 화면 폭을 다 쓴다 */
.settings-grid > div { min-width: 0; }
/* 두 열의 마지막 카드(.grow)가 남는 공간만큼 늘어나서 아래쪽 끝선이 맞는다 */
.settings-grid > .col { display: flex; flex-direction: column; }
.settings-grid > .col > .grow { flex: 1; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: minmax(0, 1fr); } }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: .3rem .8rem; box-shadow: 0 1px 2px rgba(15, 29, 64, .04); margin-bottom: 1rem; }
.panel .table-wrap { border: 0; padding: 0; box-shadow: none; margin-bottom: 0; }
table { font-size: .88rem; margin-bottom: 0; }
table th { color: var(--muted); font-weight: 600; font-size: .78rem; background: transparent; }
table td, table th { vertical-align: middle; }
td.num, th.num { text-align: right; white-space: nowrap; }
.thumb { width: 56px; height: 56px; object-fit: contain; background: #f3f5f9; border-radius: 8px; display: block; }
.thumb.empty { display: flex; align-items: center; justify-content: center; color: #aab3c8; font-size: .7rem; }
.small { font-size: .82rem; color: var(--muted); }
.quote { font-size: .8rem; color: #1b5e20; margin: -.5rem 0 .75rem; word-break: break-all; }
.warn { background: #fff4e5; border-left: 4px solid #f0a500; padding: .6rem .8rem; border-radius: 6px; font-size: .88rem; margin-bottom: .75rem; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.actions button { margin: 0; padding: .2rem .6rem; font-size: .8rem; }
.total-line { text-align: right; font-weight: 700; font-size: 1.05rem; color: #14224a; }
.row-gap { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row-gap > * { margin-bottom: 0; }
/* hidden 속성이 어떤 스타일에도 가려지지 않게 한다 (단계별 화면에서 많이 쓴다) */
[hidden] { display: none !important; }

/* ---------- 신청하기: 단계별 화면 ---------- */
/* 화면 폭 전체를 쓴다. 입력할 때마다 바뀌는 "신청 요약"은 맨 위 가로 막대(.sum-bar)에 있다 */
.wizard { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem 1.4rem; align-items: start; }
.wizard > .stepper { grid-column: 1 / -1; }
.wiz-main { min-width: 0; }
.field-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 1rem; }
.field-grid .span2 { grid-column: 1 / -1; }
/* 신청 요약 가로 막대: 스크롤해도 화면 맨 위에 붙어 따라온다 */
.sum-bar { position: sticky; top: .5rem; z-index: 20; display: flex; align-items: center; gap: .6rem 1.1rem; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: .65rem 1.1rem; margin-bottom: 1rem; box-shadow: 0 2px 10px rgba(15, 29, 64, .08); }
.sum-label { flex: none; font-size: .78rem; font-weight: 600; color: var(--muted); }
.sum-thumb { flex: none; width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: #f3f5f9; }
.sum-info { flex: 1; min-width: 0; }
.sum-name { font-weight: 700; color: #14224a; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sum-opt { margin-top: .05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sum-chip { flex: none; }
.sum-calc { flex: none; white-space: nowrap; }
.sum-amount { flex: none; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.sum-amount b { font-size: 1.35rem; color: var(--brand); white-space: nowrap; }
@media (max-width: 760px) {
  .sum-bar { flex-wrap: wrap; padding: .6rem .9rem; }
  .sum-label { display: none; }
  .sum-info { flex: 1 1 100%; }
}
@container (max-width: 900px) {
  .wizard { grid-template-columns: minmax(0, 1fr); }
  .field-grid { grid-template-columns: minmax(0, 1fr); }
}
.stepper { display: flex; gap: .5rem; list-style: none; padding: 0; margin: 0 0 1rem; }
.stepper li { flex: 1; margin: 0; padding: 0; list-style: none; }
.st { width: 100%; display: flex; align-items: center; gap: .6rem; margin: 0; padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--muted); font-size: .9rem; font-weight: 600; box-shadow: none; text-align: left; }
.st:disabled { opacity: .65; cursor: default; }
.st-no { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #e8eefb; color: var(--brand); font-size: .85rem; }
.st.active { border-color: var(--brand); background: #eef3fd; color: #14224a; }
.st.active .st-no { background: var(--brand); color: #fff; }
.st.done, .st.reached { color: #14224a; cursor: pointer; }
.st.reached .st-no { background: #cfdcf6; }
.st:not(:disabled):hover { border-color: #9fb4e0; }
.st.done .st-no { background: #1b7a46; color: #fff; font-size: 0; }
.st.done .st-no::before { content: '✓'; font-size: .85rem; }
.wiz-nav { display: flex; align-items: center; gap: .6rem; margin-top: 1rem; }
.wiz-nav .spacer { flex: 1; }
.wiz-nav button { margin: 0; min-width: 9rem; padding: .7rem 1.4rem; }
.final-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.4rem; }
@container (max-width: 700px) { .final-grid { grid-template-columns: minmax(0, 1fr); } .st-label { display: none; } }
.sub-title { font-weight: 700; color: #14224a; font-size: .95rem; }
.review-kv { grid-template-columns: 6.5rem minmax(0, 1fr); gap: .5rem .8rem; margin-top: .5rem; }
.review-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: .9rem; padding-top: .8rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.review-total b { font-size: 1.7rem; color: var(--brand); }

/* ---------- 신청하기 화면 (이전 2단 배치용, 일부 부품은 단계별 화면에서도 씀) ---------- */
.main { container-type: inline-size; }
.link-row { display: flex; gap: .6rem; align-items: stretch; }
.link-row input { margin: 0; flex: 1; min-width: 0; }
.link-row button { margin: 0; flex: none; white-space: nowrap; }
/* ---------- "AI가 읽은 내용" 패널: 구역별 카드로 나눠 훑어보기 쉽게 ---------- */
.inner-panel { margin-top: 1rem; padding: 1.1rem 1.2rem; background: #f8faff; border: 1px solid var(--line); border-radius: 14px; }
.ai-head { display: flex; align-items: center; gap: .6rem; }
.ai-head h4 { margin: 0; font-size: 1.1rem; }
.ai-sub { margin: .15rem 0 .9rem; }
.ai-sec { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .85rem 1rem; margin-bottom: .75rem; }
.ai-sec-title { font-weight: 700; color: #14224a; font-size: .95rem; margin-bottom: .6rem; }
.ai-sec-title .small { font-weight: 400; margin-left: .4rem; }
.kv { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: .6rem .8rem; margin: 0; }
.kv dt { color: var(--muted); font-size: .85rem; padding-top: .2rem; }
.kv dd { margin: 0; color: #14224a; overflow-wrap: anywhere; }
.kv .big { font-size: 1.3rem; color: var(--brand); }
.why { margin-top: .2rem; }
.why summary { font-size: .78rem; color: var(--muted); cursor: pointer; }
.why p { margin: .3rem 0 0; font-size: .8rem; color: #4b5d84; background: #f3f6fb; border-radius: 8px; padding: .45rem .65rem; overflow-wrap: anywhere; }
.opt-list { display: flex; flex-direction: column; gap: .4rem; }
.opt { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 0; padding: .6rem .85rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; transition: border-color .12s, background .12s; }
.opt:hover { border-color: #9fb4e0; }
.opt:has(input:checked) { border-color: var(--brand); background: #eef3fd; box-shadow: 0 0 0 1px var(--brand) inset; }
.opt:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.opt-name { font-size: .9rem; color: #14224a; overflow-wrap: anywhere; line-height: 1.45; }
.opt-price { flex: none; font-weight: 700; color: var(--brand); white-space: nowrap; font-size: .95rem; }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; color: var(--brand); background: #e1ecff; border-radius: 6px; padding: 0 .4rem; margin-right: .3rem; }
.mode-row { margin-top: .85rem; padding-top: .75rem; border-top: 1px dashed var(--line); }
.mode-row > .small { margin-bottom: .35rem; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid #c6d3ee; border-radius: 10px; overflow: hidden; max-width: 100%; }
.seg label { margin: 0; cursor: pointer; }
.seg span { display: block; padding: .42rem .85rem; font-size: .84rem; color: #4b5d84; background: #fff; }
.seg label + label span { border-left: 1px solid #c6d3ee; }
.seg label:has(input:checked) span { background: var(--brand); color: #fff; font-weight: 700; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: -2px; }
.mode-note { margin: .45rem 0 0; }
.price-result { background: #eef3fd; border: 1px solid #cfdcf6; border-radius: 12px; padding: .9rem 1.1rem; margin-bottom: .75rem; }
.pr-label { font-size: .82rem; color: var(--muted); }
.pr-value { font-size: 1.9rem; font-weight: 700; color: var(--brand); line-height: 1.25; }
.pr-how { margin-top: .15rem; }
.check-box { display: flex; gap: .65rem; align-items: flex-start; padding: .75rem 1rem; border: 1px solid #f0c36b; background: #fff9ec; border-radius: 12px; margin: 0 0 .75rem; cursor: pointer; }
.check-box[hidden] { display: none; }
#price-check { grid-column: 1 / -1; width: 100%; box-sizing: border-box; align-items: center; margin: .25rem 0 0; }   /* 신청 내용 박스 맨 아래, 가로 전체 */
.check-box input { margin: .2rem 0 0; flex: none; }
.inline-check { display: block; margin: .5rem 0 0; font-size: .88rem; }
.ai-foot { margin: .2rem 0 0; }
.dropzone { display: flex; align-items: center; justify-content: center; text-align: center; width: min(100%, 400px); aspect-ratio: 1 / 1; box-sizing: border-box; padding: .8rem; border: 2px dashed #c6d3ee; border-radius: 12px; background: #f8faff; cursor: pointer; color: var(--muted); transition: border-color .15s, background .15s; margin: 0; }
.dropzone:hover, .dropzone.over, .dropzone:focus-within { border-color: var(--brand); background: #eef3fd; }
.dropzone img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- 로그인 ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(135deg, var(--navy), #1a3470); }
.login-card { background: #fff; border-radius: 18px; padding: 2rem 1.8rem; width: 100%; max-width: 520px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.login-card h1 { font-size: 1.35rem; margin-bottom: .2rem; }
.login-card .sub { color: var(--muted); margin-bottom: 1.2rem; font-size: .9rem; }

#toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); background: #14224a; color: #fff; padding: .6rem 1rem; border-radius: .5rem; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; z-index: 50; }
#toast.show { opacity: .96; }
#toast.err { background: #b3261e; }

/* ---------- 화면이 좁을 때 ---------- */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 210px minmax(0, 1fr); }
  .right { grid-column: 2; position: static; height: auto; border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side-nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; gap: .3rem; padding: .7rem; }
  .brand { width: 100%; padding-bottom: .4rem; }
  .side-nav .nav-item { width: auto; padding: .5rem .8rem; margin: 0; }
  .nav-section, .side-foot { display: none; }
  .right { grid-column: 1; }
  .main { padding: 1.1rem 1rem 2rem; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- 통계 ---------- */
.chart-table { font-size: .85rem; margin: 0; }
.chart-table th, .chart-table td { padding: .3rem .6rem; }
.chart-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 1rem; background: #fff; }
.seg button { margin: 0; padding: .4rem 1.1rem; border: 0; border-radius: 0; background: transparent; color: var(--muted); font-size: .9rem; box-shadow: none; }
.seg button.on { background: var(--brand); color: #fff; font-weight: 600; }

/* ---------- 로그인 ---------- */
.login-card { word-break: keep-all; overflow-wrap: break-word; }   /* 한글을 단어 중간에서 끊지 않고 띄어쓰기에서 줄바꿈 */
.login-privacy { margin: 1.1rem 0 0; padding-left: 1.1rem; font-size: .72rem; line-height: 1.65; }
.login-privacy li { margin-bottom: .3rem; }
.login-privacy li:last-child { margin-bottom: 0; }
.login-privacy b { color: #3b4a6b; }

/* 양끝 칸(왼쪽 메뉴·오른쪽 나의 페이지)은 가운데보다 글씨를 작게 해서 시선이 가운데 화면에 모이게 한다 */
.side-card .small { font-size: .72rem; }
.side-card button { font-size: .78rem; }
.right .badge { font-size: .66rem; }
.ai-state { margin-bottom: .4rem; }

.item-missing { color: #b45309; font-weight: 600; }
.memo-cell { max-width: 180px; overflow-wrap: anywhere; font-size: .85rem; color: #3b4a6b; }

/* AI 분류 추천 확인 상자 (2단계, 분류 칸 아래) */
.cat-ai-note { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .7rem; margin: -.3rem 0 .85rem; padding: .6rem .85rem; border: 1px solid #cfe7d5; background: #eef7f0; border-radius: 10px; font-size: .86rem; }
.cat-ai-note[hidden] { display: none; }
.cat-ai-note button { margin: 0 .2rem; padding: .15rem .85rem; font-size: .82rem; }

/* 신청 목록의 품명 칸 둘째 줄: 분류는 배지, 품목은 보통 글자 (한 줄 유지) */
.cat-line { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .45rem; margin-top: .2rem; font-size: .84rem; color: #3b4a6b; }
.badge.cat { font-weight: 500; line-height: 1.6; }

/* ---------- 통계 (레퍼런스: 한 장의 카드 · 숫자 카드 · 점선으로 나눈 그래프 칸) ---------- */
.stats-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.2rem 1.3rem 1.3rem; box-shadow: 0 1px 2px rgba(15, 29, 64, .04); }
.stats-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; margin-bottom: 1rem; }
.stats-head h3 { margin: 0; font-size: 1.1rem; }
.stats-head-r { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .9rem; }
.stats-head-r .seg { margin-bottom: 0; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1.4rem; }
.kpi { border: 1px solid var(--line); border-radius: 14px; padding: .6rem 1rem; background: #fff; min-width: 0; }
.kpi-label { font-size: .84rem; font-weight: 600; color: #14224a; }
.kpi-label small { display: block; font-weight: 400; color: var(--muted); font-size: .72rem; }
.kpi-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .5rem; margin: .2rem 0 .1rem; font-size: 1.55rem; font-weight: 700; color: var(--brand); line-height: 1.25; }
.kpi-value small { font-size: .85rem; font-weight: 600; margin-left: -.35rem; }
.chip { display: inline-block; padding: 0 .55rem; border-radius: 1rem; font-size: .74rem; line-height: 1.7; font-weight: 600; background: #eef2fa; color: #3b4a6b; white-space: nowrap; }
.kpi-sub { margin: 0; }
.kpi-value .kpi-amt { font-size: 1.55rem; font-weight: 700; color: var(--brand); padding-left: .6rem; border-left: 2px solid var(--line); line-height: 1.2; }
.kpi-value .kpi-amt small { font-size: .85rem; font-weight: 600; margin-left: .1rem; }
.delta { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.delta-label { color: var(--muted); font-size: .78rem; }
.month-nav { display: flex; align-items: center; gap: .5rem; }
.month-nav h3 { margin: 0; }
.nav-arrow { margin: 0; width: 1.9rem; height: 1.9rem; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--brand); font-size: .7rem; line-height: 1; cursor: pointer; box-shadow: none; }
.nav-arrow:hover:not(:disabled) { background: #eef2fa; }
.nav-arrow:disabled { color: #c3cbdd; cursor: default; }
.stats-cols { display: grid; }
.stats-cols.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats-cols.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* 세 칸이 위 줄(제목+그래프)과 아래 줄("표 보기")을 공유한다(subgrid). 위 줄 높이는 가장 긴 칸에 맞춰지고, "표 보기"는 모든 칸에서 같은 높이에 놓인다.
   한 칸의 표를 열면 아래 줄만 늘어나므로 다른 칸의 "표 보기" 위치는 그대로다. */
.stats-cols { grid-template-rows: auto auto; }
.stats-col { min-width: 0; padding: 0 1.2rem; display: grid; grid-row: span 2; grid-template-rows: subgrid; row-gap: 0; }
.stats-col-main { min-width: 0; }
.stats-col:first-child { padding-left: 0; }
.stats-col:last-child { padding-right: 0; }
.stats-col + .stats-col { border-left: 1px dashed #c9d1e0; }
.stats-col-head { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; margin-bottom: .5rem; }
.stats-col-head h4 { margin: 0; font-size: .95rem; }
.stats-col-head b { color: var(--brand); font-size: 1.1rem; white-space: nowrap; }
.donut-wrap { max-width: 190px; margin: .5rem auto .3rem; }
.stats-cols.cols-2 .donut-wrap { max-width: 320px; margin-top: 1rem; }   /* 2칸(내 통계·구성원)은 칸이 넓어 막대 그래프가 커지므로 도넛도 키운다 */
.stats-cols.cols-2 .donut-legend { font-size: .95rem; max-width: 420px; margin-left: auto; margin-right: auto; }
.donut-legend { list-style: none; margin: .3rem 0 0; padding: 0; font-size: .85rem; }
.donut-legend li { display: flex; align-items: center; gap: .45rem; margin: 0; padding: .15rem 0; }
.donut-legend i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.donut-legend b { margin-left: auto; color: #14224a; }
.chart-details { margin: .2rem 0 0; padding: 0; border: 0; align-self: start; }
.stats-col-main > .donut-legend { margin-bottom: .6rem; }
.chart-details summary { cursor: pointer; margin: 0; padding: .2rem 0; font-size: .82rem; font-weight: 600; color: var(--brand); }
.chart-details[open] summary { margin-bottom: .4rem; }
/* 칸 폭이 좁으면(노트북 등) 세 칸을 위아래로 쌓는다. 쌓였을 때 그래프가 너무 커지지 않게 폭을 제한한다 */
@container (max-width: 1080px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-cols.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .stats-cols.cols-3 .stats-col { padding: 1rem 0; }
  .stats-cols.cols-3 .stats-col + .stats-col { border-left: 0; border-top: 1px dashed #c9d1e0; }
  .stats-cols.cols-3 { grid-template-rows: none; }
  .stats-cols.cols-3 .stats-col { display: block; grid-row: auto; }   /* 쌓였을 때는 칸마다 따로(공유 줄 없음) */
  .stats-cols.cols-3 .stats-col-main > svg { max-width: 460px; }
}
@container (max-width: 700px) {
  .stats-cols.cols-2 { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .stats-cols.cols-2 .stats-col { padding: 1rem 0; display: block; grid-row: auto; }
  .stats-cols.cols-2 .stats-col + .stats-col { border-left: 0; border-top: 1px dashed #c9d1e0; }
  .stats-cols .stats-col-main > svg { max-width: 460px; }
}