/* =============================================================================
   wii — admin/search UI
   디자인 철학: Pretendard hairline 라이트.
   warm beige 배경 (#faf9f5), 흰색 카드, 파랑→보라 브랜드 그라데이션 (#0b4cff→#5d3aff),
   ink 4단 대비 (#1a2236/#4a5568/#8a93a4/#c5c8d0), radius 8/12/14, subtle shadow.
   ========================================================================== */

:root {
  /* Backgrounds */
  --bg-root: #faf9f5;
  --bg-sub: #ffffff;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --bg-input: #ffffff;
  --bg-table-header: #f6f5f0;
  --bg-hover: rgba(11, 76, 255, 0.04);
  --bg-active: rgba(11, 76, 255, 0.08);

  /* Borders */
  --border-default: #e5e7eb;
  --border-subtle: #f0eee8;
  --border-hover: #d1d5db;
  --border-strong: #9ca3af;

  /* Text — ink 4 단계 (데모 변수: --ink / --ink-soft / --ink-dim) */
  --text-primary: #1a2236;
  --text-secondary: #4a5568;
  --text-tertiary: #8a93a4;
  --text-quaternary: #c5c8d0;
  --text-link: #0b4cff;
  --text-link-hover: #5d3aff;

  /* Brand — 데모 그라데이션 (135deg #0b4cff → #5d3aff) */
  --brand: #0b4cff;
  --brand-soft: #eaf0ff;
  --brand-gradient: linear-gradient(135deg, #0b4cff 0%, #5d3aff 100%);

  /* Accents (데모: --ok / --warn / --err / --brand) */
  --color-success: #15a657;
  --color-warning: #f0a020;
  --color-danger: #e63946;
  --color-info: #0b4cff;

  /* Status backgrounds (데모: --ok-soft / --warn-soft / --err-soft) */
  --bg-success-soft: #e3f7ec;
  --bg-warning-soft: #fef3da;
  --bg-danger-soft: #fde7e9;
  --bg-info-soft: #eaf0ff;
  --border-success-soft: rgba(21, 166, 87, 0.2);
  --border-warning-soft: rgba(240, 160, 32, 0.2);
  --border-danger-soft: rgba(230, 57, 70, 0.2);
  --border-info-soft: rgba(11, 76, 255, 0.2);

  /* Paper / shadow (데모: --paper-2 / --shadow-1) */
  --paper-2: #f6f5f0;
  --shadow-1: 0 1px 3px rgba(26, 34, 54, 0.05);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Fonts — 데모와 동일하게 Pretendard 우선 */
  --font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
}

/* ---------- Base reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  background: var(--bg-root);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.01em;
}

::selection { background: rgba(11, 76, 255, 0.15); color: var(--text-primary); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

a { color: var(--text-link); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--text-link-hover); text-decoration: underline; }

/* =============================================================================
   App shell — 좌측 240px sidebar + sticky topbar + 본문.
   ========================================================================== */

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.app-sidebar {
  width: 240px;
  flex: 0 0 240px;
  background: var(--bg-sub);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--border-subtle);
  text-decoration: none;
  color: var(--text-primary);
  flex: none;
}
.sidebar-brand:hover {
  background: var(--bg-hover);
  text-decoration: none;
  color: var(--text-primary);
}

/* WII 로고 — 34x34 정사각형 + brand gradient + 흰색 SVG 돋보기 아이콘 (데모 동일) */
.sidebar-brand-logo {
  /* login-logo 와 동일 디자인의 미니 버전 — gradient + 흰 "WII" 텍스트 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--brand-gradient);
  color: #ffffff;
  border-radius: 10px;
  flex: none;
  box-shadow: 0 4px 10px rgba(11, 76, 255, 0.35);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 0;
}
.sidebar-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}
.sidebar-brand-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
  letter-spacing: 0.3px;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 18px;
  overflow-y: auto;
}

.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-group-title {
  padding: 6px 12px 8px;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}
.sidebar-group-title:hover { color: var(--text-primary); }
/* 대메뉴(그룹) 접기/펴기 — group-title 클릭 토글(JS), 상태는 localStorage 유지. */
.sidebar-group-chevron { font-size: 9px; opacity: 0.65; transition: transform 0.15s ease; }
.sidebar-group.collapsed .sidebar-group-chevron { transform: rotate(-90deg); }
.sidebar-group.collapsed .sidebar-item { display: none; }

/* sidebar-item — 데모와 동일 좌측 dot indicator (4x4 brand color, active 시) */
.sidebar-item {
  position: relative;
  display: block;
  padding: 8px 12px 8px 24px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  letter-spacing: -0.1px;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-item::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: transparent;
  transition: background 0.12s;
}
.sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}
.sidebar-item.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
}
.sidebar-item.active::before { background: var(--brand); }
.sidebar-item-external { color: var(--text-tertiary); }

/* 대메뉴형 링크 — group-title 타이포(굵은 대메뉴)이나 클릭 가능·active 표시, 펼침 chevron/들여쓰기 없음.
   하위가 없는 최상위 목적지(전역 '프로젝트', 프로젝트 내부 메뉴 전부)에 사용. */
.sidebar-toplink {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.12s, color 0.12s;
}
.sidebar-toplink:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.sidebar-toplink.active { background: var(--brand-soft); color: var(--brand); }
/* 대메뉴형 링크 묶음 — nav gap(18px) 대신 촘촘하게(2px). */
.sidebar-toplinks { display: flex; flex-direction: column; gap: 2px; }
/* 프로젝트 사이드바 상단 프로젝트명 컨텍스트(메뉴 아님). */
.sidebar-project-name {
  padding: 2px 12px 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Footer — 32x32 round avatar + 이름 + 역할 + 로그아웃 (avatar 는 데모 추가, 로그아웃은 wii 고유) */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-subtle);
  flex: none;
}
.sidebar-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--text-primary);
  color: #ffffff;
  display: grid;
  place-items: center;
  flex: none;
}
.sidebar-avatar svg { width: 18px; height: 18px; }
.sidebar-user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  font-family: var(--font-sans);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-name:hover {
  color: var(--brand);
  text-decoration: none;
}
.sidebar-user-role {
  font-size: 11px;
  color: var(--text-tertiary);
}
.sidebar-logout-form { display: inline; margin: 0; flex: none; }
.sidebar-logout-btn {
  font-size: 11px;
  padding: 5px 10px;
  background: transparent;
  color: var(--text-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.sidebar-logout-btn:hover {
  background: var(--bg-hover);
  color: var(--brand);
  border-color: var(--brand);
}

/* ---------- Main area ---------- */
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.825rem;
  color: var(--text-tertiary);
  min-width: 0;
}
.topbar-group { font-weight: 500; }
.topbar-sep { color: var(--text-quaternary); }
.topbar-title {
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: none;
}
/* LLM 게이트웨이 실시간 부하 요약 (topbar) — 옛 .topbar-external(통합검색 버튼) 자리.
   LLM별 슬롯 점유(초록=진행중/연회색=여유/진회색=비활성) + 대기 수. 클릭 시 대기열 화면. */
.gw-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
}
.gw-summary:hover { color: var(--brand); text-decoration: none; }
.gw-label { font-weight: 600; color: var(--text-tertiary); }
.gw-slots { display: inline-flex; align-items: center; gap: 8px; }
.gw-llm { display: inline-flex; align-items: center; gap: 5px; }
.gw-name { color: var(--text-primary, #1e293b); font-weight: 600; }
.gw-cells { display: inline-flex; gap: 2px; position: relative; top: 1px; }   /* 텍스트 대비 살짝 위로 뜨는 느낌 보정 */
.gw-cell { width: 13px; height: 13px; border-radius: 2px; border: 1px solid var(--border-default, #cbd5e1); background: var(--paper-1, #f1f5f9); }
.gw-cell.on { background: #16a34a; border-color: #16a34a; }
.gw-cell.off { background: #64748b; border-color: #475569; opacity: 0.55; }
.gw-cnt { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.gw-sep { color: var(--border-default); }
.gw-wait { color: var(--text-secondary); }
.gw-wait b { color: var(--text-primary, #1e293b); font-weight: 700; margin-left: 3px; font-size: 15px; }
.gw-timeout { color: var(--text-secondary); }
.gw-timeout b { color: var(--text-primary, #1e293b); font-weight: 700; margin-left: 3px; font-size: 15px; }
.gw-timeout.gw-hot b { color: #dc2626; }   /* 최근 5분 타임아웃 발생 시 붉게 강조 */
.gw-dash { color: var(--text-tertiary); }

/* ---------- 외부망 접속(TryCloudflare 임시 터널) — topbar 우측 토글 + 드롭다운 패널 ---------- */
.tunnel { position: relative; }
.tunnel-toggle { gap: 0.4rem; }
.tunnel-badge { margin-right: 0; }
.tunnel-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: 340px;
  padding: 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
}
.tunnel-panel[hidden] { display: none; }
.tunnel-panel-title { font-size: 0.78rem; color: var(--text-tertiary); margin-bottom: 0.45rem; }
.tunnel-url-row { display: flex; gap: 0.4rem; align-items: center; }
.tunnel-url-row input {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 0.5rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.tunnel-msg { font-size: 0.75rem; margin-top: 0.45rem; min-height: 1em; }
.tunnel-msg.ok { color: var(--color-success); }
.tunnel-msg.err { color: var(--color-danger); }
.tunnel-panel-actions { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
.tunnel-panel-actions .btn { flex: 1; margin-right: 0; }

/* ---------- Responsive — 1024px 미만은 sidebar 축소 (240→200), 768px 미만은 숨김 ---------- */
@media (max-width: 1024px) {
  .app-sidebar { width: 200px; flex-basis: 200px; }
}
@media (max-width: 768px) {
  .app-sidebar { display: none; }
}

main {
  max-width: none;
  margin: 0;
  padding: 24px 28px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
  color: var(--text-primary);
}

/* 페이지 헤더: 왼쪽 제목 + 오른쪽 액션 묶음. h1 의 margin-bottom 은 컨테이너 외부에서 부담. */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0 0 1.25rem;
}
.page-header h1 { margin: 0; }
.page-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.page-actions form { display: inline; }

h2 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 1.75rem 0 0.6rem;
  color: var(--text-primary);
}

h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 1rem 0 0.5rem;
  color: var(--text-primary);
}

p { color: var(--text-secondary); margin: 0.5rem 0; }

/* Hint / muted text */
.muted {
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

/* ---------- Card grid (대시보드 / 배지) ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.875rem;
  margin-bottom: 1.5rem;
}

/* 시계열/흐름 범위 segmented control (버튼 그룹) — monitoring·llm-queue·dashboard 공유. */
.range-group { display: inline-flex; border: 1px solid var(--border-default); border-radius: 6px; overflow: hidden; }
.range-group .range-btn { border: 0; background: var(--bg-input); color: var(--text-secondary); padding: 0.28rem 0.7rem; font-size: 0.78rem; cursor: pointer; border-left: 1px solid var(--border-default); line-height: 1.2; transition: background 0.12s, color 0.12s; }
.range-group .range-btn:first-child { border-left: 0; }
.range-group .range-btn:hover { background: var(--bg-sub); color: var(--text-primary); }
.range-group .range-btn.active { background: var(--brand); color: #fff; font-weight: 600; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  transition: border-color 0.2s, transform 0.15s;
}

.card:hover { border-color: var(--border-hover); }

.card .label {
  color: var(--text-tertiary);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.card .value {
  font-size: 1.6rem;
  font-weight: 600;
  margin-top: 0.4rem;
  color: var(--text-primary);
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.card.green .value { color: var(--color-success); }
.card.yellow .value { color: var(--color-warning); }
.card.red .value { color: var(--color-danger); }
.card.blue .value { color: var(--color-info); }

.card.green { background: var(--bg-success-soft); border-color: var(--border-success-soft); }
.card.yellow { background: var(--bg-warning-soft); border-color: var(--border-warning-soft); }
.card.red { background: var(--bg-danger-soft); border-color: var(--border-danger-soft); }
.card.blue { background: var(--bg-info-soft); border-color: var(--border-info-soft); }

/* ---------- Table ---------- */
.table {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 1rem;
  overflow: hidden;
}

.table th, .table td {
  text-align: left;
  padding: 0.7rem 0.95rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.875rem;
  color: var(--text-primary);
}

.table th {
  background: var(--bg-table-header);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: var(--bg-hover); }
.table tbody tr:last-child td { border-bottom: 0; }

.table .empty,
.table tr td.empty {
  color: var(--text-tertiary);
  text-align: center;
  padding: 2.5rem 1rem;
  font-size: 0.875rem;
}

/* ---------- Buttons ---------- */
/* 기본 사이즈 통일 — height ≈ 32px (작은 액션 / 표 안 / 옆 배치). 폼 안 wide 제출도
   동일 height 유지하고 강조는 색상 (.primary) 으로만 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  height: 32px;
  padding: 0 0.85rem;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  margin-right: 0.25rem;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: middle;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-tertiary);
  color: var(--text-primary);
  text-decoration: none;
}

.btn:active { background: var(--bg-active); }

.btn.danger {
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--color-danger);
}
.btn.danger:hover {
  background: var(--bg-danger-soft);
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.btn.primary {
  background: var(--brand-gradient);
  color: #ffffff;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(11, 76, 255, 0.25);
}
.btn.primary:hover {
  background: linear-gradient(135deg, #0a44e6 0%, #5333e6 100%);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(11, 76, 255, 0.30);
}

/* form 자체에 type="submit" 만 있는 button (filter-form / search-form / dict-preview-form
   안의 inline button) 도 primary brand 그라데이션 — 본 시스템의 폼 제출 표준 */
button[type="submit"]:not(.btn) {
  background: var(--brand-gradient);
  color: #ffffff;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(11, 76, 255, 0.25);
  transition: background 0.15s, box-shadow 0.15s;
}
button[type="submit"]:not(.btn):hover {
  background: linear-gradient(135deg, #0a44e6 0%, #5333e6 100%);
  box-shadow: 0 6px 14px rgba(11, 76, 255, 0.30);
}

/* size 변형 — 큰 폼 액션 (login 등) */
.btn.btn-lg { height: 40px; padding: 0 1.2rem; font-size: 0.9rem; }
.btn.btn-sm { height: 26px; padding: 0 0.6rem; font-size: 0.72rem; }

/* 아이콘 전용 액션 버튼 — 표 안 수정/삭제/토글 등. 정사각형 + 1.1rem 글리프.
   .btn.danger / .btn.primary 와 자유 조합 가능. */
.btn.btn-icon {
  height: 30px;
  width: 30px;
  min-width: 30px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  margin-right: 0.2rem;
}

/* paginationBar fragment 의 현재 페이지 — inactive .btn.page-link 와 동일 크기에
   테두리·배경만 brand 컬러로 강조. cursor 만 default 로. */
.btn.page-link.current,
.btn.page-link.current:hover {
  background: var(--brand-soft);
  border-color: var(--color-info);
  color: var(--color-info);
  font-weight: 700;
  cursor: default;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  background: var(--bg-active);
  color: var(--text-primary);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-right: 0.25rem;
  border: 1px solid var(--border-default);
}

.badge.cat { background: var(--bg-info-soft); color: var(--color-info); border-color: var(--border-info-soft); }
.badge.src { background: rgba(168, 85, 247, 0.1); color: #c084fc; border-color: rgba(168, 85, 247, 0.25); }
/* wii-ocr 상태 배지 — VALID/INVALID/경고 (옛 ocr/layout 보강 흡수). */
.badge.ok   { background: #e7f6ee; color: var(--color-success); }
.badge.no   { background: #fdeaec; color: var(--color-danger); }
.badge.warn { background: #fdf3e3; color: var(--color-warning); }
.ocr-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

/* ---------- Code ---------- */
.code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
}

/* ---------- REST API endpoint 카탈로그 (admin 페이지 footer) ---------- */
.rest-api {
  margin-top: 1rem;
  font-size: 0.85rem;
}
.rest-api > summary {
  cursor: pointer;
  color: var(--text-tertiary);
  padding: 0.25rem 0;
  list-style: none;
  user-select: none;
}
.rest-api > summary::-webkit-details-marker { display: none; }
.rest-api > summary::before {
  content: '▸';
  display: inline-block;
  width: 1em;
  color: var(--text-quaternary);
  transition: transform 0.15s;
}
.rest-api[open] > summary::before { transform: rotate(90deg); }
.rest-api-table {
  width: 100%;
  margin-top: 0.5rem;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.rest-api-table th,
.rest-api-table td {
  text-align: left;
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}
.rest-api-table th {
  color: var(--text-tertiary);
  font-weight: 500;
  background: var(--bg-elevated);
  white-space: nowrap;
}
.rest-api-table td.method {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
  width: 1%;
}
.rest-api-table td.method.get    { color: #0369a1; }
.rest-api-table td.method.post   { color: #166534; }
.rest-api-table td.method.put    { color: #92400e; }
.rest-api-table td.method.delete { color: #991b1b; }
.rest-api-table td.path { font-family: var(--font-mono); font-size: 0.78rem; white-space: nowrap; }
.rest-api-table td.params { color: var(--text-secondary); font-size: 0.78rem; }
.rest-api-table td.swagger { width: 1%; white-space: nowrap; text-align: center; }
.rest-api-table td.swagger a { color: var(--text-tertiary); text-decoration: none; }
.rest-api-table td.swagger a:hover { color: var(--text-primary); }

/* ---------- Empty state ---------- */
.empty {
  color: var(--text-tertiary);
  padding: 2.5rem 1.5rem;
  text-align: center;
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-sub);
  font-size: 0.875rem;
}

/* ---------- Form (login + 일반) ---------- */
.form { display: flex; flex-direction: column; gap: 0.6rem; }
.form .row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
/* 빈 label (정렬 인덴트용 placeholder) 은 숨겨 버튼이 왼쪽 끝에서 시작하도록. */
.form .row > label:empty { display: none; }
.form .row label {
  width: 140px;
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  padding-top: 0.55rem;
  font-family: var(--font-mono);
}
/* 폼 row 의 input/textarea/select 는 label 옆 남은 공간 모두 차지.
   inline `style="width:Xpx"` 또는 `style="flex:1"` 로 override 가능. */
.form .row > input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
.form .row > textarea,
.form .row > select {
  flex: 1;
  min-width: 0;
}
.form .row textarea { font-family: var(--font-mono); resize: vertical; }
.form .row .hint { color: var(--text-tertiary); font-size: 0.78rem; padding-top: 0.55rem; }

/* radio/checkbox row 와 input row 키·세로 정렬 일치
   - 기본 row 는 input/textarea baseline 맞춤용 align-items:flex-start + label padding-top
   - radio/checkbox wrapper 는 line-height 만큼만 키 잡혀 input row 와 어긋남 → 세 가지 보정:
     ① row 자체 align-items:center (label 도 wrapper 도 row 중앙 정렬)
     ② label padding-top 제거 (center 정렬이라 baseline 보정 불필요)
     ③ radio/checkbox 의 직속 wrapper (div/span) min-height 40px = input 의 실 키와 일치 */
.form .row:has(input[type="radio"]),
.form .row:has(input[type="checkbox"]) {
  align-items: center;
}
.form .row:has(input[type="radio"]) > label,
.form .row:has(input[type="checkbox"]) > label {
  padding-top: 0;
}
.form .row > div:has(input[type="radio"]),
.form .row > div:has(input[type="checkbox"]),
.form .row > span:has(input[type="radio"]),
.form .row > span:has(input[type="checkbox"]) {
  min-height: 40px;
  display: flex;
  align-items: center;
}
/* radio/checkbox 가 .form .row 직속 자식 (wrapper 없음) — row 자체 min-height 로 input row 키와 일치 */
.form .row:has(> input[type="radio"]),
.form .row:has(> input[type="checkbox"]) {
  min-height: 40px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
textarea,
select,
.form input {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

input[type="text"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
textarea:hover,
select:hover { border-color: var(--border-strong); }

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11, 76, 255, 0.1);
  outline: none;
}

input::placeholder, textarea::placeholder { color: var(--text-quaternary); }

input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); }

label { color: var(--text-secondary); }

/* ---------- Search form ---------- */
.search-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.search-form input[type=text] {
  flex: 1;
  padding: 0.7rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
}
.search-form button {
  padding: 0.7rem 1.4rem;
  background: var(--brand-gradient);
  color: #ffffff;
  border: 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(11, 76, 255, 0.25);
}
.search-form button:hover {
  background: linear-gradient(135deg, #0a44e6 0%, #5333e6 100%);
  box-shadow: 0 6px 14px rgba(11, 76, 255, 0.30);
}

/* ---------- Search 2-col layout + facets + result cards ---------- */
.layout-2col { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; }
@media (max-width: 768px) {
  .layout-2col { grid-template-columns: 1fr; }
}

.facets {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  height: fit-content;
}
.facets h3 {
  font-size: 0.7rem;
  margin: 0 0 0.5rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.facets ul { list-style: none; padding: 0; margin: 0 0 1rem; }
.facets li { padding: 0.25rem 0; font-size: 0.875rem; color: var(--text-secondary); }
.facets li a { color: var(--text-primary); }
.facets .count { color: var(--text-quaternary); margin-left: 0.4rem; font-family: var(--font-mono); font-size: 0.75rem; }

.results .meta {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  font-family: var(--font-mono);
}
.results .meta strong { color: var(--text-primary); font-weight: 600; }

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.7rem;
  transition: border-color 0.2s;
}
.result-card:hover { border-color: var(--border-hover); }
.result-card h3 { margin: 0 0 0.4rem; font-size: 1.05rem; font-weight: 600; }
.result-card h3 a { color: var(--text-primary); }
.result-card h3 a:hover { color: var(--text-link-hover); text-decoration: none; }
.result-card .badges { margin-bottom: 0.5rem; }
.result-card em,
.result-card mark.hl {
  background: rgba(245, 158, 11, 0.18);
  color: var(--color-warning);
  font-style: normal;
  padding: 0 3px;
  border-radius: 3px;
}
.result-card .snippet { color: var(--text-secondary); font-size: 0.9rem; margin: 0.4rem 0; line-height: 1.55; }
.result-card .attrs { color: var(--text-tertiary); font-size: 0.78rem; font-family: var(--font-mono); }

.pagination { display: flex; gap: 0.5rem; justify-content: center; margin-top: 1.5rem; }
.pagination a, .pagination span {
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  background: var(--bg-card);
  color: var(--text-primary);
}
.pagination a:hover { border-color: var(--border-hover); text-decoration: none; }
.pagination .current { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-soft); font-weight: 700; }

/* ---------- wizard step indicator (가벼운 라인 형태) ---------- */
.wizard-steps {
  display: flex;
  gap: 0;
  margin: 1.25rem 0 1.5rem;
  align-items: center;
}
.wizard-step {
  padding: 0.4rem 0.5rem;
  font-size: 0.78rem;
  flex: 1;
  text-align: center;
  color: var(--text-tertiary);
  font-weight: 500;
  position: relative;
}
.wizard-step + .wizard-step::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 1px;
  background: var(--border-subtle);
  z-index: -1;
}
.wizard-step .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  margin-right: 0.4rem;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 600;
}

fieldset.wizard-pane {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  margin: 0.6rem 0;
  background: var(--bg-card);
}
fieldset.wizard-pane legend {
  font-weight: 600;
  padding: 0 0.5rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}
fieldset.wizard-pane .hint {
  color: var(--text-tertiary);
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
}
fieldset.wizard-pane label { color: var(--text-secondary); margin-right: 0.3rem; }

#previewResult {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg-sub);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.825rem;
  max-height: 320px;
  overflow: auto;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}
#previewResult pre { margin: 0; white-space: pre-wrap; word-break: break-all; }

/* ---------- sub-tab + filter (h1 아래 카드형 탭 — 분석/사전 공통) ---------- */
.subnav {
  display: flex;
  gap: 0.4rem;
  margin: 0 0 1.25rem;
  padding: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}
.subnav a {
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.subnav a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}
.subnav a.active {
  background: var(--bg-active);
  color: var(--text-primary);
}

.filter-form {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  padding: 0.85rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.filter-form label {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.filter-form input,
.filter-form select {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  font-family: var(--font-sans);
}
.filter-form input[type=text] { width: 220px; font-family: var(--font-mono); }
.filter-form input[type=number] { width: 90px; font-family: var(--font-mono); }
.filter-form button {
  padding: 0.45rem 1rem;
  background: var(--brand-gradient);
  color: #ffffff;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(11, 76, 255, 0.25);
}
.filter-form button:hover {
  background: linear-gradient(135deg, #0a44e6 0%, #5333e6 100%);
  box-shadow: 0 6px 14px rgba(11, 76, 255, 0.30);
}

.tag-na {
  color: var(--text-quaternary);
  font-style: italic;
  font-size: 0.85rem;
}

.bar-cell { padding: 0.35rem 0.5rem; vertical-align: middle; }
.bar {
  height: 22px;
  background: linear-gradient(90deg, var(--color-info), #60a5fa);
  border-radius: 4px;
  min-width: 2px;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

/* ---------- 화면별 inline 보강용 (몇 개 페이지 inline 사용 중) ---------- */
strong { color: var(--text-primary); font-weight: 600; }

/* hr / 구분선 */
hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 1.25rem 0;
}

/* ---------- filter-form: 분석/현황/로그 화면 공통 필터 박스 ---------- */
.filter-form {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  padding: 0.85rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.filter-form label {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.filter-form input,
.filter-form select {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  font-family: var(--font-sans);
}
.filter-form input[type=text] { width: 220px; font-family: var(--font-mono); }
.filter-form input[type=number] { width: 90px; font-family: var(--font-mono); }
.filter-form button {
  padding: 0.45rem 1rem;
  background: var(--brand-gradient);
  color: #ffffff;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.filter-form button:hover {
  background: linear-gradient(135deg, #0a44e6 0%, #5333e6 100%);
  box-shadow: 0 6px 14px rgba(11, 76, 255, 0.30);
}

/* ---------- datetime-input: text "yyyy-MM-dd HH:mm:ss" + 아이콘 → native picker ---------- */
.datetime-input {
  position: relative;
  display: inline-block;
}
.datetime-input input[type="text"] {
  padding-right: 32px;
}
.datetime-input .datetime-icon-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.datetime-input .datetime-icon-btn:hover { color: var(--text-primary); }
.datetime-input .datetime-picker {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  border: none;
  padding: 0;
  margin: 0;
}

/* ---------- Login (wpaas 동일 디자인) ---------- */
body.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.login-shell {
  width: 100%;
  max-width: 400px;
}
.login-brand {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo {
  /* sidebar-brand-logo 와 동일 디자인, 로그인용 2배 확대 — brand 그라데이션 */
  width: 60px;
  height: 60px;
  background: var(--brand-gradient);
  color: #ffffff;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-family: var(--font-sans);
  box-shadow: 0 6px 16px rgba(11, 76, 255, 0.35);
}
.login-brand-name {
  margin-top: 12px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}
.login-brand-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-tertiary);
}
.login-card {
  background: var(--bg-sub);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px 28px 24px;
}
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}
.login-input { position: relative; }
.login-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--border-strong);
  pointer-events: none;
}
.login-input input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 38px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}
.login-input input::placeholder { color: var(--text-tertiary); }
.login-input input:hover { border-color: var(--border-hover); }
.login-input input:focus { border-color: var(--color-info); }
.login-btn {
  margin-top: 4px;
  width: 100%;
  height: 40px;
  background: var(--color-info);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.login-btn:hover { background: var(--text-link-hover); }
.login-btn:active { transform: translateY(1px); }

/* 로그인 없이 통합검색(시연) 화면으로 가는 보조 링크 — 옛 topbar '통합검색 화면' 버튼을 로그인 화면으로 이동. */
.login-external {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  height: 40px;
  color: var(--text-secondary);
  background: var(--bg-sub);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.login-external:hover { background: var(--bg-hover); color: var(--brand); border-color: var(--brand); text-decoration: none; }

.login-alert {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13px;
}
.login-alert strong { font-weight: 600; }
.login-alert span { color: var(--text-secondary); }
.login-alert-error {
  background: var(--bg-danger-soft);
  border: 1px solid var(--border-danger-soft);
}
.login-alert-error strong { color: var(--color-danger); }
.login-alert-success {
  background: var(--bg-success-soft);
  border: 1px solid var(--border-success-soft);
}
.login-alert-success strong { color: var(--color-success); }

.login-footnote {
  margin-top: 20px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.6;
}
/* ---------- inline style 다크 호환 — 14개 템플릿의 라이트 가정 color 토큰 매핑 ---------- */
/* 기존 회색 계열 inline color 를 다크 토큰으로 강제 변환 (specificity 위해 !important) */
[style*="color:#6b7280"], [style*="color: #6b7280"],
[style*="color:#9ca3af"], [style*="color: #9ca3af"] {
  color: var(--text-tertiary) !important;
}
[style*="color:#4b5563"], [style*="color: #4b5563"],
[style*="color:#374151"], [style*="color: #374151"] {
  color: var(--text-secondary) !important;
}
[style*="color:#dc2626"], [style*="color: #dc2626"] {
  color: var(--color-danger) !important;
}
[style*="color:#16a34a"], [style*="color: #16a34a"] {
  color: var(--color-success) !important;
}
[style*="color:#ca8a04"], [style*="color: #ca8a04"] {
  color: var(--color-warning) !important;
}
[style*="color:#2563eb"], [style*="color: #2563eb"],
[style*="color:#1d4ed8"], [style*="color: #1d4ed8"],
[style*="color:#1e40af"], [style*="color: #1e40af"] {
  color: var(--text-link) !important;
}
[style*="background:#dbeafe"], [style*="background: #dbeafe"],
[style*="background:#ede9fe"], [style*="background: #ede9fe"],
[style*="background:#fef3c7"], [style*="background: #fef3c7"] {
  background: var(--bg-active) !important;
}

/* ---------- Tooltip cue — 한글화된 타이틀·라벨·컬럼에 호버 설명 노출 ----------
   사용: <span class="help" title="설명문">텍스트</span>
   브라우저 기본 title 툴팁 + 점선 밑줄 + ⓘ 표식으로 호버 가능 영역 시각화. */
.help {
  cursor: help;
  text-decoration: none;
  border-bottom: 1px dotted var(--text-tertiary);
}
.help:hover { border-bottom-color: var(--text-secondary); }
.help::after {
  content: ' ⓘ';
  font-size: 0.75em;
  margin-left: 0.15em;
  color: var(--text-tertiary);
  opacity: 0.55;
}
.help:hover::after { opacity: 1; }
h1 .help::after, h2 .help::after, h3 .help::after { opacity: 0.4; }
th .help, .cards .label .help, .badge .help { color: inherit; }

/* ---------- Toggle switch — 목록에서 바로 켜고 끄는 슬라이더형 on/off ----------
   사용: <label class="toggle-switch"><input type="checkbox" ...><span class="toggle-slider"></span></label>
   체크 = 활성(브랜드/초록), 원이 좌우로 이동. */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
  vertical-align: middle;
  cursor: pointer;
}
.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: 999px;
  transition: background 0.18s ease;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(26, 34, 54, 0.25);
  transition: transform 0.18s ease;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--color-success);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}
.toggle-switch input:focus-visible + .toggle-slider {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
/* disabled 토글 — 잠금/조건부 비활성(parser-options 미구현, voice-search engine≠whisper 폴백). */
.toggle-switch input:disabled + .toggle-slider { opacity: 0.5; cursor: not-allowed; }
.toggle-switch:has(input:disabled) { cursor: not-allowed; }

/* ---------- number-input — 표 안 정수 입력(콤마 표시 + 범위 검증은 admin-common.js) ----------
   parser-options / voice-search 설정 표에서 사용. 폭(width)은 화면별 inline 로 지정. */
.number-input {
  padding: 0.3rem 0.5rem;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.number-input:hover { border-color: var(--border-strong); }
.number-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 76, 255, 0.1); }
.number-error { font-size: 0.75rem; color: var(--color-danger); margin-top: 0.2rem; }

/* ---------- collapsible-card — <details class="card collapsible-card"> 접이식 카드 (parser-options 카테고리) ----------
   summary 헤더 바 + 좌측 회전 화살표. 마커 숨김 + 접힘 시 화살표 -90° 회전. */
.collapsible-card > summary { list-style: none; }
.collapsible-card > summary::-webkit-details-marker { display: none; }
.collapse-arrow { display: inline-block; transition: transform 0.2s ease; font-size: 0.75rem; color: var(--text-tertiary); }
.collapsible-card:not([open]) .collapse-arrow { transform: rotate(-90deg); }

/* ---------- modal — 등록·편집·상세 공용 모달(버튼 클릭 → 오버레이 다이얼로그) ----------
   마크업: <div class="modal-overlay" hidden><div class="modal-box"><div class="modal-head">…</div>
           <div class="modal-body">…</div><div class="modal-foot">…</div></div></div>
   토글: el.hidden = false/true. class 가 display:flex 라 [hidden] 로 명시 override 필요. */
.modal-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(15, 18, 25, 0.42);
  display: flex; align-items: flex-start; justify-content: center;
  overflow: auto; padding: 5vh 1rem;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  width: 100%; max-width: 640px; max-height: 90vh; overflow: auto;
}
.modal-box.wide { max-width: 920px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-default);
  position: sticky; top: 0; background: var(--bg-card); z-index: 1;
}
.modal-head h2 { margin: 0; font-size: 1.05rem; }
.modal-close {
  border: 0; background: transparent; font-size: 1.4rem; line-height: 1;
  cursor: pointer; color: var(--text-tertiary); padding: 0 0.25rem;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 1.1rem 1.25rem; }
.modal-foot {
  display: flex; gap: 0.5rem; justify-content: flex-end;
  padding: 0.9rem 1.25rem; border-top: 1px solid var(--border-default);
  position: sticky; bottom: 0; background: var(--bg-card);
}

/* ---------- form controls polish — file 버튼 · select 커스텀 화살표 · date/month 일관 ----------
   기존 base(input[type=text…]/select/textarea/.form input)에 얹어, 그동안 네이티브로 남던
   file/date/month/time 를 동일 스타일로 맞추고 select 화살표·파일 버튼을 브랜드 디자인으로. */
input[type="date"], input[type="month"], input[type="time"],
input[type="search"], input[type="tel"], input[type="url"] {
  background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  padding: 0.55rem 0.75rem; font-family: var(--font-sans); font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s; outline: none;
}
/* 폼(.form) 단일행 컨트롤 높이 통일 38px — 인풋·셀렉트·파일·날짜/월 동일.
   (그리드/테이블 컴팩트 인풋 .colsearch/.gsearch/.number-input 은 .form 밖이라 미적용) */
.form .row > input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
.form .row > select { height: 38px; }
/* 모든 입력요소 hover/focus 일관(date·month·select 포함, file 은 자체 규칙) */
input:hover:not([type=checkbox]):not([type=radio]):not([type=file]),
textarea:hover, select:hover { border-color: var(--border-strong); }
input:focus:not([type=checkbox]):not([type=radio]):not([type=file]),
textarea:focus, select:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 76, 255, 0.1);
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer; opacity: 0.55; transition: opacity 0.15s;
}
input[type="date"]:hover::-webkit-calendar-picker-indicator,
input[type="month"]:hover::-webkit-calendar-picker-indicator,
input[type="time"]:hover::-webkit-calendar-picker-indicator { opacity: 0.9; }

/* select — 네이티브 화살표 제거 + 커스텀 chevron(hover 시 진하게) */
select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding-right: 2.25rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a93a4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.7rem center; background-size: 16px 16px;
}
select:hover {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234a5568' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

/* file input — 점선 필드 + 브랜드 버튼(회색 네이티브 버튼 대체) */
input[type="file"] {
  color: var(--text-secondary); font-family: var(--font-sans); font-size: 0.88rem;
  background: var(--bg-input); border: 1px dashed var(--border-hover); border-radius: var(--radius-md);
  height: 38px; padding: 0 0.6rem; display: inline-flex; align-items: center; cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input[type="file"]:hover { border-color: var(--brand); background: var(--brand-soft); }
input[type="file"]:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 76, 255, 0.1); }
input[type="file"]::file-selector-button {
  margin-right: 0.85rem; padding: 0.42rem 1rem; border: 0; border-radius: var(--radius-sm);
  background: var(--brand); color: #fff; font-family: var(--font-sans); font-weight: 600; font-size: 0.85rem;
  cursor: pointer; box-shadow: 0 1px 2px rgba(11, 76, 255, 0.25); transition: background 0.15s;
}
input[type="file"]::file-selector-button:hover { background: #0a44e6; }
