/* ============================================================
   ui/ui.css — 우상향 디자인 시스템 v5 (2026-09-02)

   한 파일이 바탕·레이아웃·헤더·컴포넌트를 전부 정한다. !important 없음.
   색은 ui/tokens.css 토큰만 쓴다(라이트/다크 자동). 페이지 전용은 ui/pages.css.
   참고: peerlist(실선·세그먼트) · lattice(흰 표면·초록) · copilot(네이비 다크·큰 숫자)
         fuselab(표 정렬: 글자 좌 · 숫자 우 · 버튼 가운데) · decisio(알약 필터 + 적용 표시)
   ============================================================ */

/* ── 0. 리셋 · 바탕 ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; scroll-padding-top: calc(var(--wsh-top-h) + 12px); }
body {
  margin: 0; min-height: 100%;
  background: var(--ground); color: var(--ink);
  font-family: var(--font); font-size: var(--fs); line-height: 1.5; letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-y: scroll; overscroll-behavior: none;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand-ink); }
img { max-width: 100%; display: inline-block; vertical-align: middle; }
button { font: inherit; color: inherit; }
::selection { background: var(--brand-soft-2); color: var(--brand-ink); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--radius-xs); }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
code { font-family: var(--mono); font-size: .92em; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ── 1. 셸: 왼쪽 레일(큰 분류) + 위쪽 바(작은 항목) ──
   마크업은 app.py build_shell. 왼쪽에서 무슨 일을 할지 고르고, 위에서 어느 화면인지 고른다. */
.wsh-side {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 2400; width: var(--rail-w);
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 10px 14px;
  background: var(--side-bg); border-right: 1px solid var(--side-line);
}
.wsh-mark { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 12px; }
.wsh-mark svg { width: 32px; height: 32px; }
.wsh-nav { display: flex; flex-direction: column; align-items: stretch; gap: 4px; width: 100%; }
.wsh-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  height: 62px; border-radius: var(--radius-sm); color: var(--side-ink); font-size: 11.5px; font-weight: 600;
  transition: background .13s ease, color .13s ease;
}
.wsh-nav a i { font-size: 17px; }
.wsh-nav a:hover { background: var(--surface-3); color: var(--side-ink-on); }
.wsh-nav a.on { background: var(--side-on-bg); color: var(--side-on-ink); box-shadow: var(--shadow-sm); }
.wsh-nav a.on i { color: var(--side-on-ink); }
.wsh-side-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; padding-top: 12px; border-top: 1px solid var(--side-line); }
.wsh-side-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: var(--radius-xs);
  background: transparent; color: var(--side-ink); font-size: 14px; cursor: pointer; transition: background .13s ease, color .13s ease;
}
.wsh-side-btn:hover { background: var(--surface-3); color: var(--side-ink-on); }
/* 테마 토글 — 해·달은 직접 그린 SVG (app.py SHELL_SUN·SHELL_MOON). 라이트에선 달, 다크에선 해가 보인다.
   해는 앰버로 물들이고 살짝 빛나게, 손을 얹으면 광선이 돌며 커진다(45° 돌면 제자리라 끝 모양은 그대로). */
.wsh-theme svg { display: block; width: 18px; height: 18px; }
.wsh-theme .wsh-ico-sun { display: none; color: var(--sun); filter: drop-shadow(0 0 3px var(--sun-glow)); transition: filter .25s ease; }
.wsh-theme .rays { transform-box: view-box; transform-origin: 50% 50%; transition: transform .5s cubic-bezier(.2, .7, .3, 1); }
.wsh-theme:hover .wsh-ico-sun { filter: drop-shadow(0 0 7px var(--sun-glow)); }
.wsh-theme:hover .rays { transform: rotate(45deg) scale(1.12); }
html[data-theme="dark"] .wsh-theme .wsh-ico-moon { display: none; }
html[data-theme="dark"] .wsh-theme .wsh-ico-sun { display: block; }
html[data-theme="dark"] .wsh-theme:hover { background: var(--st-warn-bg); }

.wsh-top {
  position: fixed; top: 0; left: var(--rail-w); right: 0; z-index: 2300;
  height: var(--wsh-top-h); display: flex; align-items: center; gap: 16px; padding: 0 26px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.wsh-wordmark { flex: 0 0 auto; display: inline-flex; align-items: baseline; gap: 8px; color: var(--ink); }
.wsh-wordmark:hover { color: var(--ink); }
.wsh-wordmark strong { font-size: 17px; font-weight: 700; letter-spacing: -0.03em; }
.wsh-wordmark small { font-size: 10px; font-weight: 600; letter-spacing: .13em; color: var(--muted); }
.wsh-wordmark::after { content: ""; align-self: center; width: 1px; height: 20px; margin-left: 8px; background: var(--line-2); }

.wsh-sub { display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.wsh-sub::-webkit-scrollbar { display: none; }
.wsh-sub a {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--radius-pill);
  color: var(--ink-3); font-size: 13.5px; font-weight: 500; white-space: nowrap; transition: background .12s ease, color .12s ease;
}
.wsh-sub a i { font-size: 12.5px; opacity: .7; }
.wsh-sub a:hover { background: var(--surface-3); color: var(--ink); }
.wsh-sub a.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
.wsh-sub a.on i { opacity: 1; }

.wsh-me { margin-left: auto; display: flex; align-items: center; gap: 9px; padding: 5px 6px 5px 12px; border-radius: var(--radius-pill); flex: 0 0 auto; }
.wsh-me:hover, .wsh-me.on { background: var(--surface-3); color: inherit; }
.wsh-me-copy { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; min-width: 0; }
.wsh-me-copy strong { color: var(--ink); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.wsh-me-copy span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.wsh-avatar { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12.5px; }

/* ── 2. 페이지 틀 ─────────────────────────────────────── */
.page { max-width: calc(1720px + var(--rail-w)); margin: 0 auto; padding: calc(var(--wsh-top-h) + 28px) 34px 64px calc(var(--rail-w) + 34px); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; }
.page-head .page-sub { margin-top: 4px; color: var(--ink-3); font-size: var(--fs-sm); }
/* 제목 옆 작은 안내 — 순위 갱신 시각 같은 한 줄. 좁으면 제목 아래로 내려간다 (2026-09-15) */
.page-title-row { display: flex; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; }
.page-title-note { color: var(--ink-3); font-size: var(--fs-xs); font-weight: 500; word-break: keep-all; }   /* --muted 는 대비가 낮아 작은 글씨엔 안 씀 */
.page-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.page-actions[hidden] { display: none; }   /* 권한에 따라 숨기는 버튼 묶음 — display:flex 가 hidden 속성을 이기지 않게 */
.page-stack { display: flex; flex-direction: column; gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: var(--fs-md); font-weight: 700; }
.panel-head .muted { font-size: var(--fs-sm); }
.panel-body { padding: 16px 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 3. 통계 타일 ─────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; }
.stat { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.stat span, .stat .stat-label { display: block; color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; }
.stat strong, .stat .stat-value { display: block; margin-top: 6px; font-size: var(--fs-2xl); font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat small, .stat .stat-sub { display: block; margin-top: 4px; color: var(--muted); font-size: var(--fs-xs); }
.stat.is-accent strong { color: var(--brand-ink); }

/* ── 4. 세그먼트 (상태 탭) ────────────────────────────── */
.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.seg > button, .seg > .seg-item {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border: 0; border-right: 1px solid var(--line);
  background: transparent; color: var(--sc, var(--ink-2)); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .12s;
}
.seg > button:last-child, .seg > .seg-item:last-child { border-right: 0; }
.seg > button:hover, .seg > .seg-item:hover { background: var(--surface-3); }
.seg > button.active, .seg > button.is-active, .seg > .seg-item.active {
  background: var(--sc-bg, var(--brand-soft)); color: var(--sc, var(--brand-ink)); box-shadow: inset 0 -2px 0 var(--sc, var(--brand)); font-weight: 700;
}
.seg .seg-count, .seg > button > span:last-child, .seg .count, .seg .status-count, .seg strong {
  min-width: 22px; padding: 1px 7px; border-radius: var(--radius-pill); background: var(--sc-bg, var(--surface-3)); color: var(--sc, var(--ink-3));
  font-size: var(--fs-xs); font-weight: 700; font-variant-numeric: tabular-nums; margin: 0;
}
.seg > button.active .seg-count, .seg > button.is-active .seg-count, .seg > .seg-item.active .count, .seg > button.active .count,
.seg > button.active .status-count, .seg > button.is-active .status-count, .seg > button.active strong, .seg > .seg-item.active strong { background: var(--surface); }
.seg .metric-icon { width: 22px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; background: var(--sc-bg, var(--surface-3)); color: var(--sc, var(--ink-3)); font-size: 11px; }
.seg .title { font-weight: 600; }
.seg small { display: none; }

/* 상태별 색 — 진행 초록 · 대기 파랑 · 테스트 보라 · 등록대기/전환 청록 · 종료 예정/수정/주의 호박
   · 예정/삭제/취소 빨강 · 수집 대기 회색 */
[data-status="active"], [data-summary-filter="ready"], [data-value="create"], [data-grade="1"] { --sc: var(--st-run); --sc-bg: var(--st-run-bg); }
[data-status="scheduled"], .purchase-status-boxes [data-status="pending"], [data-summary-filter="seo"], [data-grade="10"], [data-value="extend"] { --sc: var(--st-wait); --sc-bg: var(--st-wait-bg); }
[data-status="test"], [data-grade="100"], [data-value="test_create"] { --sc: var(--st-done); --sc-bg: var(--st-done-bg); }
.slot-category-bar [data-status="pending"], [data-value="convert"] { --sc: var(--st-plan); --sc-bg: var(--st-plan-bg); }
[data-status="ending"], [data-summary-filter="attention"], [data-value="update"] { --sc: var(--st-warn); --sc-bg: var(--st-warn-bg); }
[data-status="ended"], [data-value="delete"], [data-value="test_delete"] { --sc: var(--st-stop); --sc-bg: var(--st-stop-bg); }
[data-status="cancelled"] { --sc: var(--st-stop); --sc-bg: var(--st-stop-bg); }
[data-summary-filter="waiting"] { --sc: var(--st-idle); --sc-bg: var(--st-idle-bg); }
[data-status="all"], [data-summary-filter="all"], [data-grade="all"], [data-value="all"] { --sc: var(--ink-2); --sc-bg: var(--surface-3); }

/* ── 5. 툴바 · 필터 ───────────────────────────────────── */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.toolbar-group { display: inline-flex; align-items: center; gap: 6px; }
.toolbar-label { color: var(--muted); font-size: var(--fs-xs); font-weight: 600; margin-right: 2px; white-space: nowrap; }
.toolbar-spacer { flex: 1 1 auto; }
.toolbar .divider { width: 1px; height: 22px; background: var(--line-2); margin: 0 4px; }
.pills { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.pills button, .action-filter button {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--radius-pill);
  background: var(--surface); color: var(--sc, var(--ink-2)); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .12s;
}
.pills button:hover, .action-filter button:hover { background: var(--sc-bg, var(--surface-3)); border-color: var(--sc-bg, var(--line-2)); }
.pills button.active, .action-filter button.active { background: var(--sc-bg, var(--brand-soft)); border-color: var(--sc, var(--brand)); color: var(--sc, var(--brand-ink)); }
.action-filter { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.has-filter .btn-reset, .has-filter [id*="reset"], .has-filter [onclick*="reset"], .has-filter [onclick*="Reset"] { border-color: var(--brand); color: var(--brand-ink); }
.has-filter .btn-reset::after, .has-filter [id*="reset"]::after, .has-filter [onclick*="reset"]::after, .has-filter [onclick*="Reset"]::after {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); margin-left: 6px;
}

/* ── 6. 버튼 ──────────────────────────────────────────── */
.btn, .slot-btn, .icon-btn, .detail-button, .rank-action-btn, .btn-rank {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-2);
  font-size: var(--fs-sm); font-weight: 600; line-height: 1; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover, .slot-btn:hover, .icon-btn:hover, .detail-button:hover, .rank-action-btn:hover { background: var(--surface-3); color: var(--ink); }
.btn:disabled, .slot-btn:disabled, .detail-button:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary, .btn.modal-submit, .btn.active, .btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-on); }
.btn.primary:hover, .btn.modal-submit:hover, .btn.active:hover, .btn-primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); color: var(--brand-on); }
.btn.soft, .slot-btn.primary, .slot-btn.edit { background: var(--brand-soft); border-color: var(--brand-soft-2); color: var(--brand-ink); }
.btn.soft:hover, .slot-btn.primary:hover, .slot-btn.edit:hover { background: var(--brand-soft-2); border-color: var(--brand); color: var(--brand-ink); }
.btn.subtle, .btn.modal-cancel, .btn.clean, .btn.secondary, .slot-btn.gray { background: transparent; border-color: var(--line-2); color: var(--ink-3); }
.btn.subtle:hover, .btn.modal-cancel:hover, .btn.clean:hover, .btn.secondary:hover, .slot-btn.gray:hover { background: var(--surface-3); color: var(--ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-3); }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn.danger, .slot-btn.red, .slot-btn.danger, .btn-delete { border-color: var(--line-2); background: var(--surface); color: var(--st-stop); }
.btn.danger:hover, .slot-btn.red:hover, .slot-btn.danger:hover, .btn-delete:hover { background: var(--st-stop-bg); border-color: var(--st-stop-bg); color: var(--st-stop); }
.slot-btn.yellow { border-color: var(--line-2); color: var(--st-warn); }
.slot-btn.yellow:hover { background: var(--st-warn-bg); border-color: var(--st-warn-bg); }
.btn.sm, .btn-sm { height: 30px; padding: 0 10px; font-size: var(--fs-xs); }
.btn.lg { height: 42px; padding: 0 18px; font-size: var(--fs); }
.btn.icon { width: 36px; padding: 0; }
.btn i, .slot-btn i { font-size: 12px; }
.excel-btn { color: var(--ink-2); }
.checked-count { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 11px; border-radius: var(--radius-pill); background: var(--surface-3); color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; }
.checked-count.is-on { background: var(--brand-soft); color: var(--brand-ink); }

/* 선택 후 나타나는 일괄 작업 바 */
.bulkbar {
  position: fixed; left: calc(50% + var(--rail-w) / 2); bottom: 24px; z-index: 2100; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; border: 1px solid var(--line-2); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-lg); transition: opacity .16s, transform .16s;
}
.bulkbar.is-on { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.bulkbar .bulkbar-count { font-size: var(--fs-sm); font-weight: 700; color: var(--brand-ink); white-space: nowrap; margin-right: 6px; }
.bulkbar .bulkbar-count b { font-variant-numeric: tabular-nums; }

/* ── 7. 입력 ──────────────────────────────────────────── */
input[type="text"], input[type="search"], input[type="number"], input[type="email"], input[type="password"], input[type="url"], input:not([type]),
select, textarea, .form-input, .form-select, .select-box, .slot-date, .search input {
  height: 36px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  font: inherit; font-size: var(--fs-sm); font-weight: 500; transition: border-color .12s, box-shadow .12s; max-width: 100%;
}
textarea, textarea.form-input { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); font-weight: 400; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
input:disabled, select:disabled, .form-input:disabled { background: var(--surface-3); color: var(--ink-3); }
input[readonly] { background: var(--surface-2); }
select, .select-box, .form-select { padding-right: 30px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; }
html[data-theme="dark"] select, html[data-theme="dark"] .select-box, html[data-theme="dark"] .form-select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238c95a6' stroke-width='2.5'><path d='M6 9l6 6 6-6'/></svg>"); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; margin: 0; }
.search { position: relative; display: inline-flex; align-items: center; }
.search i { position: absolute; left: 11px; color: var(--muted); font-size: 12px; pointer-events: none; }
/* 검색칸 폭은 초점 여부로 바꾸지 않는다 — 예전엔 초점일 때만 40px 넓어서, 입력하고 바로 옆 검색·조회 버튼을 누르면
   초점이 빠지는 순간 칸이 줄어 버튼이 밀리고 클릭이 빗나갔다(2026-09-15 실측). 초점 표시는 테두리·그림자(input:focus)가 한다. */
.search input { padding-left: 30px; width: 280px; }
.search.wide input { width: 360px; }
.date-nav, .slot-date:has(button) { display: inline-flex; align-items: center; gap: 2px; height: 36px; padding: 0 4px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); }
.date-nav button, .slot-date button { width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-3); font-size: 15px; cursor: pointer; }
.date-nav button:hover, .slot-date button:hover { background: var(--surface-3); color: var(--ink); }
.date-nav span, .slot-date span, .analysis-date-picker strong { min-width: 96px; text-align: center; font-size: var(--fs-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.analysis-date-picker { display: inline-flex; align-items: center; gap: 2px; height: 36px; padding: 0 4px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); }
.analysis-date-picker button { width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-3); font-size: 15px; cursor: pointer; }
.analysis-date-picker button:hover { background: var(--surface-3); color: var(--ink); }
.analysis-date-picker button:disabled { color: var(--line-2); cursor: not-allowed; background: transparent; }
.field, .form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-row:last-child { margin-bottom: 0; }
.field-label, .form-label { color: var(--ink-2); font-size: var(--fs-xs); font-weight: 600; }
.form-input, .form-select { width: 100%; }
.form-hint { color: var(--muted); font-size: var(--fs-xs); }
.checkbox { position: relative; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.checkbox input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; }
.checkbox-mark { width: 16px; height: 16px; border: 1px solid var(--line-2); border-radius: 4px; background: var(--surface); display: inline-block; position: relative; transition: background .1s, border-color .1s; }
.checkbox input:checked + .checkbox-mark { background: var(--brand); border-color: var(--brand); }
.checkbox input:checked + .checkbox-mark::after { content: ""; position: absolute; left: 5px; top: 2px; width: 4px; height: 8px; border: solid var(--brand-on); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.checkbox input:disabled + .checkbox-mark { opacity: .4; }
.checkbox input:focus-visible + .checkbox-mark { box-shadow: 0 0 0 3px var(--brand-ring); }
.slot-type-tabs { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; }
.slot-type-btn { height: 34px; padding: 0 16px; border: 0; border-right: 1px solid var(--line); background: var(--surface); color: var(--ink-3); font-weight: 600; cursor: pointer; }
.slot-type-btn:last-of-type { border-right: 0; }
.slot-type-btn.active { background: var(--brand-soft); color: var(--brand-ink); }
.slot-type-btn:disabled { opacity: .45; cursor: not-allowed; }
.slot-test-text { color: var(--muted); font-size: var(--fs-xs); margin: 4px 0 0; }

/* ── 8. 배지 · 칩 ─────────────────────────────────────── */
.badge, .status-badge, .state-chip, .status-chip, .tag {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--radius-pill);
  background: var(--st-idle-bg); color: var(--st-idle); font-size: var(--fs-xs); font-weight: 700; line-height: 1; white-space: nowrap;
}
.badge::before, .status-badge::before, .status-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 6px; }
.status-badge.is-pending, .status-badge.is-대기, .badge.blue, .badge.wait, .badge.waiting { background: var(--st-wait-bg); color: var(--st-wait); }
.status-badge.is-active, .status-badge.is-received, .status-badge.is-진행, .status-badge.ready, .badge.green, .badge.run { background: var(--st-run-bg); color: var(--st-run); }
.status-badge.is-completed, .status-badge.is-완료, .badge.purple, .badge.done { background: var(--st-done-bg); color: var(--st-done); }
.status-badge.waiting, .badge.gray { background: var(--st-idle-bg); color: var(--st-idle); }
.status-badge.is-cancelled, .status-badge.is-취소 { background: var(--st-stop-bg); color: var(--st-stop); }
.status-badge.is-failed, .status-badge.is-실패, .status-badge.stopped, .badge.red, .badge.cancel { background: var(--st-stop-bg); color: var(--st-stop); }
.status-badge.warning, .badge.yellow, .badge.warn { background: var(--st-warn-bg); color: var(--st-warn); }
.tag { background: var(--brand-soft); color: var(--brand-ink); }
.tag::before { display: none; }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: var(--radius-pill); background: var(--surface-3); color: var(--ink-2); font-size: var(--fs-xs); font-weight: 600; }
.pill.up { background: var(--st-run-bg); color: var(--up); } .pill.down { background: var(--st-stop-bg); color: var(--down); }
.pill.same { background: var(--st-idle-bg); color: var(--st-idle); } .pill.no { background: var(--st-warn-bg); color: var(--st-warn); } .pill.out { background: var(--st-done-bg); color: var(--st-done); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }

/* ── 9. 표 ────────────────────────────────────────────── */
.table-wrap, .table-scroll { overflow: auto; }
.panel > .table-wrap, .panel > .table-scroll { border-radius: 0; }
table.table, .data-table, .stat-table, .analysis-table, .purchase-table, .slot-detail-table, .purchase-log-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.data-table thead th, .table thead th, .analysis-table th {
  position: sticky; top: 0; z-index: 1; padding: 10px 12px; background: var(--surface-3); color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600;
  text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line);
}
.data-table thead th i, .th-stack i, .heading-with-icon i { color: var(--muted); font-size: 11px; margin-right: 5px; }
.heading-with-icon, .th-stack { display: inline-flex; align-items: center; gap: 4px; }
.data-table tbody td, .table tbody td, .analysis-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: middle; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table td.wrap, .data-table td.desc-cell, .purchase-settlement-table td:nth-child(6), .purchase-log-table td:nth-child(6) { white-space: normal; min-width: 260px; }
.data-table tbody tr:last-child td, .table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td, .table tbody tr:hover td, .analysis-table tbody tr:hover td { background: var(--surface-2); }
.data-table tbody tr.is-selected td, .data-table tbody tr.selected td, #purchase-body tr.is-selected > td { background: var(--brand-soft); }
.data-table tfoot td, .total-row td { padding: 11px 12px; border-top: 1px solid var(--line-2); background: var(--surface-3); color: var(--ink); font-weight: 700; }
.data-table tbody td strong, .data-table tbody td b { color: var(--ink); font-weight: 700; }
.data-table td.col-select, .data-table th.col-select { width: 44px; text-align: center; padding-left: 10px; padding-right: 6px; }
.data-table td.col-number, .data-table th.col-number { width: 64px; }
.empty-row td, .empty-result, .daily-empty { padding: 44px 12px; color: var(--muted); text-align: center; font-weight: 500; }
table th.al-num, table td.al-num { text-align: right; } table th.al-ctl, table td.al-ctl { text-align: center; } table th.al-text, table td.al-text { text-align: left; }
.table-foot, .page-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.rows-per-page { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: var(--fs-xs); font-weight: 500; }
.rows-per-page select { height: 30px; padding: 0 26px 0 10px; font-size: var(--fs-xs); }
.pagination-box, #pagination-box { display: inline-flex; gap: 4px; }
.page-btn { min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--surface); color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums; }
.page-btn:hover { background: var(--surface-3); color: var(--ink); }
.page-btn.is-active { background: var(--brand); border-color: var(--brand); color: var(--brand-on); }
.cell-ellipsis { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-hover-wrap { position: relative; display: block; max-width: 100%; }
.text-hover-tooltip { position: absolute; left: 0; top: 100%; z-index: 30; display: none; min-width: 220px; max-width: 420px; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-lg); color: var(--ink); font-size: var(--fs-sm); line-height: 1.5; white-space: normal; word-break: break-word; text-align: left; }
.text-hover-wrap:hover .text-hover-tooltip, .text-hover-wrap:focus-within .text-hover-tooltip { display: block; }
.tooltip-wrap { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.tooltip-wrap .tooltip { position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; display: none; min-width: 200px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-lg); color: var(--ink-2); font-size: var(--fs-xs); font-weight: 500; white-space: normal; }
.tooltip-wrap:hover .tooltip { display: block; }
.info-icon { color: var(--muted); font-size: 11px; }

/* ── 10. 모달 ─────────────────────────────────────────── */
.modal-backdrop, #local-modal-backdrop { position: fixed; inset: 0; z-index: 2900; background: rgba(15, 20, 30, .45); backdrop-filter: blur(2px); }
.modal { position: fixed; inset: 0; z-index: 3000; display: none; align-items: center; justify-content: center; padding: 20px; pointer-events: none; }
.modal > .modal-content, .modal > .modal-card { pointer-events: auto; }
.modal-content, .modal-card, .custom-alert-modal {
  display: flex; flex-direction: column; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px);
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden;
}
.modal-content.large, .modal-card.large { width: min(960px, calc(100vw - 32px)); }
.modal-header, .modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-title, .detail-title { font-size: var(--fs-md); font-weight: 700; color: var(--ink); }
.modal-close { width: 30px; height: 30px; border: 0; border-radius: var(--radius-xs); background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.modal-close:hover { background: var(--surface-3); color: var(--ink); }
.modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 20px; }
form.modal-body { display: block; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.modal-footer .btn { min-width: 96px; }
form.modal-body .modal-footer { margin: 20px -20px -20px; }
.custom-alert-backdrop { position: fixed; inset: 0; z-index: 3500; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(15, 20, 30, .45); backdrop-filter: blur(2px); }
.custom-alert-modal { width: min(420px, calc(100vw - 32px)); }
.custom-alert-body { padding: 26px 22px 18px; font-size: var(--fs-md); font-weight: 600; color: var(--ink); text-align: center; line-height: 1.55; white-space: pre-line; }
.custom-alert-footer { justify-content: center; background: transparent; border-top: 0; padding-top: 0; }
.custom-alert-footer .btn { min-width: 110px; }
.modal .table-wrap { border: 1px solid var(--line); border-radius: var(--radius-sm); }
.modal table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.modal thead th { position: sticky; top: 0; padding: 9px 10px; background: var(--surface-3); color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; text-align: center; border-bottom: 1px solid var(--line); }
.modal tbody td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: center; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.modal tbody tr:last-child td { border-bottom: 0; }
.modal tbody tr:hover td { background: var(--surface-2); }
.modal td.up { color: var(--up); font-weight: 700; } .modal td.down { color: var(--down); font-weight: 700; } .modal td.same { color: var(--muted); }

/* ── 11. 빈 상태 · 메시지 ─────────────────────────────── */
.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.empty i { display: block; font-size: 26px; margin-bottom: 10px; color: var(--line-2); }
.notice { padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.55; }
.notice.warn { border-color: var(--st-warn-bg); background: var(--st-warn-bg); color: var(--st-warn); }

/* ── 12. Litepicker ───────────────────────────────────── */
.litepicker { font-family: var(--font); --litepicker-container-months-color-bg: var(--surface); --litepicker-month-header-color: var(--ink);
  --litepicker-day-color: var(--ink-2); --litepicker-day-color-hover: var(--brand-ink); --litepicker-is-start-color-bg: var(--brand); --litepicker-is-end-color-bg: var(--brand);
  --litepicker-is-in-range-color: var(--brand-soft); --litepicker-is-today-color: var(--brand-ink); --litepicker-month-weekday-color: var(--muted);
  --litepicker-button-prev-month-color: var(--ink-3); --litepicker-button-next-month-color: var(--ink-3); --litepicker-container-months-box-shadow-color: rgba(0,0,0,.15); }
.litepicker .container__months { border-radius: var(--radius); border: 1px solid var(--line); }

/* ── 13. 다크 보정 ────────────────────────────────────── */
html[data-theme="dark"] img { opacity: .94; }
html[data-theme="dark"] .modal-backdrop, html[data-theme="dark"] #local-modal-backdrop, html[data-theme="dark"] .custom-alert-backdrop { background: rgba(0, 0, 0, .6); }

/* ── 14. 반응형 ───────────────────────────────────────── */
@media (max-width: 1100px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  :root { --rail-w: 62px; }
  .page { padding: calc(var(--wsh-top-h) + 16px) 14px 36px calc(var(--rail-w) + 14px); }
  .page-head { flex-direction: column; align-items: flex-start; }
  .wsh-side { padding: 12px 7px; }
  .wsh-nav a span { display: none; } .wsh-nav a { height: 46px; }
  .wsh-top { padding: 0 12px; gap: 10px; }
  .wsh-wordmark small, .wsh-me-copy { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .search input, .search.wide input { width: 100%; }
  .toolbar { padding: 10px 12px; }
  .modal-content, .modal-card { width: 100%; }
}
@media print { .wsh-top, .bulkbar, .toolbar, .table-foot { display: none; } .page { padding: 0; } }


/* ══ v6 — 표 안쪽 스크롤 + 고정 머리글 ══
   표가 길어도 툴바·페이지네이션이 화면에 남는다. 짧은 표는 그대로 짧다. */
.panel > .table-wrap { max-height: calc(100vh - 340px); min-height: 0; }

/* ══ v6 — 모션 (짧고 조용하게) ══ */
@keyframes wsh-fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
main.page { animation: wsh-fade .22s ease both; }
.stat { transition: border-color .15s ease; }
.stat:hover { border-color: var(--line-2); }
.data-table tbody tr { transition: background .12s ease; }
.modal-content, .modal-card, .custom-alert-modal { animation: wsh-fade .16s ease both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}


/* ══════════════════════════════════════════════════════════
   v8 (2026-09-02) — 세련되게
   색은 tokens.css 가 바꿨다. 여기서는 글자 · 선 · 간격만 다듬는다.
   원칙: 선은 얇게 하나만, 그림자는 떠 있는 것에만, 제목은 크고 자간을 죄고,
        보조 글자는 확실히 물러선다.
   ══════════════════════════════════════════════════════════ */

/* ── 제목 · 본문 ── */
.page-head h1 { letter-spacing: -0.035em; line-height: 1.2; }
.page-head .page-sub { margin-top: 7px; max-width: 70ch; font-size: var(--fs); color: var(--ink-3); }
.panel-head { padding: 15px 18px; }
.panel-head h2 { letter-spacing: -0.02em; }

/* ── 카드: 그림자를 걷고 선 하나만 ── */
.panel { box-shadow: none; }
.stat { padding: 18px 18px 16px; box-shadow: none; }
.stat span, .stat .stat-label { font-size: 12px; font-weight: 500; letter-spacing: .01em; }
.stat strong, .stat .stat-value { margin-top: 9px; letter-spacing: -0.04em; }
.stat small, .stat .stat-sub { margin-top: 5px; }

/* ── 표: 머리글은 작고 넓게, 본문은 또렷하게 ── */
.data-table thead th, .table thead th, .analysis-table th {
  padding: 12px; background: var(--surface); color: var(--muted);
  font-size: 11.5px; font-weight: 600; letter-spacing: .03em;
  border-bottom: 1px solid var(--line-2);
}
.data-table tbody td, .table tbody td, .analysis-table td { padding: 12px; font-size: 13.5px; }
.data-table tfoot td, .total-row td { background: var(--surface-2); }
.table-foot, .page-bottom { padding: 13px 16px; }

/* ── 버튼 · 입력: 높이를 34 로 맞춰 툴바 한 줄이 딱 떨어지게 ── */
.btn, .slot-btn, .icon-btn, .detail-button, .rank-action-btn, .btn-rank {
  height: 34px; letter-spacing: -0.01em;
}
.btn.lg { height: 42px; } .btn.sm, .btn-sm { height: 28px; } .btn.icon { width: 34px; }
input[type="text"], input[type="search"], input[type="number"], input[type="email"], input[type="password"], input[type="url"], input:not([type]),
select, .form-input, .form-select, .select-box, .slot-date, .search input { height: 34px; }
textarea, textarea.form-input { height: auto; min-height: 96px; }
.date-nav, .slot-date:has(button), .analysis-date-picker { height: 34px; }
.date-nav button, .slot-date button, .analysis-date-picker button { width: 26px; height: 26px; }
.toolbar { padding: 13px 16px; gap: 8px; }

/* ── 세그먼트: 선을 얇게, 선택은 밑줄로만 ── */
.seg { background: var(--surface); }
.seg > button, .seg > .seg-item { padding: 10px 15px; }

/* ── 레일: 선택 메뉴는 짙은 면 위 민트 블록 ── */
.wsh-nav a.on { background: var(--rail-on-bg); color: var(--rail-on-ink); }
.wsh-nav a.on i { color: var(--rail-on-ink); }
.wsh-wordmark strong { letter-spacing: -0.03em; }

/* ── 드로어 · 모달: 떠 있는 것에만 그림자 ── */
.modal-content, .modal-card, .custom-alert-modal { box-shadow: var(--shadow-lg); }

/* ── 상품 셀: 이름과 보조 정보의 대비를 키운다 ── */
.prod-name { font-size: var(--fs); letter-spacing: -0.01em; }
.prod-meta { gap: 8px; }
.prod-meta .kw { background: var(--brand-soft); color: var(--brand-ink); }
.cell-owner .owner-name { font-weight: 500; }


/* ══════════════════════════════════════════════════════════
   v9 (2026-09-02) — 면을 나누는 방법을 바꾼다
   얇은 선으로 나누던 것을 부드러운 그림자 + 큰 라운드로. 캔버스가 카드보다 어둡다.
   ══════════════════════════════════════════════════════════ */
.panel { border-color: transparent; box-shadow: var(--shadow); }
.stat { border-color: transparent; box-shadow: var(--shadow-sm); }
.stat:hover { box-shadow: var(--shadow); border-color: transparent; }
.seg { border-color: transparent; box-shadow: var(--shadow-sm); }
.panel-head { border-bottom: 1px solid var(--line); }
.toolbar { border-bottom: 1px solid var(--line); }
.table-foot, .page-bottom { border-top: 1px solid var(--line); }

/* 표: 머리글에 옅은 보라 기운을 준다 */
.data-table thead th, .table thead th, .analysis-table th {
  background: var(--surface-2); color: var(--ink-3); border-bottom: 1px solid var(--line);
}
.data-table tbody tr:hover td { background: var(--surface-2); }
.data-table tbody tr.is-selected td, #purchase-body tr.is-selected > td { background: var(--brand-soft); }

/* 버튼: 조금 더 둥글게, 주요 버튼에 옅은 그림자 */
.btn, .slot-btn, .icon-btn, .detail-button { border-radius: var(--radius-sm); }
.btn.primary, .btn.modal-submit, .btn.active, .login-submit { box-shadow: var(--shadow-sm); }
.page-btn { border-radius: var(--radius-xs); }

/* 입력: 테두리를 옅게, 초점에서 또렷하게 */
input[type="text"], input[type="search"], input[type="number"], input[type="email"], input[type="password"], input[type="url"], input:not([type]),
select, textarea, .form-input, .form-select, .select-box, .slot-date, .search input {
  border-color: var(--line-2); border-radius: var(--radius-sm); background-color: var(--surface);
}

/* 드로어·모달도 같은 곡률 */
.modal-content, .modal-card, .custom-alert-modal { border-color: transparent; }
#rank-modal .modal-content, #hourly-rank-modal .modal-content, .analysis-modal-card {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

