/* ============ iDocu Redesign — Design Tokens ============ */
:root {
  /* Light theme (default) */
  --bg: #F7F8FA;
  --bg-elev: #FFFFFF;
  --bg-sunken: #EEF1F5;
  --bg-hover: #F1F4F8;
  --bg-active: #E6ECF3;

  --border: #E3E7ED;
  --border-strong: #CFD6DF;
  --divider: #EEF1F5;

  --text: #0F1B2D;
  --text-secondary: #4A5668;
  --text-tertiary: #6B7585;
  --text-muted: #9099A6;
  --text-inverse: #FFFFFF;

  --primary: #1E3A5F;
  --primary-hover: #284D7C;
  --primary-active: #15293F;
  --primary-soft: #E8EEF6;
  --primary-soft-hover: #DBE4F0;

  --accent: #8FBF2F;
  --accent-hover: #7BA825;
  --accent-soft: #F0F7DF;

  --status-pending: #6B7585;
  --status-pending-soft: #EEF1F5;
  --status-progress: #C68A12;
  --status-progress-soft: #FBF1DC;
  --status-success: #1F8A5B;
  --status-success-soft: #DEF1E6;
  --status-fail: #C2354B;
  --status-fail-soft: #FBE2E6;
  --status-reapply: #D4680E;
  --status-reapply-soft: #FEF0E7;
  --status-info: #1A6EA8;
  --status-info-soft: #DAE9F5;
  --status-teal: #0E7A70;
  --status-teal-soft: #D5EFED;
  --status-purple: #6B35B8;
  --status-purple-soft: #EAE0F8;

  --shadow-sm: 0 1px 2px rgba(15, 27, 45, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 27, 45, 0.06), 0 1px 3px rgba(15, 27, 45, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 27, 45, 0.10), 0 2px 8px rgba(15, 27, 45, 0.06);
  --shadow-pop: 0 24px 60px rgba(15, 27, 45, 0.18);

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --sidebar-w: 248px;
  --sidebar-w-collapsed: 64px;

  /* density: compact (default for grids) */
  --row-h: 30px;
  --cell-py: 5px;
  --cell-px: 10px;
  --gap-section: 16px;

  --ease-spring: cubic-bezier(0.34, 1.2, 0.64, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);

  --font: 'KoPubWorld Dotum', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo',
          'Segoe UI', Roboto, system-ui, sans-serif;
  --font-mono: 'KoPubWorld Dotum', monospace;
}

[data-density="compact"] {
  --row-h: 30px;
  --cell-py: 5px;
  --cell-px: 10px;
  --gap-section: 14px;
}

[data-theme="dark"] {
  --bg: #0B1220;
  --bg-elev: #131C2E;
  --bg-sunken: #0A1019;
  --bg-hover: #1A2438;
  --bg-active: #223052;

  --border: #233149;
  --border-strong: #324568;
  --divider: #1B2438;

  --text: #E8ECF3;
  --text-secondary: #B7C0D0;
  --text-tertiary: #8A95A8;
  --text-muted: #5C677B;
  --text-inverse: #0B1220;

  --primary: #4A7BC0;
  --primary-hover: #5A8BD4;
  --primary-active: #3D6AA8;
  --primary-soft: #1A2A44;
  --primary-soft-hover: #21355A;

  --accent: #A8D24A;
  --accent-hover: #B8DE5C;
  --accent-soft: #1F2C13;

  --status-pending: #8A95A8;
  --status-pending-soft: #1B2438;
  --status-progress: #E0A93A;
  --status-progress-soft: #2D2310;
  --status-success: #4FC890;
  --status-success-soft: #122A1F;
  --status-fail: #E26779;
  --status-fail-soft: #2C1318;
  --status-reapply: #F07030;
  --status-reapply-soft: #2A1400;
  --status-info: #5AADE0;
  --status-info-soft: #0D2339;
  --status-teal: #3DC9BE;
  --status-teal-soft: #0A2320;
  --status-purple: #B07EF0;
  --status-purple-soft: #1E0D38;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-pop: 0 24px 60px rgba(0, 0, 0, 0.6);
}

@font-face {
  font-family: 'KoPubWorld Dotum';
  font-weight: 300;
  font-display: swap;
  font-style: normal;
  src: url('/fonts/KoPubWorld Dotum Light.ttf') format('truetype');
}
@font-face {
  font-family: 'KoPubWorld Dotum';
  font-weight: 500;
  font-display: swap;
  font-style: normal;
  src: url('/fonts/KoPubWorld Dotum Medium.ttf') format('truetype');
}
@font-face {
  font-family: 'KoPubWorld Dotum';
  font-weight: 700;
  font-display: swap;
  font-style: normal;
  src: url('/fonts/KoPubWorld Dotum Bold.ttf') format('truetype');
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
  height: 100vh;
  overflow: hidden;
  transition: background-color 0.3s var(--ease-soft), color 0.3s var(--ease-soft);
}
#root { height: 100vh; overflow: hidden; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============ Layout ============ */
.app {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* ============ Sidebar ============ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  transition: width 0.32s var(--ease-soft);
  z-index: 50;
}
.sidebar[data-collapsed="true"] {
  width: var(--sidebar-w-collapsed);
}
.sidebar.no-transition,
.sidebar.no-transition * {
  transition: none !important;
}
html.init-sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
html.init-sidebar-collapsed .sidebar-logo-full { display: none; }
html.init-sidebar-collapsed .sidebar-mark-btn { display: inline-flex; }
html.init-sidebar-collapsed .sidebar-toggle-btn { display: none; }
html.init-sidebar-collapsed .nav-item-label { opacity: 0; width: 0; }
html.init-sidebar-collapsed .nav-section-label { opacity: 0; padding: 8px 0; height: 1px; overflow: hidden; }
html.init-sidebar-collapsed .nav-group-chevron { opacity: 0; }
html.init-sidebar-collapsed .nav-group-children { grid-template-rows: 0fr !important; }
html.init-sidebar-collapsed .user-info { opacity: 0; width: 0; }

/* Detail-page splitter handle (PDF ↔ Verify items) */
.splitter-handle {
  width: 5px !important;
  background: var(--border) !important;
  position: relative;
}
.splitter-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 56px;
  border-radius: 5px;
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--bg-elev), 0 1px 4px rgba(0,0,0,0.18);
  opacity: 0.85;
  transition: opacity 0.18s var(--ease-soft), background 0.18s var(--ease-soft), width 0.18s var(--ease-soft), height 0.18s var(--ease-soft);
}
/* dotted grip lines inside the pill, drawn with a repeating gradient */
.splitter-handle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 36px;
  background-image: linear-gradient(
    to bottom,
    rgba(255,255,255,0.85) 0,
    rgba(255,255,255,0.85) 2px,
    transparent 2px,
    transparent 6px
  );
  background-size: 100% 6px;
  z-index: 1;
  pointer-events: none;
  opacity: 0.9;
}
.splitter-handle:hover {
  background: var(--primary) !important;
}
.splitter-handle:hover::after {
  opacity: 1;
  width: 10px;
  height: 64px;
}

.sidebar-toggle-floating {
  display: none;
}
.sidebar-toggle-floating-OLD {
  position: absolute;
  top: 50%;
  right: -12px;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary);
  z-index: 50;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  transition: all 0.18s var(--ease-soft);
}
.sidebar-toggle-floating::before {
  content: "";
  position: absolute;
  inset: -16px;
  border-radius: 50%;
}
.sidebar-toggle-floating:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-50%) scale(1.08);
}
.sidebar[data-collapsed="true"] .sidebar-toggle-floating svg { transform: rotate(180deg); }
.sidebar-toggle-floating svg { transition: transform 0.32s var(--ease-soft); }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px 14px 20px;
  border-bottom: 1px solid var(--divider);
  min-height: 60px;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}
.sidebar-logo img {
  height: 32px;
  width: auto;
  flex-shrink: 0;
  filter: brightness(1);
  transition: filter 0.3s var(--ease-soft);
}
.sidebar-logo-full {
  display: block;
  opacity: 1;
  transition: opacity 0.18s var(--ease-soft);
}
.sidebar[data-collapsed="true"] .sidebar-logo-full { display: none; }

/* Mark button (collapsed: shows favicon, hover swaps to toggle icon) */
.sidebar-mark-btn {
  display: none;
  position: relative;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.18s var(--ease-soft);
  margin: 0;
  padding: 0;
}
.sidebar[data-collapsed="true"] .sidebar-mark-btn { display: inline-flex; }
.sidebar-mark-img {
  height: 30px !important;
  width: auto;
  transition: opacity 0.18s var(--ease-soft);
}
.sidebar-mark-toggle-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.18s var(--ease-soft);
  color: var(--text-secondary);
}
.sidebar-mark-btn:hover { background: var(--bg-hover); }
.sidebar-mark-btn:hover .sidebar-mark-img { opacity: 0; }
.sidebar-mark-btn:hover .sidebar-mark-toggle-icon { opacity: 1; color: var(--text); }
.sidebar-mark-btn[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--text);
  color: var(--bg-elev);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

/* Inline toggle (expanded state, header right) */
.sidebar-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.18s var(--ease-soft), color 0.18s var(--ease-soft);
  flex-shrink: 0;
}
.sidebar-toggle-btn:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-toggle-btn:active { transform: scale(0.94); }
.sidebar[data-collapsed="true"] .sidebar-toggle-btn { display: none; }
.sidebar-toggle-btn[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  right: 8px;
  top: 100%;
  margin-top: 4px;
  background: var(--text);
  color: var(--bg-elev);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.sidebar-toggle-btn { position: relative; }
.sidebar[data-collapsed="true"] .sidebar-header {
  padding: 12px 7px 12px 10px;
  justify-content: flex-start;
  border-bottom: none;
}
.sidebar-header { border-bottom: none !important; padding-bottom: 8px; }
.sidebar[data-collapsed="true"] .sidebar-logo {
  flex: 1 1 auto;
  justify-content: flex-start;
  overflow: visible;
}

.sidebar-toggle {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary);
  transition: all 0.18s var(--ease-soft);
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-toggle:active { transform: scale(0.92); }
.sidebar[data-collapsed="true"] .sidebar-toggle svg { transform: rotate(180deg); }
.sidebar-toggle svg { transition: transform 0.32s var(--ease-soft); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-section-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 10px 4px;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.2s var(--ease-soft);
}
.sidebar[data-collapsed="true"] .nav-section-label {
  opacity: 0;
  padding: 8px 0;
  height: 1px;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.14s var(--ease-soft), color 0.14s var(--ease-soft);
  white-space: nowrap;
  position: relative;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
[data-theme="dark"] .nav-item.active { color: var(--text); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
  transition: opacity 0.2s var(--ease-soft);
}

.nav-item-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.nav-item-icon svg { width: 18px; height: 18px; }

.nav-item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 1;
  transition: opacity 0.2s var(--ease-soft);
}
.sidebar[data-collapsed="true"] .nav-item-label {
  opacity: 0;
  width: 0;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  position: relative;
}
.nav-group-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  text-align: left;
  white-space: nowrap;
  transition: background 0.14s var(--ease-soft);
}
.nav-group-trigger:hover { background: var(--bg-hover); color: var(--text); }
.nav-group-chevron {
  margin-left: auto;
  transition: transform 0.25s var(--ease-soft), opacity 0.2s;
  width: 14px; height: 14px;
  color: var(--text-muted);
}
.nav-group[data-open="true"] .nav-group-chevron { transform: rotate(90deg); }
.sidebar[data-collapsed="true"] .nav-group-chevron { opacity: 0; }

.nav-group-children {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s var(--ease-soft);
}
.nav-group[data-open="true"] .nav-group-children { grid-template-rows: 1fr; }
.nav-group-children > div {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-left: 0;
}
.nav-group-children .nav-item {
  padding: 5px 10px 5px 38px;
  font-size: 13px;
  font-weight: 400;
  justify-content: flex-start;
  text-align: left;
}
.nav-group-children .nav-item .nav-item-label {
  text-align: left;
}

.sidebar[data-collapsed="true"] .nav-group-children { grid-template-rows: 0fr !important; }

.sidebar-footer {
  border-top: 1px solid var(--divider);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.14s var(--ease-soft);
  white-space: nowrap;
}
.user-card:hover { background: var(--bg-hover); }
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.user-info {
  display: flex; flex-direction: column;
  flex: 1;
  overflow: hidden;
  transition: opacity 0.2s var(--ease-soft);
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11.5px; color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; }
.sidebar[data-collapsed="true"] .user-info { opacity: 0; width: 0; }

/* ============ Sidebar Footer items (알림 / 설정 / 사용자) ============ */
.sidebar-footer-item { position: relative; }
.sidebar-footer-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: background 0.14s var(--ease-soft), color 0.14s var(--ease-soft);
  white-space: nowrap;
  text-align: left;
}
.sidebar-footer-btn:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-footer-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.sidebar-footer-label {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.2s var(--ease-soft);
}
.sidebar[data-collapsed="true"] .sidebar-footer-btn {
  justify-content: flex-start;
  padding: 8px 11px;
}
.sidebar[data-collapsed="true"] .sidebar-footer-label {
  opacity: 0;
  width: 0;
  display: none;
}

/* 알림 빨간 점 — 시인성 강화 (크기↑ + 글로우, 신규 감지 시 1회성 펄스) */
.sidebar-notify-dot {
  position: absolute;
  top: -3px; right: -3px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--status-fail);
  border: 2px solid var(--bg-elev);
  box-shadow:
    0 0 0 2px rgba(194, 53, 75, 0.20),
    0 0 6px rgba(194, 53, 75, 0.55);
}
[data-theme="dark"] .sidebar-notify-dot {
  box-shadow:
    0 0 0 2px rgba(226, 103, 121, 0.25),
    0 0 8px rgba(226, 103, 121, 0.55);
}
/* 미확인 건이 1건 이상이면 멈추지 않는 부드러운 호흡 펄스. */
.sidebar-notify-dot.notify-dot-pulse {
  animation: notifyDotPulse 2s var(--ease-soft) 0s infinite;
}
@keyframes notifyDotPulse {
  0%   { transform: scale(1);    box-shadow: 0 0 0 0   rgba(194, 53, 75, 0.55), 0 0 6px rgba(194, 53, 75, 0.55); }
  50%  { transform: scale(1.12); box-shadow: 0 0 0 5px rgba(194, 53, 75, 0.00), 0 0 6px rgba(194, 53, 75, 0.55); }
  100% { transform: scale(1);    box-shadow: 0 0 0 0   rgba(194, 53, 75, 0.00), 0 0 6px rgba(194, 53, 75, 0.55); }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar-notify-dot.notify-dot-pulse { animation: none; }
}

/* 알림 패널 popup — 사이드바 오른쪽 위로 펼침 */
.sidebar-notify-panel {
  position: absolute;
  left: calc(100% + 8px);
  bottom: 0;
  width: 320px;
  max-height: 420px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(15, 24, 40, 0.16), 0 2px 6px rgba(15, 24, 40, 0.06);
  z-index: 1000;
  overflow: hidden;
}
.sidebar-notify-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-notify-count {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}
.sidebar-notify-list {
  max-height: 360px;
  overflow-y: auto;
}
.sidebar-notify-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
}

/* 사용자 정보 + 로그아웃 행 */
.sidebar-footer-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin-top: 4px;
  border-top: 1px solid var(--divider);
  padding-top: 10px;
}
.sidebar-user-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  max-width: 300px;
  transition: opacity 0.2s var(--ease-soft), max-width 0.32s var(--ease-soft);
}
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-role {
  font-size: 11.5px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
}
.sidebar-footer-icon-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  background: transparent;
  cursor: pointer;
  transition: background 0.14s var(--ease-soft), color 0.14s var(--ease-soft);
}
.sidebar-footer-icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.sidebar[data-collapsed="true"] .sidebar-user-info {
  opacity: 0;
  max-width: 0;
}
.sidebar[data-collapsed="true"] .sidebar-footer-user {
  justify-content: flex-start;
  padding-left: 6px;
  padding-right: 6px;
  gap: 0;
}

/* 접힌 사이드바에서 footer 버튼 호버 시 툴팁 */
.sidebar[data-collapsed="true"] .sidebar-footer-btn[data-tooltip]:hover::after,
.sidebar[data-collapsed="true"] .sidebar-footer-icon-btn[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--text);
  color: var(--bg-elev);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 100;
  box-shadow: var(--shadow-md);
  pointer-events: none;
}
.sidebar[data-collapsed="true"] .sidebar-footer-icon-btn { position: relative; }
.sidebar[data-collapsed="true"] .sidebar-notify-panel {
  /* 접힘 상태에서도 동일하게 사이드바 오른쪽으로 펼침 */
  left: calc(100% + 8px);
}

/* ============ Settings 모달 row ============ */
#settingsModal .modal-body { padding: 8px 20px 16px; }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  min-height: 44px;
  border-bottom: 1px solid var(--divider);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

/* Tooltip when collapsed */
.sidebar[data-collapsed="true"] .nav-item,
.sidebar[data-collapsed="true"] .nav-group-trigger {
  position: relative;
  padding-left: 13px;
}
.sidebar[data-collapsed="true"] .sidebar-nav { overflow: visible; }
.sidebar[data-collapsed="true"] .nav-item:hover::after,
.sidebar[data-collapsed="true"] .nav-group:not([data-flyout="true"]) .nav-group-trigger:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--text);
  color: var(--bg-elev);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 100;
  box-shadow: var(--shadow-md);
  pointer-events: none;
}

/* Flyout menu (collapsed sidebar group) */
.nav-flyout {
  position: absolute;
  left: calc(100% + 10px);
  top: -4px;
  min-width: 220px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(15, 24, 40, 0.14), 0 2px 6px rgba(15, 24, 40, 0.06);
  padding: 6px;
  z-index: 200;
  animation: navFlyoutIn 0.14s var(--ease-soft);
}
@keyframes navFlyoutIn {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0); }
}
.nav-flyout-title {
  padding: 8px 12px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}
.nav-flyout-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.14s var(--ease-soft), color 0.14s var(--ease-soft);
}
.nav-flyout-item:hover { background: var(--bg-hover); }
.nav-flyout-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* 동적 메뉴 보강 — 접힌 사이드바에서만 flyout 노출 */
.nav-flyout { display: none; }
.sidebar[data-collapsed="true"] .nav-group { position: relative; }
.sidebar[data-collapsed="true"] .nav-group[data-flyout="true"] .nav-flyout { display: block; }
.sidebar[data-collapsed="true"] .nav-group .nav-group-children { display: none; }
.nav-flyout-item { text-decoration: none; }

/* 매핑이 없는 비활성 리프 — 호버 클릭 가능하지만 시각적으로 흐리게 */
.nav-item[data-disabled="true"],
.nav-flyout-item[data-disabled="true"] {
  color: var(--text-tertiary);
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============ Main ============ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

.icon-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-md);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-tertiary);
  transition: all 0.16s var(--ease-soft);
  position: relative;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 18px; height: 18px; }

.lang-switch {
  display: inline-flex;
  background: var(--bg-sunken);
  border-radius: 8px;
  padding: 3px;
  position: relative;
  font-size: 12px;
  font-weight: 600;
}
.lang-switch button {
  padding: 5px 12px;
  border-radius: 6px;
  color: var(--text-tertiary);
  position: relative;
  z-index: 1;
  transition: color 0.2s var(--ease-soft);
}
.lang-switch button.active { color: var(--text); }
.lang-switch .lang-pill {
  position: absolute;
  top: 3px; bottom: 3px;
  background: var(--bg-elev);
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
  transition: left 0.3s var(--ease-spring), width 0.3s var(--ease-spring);
}

/* Page area */
.page {
  flex: 1;
  min-height: 0;
  padding: 22px 24px 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.page > .fade-in {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 16px;
}
.page-title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text);
  flex-shrink: 0;
}
.page-subtitle {
  font-size: 12.5px;
  color: var(--text-tertiary);
  margin: 0;
  font-weight: 400;
  position: relative;
  padding-left: 12px;
}
.page-subtitle::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 13px;
  background: var(--border-strong);
}

/* ============ Card ============ */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}
.card-body { padding: 18px; }

/* ============ Filter bar ============ */
.filter-collapsible {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease, margin 0.35s ease;
  opacity: 1;
}
.filter-collapsible.closed {
  grid-template-rows: 0fr;
  opacity: 0;
  margin-bottom: -8px;
}
.filter-collapsible-inner {
  overflow: hidden;
  min-height: 0;
}
.form-panel-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.form-panel-body.closed {
  grid-template-rows: 0fr;
}
.form-panel-body-inner {
  overflow: hidden;
  min-height: 0;
}
[data-form-panel-header] {
  cursor: pointer;
  user-select: none;
}
[data-form-panel-header] svg {
  transition: transform 0.25s ease;
}
.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
}
.filter-toggle:hover {
  background: var(--bg-sunken);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.filter-card {
  display: grid;
  grid-template-columns: repeat(3, auto minmax(0, 1fr));
  gap: 10px 16px;
  padding: 14px 20px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  align-items: center;
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--gap-section);
}
.filter-field {
  display: grid;
  grid-column: span 2;
  grid-template-columns: subgrid;
  align-items: center;
  min-width: 0;
}
.filter-field > :not(.filter-label) {
  min-width: 0;
}
/* full-width rows (buttons / full-span date fields) keep flex layout */
.filter-field[style*="grid-column: 1 / -1"] {
  display: flex;
  flex-direction: row;
  gap: 10px;
}
/* filter-field spanning 2 logical columns */
.filter-field--wide { grid-column: span 4; }
.filter-field--wide > :not(.filter-label) { grid-column: 2 / -1; }
.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  line-height: 28px;
  white-space: nowrap;
}
.filter-label::before {
  content: '';
  width: 3px; height: 3px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
}

.input, .select {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-elev);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
  width: 100%;
}
.input:hover, .select:hover { border-color: var(--text-tertiary); }
.input:focus, .select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.input::placeholder { color: var(--text-muted); }

.select {
  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='%236B7585' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
  transition: border-color 0.15s var(--ease-soft), box-shadow 0.15s var(--ease-soft), background-color 0.15s var(--ease-soft);
}
.select:focus,
.select:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  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='%231E3A5F' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='18 15 12 9 6 15'/></svg>");
  outline: none;
}
.select:active { background-color: var(--primary-soft); }
.select option {
  padding: 8px 12px;
  background: var(--bg-elev);
  color: var(--text);
  font-size: 13px;
}

/* Custom <Select> trigger (button) — same look as .select */
button.select-trigger {
  appearance: none;
  display: inline-flex;
  align-items: center;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  background-image: none !important;
  padding-right: 30px;
  position: relative;
}
.select-caret {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%) rotate(0deg);
  color: var(--text-tertiary);
  pointer-events: none;
  transition: transform 0.18s var(--ease-soft), color 0.14s;
  flex-shrink: 0;
}
button.select-trigger.is-open .select-caret {
  transform: translateY(-50%) rotate(180deg);
  color: var(--primary);
}
button.select-trigger:disabled { opacity: 0.5; cursor: not-allowed; }
/* 폼 필드 읽기전용 select-wrap — 회색 배경 + 검정 글씨 */
.select-wrap[data-disabled="true"] button.select-trigger:disabled {
  background: var(--bg-sunken);
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  opacity: 1;
  cursor: default;
}
button.select-trigger.is-open {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  outline: none;
}
.select-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 14px;
}
.select-value.is-placeholder { color: var(--text-muted); }

/* Upload file row — compact chip-style selects */
.upload-file-chips {
  display: flex;
  gap: 6px;
  padding-left: 42px;
  flex-wrap: wrap;
}
.upload-file-chips-stacked {
  flex-direction: column;
  align-items: stretch;
  padding-left: 0;
  gap: 4px;
  flex-shrink: 0;
}
.upload-file-chip { flex: 0 0 auto; }
.upload-file-chip[data-extra-type-for] { width: 160px; }
.upload-page-chip { flex: 1; min-width: 0; }
.upload-thumb { align-items: stretch !important; }
.upload-thumb .upload-thumb-mini { align-self: center; }
.upload-thumb-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 0 2px;
}
.upload-thumb-foot .pdf-thumb-num {
  flex-shrink: 0;
  min-width: 22px;
  text-align: center;
}
.upload-thumbs-col {
  flex-shrink: 0;
  min-width: 130px;
  overflow: hidden;
}
.upload-thumbs-resizer {
  flex: 0 0 6px;
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  position: relative;
  z-index: 5;
}
.upload-thumbs-resizer-handle {
  width: 2px;
  height: 36px;
  background: var(--border);
  border-radius: 2px;
  transition: background 0.15s ease, height 0.15s ease;
}
.upload-thumbs-resizer:hover .upload-thumbs-resizer-handle,
.upload-thumbs-resizer:active .upload-thumbs-resizer-handle {
  background: var(--primary);
  height: 60%;
}
.upload-file-chip .select-trigger {
  height: 24px;
  width: 100%;
  min-width: 0;
  padding: 0 22px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  justify-content: center;
}
.upload-file-chip .select-trigger:hover {
  border-color: var(--primary);
  color: var(--text);
}
.upload-file-chip .select-trigger.is-open {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--text);
}
.upload-file-chip .select-value {
  padding-right: 0;
  font-size: 11px;
  text-align: center;
  flex: 0 1 auto;
}
.upload-file-chip .select-caret {
  right: 6px;
  width: 10px;
  height: 10px;
}
.upload-file-chip-prefix {
  margin-right: 4px;
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Popover */
.select-popover {
  position: fixed;
  z-index: 1000;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform-origin: top center;
  animation: selectPopIn 0.16s var(--ease-soft);
}
@keyframes selectPopIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.select-popover-inner {
  max-height: inherit;
  overflow-y: auto;
  padding: 4px;
  border-radius: var(--radius-md);
}
.select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: background 0.10s var(--ease-soft), color 0.10s var(--ease-soft);
}
.select-option-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.select-option.is-hover { background: var(--bg-hover); }
.select-option.is-selected {
  color: var(--primary);
  font-weight: 600;
}
.select-option.is-selected.is-hover,
.select-option.is-selected:hover { background: var(--primary-soft); }
.select option:hover,
.select option:checked {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
[data-theme="dark"] .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='%23A0AEC0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
}
[data-theme="dark"] .select:focus {
  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='%237EB3F0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='18 15 12 9 6 15'/></svg>");
}

.input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.input-group .input { flex: 1; }
.date-sep { color: var(--text-muted); font-weight: 500; }

/* Date input with calendar icon affordance */
.date-input-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 1;
}
.date-input-wrap .input {
  width: 100%;
  padding-right: 32px;
  font-variant-numeric: tabular-nums;
}
.date-input-icon {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
  display: flex;
}
.date-input-wrap:hover .date-input-icon,
.date-input-wrap:focus-within .date-input-icon { color: var(--primary); }

/* Date range popover */
.daterange-anchor { position: relative; }
.daterange-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 60;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 14px;
  display: flex;
  gap: 16px;
  transform-origin: top left;
  animation: drp-pop 0.16s var(--ease-soft);
}
@keyframes drp-pop {
  from { opacity: 0; transform: scale(0.97) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.dp-cal { width: 240px; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-head-title { font-size: 13px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.dp-nav-btn {
  width: 26px; height: 26px;
  border: 0; background: transparent;
  border-radius: 6px;
  color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.dp-nav-btn:hover { background: var(--bg-elev); color: var(--text); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow { font-size: 10.5px; font-weight: 600; color: var(--text-tertiary); text-align: center; height: 22px; line-height: 22px; }
.dp-dow.sun { color: #C53030; }
.dp-dow.sat { color: #2C5282; }
.dp-cell {
  height: 30px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  position: relative;
}
.dp-cell:hover { background: var(--bg-elev); }
.dp-cell.muted { color: var(--text-muted); }
.dp-cell.today { font-weight: 700; box-shadow: inset 0 0 0 1px var(--primary-soft); }
.dp-cell.in-range { background: var(--primary-soft); border-radius: 0; }
.dp-cell.range-start { background: var(--primary); color: var(--text-inverse); border-top-right-radius: 0; border-bottom-right-radius: 0; }
.dp-cell.range-end { background: var(--primary); color: var(--text-inverse); border-top-left-radius: 0; border-bottom-left-radius: 0; }
.dp-cell.range-start.range-end { border-radius: 6px; }
.dp-foot { display: flex; justify-content: flex-end; gap: 6px; padding-top: 10px; border-top: 1px solid var(--divider); margin-top: 10px; }
.dp-divider { width: 1px; background: var(--divider); }

.chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  min-height: 34px;
}
.chip {
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  transition: all 0.16s var(--ease-soft);
}
.chip:hover { background: var(--bg-hover); color: var(--text); border-color: var(--text-tertiary); }
.chip:active { transform: scale(0.95); }
.chip.active {
  background: var(--primary);
  color: var(--text-inverse);
  border-color: var(--primary);
}
[data-theme="dark"] .chip.active { color: var(--bg); }

.radio-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  height: 34px;
  align-items: center;
}
.radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.radio input { display: none; }
.radio .radio-dot {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.16s var(--ease-soft);
  flex-shrink: 0;
}
.radio input:checked + .radio-dot {
  border-color: var(--primary);
  border-width: 5px;
}
.radio:hover .radio-dot { border-color: var(--primary); }

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.16s var(--ease-soft);
  border: 1px solid transparent;
  letter-spacing: -0.005em;
}
.btn:active { transform: scale(0.96); }
.btn svg { width: 14px; height: 14px; }
.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}
/* 검증반영 버튼은 비활성 상태에서도 호버 시 not-allowed 커서와 title 툴팁을 노출한다. */
#detailCommitBtn:disabled,
#detailCommitBtn[disabled] {
  pointer-events: auto;
}

.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
}
[data-theme="dark"] .btn-primary { color: var(--bg); }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 4px 10px -2px var(--primary-soft-hover); }
.btn-primary:active { background: var(--primary-active); }

.btn-secondary {
  background: var(--bg-elev);
  color: var(--text-secondary);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text); border-color: var(--text-tertiary); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-danger {
  background: var(--bg-elev);
  color: var(--status-fail);
  border-color: var(--status-fail-soft);
}
.btn-danger:hover { background: var(--status-fail-soft); }

.btn-accent {
  background: var(--accent);
  color: #1F2C13;
}
.btn-accent:hover { background: var(--accent-hover); }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 40px; padding: 0 18px; font-size: 14px; }

/* ============ Table / Grid ============ */
.data-grid {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  align-self: stretch;
}
.grid-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 39px;
  padding: 0 16px;
  border-bottom: 1px solid var(--divider);
  gap: 12px;
  flex-shrink: 0;
}
.grid-meta {
  font-size: 13px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 14px;
}
.grid-meta strong { color: var(--text); font-weight: 600; }

.grid-scroll {
  overflow: auto;
  flex: 1;
  min-height: 0;
  width: 100%;
}

table.t {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
table.t.verify-grid {
  table-layout: fixed;
  width: 100%;
}
table.t.verify-grid tbody td {
  max-width: none;
}
/* Register list grid — fixed layout so columns fill 100% width regardless of cell max-width */
table.t.register-grid {
  table-layout: fixed;
  width: 100%;
}
table.t.register-grid tbody td {
  max-width: none;
}
/* Verify grid header — light sky blue, centered */
table.t.verify-grid thead th {
  background: #E6F1FB;
  color: var(--text-secondary);
  border-bottom: 2px solid #BBD6EC;
  box-shadow: inset 0 -1px 0 rgba(43, 74, 107, 0.08);
  text-align: center;
}

/* Resizable grid — column resize handles between headers */
table.resizable-grid thead th { position: relative; }
table.resizable-grid thead th .col-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
  user-select: none;
  background: transparent;
  transition: background 0.12s var(--ease-soft);
}
table.resizable-grid thead th .col-resizer::after {
  content: "";
  position: absolute;
  top: 25%;
  left: 50%;
  width: 1px;
  height: 50%;
  background: rgba(43, 74, 107, 0.18);
  transform: translateX(-50%);
}
table.resizable-grid thead th .col-resizer:hover,
table.resizable-grid thead th .col-resizer.active {
  background: rgba(74, 144, 226, 0.25);
}
table.resizable-grid.resizing,
table.resizable-grid.resizing * { user-select: none !important; cursor: col-resize !important; }
table.t.resizable-grid {
  table-layout: fixed;
  width: 100%;
}
table.t.resizable-grid tbody td { max-width: none; }
table.t.resizable-grid thead th {
  border-bottom: 2px solid #BBD6EC;
  box-shadow: inset 0 -1px 0 rgba(43, 74, 107, 0.08);
}
table.t thead th {
  position: sticky;
  top: 0;
  background: #E6F1FB;
  color: var(--text-secondary);
  font-weight: 600;
  text-align: left;
  padding: 0 var(--cell-px);
  height: 38px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  z-index: 2;
  font-size: 12.5px;
  letter-spacing: -0.005em;
}
table.t thead th:first-child { padding-left: 16px; }
table.t thead th.center { text-align: center; }
table.t thead th.right { text-align: right; }

table.t tbody td {
  padding: var(--cell-py) var(--cell-px);
  border-bottom: 1px solid var(--divider);
  height: var(--row-h);
  color: var(--text);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}
table.t tbody td:first-child { padding-left: 16px; }
table.t tbody tr.group-start td.group-cell { padding-left: 16px; }
table.t tbody tr.group-start td.group-cell + td { padding-left: 16px; }
table.t tbody td.center { text-align: center; }
table.t tbody td.right { text-align: right; }
table.t tbody td.mono { font-family: var(--font-mono); font-size: 12px; }
table.t tbody td.num { font-variant-numeric: tabular-nums; color: var(--text-tertiary); }

table.t tbody tr {
  cursor: pointer;
  transition: background 0.12s var(--ease-soft);
}
table.t tbody tr:hover { background: var(--bg-hover); }
table.t tbody tr.selected { background: var(--primary-soft); }
table.t tbody tr.selected td { color: var(--text); }
table.t tbody tr.group-start td { border-top: 1px solid var(--border); }
.loader-spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: loader-spin 0.7s linear infinite;
}
@keyframes loader-spin { to { transform: rotate(360deg); } }

/* Sequence tabs (detail header) */
.seq-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: color 0.14s, border-color 0.14s, background 0.14s;
}
.seq-tab:hover { color: var(--text-primary); background: var(--bg-hover); }
.seq-tab[data-active="true"] {
  color: var(--text-primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.seq-tab-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 600;
}
.seq-tab[data-active="true"] .seq-tab-num { color: var(--primary); }
.seq-tab-name { color: var(--text-secondary); }

/* File rows (분석파일 / 원본파일) — detail header */
.file-row {
  display: flex;
  align-items: stretch;
  border-top: 1px solid var(--divider);
  background: #ffffff;
  min-height: 38px;
}
/* 분석파일 ↔ 원본파일 명확한 분리 */
.file-row + .file-row {
  border-top: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(15, 27, 45, 0.04);
  background: #ffffff;
}
.file-row + .file-row .file-row-label {
  background: #E6F1FB;
}
.file-row-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #2B4A6B;
  text-transform: uppercase;
  flex-shrink: 0;
  white-space: nowrap;
  min-width: 112px;
  background: #E6F1FB;
  border-right: 1px solid #BBD6EC;
  height: 38px;
  align-self: flex-start;
}
.file-row-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 16px;
  padding: 0 5px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #BBD6EC;
  color: #2B4A6B;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.file-row-scroller {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
}
/* file-row-scroller 의 스크롤바는 전역 스크롤바와 통일 */

.file-nav-group {
  display: flex;
  flex-shrink: 0;
  border-left: 1px solid var(--divider);
}
.file-nav-btn {
  flex-shrink: 0;
  width: 32px;
  height: 38px;
  align-self: flex-start;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.14s, color 0.14s, opacity 0.14s;
}
.file-nav-btn.prev { border-right: 1px solid var(--divider); }
.file-nav-btn.next { }
.file-nav-btn:hover:not(:disabled) {
  background: #F4F8FC;
  color: var(--text);
}
.file-nav-btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

.file-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-elev);
  cursor: pointer;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  position: relative;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
  line-height: 1;
}
.file-chip:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--primary-soft);
}
.file-chip[data-active="true"] {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: 600;
}
.file-chip[data-active="true"]::after { display: none; }
.file-chip-confirm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  margin-left: 2px;
}
.file-chip-confirm[data-confirmed="true"] { color: var(--status-success); --check-color: white; }
.file-chip-confirm[data-confirmed="false"] { color: var(--text-muted); }
.file-chip[data-active="true"] .file-chip-confirm[data-confirmed="true"] { color: #ffffff; --check-color: var(--primary); }
.file-chip[data-active="true"] .file-chip-confirm[data-confirmed="false"] { color: rgba(255,255,255,0.7); }
.file-chip-num {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-tertiary);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.file-chip[data-active="true"] .file-chip-num { color: rgba(255,255,255,0.85); }
.file-chip-badge {
  display: inline-block;
  padding: 1px 6px;
  background: var(--bg-sunken);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
}
.file-chip-badge[data-active="true"] {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.file-chip-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--status-success);
  color: white;
  flex-shrink: 0;
}
.file-chip-pending {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.file-chip[data-active="true"] .file-chip-check {
  box-shadow: 0 0 0 2px var(--bg-elev);
}
.file-chip[data-active="true"] .file-chip-pending {
  color: var(--primary);
}
.manual-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.manual-type-chip:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--primary-soft);
}
.manual-type-chip[data-active="true"] {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: 600;
}
.meta-collapse {
  overflow: hidden;
  max-height: 600px;
  opacity: 1;
  transition: max-height 0.32s var(--ease-soft), opacity 0.22s var(--ease-soft);
}
.meta-collapse[data-collapsed="true"] {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}
.file-chip-name {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-chip-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* Horizontal pdf tab */
.pdf-tab-h {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.14s, border-color 0.14s, background 0.14s;
}
.pdf-tab-h:hover { color: var(--text-primary); background: var(--bg-hover); }
.pdf-tab-h.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
  background: var(--bg-elevated);
}

/* Status dot/badge */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--status-pending-soft);
  color: var(--status-pending);
  white-space: nowrap;
}
.status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status.pending { background: var(--status-pending-soft); color: var(--status-pending); }
.status.progress { background: var(--status-progress-soft); color: var(--status-progress); }
.status.progress::before { animation: pulse-dot 1.4s ease-in-out infinite; }
.status.success { background: var(--status-success-soft); color: var(--status-success); }
.status.fail    { background: var(--status-fail-soft);    color: var(--status-fail); }
.status.reapply { background: var(--status-reapply-soft); color: var(--status-reapply); }
.status.info    { background: var(--status-info-soft);    color: var(--status-info); }
.status.teal   { background: var(--status-teal-soft);   color: var(--status-teal); }
.status.purple { background: var(--status-purple-soft); color: var(--status-purple); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.7); }
}

.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  vertical-align: middle;
}
.dot.pending { background: var(--status-pending); }
.dot.progress { background: var(--status-progress); }
.dot.success  { background: var(--status-success); }
.dot.fail     { background: var(--status-fail); }
.dot.reapply  { background: var(--status-reapply); }

/* checkbox */
.checkbox {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--bg-elev);
  transition: all 0.14s var(--ease-soft);
  flex-shrink: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
}
.checkbox:hover { border-color: var(--primary); }
.checkbox.checked {
  background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='8' viewBox='0 0 10 8'%3E%3Cpolyline points='1 4 4 7 9 1' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
  border-color: var(--primary);
}

/* toggle switch — STK2026 메신저ID 확인 (행사 종료 후 제거) */
.switch {
  position: relative;
  width: 34px;
  height: 18px;
  border-radius: 999px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-elev);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.16s var(--ease-soft), border-color 0.16s var(--ease-soft);
}
.switch::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  transform: translateY(-50%);
  transition: left 0.16s var(--ease-soft), background 0.16s var(--ease-soft);
}
.switch.on {
  background: var(--primary);
  border-color: var(--primary);
}
.switch.on::after {
  left: 18px;
  background: #fff;
}

/* ============ Editable grid (system management) ============ */
table.t.sys-user-grid thead th {
  background: #E6F1FB;
  color: var(--text-secondary);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  box-shadow: inset 0 -1px 0 rgba(43, 74, 107, 0.08);
}
table.t.sys-user-grid tbody td {
  padding: 4px 6px;
  vertical-align: middle;
}
table.t.sys-user-grid tbody td:first-child { padding-left: 12px; }
table.t.sys-user-grid tbody tr { cursor: default; }
table.t.sys-user-grid tbody tr[data-state="new"] td:first-child { box-shadow: inset 3px 0 0 var(--status-success); }
table.t.sys-user-grid tbody tr[data-state="edit"] td:first-child { box-shadow: inset 3px 0 0 var(--status-progress); }
.cell-input:hover { background: var(--bg-sunken) !important; }
.cell-input:focus { background: var(--bg-elev) !important; border-color: var(--primary) !important; }
.cell-select { width: 100%; }
.cell-select.is-empty .select-btn,
.cell-select.is-empty button[class*="select"] {
  border-color: var(--status-fail-soft);
}

/* ============ Modal ============ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 27, 45, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s var(--ease-soft);
}
[data-theme="dark"] .modal-overlay { background: rgba(0, 0, 0, 0.6); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal {
  background: var(--bg-elev);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-pop);
  max-width: 92vw;
  max-height: 92vh;
  overflow: hidden;
  animation: slideUp 0.28s var(--ease-spring);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--divider);
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-title small {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  background: var(--bg-sunken);
  padding: 2px 8px;
  border-radius: 4px;
}
.modal-close { /* uses .icon-btn */ }
.modal-body { padding: 20px; overflow: auto; flex: 1; }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--divider);
  background: var(--bg-sunken);
}

/* ============ 등록문서 미리보기 모달 ============ */
.doc-preview-modal {
  width: 92vw;
  height: calc(100vh - 24px);
  max-height: calc(100vh - 24px);
  max-width: 1480px;
  border-radius: var(--radius-xl);
}
/* 등록문서번호 칩 — 모달 타이틀 본문과 같은 사이즈로 보이도록 */
.doc-preview-modal .modal-title small {
  font-size: 16px;
  padding: 4px 10px;
}
/* 분석파일 활성 상태에서는 좌측 썸네일/리사이저 영역을 숨긴다 (단일 페이지). */
.doc-preview-modal[data-active-kind="analysis"] .upload-thumbs-col,
.doc-preview-modal[data-active-kind="analysis"] .upload-thumbs-resizer {
  display: none;
}
/* 원본파일 chip 의 파일 유형 배지 — toolbar 의 .upload-preview-icon 톤과 통일. */
.file-chip-badge.is-pdf:not([data-active="true"]) {
  background: var(--status-fail-soft);
  color: var(--status-fail);
  border-color: var(--status-fail-soft);
}
.file-chip-badge.is-img:not([data-active="true"]) {
  background: var(--status-progress-soft);
  color: var(--status-progress);
  border-color: var(--status-progress-soft);
}
/* 모달은 height 가 고정이므로 본문(썸네일+캔버스)이 남은 공간을 차지하도록 */
.doc-preview-body {
  display: flex;
  flex: 1;
  min-height: 0;
}
.doc-preview-body .upload-preview-main {
  position: relative;
}
.doc-preview-empty {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 12.5px;
  pointer-events: none;
}

/* ============ PDF viewer mock ============ */
.pdf-shell {
  display: flex;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 100%;
  min-height: 600px;
}
.pdf-sidebar {
  width: 168px;
  background: var(--bg-elev);
  border-right: 1px solid var(--divider);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  flex-shrink: 0;
}
.pdf-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.14s var(--ease-soft);
  text-align: left;
  width: 100%;
}
.pdf-tab:hover { background: var(--bg-hover); color: var(--text); }
.pdf-tab.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-soft-hover);
  font-weight: 600;
}
[data-theme="dark"] .pdf-tab.active { color: var(--text); }
.pdf-tab svg { width: 14px; height: 14px; flex-shrink: 0; }

.pdf-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-sunken);
}
.pdf-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--divider);
}
.pdf-search {
  flex: 1;
  max-width: 280px;
}
.pdf-zoom {
  display: inline-flex;
  align-items: center;
  background: var(--bg-sunken);
  border-radius: 6px;
  padding: 2px;
}
.pdf-zoom button {
  width: 26px; height: 26px;
  border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: background 0.12s;
}
.pdf-zoom button:hover { background: var(--bg-elev); }
.pdf-zoom-value { padding: 0 8px; font-size: 12px; font-weight: 600; min-width: 48px; text-align: center; cursor: pointer; }
.pdf-zoom-value:hover { color: var(--primary); }
.pdf-zoom button:disabled { opacity: 0.35; cursor: not-allowed; }
.pdf-zoom button:disabled:hover { background: transparent; }
.pdf-zoom-input-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 22px;
  padding: 0 6px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}
.pdf-zoom-input-wrap:hover { background: var(--bg-elev); }
.pdf-zoom-input-wrap:focus-within {
  border-color: var(--primary);
  background: var(--bg);
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.pdf-zoom-input {
  width: 28px;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
  outline: none;
}
.pdf-zoom-pct {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-left: 1px;
  pointer-events: none;
}
.pdf-zoom .pdf-zoom-select { margin-right: 4px; }

.pdf-tab-icon-btn {
  width: 28px;
  align-self: center;
  height: 28px;
  margin: 0 2px 0 6px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: background 0.14s, color 0.14s;
}
.pdf-tab-icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.pdf-tab-icon-btn.active { background: var(--primary-soft); color: var(--primary); }

@keyframes pagesPanelIn {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}

.pdf-canvas {
  flex: 1;
  overflow: auto;
  padding: 24px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.pdf-page {
  width: 100%;
  max-width: 720px;
  background: white;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 36px 40px;
  font-family: 'Times New Roman', serif;
  color: #111;
  line-height: 1.55;
  min-height: 800px;
}
[data-theme="dark"] .pdf-page { background: #f0f0f0; }

/* ============ PDF page thumbnails sidebar ============ */
.pdf-thumbs {
  width: 132px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-sunken);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.pdf-thumbs-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pdf-thumbs-label span {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.pdf-thumbs-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pdf-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 0;
  padding: 4px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s ease;
}
.pdf-thumb:hover { background: var(--bg-hover); }
.pdf-thumb-mini {
  width: 96px;
  height: 124px;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
[data-theme="dark"] .pdf-thumb-mini { background: #f0f0f0; }
.pdf-thumb-bar {
  height: 4px;
  background: #d4d4d8;
  border-radius: 1px;
  display: block;
}
.pdf-thumb-num {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}
.pdf-thumb[data-active="true"] .pdf-thumb-mini {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft), 0 2px 6px rgba(15, 23, 42, 0.08);
}
.pdf-thumb[data-active="true"] .pdf-thumb-num {
  color: var(--primary);
  font-weight: 700;
}
.upload-thumb[data-active="true"] .upload-thumb-mini {
  border-color: var(--primary);
  border-width: 2px;
  box-shadow: 0 0 0 3px var(--primary-soft), 0 2px 8px rgba(15, 23, 42, 0.12);
}
.upload-thumb[data-active="true"] .pdf-thumb-num {
  color: #fff;
  background: var(--primary);
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 700;
}

/* ============ Drop zone ============ */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--bg-elev);
  cursor: pointer;
  transition: all 0.2s var(--ease-soft);
  text-align: center;
  min-height: 240px;
}
.dropzone:hover, .dropzone.over {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.dropzone-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  transition: transform 0.3s var(--ease-spring);
}
.dropzone:hover .dropzone-icon { transform: scale(1.08) translateY(-2px); }
.dropzone-title { font-weight: 600; color: var(--text); }
.dropzone-sub { font-size: 12px; color: var(--text-tertiary); }

/* ============ Mini info ============ */
.kbd {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--bg-sunken);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  box-shadow: inset 0 -1px 0 var(--border);
}

.legend {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--text-tertiary);
}
.legend-item { display: inline-flex; align-items: center; gap: 5px; }

/* ============ Stats / Dashboard ============ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: var(--gap-section);
}
.stat-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s var(--ease-soft), box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-label {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
}
.stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.stat-value small { font-size: 13px; font-weight: 500; color: var(--text-tertiary); }
.stat-trend {
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.stat-trend.up { color: var(--status-success); }
.stat-trend.down { color: var(--status-fail); }

/* ============ Tabs (page-level) ============ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--gap-section);
  position: relative;
}
.tab {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s var(--ease-soft);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
[data-theme="dark"] .tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ============ Login ============ */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  background: var(--bg);
}
.login-hero {
  background: #122340;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 48px;
  color: white;
}
.login-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 720px 520px at 12% -8%, rgba(74, 123, 192, 0.42), transparent 60%),
    radial-gradient(ellipse 620px 440px at 108% 24%, rgba(99, 102, 241, 0.28), transparent 58%),
    radial-gradient(ellipse 820px 600px at 50% 118%, rgba(168, 210, 74, 0.10), transparent 65%);
  pointer-events: none;
}
.login-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1.2px);
  background-size: 28px 28px;
  opacity: 0.55;
  -webkit-mask-image: radial-gradient(ellipse at center, black 18%, transparent 78%);
  mask-image: radial-gradient(ellipse at center, black 18%, transparent 78%);
  pointer-events: none;
}
.login-hero-stage {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #122340;
  pointer-events: none;
}
.login-hero-stage canvas {
  display: block;
  position: absolute;
  inset: 0;
}
.login-hero .vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 48%, transparent 0%, transparent 44%, rgba(0,0,0,0.22) 72%, rgba(0,0,0,0.68) 100%),
    linear-gradient(to bottom, rgba(255,255,255,0.025), transparent 22%, rgba(0,0,0,0.18));
}
.login-hero-content { position: relative; z-index: 3; max-width: 480px; }
.login-hero h1 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
  line-height: 1.15;
}
.login-hero p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.6;
  margin: 0;
}
.login-form-pane {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}
.login-form {
  width: 100%;
  max-width: 380px;
}
.login-logo { height: 36px; margin-bottom: 36px; }
[data-theme="dark"] .login-logo { filter: brightness(0) invert(0.92); }
.login-form h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.login-form .sub {
  font-size: 13px;
  color: var(--text-tertiary);
  margin: 0 0 28px;
}
.field-group { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.input-lg {
  height: 42px;
  font-size: 14px;
  padding: 0 14px;
}
.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12.5px;
}
.btn-login {
  width: 100%;
  height: 44px;
  font-size: 14px;
  margin-top: 22px;
}
.login-foot {
  text-align: center;
  margin-top: 22px;
  font-size: 12px;
  color: var(--text-tertiary);
}
.login-foot a { color: var(--primary); font-weight: 600; text-decoration: none; }

.login-tour {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(168, 210, 74, 0.06);
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}
.login-tour-link {
  color: var(--primary);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  margin-left: 6px;
}
.login-tour-link:hover { opacity: 0.85; }

/* ============ Bar chart ============ */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 48px;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}
.bar-label { color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-value { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.bar-track {
  height: 22px;
  background: var(--bg-sunken);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-hover));
  border-radius: 4px;
  transition: width 0.6s var(--ease-spring);
}
.bar-fill.accent { background: linear-gradient(90deg, var(--accent), var(--accent-hover)); }

.revision-dashboard {
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) minmax(520px, 1.35fr);
  gap: 14px;
  height: clamp(340px, calc(100vh - 360px), 560px);
  min-height: 0;
  align-items: stretch;
}
.revision-list-panel,
.revision-chart-panel {
  min-width: 0;
}
.revision-list-panel {
  display: flex;
  flex-direction: column;
}
.revision-list-scroll {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}
.revision-chart-area {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  min-height: 0;
}
.revision-chart-wide {
  grid-column: 1 / -1;
}
.revision-chart-panel {
  display: flex;
  flex-direction: column;
  padding: 14px 14px 8px;
  min-height: 0;
  overflow: hidden;
}
.revision-chart-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.revision-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 96px;
  height: auto;
  border-bottom: 1px solid var(--divider);
}
.revision-canvas-small {
  height: auto;
}
.revision-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.revision-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  padding-top: 8px;
  min-height: 28px;
}
.revision-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 118px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-sunken);
  color: var(--text-secondary);
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.revision-legend-item:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.revision-legend-item[data-disabled="true"] {
  opacity: 0.42;
}
.revision-legend-item[data-disabled="true"] .revision-legend-swatch {
  background: var(--text-muted) !important;
}
.revision-legend-swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex: 0 0 auto;
}
@media (max-width: 1180px) {
  .revision-dashboard {
    grid-template-columns: 1fr;
    height: auto;
  }
  .revision-list-scroll { max-height: 420px; }
}
@media (max-width: 720px) {
  .revision-chart-area {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }
  .revision-chart-wide {
    grid-column: auto;
  }
  .revision-canvas-wrap {
    min-height: 220px;
  }
}

/* tree expandable cell */
.tree-cell { display: inline-flex; align-items: center; gap: 4px; }
.tree-toggle {
  width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-tertiary);
  transition: transform 0.18s;
}
.tree-toggle.open { transform: rotate(90deg); }
.tree-indent { display: inline-block; width: 18px; }

/* fade in for content */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp 0.32s var(--ease-soft); }

/* responsive collapse */
@media (max-width: 1100px) {
  .filter-card { grid-template-columns: repeat(2, auto minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============ Upload preview (문서등록 우측 영역) ============ */
.upload-preview-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 14px;
  border-bottom: 1px solid var(--divider);
  background: var(--bg-elev);
  flex-shrink: 0;
}
/* 검증상세 — 좌측 페이지 썸네일 컬럼 접기/펼치기 토글 (문서유형 아이콘 왼쪽) */
.detail-thumbs-toggle {
  width: 26px; height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-tertiary);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.detail-thumbs-toggle:hover { color: var(--primary); border-color: var(--primary); }
.detail-thumbs-toggle.is-active {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: var(--primary);
}
.upload-thumbs-col[data-collapsed="true"] {
  /* 너비는 JS 인라인으로 제어 — !important 강제와 inline 사이의 전환을 막아 transition 이 깔끔하게 보간되게 한다. */
  min-width: 0 !important;
  overflow: hidden;
}
.upload-thumbs-resizer[data-collapsed="true"] {
  flex: 0 0 0;
  pointer-events: none;
  opacity: 0;
}
/*
  검증상세 페이지의 페이지목록 컬럼 — 접기/펼치기에 부드러운 너비 전환.
  업로드 페이지의 드래그 리사이즈는 transition이 있으면 끊겨 보이므로
  드래그 중에는 인라인 `style.transition='none'` 으로 임시 무효화한다.
*/
/*
  min-width 가 transition 도중에 강제 최솟값을 만들면 펼치기 초반에 130px 로
  스냅돼 어색해진다. 검증상세에서는 JS 리사이저(MIN_W=130) 가 사용자의 드래그를
  보호하므로 CSS 차원의 min-width 는 0 으로 풀어 width 만 자유롭게 보간한다.
*/
#detailPreviewPane .upload-thumbs-col {
  min-width: 0;
  transition: width 0.11s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: width;
}
#detailPreviewPane .upload-thumbs-resizer {
  transition: opacity 0.1s ease;
}
.upload-preview-file {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}
.upload-preview-icon {
  width: 26px; height: 26px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
}
.upload-preview-icon.is-pdf { background: var(--status-fail-soft); color: var(--status-fail); }
.upload-preview-icon.is-img { background: var(--status-progress-soft); color: var(--status-progress); }
.upload-preview-icon.is-text { background: var(--primary-soft); color: var(--primary); }

/*
  pdf.js textLayer — 캔버스 위에 투명 텍스트 span 을 절대 위치로 깔아
  사용자가 드래그로 PDF 텍스트를 선택/복사할 수 있게 한다.
  page-detail.js 는 textLayer 를 css 픽셀 viewport(zoom/100)로 별도 렌더링하므로
  인라인 span 좌표가 이미 css 픽셀 기준이라 transform 스케일링은 불필요.
*/
.pdf-page-shell { position: relative; display: inline-block; }
.textLayer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 1;
  line-height: 1;
  transform-origin: 0 0;
  pointer-events: auto;
}
.textLayer > span,
.textLayer > br {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
}
.textLayer ::selection { background: rgba(0, 100, 255, 0.35); color: transparent; }
.textLayer ::-moz-selection { background: rgba(0, 100, 255, 0.35); color: transparent; }
/*
  분석파일 미리보기 헤더의 PDF/TEXT 토글 — button 으로 렌더링되므로 기본
  button 스타일을 끄고, 활성 상태는 data-active 로 강조한다.
*/
button.upload-preview-icon {
  border: 1px solid transparent;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  transition: opacity 0.15s ease, border-color 0.15s ease;
  opacity: 0.45;
}
button.upload-preview-icon[data-active="true"] {
  opacity: 1;
  border-color: currentColor;
}
button.upload-preview-icon:hover { opacity: 1; }
.upload-preview-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex-shrink: 0;
}
.upload-preview-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--text-tertiary);
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.upload-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.upload-mode-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.upload-mode-opt input[type="radio"] {
  accent-color: var(--primary);
  width: 14px;
  height: 14px;
  cursor: pointer;
}
.upload-mode-opt input[type="radio"]:checked + span {
  color: var(--primary);
  font-weight: 600;
}
.upload-preview-body {
  display: flex;
  flex: 1;
  min-height: 0;
  background: var(--bg-sunken);
}
.upload-thumbs-col {
  width: 116px;
}
.upload-thumb { gap: 6px; }
.upload-thumb-mini {
  position: relative;
  width: 100%;
  aspect-ratio: 84 / 110;
  height: auto;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.upload-thumb-page-num {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 3;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px 2px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  letter-spacing: 0.02em;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.upload-thumb[data-active="true"] .upload-thumb-page-num {
  background: var(--primary);
}
.upload-thumb-mini:hover { border-color: var(--border-strong); }
.upload-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.upload-thumb-check {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  margin: 0;
  cursor: pointer;
  background: white;
  border-radius: 2px;
  z-index: 2;
}
.upload-preview-main {
  flex: 1;
  min-width: 0;
  display: flex;
  background: var(--bg-sunken);
}
.upload-preview-scroll {
  flex: 1;
  min-width: 0;
  overflow: auto;
  padding: 16px;
  display: flex;
  align-items: flex-start;
}
.pdf-pages-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  /* 확대로 페이지가 뷰포트보다 넓어지면 center 정렬은 좌측 overflow 를
     scrollLeft(>=0) 로 도달 불가하게 만든다. safe 로 넘칠 때만 좌측 정렬 폴백.
     앞 줄(center)은 safe 미지원 브라우저용 폴백. */
  align-items: center;
  align-items: safe center;
  gap: 16px;
}
.pdf-page-item {
  flex-shrink: 0;
}
.upload-preview-canvas {
  background: white;
  box-shadow: var(--shadow-md);
  max-width: none;
  display: block;
  margin: 0 auto;
}
[data-preview-img] {
  background: white;
  box-shadow: var(--shadow-md);
  max-width: none;
  margin: 0 auto;
}

/* ============ Upload pan hint ============ */
.upload-pan-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  user-select: none;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.upload-pan-hint.is-active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}

/* ────────────────────────────────────────────────────────────────────
   리사이즈 가능 그리드 (검증 상세의 분석항목·공통수기항목)
   - <table class="resizable-grid"> + <th> 안에 <span class="col-resizer">
   - 너비는 page-detail.js 가 <col> 요소에 width:N% 로 주입 (% 관리)
   - 마지막 컬럼은 resizer 없음 (자동 잔여 공간)
──────────────────────────────────────────────────────────────────── */
.resizable-grid {
  table-layout: fixed;
  width: 100%;
}
.resizable-grid th {
  position: relative; /* col-resizer 의 absolute 앵커 */
}
.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  background: transparent;
  z-index: 2;
  transition: background-color 0.15s ease;
}
.col-resizer:hover,
.col-resizer.is-dragging {
  background: var(--primary-soft);
}
.col-resizer::after {
  content: "";
  position: absolute;
  top: 25%;
  right: 2px;
  width: 1px;
  height: 50%;
  background: var(--divider);
  transition: background-color 0.15s ease;
}
.col-resizer:hover::after,
.col-resizer.is-dragging::after {
  background: var(--primary);
}

/* ── 항목등록 그리드 드래그앤드롭 ─────────────────────────── */
.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 24px;
  cursor: grab;
  color: var(--text-tertiary);
  font-size: 14px;
  border-radius: 3px;
  user-select: none;
}
.drag-handle:hover { color: var(--text-secondary); background: var(--bg-hover); }
.drag-handle:active { cursor: grabbing; }

.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  background: var(--bg-elev, #fff) !important;
  border: 1px solid var(--primary);
  border-radius: 6px;
  opacity: 0.96;
  box-shadow: 0 10px 28px rgba(0,0,0,.22), 0 2px 8px rgba(0,0,0,.10);
  overflow: hidden;
  table-layout: fixed !important;
}

table.t tbody tr.drag-over-top td  { box-shadow: inset 0 2px 0 0 var(--primary); }
table.t tbody tr.drag-over-bottom td { box-shadow: inset 0 -2px 0 0 var(--primary); }

/* 검증 상세의 분석항목·공통수기항목 그리드 행은 "클릭 가능한 행" 이 아니다.
   포인터 커서/호버 하이라이트를 제거하고, 셀의 텍스트 영역은 I-beam(text) 커서를 유지해
   사용자가 분석 결과 등을 드래그/복사 할 수 있도록 한다.
   (textarea·button 같은 인터랙티브 자식은 각자 자신의 cursor 를 가진다.) */
table.t.verify-grid tbody tr {
  cursor: text;
}
table.t.verify-grid tbody tr:hover {
  background: transparent;
}
table.t.verify-grid tbody td {
  cursor: text;
}
table.t.verify-grid tbody td button,
table.t.verify-grid tbody td a {
  cursor: pointer;
}
table.t.verify-grid tbody td textarea:disabled {
  cursor: not-allowed;
}

/* 분석내용 → 수정내용 복사 컬럼 (analysisGrid 의 가운데 컬럼)
   - 헤더(>>) : 전체 복사 — 다른 헤더와 동일한 연한 하늘색 배경, 아이콘만 회색
   - 행(>)    : 해당 행만 복사 — 셀 전체 높이만큼 클릭 히트박스 확장
   - 행 호버 시에만 행 버튼이 또렷해져 시각 잡음을 줄인다. */
table.t.verify-grid thead th.copy-col-head {
  /* background 는 .verify-grid thead th 기본값(#E6F1FB) 사용 */
  padding: 0;
}
table.t.verify-grid tbody td.copy-col-cell {
  padding: 0;
  text-align: center;
  vertical-align: middle;
  cursor: default;
  border-left: 1px dashed var(--divider);
  border-right: 1px dashed var(--divider);
  background: color-mix(in srgb, #E6F1FB 35%, transparent);
}
.copy-col-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  margin: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm, 4px);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  line-height: 0;
  transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}
.copy-col-btn:hover:not(:disabled) {
  color: var(--brand, var(--accent, #4a6cf7));
  background: var(--bg-hover);
  border-color: var(--border);
}
.copy-col-btn:active:not(:disabled) {
  transform: translateX(1px);
}
.copy-col-btn:focus-visible {
  outline: 2px solid var(--brand, var(--accent, #4a6cf7));
  outline-offset: 1px;
}
.copy-col-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
/* 헤더 — 전체 복사: 더블 화살표. 연한 하늘색 배경에 회색 아이콘 */
.copy-col-btn--all {
  color: var(--text-tertiary);
  width: 26px;
  height: 26px;
}
.copy-col-btn--all:hover:not(:disabled) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.55);
  border-color: var(--border);
}
/* 행 — 행 복사: 평소엔 흐릿, 행 호버 시 또렷해진다.
   클릭 편의를 위해 셀 전체 높이(상하 패딩 포함)를 히트박스로 사용. */
.copy-col-btn--row {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 36px;
  padding: 4px 2px;
  border-radius: 0;
  opacity: 0.45;
}
table.t.verify-grid tbody tr:hover .copy-col-btn--row {
  opacity: 1;
}
.copy-col-btn--row.is-flash {
  color: var(--status-success, #16a34a);
  background: color-mix(in srgb, var(--status-success, #16a34a) 12%, transparent);
  border-color: color-mix(in srgb, var(--status-success, #16a34a) 35%, transparent);
}

/* 공백보기 토글 버튼 — 다른 grid-toolbar 버튼과 동일한 .btn .btn-secondary .btn-sm 베이스,
   ON 상태는 aria-pressed + .is-active 로 강조. */
.whitespace-toggle.is-active {
  background: var(--accent-soft, #F0F7DF);
  border-color: var(--accent, #8FBF2F);
  color: var(--text-primary);
}

/* 분석내용 공백 마커 — 평소엔 노출되지 않고, 부모(#detailAnalysisBody)가 .show-whitespace
   일 때만 pseudo-element 로 점·화살표·꺾쇠를 그린다. 원본 텍스트(공백/탭/줄바꿈)는 그대로
   유지되어 사용자가 선택/복사하면 원본이 클립보드에 들어간다.
   - 공백 : 진한 회색 점 (slate-600) — 폰트 크기를 키워 식별성 확보
   - 탭   : 보라색 화살표
   - nbsp : 빨강색 점 (일반 공백과 명확히 구분)
   - 줄바꿈: 주황색 ↵ + 옅은 주황 배경 배지로 한눈에 식별 */
.ws-mark {
  position: relative;
}
/* 공백 — 1개 공백마다 또렷한 주황 도트 1개를 글자 흐름 안에 inline 으로 끼워넣는다.
   ::before 에 background+border-radius 로 실제 원형을 그려 폰트 글리프와 무관하게
   픽셀 단위로 크기와 굵기를 정확히 컨트롤한다.
   span 자체의 공백 텍스트 노드는 font-size:0 으로 폭을 축소(복사 시 원본 보존).
   연속 공백 = 도트가 옆으로 나란히 들어가 개수가 한눈에 식별된다. */
.show-whitespace .extracted-content .ws-mark[data-ws="space"] {
  font-size: 0;
}
.show-whitespace .extracted-content .ws-mark[data-ws="space"]::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  background: #EA580C;
  border-radius: 50%;
  /* baseline 위로 0.3em 올려 글자 vertical center 에 정렬 (middle 만으로는 살짝 아래쪽으로 떨어진다) */
  vertical-align: 0.3em;
  margin: 0 1.5px;
  pointer-events: none;
}
/* NBSP — 동일 디자인, 빨강 톤으로 일반 공백과 구분 */
.show-whitespace .extracted-content .ws-mark[data-ws="nbsp"] {
  font-size: 0;
}
.show-whitespace .extracted-content .ws-mark[data-ws="nbsp"]::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  background: #DC2626;
  border-radius: 50%;
  vertical-align: 0.3em;
  margin: 0 1.5px;
  pointer-events: none;
}
.show-whitespace .extracted-content .ws-mark[data-ws="tab"]::before {
  content: '→';
  position: absolute;
  top: 50%;
  left: 0.15em;
  transform: translateY(-50%);
  color: #7C3AED;
  font-family: var(--font-mono);
  font-weight: 800;
  pointer-events: none;
}
/* 줄바꿈 — 인라인 SVG 를 주황 배지로 감싼다. SVG stroke-width=1.6 으로 얇게 표현.
   평소에는 span 자체를 숨겨 일반 텍스트 흐름에 영향이 없도록 한다. */
.ws-mark[data-ws="newline"] {
  display: none;
}
.show-whitespace .extracted-content .ws-mark[data-ws="newline"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #EA580C;
  color: #FFFFFF;
  padding: 1px 3px;
  margin: 0 2px 0 1px;
  border-radius: 3px;
  vertical-align: middle;
  line-height: 0;
  pointer-events: none;
}
.show-whitespace .extracted-content .ws-mark[data-ws="newline"] svg {
  width: 11px;
  height: 11px;
  display: block;
}

/* 검증문서 목록 그리드 — data-detail-seq 행은 클릭 가능하므로 포인터 커서·호버 배경 복원 */
table.t.verify-list-grid tbody tr[data-detail-seq],
table.t.verify-list-grid tbody tr[data-detail-seq] td {
  cursor: pointer;
}
/* 문서종류 칩 색상 — 등록문서조회·검증문서조회·검증문서상세 공통.
   BL=파랑, AWB=흰색, CI=노랑, PL=초록, SR=회색(기본). inline style 의 background/border
   를 덮어쓰기 위해 !important 사용. detail 화면의 file-chip-badge active 상태는
   :not([data-active="true"]) 로 색을 적용하지 않아 primary 강조 색을 유지한다. */
[data-docu-type="BL"]:not([data-active="true"])  { background: #dce8fb !important; border-color: #a8c4e8 !important; color: #1e3a5f !important; }
[data-docu-type="AWB"]:not([data-active="true"]) { background: #ffffff !important; border-color: var(--border) !important; color: var(--text-secondary) !important; }
[data-docu-type="CI"]:not([data-active="true"])  { background: #fff8dc !important; border-color: #e8d8a0 !important; color: #7a6212 !important; }
[data-docu-type="PL"]:not([data-active="true"])  { background: #dcf2e0 !important; border-color: #a8d8b0 !important; color: #1e5f2e !important; }
[data-docu-type="SR"]:not([data-active="true"])  { background: var(--bg-sunken) !important; border-color: var(--border) !important; color: var(--text-secondary) !important; }
table.t.verify-list-grid tbody tr[data-detail-seq]:hover {
  background: var(--bg-hover);
}

/* 변경이력 비교 모달 — 좌/우 JSON 원문 패널 */
.json-diff-pane {
  flex: 1;
  min-height: 0;
  min-width: 0;
  margin: 0;
  padding: 12px 14px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-primary);
  white-space: pre;
  overflow: auto;
  tab-size: 2;
}
.json-diff-pane.is-empty {
  color: var(--text-tertiary);
  font-style: italic;
  white-space: normal;
}
/* 변경이력 비교 모달 — 좌우 분할 핸들 호버 강조 (검증상세 splitter 와 동일 톤). */
#diffSplitResizer:hover .splitter-handle,
#diffSplitResizer.is-dragging .splitter-handle {
  background: var(--primary);
}

/* 변경이력 모달 — 두 그리드 모두 5행 정도 보이는 고정 높이로 통일 */
.history-grid-scroll {
  /* 행 높이 ~34px + 헤더 ~36px + 여백 → 약 220px */
  height: 220px;
}

/* 변경이력 그리드 — 클릭 가능한 행 표시 */
#analysisHistoryTable tbody tr,
#commonHistoryTable tbody tr {
  cursor: pointer;
}
#analysisHistoryTable tbody tr:hover,
#commonHistoryTable tbody tr:hover {
  background: var(--bg-hover);
}

/* 검증상세 — 등록문서번호 옆 "반영완료" 캡슐 */
.doc-applied-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  background: var(--status-success-soft);
  color: var(--status-success);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.4;
  white-space: nowrap;
}
.doc-applied-badge svg { stroke: currentColor; }

/* 그리드 셀 오버플로 툴팁 */
#cell-tip {
  position: fixed;
  z-index: 9999;
  background: var(--text);
  color: var(--bg-elev);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: normal;
  word-break: break-word;
  max-width: 480px;
  pointer-events: none;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: opacity 0.12s var(--ease-soft);
}
#cell-tip.visible { opacity: 1; }
