:root {
  --accent:       #4F46E5;
  --accent-dark:  #4338CA;
  --accent-light: #E0E7FF;
  --accent-ring:  rgba(79,70,229,0.15);
  --pass-shadow:  rgba(22,163,74,0.22);
  --fail-shadow:  rgba(220,38,38,0.22);
  --border:       #D3D8DE;
  --border-strong:#A5B4FC;
  --surface:      #fff;
  --surface-soft: #f8fafc;
  --surface-blue: #EEF2FF;
  --text-primary: #1e293b;
  --text-muted:   #64748b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

@font-face { font-family: 'Pretendard'; font-weight: 100; font-style: normal; font-display: swap; src: url('/fonts/Pretendard/Pretendard-Thin.ttf') format('truetype'); }
@font-face { font-family: 'Pretendard'; font-weight: 200; font-style: normal; font-display: swap; src: url('/fonts/Pretendard/Pretendard-ExtraLight.ttf') format('truetype'); }
@font-face { font-family: 'Pretendard'; font-weight: 300; font-style: normal; font-display: swap; src: url('/fonts/Pretendard/Pretendard-Light.ttf') format('truetype'); }
@font-face { font-family: 'Pretendard'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/Pretendard/Pretendard-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Pretendard'; font-weight: 500; font-style: normal; font-display: swap; src: url('/fonts/Pretendard/Pretendard-Medium.ttf') format('truetype'); }
@font-face { font-family: 'Pretendard'; font-weight: 600; font-style: normal; font-display: swap; src: url('/fonts/Pretendard/Pretendard-SemiBold.ttf') format('truetype'); }
@font-face { font-family: 'Pretendard'; font-weight: 700; font-style: normal; font-display: swap; src: url('/fonts/Pretendard/Pretendard-Bold.ttf') format('truetype'); }
@font-face { font-family: 'Pretendard'; font-weight: 800; font-style: normal; font-display: swap; src: url('/fonts/Pretendard/Pretendard-ExtraBold.ttf') format('truetype'); }
@font-face { font-family: 'Pretendard'; font-weight: 900; font-style: normal; font-display: swap; src: url('/fonts/Pretendard/Pretendard-Black.ttf') format('truetype'); }

/* 전자서명용 필기체 — 로컬 파일로 선언(사내망/오프라인에서도 CDN 없이 렌더링) */
@font-face { font-family: 'Nanum Pen Script'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/NanumPenScript-Regular.ttf') format('truetype'); }

body {
  font-family: 'Pretendard', sans-serif;
  font-size: 0.875rem;      /* 본문 기본 14px — 태블릿 현장 가독성 */
  background: #EEF1F5;
  color: #1e293b;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;   /* 고해상도(레티나)·맥에서 글자 더 선명 (윈도우는 효과 제한적) */
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.hidden { display: none !important; }

/* ========================================================
   SHELL LAYOUT  (sidebar + main)
======================================================== */
#shell {
  display: flex;
  min-height: 100vh;
}

/* ========================================================
   SIDEBAR
======================================================== */
#sidebar {
  width: 240px;
  min-height: 100vh;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  background: #1E293B;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.2s;
}

/* Logo */
.sb-logo {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.sb-logo-badge {
  width: 46px; height: 36px;
  background: #fff;
  border-radius: 8px;
  padding: 3px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.sb-logo-mark {
  width: 100%; height: 100%;
  object-fit: contain;
}
.sb-logo-text {
  font-size: 0.96rem;
  font-weight: 700;
  color: #DFE1E1;
  line-height: 1.35;
}
.sb-logo-text span {
  display: block;
  font-weight: 400;
  font-size: 0.78rem;
  color: rgba(223,225,225,0.5);
}

/* Nav */
.sb-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.sb-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 8px;
  border: none;
  background: none;
  color: #DFE1E1;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.sb-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.sb-item.active {
  background: #4F46E5;
  color: #fff;
  font-weight: 600;
}
.sb-icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  opacity: 0.8;
}
.sb-item:hover .sb-icon  { opacity: 1; }
.sb-item.active .sb-icon { opacity: 1; }

/* Footer */
.sb-footer {
  padding: 12px 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  margin-bottom: 8px;
}
.sb-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4F46E5, #4338CA);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.82rem;
  flex-shrink: 0;
}
.sb-user-info { min-width: 0; }
#nav-username {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #DFE1E1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-role-tag {
  display: inline-block;
  font-size: 0.68rem;
  color: rgba(223,225,225,0.5);
  margin-top: 2px;
}
.sb-sample-pdf-btn {
  width: 100%;
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px dashed rgba(99,179,237,0.4);
  background: rgba(99,179,237,0.07);
  color: #63b3ed;
  font-size: 0.75rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.sb-sample-pdf-btn:hover {
  background: rgba(99,179,237,0.15);
  border-color: rgba(99,179,237,0.7);
  color: #90cdf4;
}
.sb-logout {
  width: 100%;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.1);
  background: none;
  color: rgba(223,225,225,0.55);
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  text-align: left;
}
.sb-logout:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-color: rgba(255,255,255,0.2);
}

/* ========================================================
   MAIN AREA
======================================================== */
#main {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top bar */
#top-bar {
  height: 58px;
  background: #fff;
  border-bottom: 1px solid #dde3ed;
  position: sticky;
  top: 0; z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
#top-bar-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #134E4A;
  letter-spacing: -0.02em;
}
.tb-right {
  display: flex; align-items: center; gap: 14px;
}
.tb-search {
  display: flex; align-items: center; gap: 8px;
  background: #f5f7fb;
  border: 1px solid #dde3ed;
  border-radius: 8px;
  padding: 7px 14px;
  width: 220px;
}
.tb-search svg { color: #64748b; flex-shrink: 0; }
.tb-search input {
  border: none; background: none;
  font-size: 0.84rem; color: #374151;
  font-family: inherit; outline: none; width: 100%;
}
.tb-search input::placeholder { color: #64748b; }
/* 검색 인풋은 outline:none이라 키보드 포커스가 안 보임 → 감싸는 박스에 포커스 링 표시 */
.tb-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.tb-user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 6px;
  background: #f5f7fb;
  border: 1px solid #dde3ed;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s;
}
.tb-user-chip:hover { background: #edf0f5; }
.tb-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #4F46E5, #4338CA);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.72rem;
}
#tb-username {
  font-size: 0.82rem; font-weight: 600; color: #374151;
}
.tb-caret {
  color: #64748b; font-size: 0.7rem; margin-left: 2px;
}

/* Content */
#app {
  padding: 22px 28px 60px;
  flex: 1;
  background: #EEF1F5;
}

/* ========================================================
   LOGIN PAGE  (fixed overlay)
======================================================== */
#page-login {
  position: fixed; inset: 0; z-index: 1000;
  display: flex;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1E293B 0%, #134E4A 60%, #4F46E5 100%);
  padding: 20px;
}
.login-box {
  background: #fff;
  border-radius: 18px;
  padding: 40px 32px;
  width: 100%; max-width: 380px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}
.login-logo {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 28px; gap: 10px;
}
.login-logo-mark {
  width: 84px; height: 65px;
  object-fit: contain;
}
.login-box h1 {
  font-size: 1.45rem; font-weight: 800; color: #0f172a;
  text-align: center; line-height: 1.4;
}
.login-box .subtitle {
  text-align: center; color: #0f172a; font-size: 1rem; font-weight: 600;
}
.login-credit {
  position: absolute;
  bottom: 18px; right: 24px;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.32);
  letter-spacing: 0.02em;
}
.login-fields {
  display: flex; flex-direction: column; gap: 14px;
}

/* ========================================================
   FORMS
======================================================== */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
  font-size: 0.78rem; font-weight: 600; color: #475569;
  letter-spacing: 0.01em;
}
.form-group input, .form-group select, .form-group textarea {
  border: 1.5px solid #D6DCE4; border-radius: 8px;
  padding: 9px 12px; font-size: 0.875rem; font-family: inherit;
  color: #1e293b; background: #f8fafc;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: #4F46E5; background: #fff;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.form-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px; margin-bottom: 14px;
}
.form-section {
  background: #fff; border-radius: 10px;
  padding: 18px 20px; margin-bottom: 14px;
  border: 1px solid #dde3ed;
  box-shadow: 0 4px 14px rgba(15,23,42,0.09);
  overflow-x: auto;
}
.form-section h3 {
  font-size: 0.75rem; font-weight: 700; color: #64748b;
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid #e8eef5;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.form-actions {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px;
}

/* 개선 요청 제출 폼 — 제목/내용 표시를 더 진하고 크게 */
#page-improvement .form-section h3 {
  font-size: 1.05rem; font-weight: 700; color: #1e293b;
  text-transform: none; letter-spacing: normal;
}
#page-improvement .form-group label {
  font-size: 0.9rem; font-weight: 700; color: #1e293b;
}

/* ========================================================
   BUTTONS
======================================================== */
.btn-primary {
  background: #4F46E5; color: #fff;
  border: none; border-radius: 8px; padding: 10px 22px;
  font-size: 0.875rem; font-weight: 600; cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s; font-family: inherit;
}
.btn-primary:hover {
  background: #4338CA;
  box-shadow: 0 4px 14px rgba(79,70,229,0.3);
}
.btn-secondary {
  background: #fff; color: #374151;
  border: 1.5px solid #d1d5db; border-radius: 8px; padding: 10px 22px;
  font-size: 0.875rem; font-weight: 600; cursor: pointer;
  transition: all 0.15s; font-family: inherit;
}
.btn-secondary:hover { background: #f8fafc; border-color: #64748b; }
.btn-full { width: 100%; justify-content: center; }
.btn-back {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; color: #4F46E5;
  font-size: 0.875rem; font-weight: 600; cursor: pointer;
  padding: 6px 0; font-family: inherit;
}
.btn-sm {
  padding: 5px 12px; font-size: 0.78rem; border-radius: 6px;
  border: none; cursor: pointer; font-weight: 600; font-family: inherit;
}
.btn-green  { background: #dcfce7; color: #166534; }
.btn-blue   { background: #dbeafe; color: #1e40af; }
.btn-yellow { background: #fef9c3; color: #854d0e; }
.btn-red    { background: #fee2e2; color: #991b1b; }
.btn-purple { background: #ede9fe; color: #5b21b6; }
.btn-excel  { background: #dcfce7; color: #166534; display: inline-flex; align-items: center; gap: 4px; }
.btn-excel:hover { background: #bbf7d0; }

/* 승인자 액션 유도 — "승인 대기" 상태 배지에 묻히지 않도록 CTA로 강조 */
.btn-approve-cta {
  background: #7C3AED; color: #fff; border: none;
  padding: 4px 10px; border-radius: 16px;
  font-size: 0.72rem; font-weight: 700; font-family: inherit;
  display: inline-flex; align-items: center; gap: 3px;
  cursor: pointer; white-space: nowrap;
  box-shadow: 0 2px 6px rgba(124,58,237,0.3);
  animation: approve-cta-pulse 2.2s ease-out 3;
}
.btn-approve-cta:hover { background: #6D28D9; box-shadow: 0 3px 10px rgba(124,58,237,0.45); animation-play-state: paused; }
/* 무한 깜빡임 대신 진입 시 3회만 은은하게 강조 후 정적 유지 — 목록에 여러 건이어도 산만하지 않게 */
@keyframes approve-cta-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(124,58,237,0.40), 0 2px 6px rgba(124,58,237,0.3); }
  70%  { box-shadow: 0 0 0 5px rgba(124,58,237,0), 0 2px 6px rgba(124,58,237,0.3); }
  100% { box-shadow: 0 0 0 0 rgba(124,58,237,0), 0 2px 6px rgba(124,58,237,0.3); }
}
@media (prefers-reduced-motion: reduce) {
  .btn-approve-cta { animation: none; }
}

/* ========================================================
   ERROR
======================================================== */
.error-msg {
  color: #dc2626; font-size: 0.82rem; padding: 8px 12px;
  background: #fef2f2; border-radius: 7px;
  border: 1px solid #fecaca;
}

/* ========================================================
   DASHBOARD — STAT CARDS
======================================================== */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  border-radius: 14px; padding: 22px 24px;
  cursor: pointer;
  border: 1px solid #DCE3ED;
  background: #fff;
  box-shadow: 0 6px 20px rgba(15,23,42,0.13);
  transition: all 0.18s;
  display: flex; align-items: center;
  justify-content: space-between; gap: 16px;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 32px rgba(15,23,42,0.19);
  border-color: #A5B4FC;
}

.stat-icon {
  width: 58px; height: 58px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 30px; height: 30px; }
/* 상태별 아이콘 배경 톤 — 대시보드 스캔성 향상 (대기 amber / 진행 blue / 완료 green / 승인 purple) */
.sc-pending .stat-icon    { background: #FEF3C7; }
.sc-inprogress .stat-icon { background: #DBEAFE; }
.sc-completed .stat-icon  { background: #D1FAE5; }
.sc-approved .stat-icon   { background: #EDE9FE; }

.stat-text { flex: 1; }
.stat-sub {
  font-size: 0.88rem; font-weight: 700; color: #475569;
  margin-bottom: 6px; letter-spacing: 0.02em;
}
.stat-number {
  font-size: 2.5rem; font-weight: 800; line-height: 1;
  letter-spacing: -0.03em; color: #0F172A; margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}
.stat-desc { font-size: 0.82rem; color: #94A3B8; }

/* 레거시 .stat-label 유지 */
.stat-label { display: none; }

/* ========================================================
   PAGE HEADER
======================================================== */
.page-header {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; margin-bottom: 20px;
}
.page-heading {
  font-size: 1rem; font-weight: 700; color: #0f172a;
  margin-bottom: 0;
}

/* ========================================================
   FILTER TABS
======================================================== */
.filter-tabs {
  display: flex; gap: 0;
  background: #fff;
  border: 1px solid #dde3ed;
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(15,23,42,0.06);
}
.tab {
  background: none; border: 1px solid transparent;
  border-radius: 6px; padding: 7px 18px;
  font-size: 0.83rem; cursor: pointer; color: #64748b;
  font-weight: 500; transition: all 0.15s; font-family: inherit;
  min-width: 92px; text-align: center;
}
.tab.active {
  background: #4F46E5; color: #fff;
  box-shadow: 0 3px 10px rgba(79,70,229,0.32);
}
.tab:hover:not(.active) {
  background: #EEF2FF; color: #4F46E5;
  border-color: #E0E7FF;
  box-shadow: 0 2px 6px rgba(79,70,229,0.12);
}

/* ========================================================
   TABLE
======================================================== */
.table-wrap {
  background: #fff;
  border-radius: 14px;
  overflow: auto;
  border: 1px solid #E6EAF0;
  box-shadow: 0 6px 18px rgba(15,23,42,0.11);
  max-height: calc(100vh - 260px);
}
.table-wrap thead th {
  position: sticky; top: 0; z-index: 10;
  background: #F8FAFC;
}
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-strong);
  background: #fff;
  transition: background 0.15s;
}
.table-toolbar:hover { background: var(--accent-light); }
.table-toolbar-title {
  font-size: 0.92rem; font-weight: 700; color: var(--accent-dark);
}
.table-toolbar-right { display: flex; align-items: center; gap: 10px; }

/* 목록 검색바(개선요청 등 클라이언트 측 검색) */
.list-searchbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
}
.list-search-input {
  flex: 0 1 320px;
  padding: 8px 12px; font-size: 0.85rem; font-family: inherit;
  border: 1.5px solid var(--border); border-radius: 8px; background: #fff; color: #1e293b;
}
.list-search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.list-search-count { font-size: 0.8rem; color: #64748b; }

/* 삭제(휴지통)된 행 — 대시보드 최근현황에서 취소선 + 흐리게, 조작 불가 표시 */
.row-deleted td { color: #94a3b8; text-decoration: line-through; background: #fafbfc; }
.row-deleted td.td-id, .row-deleted td:last-child { text-decoration: none; }
/* 비활성 사용자 행 */
.row-inactive td { background: #fef2f2; color: #94a3b8; }
.badge-inactive { background: #fee2e2; color: #b91c1c; font-size: 0.7rem; }
table { width: 100%; border-collapse: collapse; }
th {
  background: #F8FAFC;
  font-size: 0.8rem; font-weight: 700;
  color: #334155; padding: 10px 16px; text-align: left;
  border-bottom: 1.5px solid #DCE1E8;
  border-right: 1px solid #DCE1E8;
  white-space: nowrap;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
th:last-child { border-right: none; }
td {
  padding: 14px 16px; font-size: 0.855rem;
  border-bottom: 1px solid #DCE1E8;
  border-right: 1px solid #DCE1E8;
  color: #1e293b; vertical-align: middle; white-space: nowrap;
}
.td-wrap {
  white-space: normal;
  overflow-wrap: anywhere;
  min-width: 80px;
}
.td-ellipsis {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}
td:last-child { border-right: none; }
tr:last-child td { border-bottom: none; }
/* 목록 테이블(.table-wrap) 안에서만 적용 — 스코프 없이 걸면 검사의뢰서 표 등
   무관한 테이블까지 호버/줄무늬가 새어 들어가 섹션헤더 배경이 깨져 보임 */
.table-wrap tr:nth-child(even) td { background: #EEF1F6; }
.table-wrap tr:hover td { background: #EEF2FF !important; }
/* 호버 시 좌측에 은은한 강조색 라인 — inset box-shadow라 레이아웃(폭/정렬)에 전혀 영향 없음 */
.table-wrap tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--border-strong, #A5B4FC); }
/* 빈 값 처리 */
.td-empty { color: #b0bcc8; font-size: 0.8rem; }
/* 테이블 내 ID(번호) */
.td-id { color: #64748b; font-size: 0.82rem; font-weight: 700; }
/* 테이블 강조 텍스트 */
.td-main { font-weight: 700; color: #0f172a; }

/* ========================================================
   STATUS BADGE
======================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.01em;
  border: 1.5px solid transparent;
  white-space: nowrap;
}
.badge::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  flex-shrink: 0;
}
.badge-pending     { background: #fef3c7; color: #78350f; border-color: #fbbf24; }
.badge-pending::before { background: #d97706; }
.badge-in_progress { background: #DDDBFA; color: #120B7E; border-color: #665EED; }
.badge-in_progress::before { background: #4F46E5; }
.badge-completed   { background: #d1fae5; color: #064e3b; border-color: #34d399; }
.badge-completed::before { background: #059669; }
.badge-approved    { background: #ede9fe; color: #4c1d95; border-color: #a78bfa; }
.badge-approved::before { background: #7c3aed; }
.badge-modified    { background: #fff7ed; color: #9a3412; border-color: #fdba74; }
.badge-modified::before { display: none; }

/* Part List 목록 — 옵션코드 요약 (코드/설명을 줄맞춰 정렬) */
.opt-code-list { display: flex; flex-direction: column; gap: 3px; }
.opt-code-row { display: flex; align-items: center; gap: 7px; }
.opt-code-tag {
  flex-shrink: 0; min-width: 30px; text-align: center;
  background: #fef3c7; color: #78350f; border: 1px solid #fbbf24;
  border-radius: 4px; padding: 1px 6px;
  font-size: 0.7rem; font-weight: 600;
}
.opt-code-desc {
  color: #64748b; font-size: 0.72rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px;
}

/* ========================================================
   INSPECTION FORM
======================================================== */
.inspection-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.inspection-header h2 {
  margin-bottom: 0; flex: 1;
  font-size: 1rem; font-weight: 700; color: #0f172a;
}
#inspection-progress-bar {
  width: 100%; height: 4px; background: #e2e8f0;
  border-radius: 4px; margin-top: 7px;
}
#inspection-progress-fill {
  height: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  border-radius: 4px; transition: width 0.35s ease;
}

.section-tabs {
  display: flex; gap: 4px; flex-wrap: nowrap;
  overflow-x: auto; margin-bottom: 14px;
  background: #fff; border-radius: 10px; padding: 7px;
  border: 1px solid var(--border);
  box-shadow: 0 5px 16px rgba(15,23,42,0.10);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.section-tabs::-webkit-scrollbar { display: none; }
.section-tab {
  padding: 6px 14px; border-radius: 6px; font-size: 0.78rem;
  border: 1px solid transparent; cursor: pointer; background: none; color: #64748b;
  transition: all 0.15s; font-family: inherit; font-weight: 500;
}
.section-tab.active { background: #4F46E5; color: #fff; box-shadow: 0 3px 10px rgba(79,70,229,0.32); }
.section-tab:hover:not(.active) {
  background: #f1f5f9; color: #334155;
  border-color: #E2E8F0; box-shadow: 0 2px 6px rgba(15,23,42,0.08);
}

/* ========================================================
   INSPECTION ITEMS  (2-col grid)
======================================================== */
.col2-header-row {
  display: grid; grid-template-columns: 1fr 1fr;
  background: #f8fafc; border-bottom: 2px solid #e2e8f0;
  border-radius: 8px 8px 0 0;
}
.col2-header-half {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; font-size: 0.72rem; font-weight: 700;
  color: #64748b; border-right: 1px solid #e2e8f0;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.col2-header-half:last-child { border-right: none; }
.col2-row {
  display: grid; grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid #f1f5f9;
}
.col2-row:last-child { border-bottom: none; }
.col2-row:hover .col2-cell { background: #f5f8fe; }
.col2-cell {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-right: 1px solid #f1f5f9;
  transition: background 0.12s;
}
.col2-cell:last-child { border-right: none; }
.col2-cell.empty { background: #fafafa; }
.col2-cell .item-label {
  flex: 1; font-size: 0.82rem; line-height: 1.35;
  min-width: 0; word-break: break-word; color: #374151;
}
.col2-cell.check { justify-content: space-between; }
.col2-cell.check .item-label { flex: 1; }
.col2-cell.text input {
  width: 110px; flex-shrink: 0;
  border: 1.5px solid #e2e8f0; border-radius: 6px;
  padding: 5px 8px; font-size: 0.82rem; font-family: inherit; color: #1e293b;
}
.col2-cell.text.board input { width: 150px; }
.col2-cell.text input:focus {
  outline: none; border-color: #4F46E5;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.check-group { display: flex; gap: 4px; flex-shrink: 0; }
.check-text-cell { display: flex; flex-direction: column; gap: 5px; }
.check-text-cell .check-group { flex-wrap: wrap; }
.insp-input-sm { padding: 3px 6px; font-size: 0.72rem; }
.check-fill-row { display: flex; gap: 4px; }
.check-fill-row .insp-input-sm { width: 92px; flex: 0 0 auto; min-width: 0; text-align: center; padding: 3px 2px; }
.check-btn {
  border: 1.5px solid #d1d5db; border-radius: 7px;
  padding: 5px 9px; font-size: 0.85rem; font-weight: 700;
  cursor: pointer; background: #fff; color: #64748b;
  transition: all 0.15s; font-family: inherit;
  min-width: 34px; text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.check-btn:hover { border-color: #64748b; color: #374151; background: #f8fafc; }
.check-btn.selected-합 {
  background: #dcfce7; border-color: #16a34a; color: #166534;
  box-shadow: 0 2px 7px var(--pass-shadow);
}
.check-btn.selected-불 {
  background: #fee2e2; border-color: #dc2626; color: #991b1b;
  box-shadow: 0 2px 7px var(--fail-shadow);
}
.check-btn.selected-제외 {
  background: #f1f5f9; border-color: #64748b; color: #64748b;
  box-shadow: 0 1px 3px rgba(100,116,139,0.15);
  text-decoration: line-through;
}

.item-label { font-size: 0.85rem; line-height: 1.4; }
.notes-section { margin-top: 0; }
.notes-section textarea { width: 100%; font-family: inherit; resize: vertical; }

/* ========================================================
   PART LIST — 옵션코드 선택 카드 (섹션별 그룹 + 원형 배지)
======================================================== */
.opt-code-panel {
  padding: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.opt-code-section { margin-bottom: 18px; }
.opt-code-section:last-child { margin-bottom: 0; }
.opt-code-section-title {
  font-size: 0.78rem; font-weight: 700; color: var(--accent-dark);
  padding-bottom: 6px; margin-bottom: 12px;
  border-bottom: 1.5px solid var(--accent-light);
}
.opt-code-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 14px 8px;
}
.opt-code-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 6px 4px 2px;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  font-weight: normal;
  transition: background 0.15s;
}
.opt-code-card:hover { background: var(--surface-blue); }
.opt-code-card input[type="checkbox"] {
  position: absolute; width: 1px; height: 1px;
  opacity: 0; pointer-events: none;
}
.opt-code-circle {
  width: 50px; height: 50px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.76rem; font-weight: 800; letter-spacing: 0.01em;
  color: #64748b;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.opt-code-name {
  font-size: 0.7rem; color: var(--text-secondary); line-height: 1.25;
  word-break: keep-all;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
/* 선택 애니메이션 — 체크될 때 원이 살짝 눌렸다 튀어오르며 커지고, 링이 바깥으로 번지듯 확장 */
@keyframes optCodePop {
  0%   { transform: scale(0.8); }
  55%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}
@keyframes optCodeRing {
  0%   { box-shadow: 0 0 0 0 var(--accent-ring); }
  100% { box-shadow: 0 0 0 5px var(--accent-ring); }
}
.opt-code-card:has(input:checked) .opt-code-circle {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 0 0 3px var(--accent-ring);
  animation: optCodePop 0.32s cubic-bezier(.34,1.56,.64,1), optCodeRing 0.45s ease-out;
}
.opt-code-card:has(input:checked) .opt-code-name {
  color: var(--accent-dark); font-weight: 700;
  animation: optCodePop 0.32s cubic-bezier(.34,1.56,.64,1);
}

/* ========================================================
   REQUEST PAGE LAYOUT — 검사의뢰서 + 저장된 사양 패널
======================================================== */
.req-layout {
  display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap;
  margin-left: 40px;
}
/* 좁은 화면(태블릿 세로 등)에서는 고정 좌측 여백 제거 — 폼이 눌리지 않도록 */
@media (max-width: 1100px) { .req-layout { margin-left: 0; } }
.spec-template-panel {
  flex: 1 1 420px; max-width: 500px;
  background: #fff; border: 1px solid #DCE3ED; border-radius: 12px;
  box-shadow: 0 6px 18px rgba(15,23,42,0.11);
  overflow: hidden;
}
.stp-header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 14px 16px; border-bottom: 1px solid var(--border-strong);
  background: #fff; transition: background 0.15s;
}
.stp-header:hover { background: var(--accent-light); }
.stp-header h3 { font-size: 0.88rem; font-weight: 700; color: #0F172A; }
.stp-list { display: flex; flex-direction: column; }
.stp-item {
  padding: 10px 16px; border-bottom: 1px solid #F1F5F9;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.stp-item:last-child { border-bottom: none; }
.stp-item-editing { background: var(--accent-light); }
.stp-item-editing-hint { font-size: 0.72rem; color: var(--accent-dark); font-weight: 600; }
.stp-item-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.stp-item-name {
  font-size: 0.85rem; font-weight: 700; color: #1e293b;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px;
  position: relative; cursor: default;
}
.stp-item-name::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 0; top: calc(100% + 4px);
  background: #1e293b; color: #fff;
  font-size: 0.75rem; font-weight: 400;
  padding: 4px 8px; border-radius: 6px;
  white-space: nowrap; z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s;
}
.stp-item-name:hover::after { opacity: 1; }
.stp-item-author { font-size: 0.72rem; color: #94A3B8; flex-shrink: 0; }

/* ========================================================
   DOCUMENT FORM — 검사 의뢰서 양식
======================================================== */
.doc-form-wrap {
  max-width: 720px;
  margin: 0;
  background: #fff;
  border: 1px solid #DCE3ED;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(15,23,42,0.16);
  overflow: hidden;
}
.doc-header {
  background: #F8FAFC;
  color: #0F172A;
  text-align: center;
  padding: 18px 20px;
  border-bottom: 1px solid #E2E8F0;
}
.doc-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-indent: 0.15em;
}
.spec-edit-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px;
  background: #FEE2E2; border-bottom: 1.5px solid #FCA5A5;
}
.seb-text { font-size: 0.84rem; font-weight: 700; color: #991B1B; }
.seb-actions { display: flex; gap: 6px; flex-shrink: 0; }
.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.doc-sec-hdr {
  background: #fff;
  color: var(--accent-dark);
  font-weight: 700;
  padding: 7px 14px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-strong);
  transition: background 0.15s;
}
.doc-sec-hdr:hover { background: var(--accent-light); }
.doc-lbl {
  background: #f8fafc;
  color: #374151;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 8px 10px;
  border: 1px solid #F1F5F9;
  word-break: keep-all;
  overflow-wrap: break-word;
  vertical-align: middle;
  text-align: center;
}
.doc-req { color: #dc2626; font-weight: 900; margin-left: 2px; }
.doc-val {
  padding: 6px 8px;
  border: 1px solid #F1F5F9;
  vertical-align: middle;
  background: #fff;
}
.doc-val input,
.doc-val select {
  width: 100%;
  border: 1.5px solid #D6DCE4;
  border-radius: 7px;
  outline: none;
  background: #f8fafc;
  font-size: 0.82rem;
  font-family: inherit;
  color: #1e293b;
  padding: 6px 9px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.doc-val input:focus,
.doc-val select:focus {
  border-color: #4F46E5; background: #fff;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.doc-val .etc-input { margin-top: 5px; }
.doc-val .etc-input.hidden { display: none; }
.doc-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}

/* ========================================================
   MODAL
======================================================== */
.modal {
  position: fixed; inset: 0; background: rgba(15,23,42,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 300; backdrop-filter: blur(3px);
}
.modal-content {
  background: #fff; border-radius: 16px;
  padding: 28px 26px; width: 100%; max-width: 400px;
  max-height: 90vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25);
}
.modal-title {
  font-size: 1rem; font-weight: 700; color: #0f172a;
  padding-bottom: 12px; border-bottom: 1px solid #f1f5f9;
}

/* ========================================================
   ETC INPUT
======================================================== */
.etc-input {
  margin-top: 6px; border: 1.5px solid #fbbf24;
  border-radius: 8px; padding: 8px 12px;
  font-size: 0.875rem; font-family: inherit; width: 100%;
  background: #fef9c3;
}
.etc-input:focus { outline: none; border-color: #f59e0b; }

/* ========================================================
   ACTION DROPDOWN
======================================================== */
.action-menu { display: inline-block; }
.action-menu-btn {
  width: 32px; height: 32px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 700; letter-spacing: 0.08em;
  cursor: pointer; background: none; border: 1.5px solid #dde3ed;
  color: #64748b; font-family: inherit; transition: all 0.15s;
}
.action-menu-btn:hover { background: #EEF2FF; border-color: #4F46E5; color: #4F46E5; }
.action-menu-list {
  display: none; position: fixed; z-index: 400;
  background: #fff; border: 1px solid #dde3ed; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1); min-width: 170px; padding: 6px;
}
.action-menu-list.open { display: block; }
.menu-label {
  padding: 7px 12px 4px;
  font-size: 0.68rem; font-weight: 700; color: #64748b;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.action-menu-list button {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  padding: 8px 12px; border: none; background: none;
  font-size: 0.83rem; border-radius: 6px; cursor: pointer;
  font-family: inherit; color: #374151; transition: background 0.1s;
}
.action-menu-list button:hover { background: #EEF2FF; color: #4F46E5; }
.action-menu-list .mi-blue   { color: #1e40af; }
.action-menu-list .mi-green  { color: #065f46; }
.action-menu-list .mi-purple { color: #5b21b6; }
.action-menu-list .mi-yellow { color: #854d0e; }
.action-menu-list .mi-red    { color: #991b1b; }
.menu-divider { border: none; border-top: 1px solid #edf0f5; margin: 4px 0; }

/* ========================================================
   SPEC CHANGE BANNER
======================================================== */
.spec-change-banner {
  background: #fffbeb; border: 1.5px solid #f59e0b; border-radius: 10px;
  padding: 14px 16px; margin-bottom: 16px;
}
.scb-header { display: flex; align-items: center; gap: 10px; }
.scb-icon { font-size: 1.1rem; flex-shrink: 0; }
.scb-title { flex: 1; }
.scb-title strong { display: block; color: #92400e; font-size: 0.875rem; font-weight: 700; }
.scb-title span   { color: #78350f; font-size: 0.78rem; }
.scb-list {
  margin-top: 10px; padding: 10px 12px;
  background: rgba(254,243,199,0.5); border-radius: 8px;
  border: 1px solid #fde68a;
  display: flex; flex-direction: column; gap: 6px;
}
.scb-item { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; }
.scb-field  { min-width: 80px; font-weight: 700; color: #78350f; }
.scb-before { color: #dc2626; text-decoration: line-through; }
.scb-arrow  { color: #9ca3af; font-weight: 700; }
.scb-after  { color: #059669; font-weight: 700; }

/* ========================================================
   EMPTY STATE
======================================================== */
.empty {
  text-align: center; padding: 52px 20px;
  color: #64748b; font-size: 0.875rem;
}

/* ========================================================
   SECTION LABEL (대시보드 등 섹션 구분)
======================================================== */
.section-label {
  font-size: 0.82rem; font-weight: 700; color: #64748b;
  margin-bottom: 12px;
  text-transform: uppercase; letter-spacing: 0.05em;
}

/* 테이블 toolbar 건수 뱃지 */
.table-count {
  display: inline-flex; align-items: center;
  background: #eef2ff; color: #4338ca;
  border-radius: 20px; padding: 2px 10px;
  font-size: 0.75rem; font-weight: 700;
}

/* 대시보드 최근 검사 현황 — 표시 건수 토글 (5/10/20건) */
.recent-limit-toggle { display: flex; gap: 4px; }
.rl-btn {
  padding: 3px 11px; font-size: 0.72rem; font-weight: 700;
  border: 1.5px solid #E2E8F0; border-radius: 14px;
  background: #fff; color: #64748B; cursor: pointer; font-family: inherit;
  transition: all 0.15s;
}
.rl-btn:hover:not(.active) { background: #EEF2FF; border-color: #4F46E5; color: #4F46E5; }
.rl-btn.active { background: #4F46E5; border-color: #4F46E5; color: #fff; }

/* 페이지 설명 (콘텐츠 상단) — 페이지명 자체는 상단바(#top-bar-title)에 이미 크게
   표시되므로, 여기서는 중복 없이 설명 한 줄만 잘 보이는 크기/색으로 표시 */
.page-subtitle {
  font-size: 0.9rem; font-weight: 600; color: #64748B; margin-bottom: 0;
}
.page-title-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 22px;
}

/* ========================================================
   USER MANAGE
======================================================== */
#user-list-container .table-wrap { margin-top: 0; max-width: 1000px; }
#user-list-container .table-wrap table { table-layout: fixed; }
/* 역할 배지는 개수와 무관하게 한 줄로 표시(칸 자체를 넓게 잡음) */
#user-list-container tbody td:nth-child(4) { white-space: nowrap; }

/* 대시보드 최근 검사 현황 — 5/10/20건 토글 시 스크롤바 유무에 따라
   컬럼 폭(간격)이 흔들리지 않도록 내부 스크롤을 아예 사용하지 않음.
   (overflow:visible은 border-radius 클리핑까지 깨버려서 모서리가 각지게 보이므로 hidden 사용) */
#recent-list .table-wrap { max-height: none; overflow: hidden; }
/* table-layout:auto는 보이는 행의 실제 내용(수주번호/시리얼번호 등 값 유무)에 따라
   컬럼 폭이 매번 달라짐 — colgroup 기준 고정 폭으로 5/10/20건 전환해도 폭이 안 흔들리게 */
#recent-list table { table-layout: fixed; }
#recent-list td, #recent-list th { overflow: hidden; text-overflow: ellipsis; }

/* 검사 현황 읽기 전용 모드 */
#page-inspection-form.view-only input,
#page-inspection-form.view-only .check-btn,
#page-inspection-form.view-only .btn-chk-all,
#page-inspection-form.view-only .insp-input { opacity: 0.55; cursor: not-allowed; }

/* Part List 읽기 전용 모드 (생산팀 조회 / 관리자 "보기") — 수정은 막되 흐리게 보이지 않도록 opacity는 그대로 둠 */
#page-part-list-form.view-only input:disabled,
#page-part-list-form.view-only select:disabled,
#page-part-list-form.view-only button:disabled { cursor: not-allowed; }

/* 검사목록 탭 전환 시 컬럼 폭 고정 (colgroup + table-layout:fixed 보조) */
#inspection-table-container td, #inspection-table-container th { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 스크롤바 유무와 무관하게 공간 항상 예약 → 탭 전환 시 폭 안 흔들림 */
#inspection-table-container .table-wrap { overflow-y: auto; scrollbar-gutter: stable; }
#cert-list-container .table-wrap { overflow-y: auto; scrollbar-gutter: stable; }
#cert-list-container td, #cert-list-container th { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ========================================================
   INSPECTION FORM — DATE FIELD IN HEADER
======================================================== */
.insp-date-field {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  background: #fff;
  border: 1.5px solid #dde3ed;
  border-radius: 8px;
  padding: 5px 12px;
}
.insp-date-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}
#inspection-date-input {
  border: none;
  outline: none;
  font-size: 0.84rem;
  font-family: inherit;
  color: #1e293b;
  background: none;
}

/* ========================================================
   INSPECTION TABLE
======================================================== */
.insp-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 1px solid #E6EAF0;
  background: #fff;
  box-shadow: 0 5px 16px rgba(15,23,42,0.10);
}
.insp-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.insp-table th {
  background: #F8FAFC;
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1.5px solid #DCE1E8;
  border-right: 1px solid #DCE1E8;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.insp-table th:last-child { border-right: none; }
.insp-table td {
  padding: 10px 14px;
  font-size: 0.84rem;
  border-bottom: 1px solid #F1F5F9;
  border-right: 1px solid #F1F5F9;
  color: #1e293b;
  vertical-align: middle;
  word-break: break-word;
}
.insp-table td:last-child { border-right: none; }
.insp-table tbody tr:last-child td { border-bottom: none; }
.insp-table tbody tr:nth-child(even) td { background: transparent; }
.insp-table tr:hover td { background: #EEF2FF !important; }
/* 기준전압 컬럼 */
.td-ref-v {
  font-weight: 800;
  color: #4338CA;
  text-align: center;
  background: #EEF2FF !important;
}
/* 사양 확인 테이블 (기본사양 탭) */
.insp-spec-table th {
  background: #F8FAFC;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 700;
  width: 160px;
  border-bottom: 1.5px solid #DCE1E8;
  border-right: 1px solid #DCE1E8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.insp-spec-table td {
  background: #fff;
  border-bottom: 1px solid #F1F5F9;
  border-right: 1px solid #F1F5F9;
}
/* 서브 섹션 헤더 행 (옵션 자재 구분) */
.insp-sub-header {
  background: #e8eef8 !important;
  color: #1a2e5a !important;
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  padding: 7px 14px !important;
  border: 1.5px solid #c7d2e8 !important;
}
/* 섹션 내 소제목 */
.insp-sub-title {
  padding: 9px 16px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #1a2e5a;
  background: #e8eef8;
  border-bottom: 1.5px solid #c7d2e8;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
/* 텍스트 입력 (검사 테이블 안) */
.insp-input {
  width: 100%;
  border: 1.5px solid #D6DCE4;
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 0.83rem;
  font-family: inherit;
  color: #1e293b;
  background: #f8fafc;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.insp-input:focus {
  outline: none;
  border-color: #4F46E5; background: #fff;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

/* ========================================================
   INSPECTION — INLINE HEADER CHECK BUTTONS
======================================================== */
.th-check {
  white-space: nowrap;
}
.btn-chk-all {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 4px;
  border: 1px solid;
  cursor: pointer;
  font-family: inherit;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1.4;
}
.btn-all-합 { background: #dcfce7; color: #166534; border-color: #86efac; }
.btn-all-불 { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.btn-all-reset { background: #f1f5f9; color: #64748b; border-color: #cbd5e1; }
.td-empty-col { background: #fafbfc; }

/* ========================================================
   ACCOUNT PAGE — SIGNATURE PREVIEW
======================================================== */
.sig-preview-box {
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 10px;
  padding: 16px 20px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}
.sig-preview {
  font-family: 'Nanum Pen Script', cursive;
  font-size: 2rem;
  color: #1e293b;
  line-height: 1.2;
}

/* ========================================================
   CERTIFICATES PAGE
======================================================== */
.cert-search-wrap {
  display: flex; align-items: center; gap: 8px;
  background: #fff;
  border: 1px solid #dde3ed;
  border-radius: 8px;
  padding: 7px 14px;
  width: 260px;
}
.cert-search-wrap svg { color: #64748b; flex-shrink: 0; }
.cert-search-wrap input {
  border: none; background: none;
  font-size: 0.84rem; color: #374151;
  font-family: inherit; outline: none; width: 100%;
}
.cert-search-wrap input::placeholder { color: #64748b; }
.cert-search-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

/* ========================================================
   ROLE BADGES
======================================================== */
.role-badge-grid {
  display: flex; flex-wrap: nowrap;
  gap: 4px 6px;
}
.role-badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 12px;
  font-size: 0.72rem; font-weight: 600;
}
.role-requester    { background: #eff6ff; color: #4338CA; }
.role-inspector    { background: #f0fdf4; color: #15803d; }
.role-approver     { background: #faf5ff; color: #6d28d9; }
.role-spec_manager { background: #fffbeb; color: #b45309; }
.role-production   { background: #f0f9ff; color: #0369a1; }

/* ========================================================
   TABLE — 정렬 / 행 클릭
======================================================== */
th.sortable {
  cursor: pointer;
  user-select: none;
}
th.sortable:hover { background: #d4ddf0; }
.sort-icon {
  display: inline-block;
  margin-left: 5px;
  font-size: 0.7rem;
  color: #64748b;
  vertical-align: middle;
}
.sort-icon.active { color: #4F46E5; }
.row-clickable { cursor: pointer; }
.row-clickable:hover td { background: #f0f4fb !important; }

/* ========================================================
   TABLE — 컴팩트 패딩
======================================================== */
th { padding: 10px 13px !important; }
td { padding: 9px 13px !important; font-size: 0.86rem !important; }

/* ========================================================
   INSP-TABLE — 합/불/제외 판정 행 절반 하이라이트 (좌/우 독립)
   6열 테이블: td3=좌판정, td6=우판정  /  4열 테이블: td2=좌판정, td4=우판정
======================================================== */
/* 6열 — 좌 */
.insp-table tr:has(td:nth-child(3) .check-btn.selected-합)  td:nth-child(-n+3) { background: #f0fdf4 !important; }
.insp-table tr:has(td:nth-child(3) .check-btn.selected-불)  td:nth-child(-n+3) { background: #fff5f5 !important; }
.insp-table tr:has(td:nth-child(3) .check-btn.selected-제외) td:nth-child(-n+3) { background: #f8fafc !important; color: #64748b !important; }
/* 6열 — 우 */
.insp-table tr:has(td:nth-child(6) .check-btn.selected-합)  td:nth-child(n+4) { background: #f0fdf4 !important; }
.insp-table tr:has(td:nth-child(6) .check-btn.selected-불)  td:nth-child(n+4) { background: #fff5f5 !important; }
.insp-table tr:has(td:nth-child(6) .check-btn.selected-제외) td:nth-child(n+4) { background: #f8fafc !important; color: #64748b !important; }
/* 4열 — 좌 */
.insp-table tr:has(td:nth-child(2) .check-btn.selected-합)  td:nth-child(-n+2) { background: #f0fdf4 !important; }
.insp-table tr:has(td:nth-child(2) .check-btn.selected-불)  td:nth-child(-n+2) { background: #fff5f5 !important; }
.insp-table tr:has(td:nth-child(2) .check-btn.selected-제외) td:nth-child(-n+2) { background: #f8fafc !important; color: #64748b !important; }
/* 4열 — 우 */
.insp-table tr:has(td:nth-child(4) .check-btn.selected-합)  td:nth-child(n+3) { background: #f0fdf4 !important; }
.insp-table tr:has(td:nth-child(4) .check-btn.selected-불)  td:nth-child(n+3) { background: #fff5f5 !important; }
.insp-table tr:has(td:nth-child(4) .check-btn.selected-제외) td:nth-child(n+3) { background: #f8fafc !important; color: #64748b !important; }

/* ========================================================
   SECTION TABS — 완료율 배지
======================================================== */
.tab-prog {
  display: inline-block;
  margin-left: 5px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  background: #e2e8f0;
  color: #64748b;
  vertical-align: middle;
}
.tab-prog-partial { background: #fef3c7; color: #92400e; }
.tab-prog-done    { background: #d1fae5; color: #065f46; }
.section-tab.active .tab-prog { background: rgba(255,255,255,0.25); color: #fff; }

/* ========================================================
   날짜 빠른 필터
======================================================== */
.date-quick-btns {
  display: flex; gap: 4px;
}
.date-quick-btn {
  background: #fff; border: 1.5px solid #dde3ed; border-radius: 6px;
  padding: 6px 14px; font-size: 0.8rem; font-weight: 600;
  color: #475569; cursor: pointer; font-family: inherit;
  box-shadow: 0 1px 4px rgba(15,23,42,0.05);
  transition: all 0.15s;
}
.date-quick-btn:hover {
  background: #EEF2FF; border-color: #4F46E5; color: #4F46E5;
  box-shadow: 0 4px 12px rgba(79,70,229,0.16);
  transform: translateY(-1px);
}
.date-quick-btn.active { background: #4F46E5; border-color: #4F46E5; color: #fff; }

/* ========================================================
   SIDEBAR — NEW BADGE
======================================================== */
.sb-badge-new {
  margin-left: auto;
  background: #ef4444;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

/* 검사 취소 버튼 */
.btn-cancel-insp {
  color: #dc2626 !important;
  border-color: #fca5a5 !important;
}
.btn-cancel-insp:hover {
  background: #fef2f2 !important;
  border-color: #f87171 !important;
}

/* ========================================================
   RESPONSIVE
======================================================== */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .cal-stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  #sidebar { width: 60px; }
  .sb-logo-text, #nav-username, .sb-role-tag, .sb-group-label { display: none; }
  .sb-logo { justify-content: center; padding: 0 10px; }
  .sb-item { justify-content: center; padding: 10px; }
  .sb-item span:not(.sb-icon) { display: none; }
  .sb-badge-new { display: none; }
  .sb-footer { padding: 8px 6px 10px; }
  .sb-user { justify-content: center; padding: 4px; }
  .sb-user-info { display: none; }
  .sb-logout { padding: 7px; text-align: center; font-size: 0; }
  .sb-logout::before { content: '⏻'; font-size: 0.9rem; }
  #main { margin-left: 60px; }
  .tb-search { display: none; }
}
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  #app { padding: 14px 12px 60px; }
  .table-wrap { overflow-x: auto; }
  table { min-width: 540px; }
  #top-bar { padding: 0 14px; }
}

/* ========================================================
   TABLET / TOUCH 최적화  (터치 디바이스 공통)
======================================================== */
@media (pointer: coarse) {
  /* 합/불/제외 버튼 — 손가락으로 누르기 쉽게 */
  .check-btn {
    min-height: 48px;
    min-width: 48px;
    padding: 10px 12px;
    font-size: 1rem;
    border-radius: 10px;
  }
  /* 검사 항목 입력란 */
  .insp-input {
    min-height: 48px;
    padding: 10px 14px;
    font-size: 1rem;
    border-radius: 8px;
  }
  /* 검사 항목 행 간격 넓히기 */
  .insp-table td {
    padding: 13px 14px !important;
  }
  .insp-table th {
    padding: 13px 14px !important;
  }
  /* 전체 합/초기화 버튼 */
  .btn-chk-all {
    min-height: 36px;
    padding: 4px 12px;
    font-size: 0.78rem;
    border-radius: 6px;
  }
  /* 섹션 탭 */
  .section-tab {
    padding: 10px 18px;
    font-size: 0.85rem;
    min-height: 42px;
  }
  /* 하단 액션 버튼들 */
  .form-actions .btn-primary,
  .form-actions .btn-secondary {
    min-height: 52px;
    padding: 14px 24px;
    font-size: 1rem;
  }
  /* 체크 그룹 간격 */
  .check-group { gap: 8px; }
  /* 날짜 입력 */
  #inspection-date-input { min-height: 40px; font-size: 1rem; }
  /* 사이드바 항목 */
  .sb-item { padding: 14px 14px; }
  /* 일반 버튼들 */
  .btn-sm { min-height: 38px; padding: 8px 16px; font-size: 0.85rem; }
  /* 테이블 행 높이 */
  td { padding: 12px 13px !important; }
  /* 필터 탭 */
  .tab { padding: 10px 16px; font-size: 0.88rem; }
  .date-quick-btn { padding: 10px 16px; font-size: 0.88rem; min-height: 42px; }
  /* 검사 의뢰서·모달·계정 등 일반 폼 입력도 터치 타깃 확대(검사 채점 화면만 컸던 것을 전체로 통일) */
  .doc-val input, .doc-val select,
  .form-group input, .form-group select, .form-group textarea {
    min-height: 44px; font-size: 0.95rem;
  }
  .list-search-input { min-height: 44px; }
}

/* ========================================================
   보드 시리얼 — 태블릿 마법사 모드
======================================================== */
.bwiz {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 32px 24px !important;
  text-align: center;
}
.bwiz-progress {
  font-size: 0.85rem;
  font-weight: 700;
  color: #4F46E5;
  background: #EEF2FF;
  padding: 4px 14px;
  border-radius: 12px;
}
.bwiz-board-name {
  font-size: 1.3rem;
  font-weight: 800;
  color: #0f172a;
}
.bwiz-input {
  width: 100%;
  max-width: 420px;
  min-height: 64px;
  font-size: 1.3rem;
  text-align: center;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 16px;
  font-family: inherit;
  color: #1e293b;
}
.bwiz-input:focus {
  outline: none;
  border-color: #4F46E5;
  box-shadow: 0 0 0 4px rgba(79,70,229,0.12);
}
.bwiz-scan-btn {
  width: 100%;
  max-width: 420px;
  min-height: 52px;
  font-size: 1rem;
}
.bwiz-nav {
  width: 100%;
  max-width: 420px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.bwiz-nav .btn-primary,
.bwiz-nav .btn-secondary {
  flex: 1;
  min-height: 52px;
  font-size: 1rem;
}
.bwiz-summary-table { max-width: 520px; }
.bwiz-summary-table tbody tr { cursor: pointer; }
.bwiz-summary-table tbody tr:hover td { background: #EEF2FF !important; }
.bwiz-summary-ok { min-width: 200px; }

/* ========================================================
   SIDEBAR — GROUP LABELS
======================================================== */
.sb-group { margin-bottom: 2px; }
.sb-group-label {
  padding: 12px 14px 4px;
  font-size: 0.6rem;
  font-weight: 700;
  color: #6FCFC2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  user-select: none;
}
.sb-group + .sb-group { margin-top: 4px; }

/* ========================================================
   CALENDAR PAGE
======================================================== */
.cal-nav {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}
.cal-nav-title {
  font-size: 1.25rem; font-weight: 800; color: #0F172A;
  min-width: 160px; text-align: center;
}
.cal-nav-btn {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1.5px solid #E2E8F0; background: #fff;
  cursor: pointer; font-size: 1rem; color: #475569;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(15,23,42,0.05);
  transition: all 0.15s;
}
.cal-nav-btn:hover {
  background: #EEF2FF; border-color: #4F46E5; color: #4F46E5;
  box-shadow: 0 4px 12px rgba(79,70,229,0.16); transform: translateY(-1px);
}
.cal-today-btn {
  margin-left: auto; font-size: 0.78rem; padding: 5px 14px;
  border: 1.5px solid #E2E8F0; border-radius: 7px;
  background: #fff; cursor: pointer; color: #475569; font-family: inherit;
  box-shadow: 0 1px 4px rgba(15,23,42,0.05);
  transition: all 0.15s;
}
.cal-today-btn:hover {
  background: #EEF2FF; border-color: #4F46E5; color: #4F46E5;
  box-shadow: 0 4px 12px rgba(79,70,229,0.16); transform: translateY(-1px);
}

.cal-stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px;
}
.cal-stat {
  background: #fff; border: 1px solid #DCE3ED; border-radius: 12px; padding: 16px 20px;
  box-shadow: 0 5px 16px rgba(15,23,42,0.11);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.cal-stat-text { flex: 1; }
.cal-stat-icon {
  width: 48px; height: 48px; border-radius: 12px; background: #F1F5F9;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cal-stat-icon svg { width: 26px; height: 26px; }
.cal-stat-clickable { cursor: pointer; transition: all 0.18s; }
.cal-stat-clickable:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 32px rgba(15,23,42,0.19);
  border-color: #A5B4FC;
}

.cal-grid-wrap {
  background: #fff; border: 1px solid #D6DCE4; border-radius: 12px;
  overflow: hidden; padding: 20px;
  box-shadow: 0 5px 16px rgba(15,23,42,0.11);
  width: 100%;
}
.cal-dow-row {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: #E0E7FF; border: 1px solid #D6DEFC; border-radius: 8px; margin-bottom: 4px;
}
.cal-dow {
  padding: 10px 0; text-align: center;
  font-size: 0.85rem; font-weight: 750; color: #3730A3;
}
.cal-dow:first-child { color: #EF4444; }
.cal-dow:last-child  { color: #3B82F6; }
.cal-body { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell {
  min-height: 200px; padding: 10px 9px 8px;
  border-right: 1px solid #D6DCE4; border-bottom: 1px solid #D6DCE4;
  position: relative; transition: background 0.12s;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.other-month { background: #FAFAFA; }
.cal-cell.today { background: #EEF2FF; }
.cal-cell:hover { background: #f8fffe; }
.cal-day-num {
  font-size: 0.86rem; font-weight: 600; color: #475569;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; margin-bottom: 5px;
}
.cal-cell.today .cal-day-num { background: #4F46E5; color: #fff; }
.cal-cell.sunday .cal-day-num  { color: #EF4444; }
.cal-cell.saturday .cal-day-num { color: #3B82F6; }
.cal-events { display: flex; flex-direction: column; gap: 3px; }
.cal-event {
  padding: 4px 6px;
  font-size: 0.76rem; font-weight: 600; cursor: pointer;
  background: none; color: #1E293B;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  transition: color 0.12s; min-width: 0;
}
.cal-event-row:hover .cal-event { color: #fff; }
.cal-more {
  font-size: 0.66rem; color: #fff; background: #4F46E5;
  border-radius: 8px; padding: 1px 6px; display: inline-block; margin-top: 2px;
  font-weight: 700;
}

/* ========================================================
   DASHBOARD CHARTS
======================================================== */
.charts-row {
  display: grid; grid-template-columns: 4fr 5fr; gap: 16px; margin-top: 20px;
}
.chart-card {
  background: #fff; border: 1px solid #DCE3ED; border-radius: 14px;
  padding: 22px 24px; box-shadow: 0 6px 18px rgba(15,23,42,0.11);
  display: flex; flex-direction: column;
}
.chart-title { font-size: 0.92rem; font-weight: 700; color: #0F172A; margin-bottom: 3px; }
.chart-sub { font-size: 0.72rem; color: #94A3B8; margin-bottom: 16px; }
/* 두 차트 모두 고정 높이로 통일 — SVG의 width:100%;height:auto 방식은 카드 폭이
   넓어지면 종횡비에 따라 높이가 같이 커져 막대그래프가 비정상적으로 거대해짐 */
.chart-svg-wrap {
  width: 100%; height: 280px;
  display: flex; align-items: center; justify-content: center;
}
.chart-legend {
  display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 14px;
  padding-top: 12px; border-top: 1px solid #F1F5F9;
}
.chart-legend-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.72rem; color: #374151; font-weight: 500;
}

/* ========================================================
   ROLE BADGES — ADMIN
======================================================== */
.role-admin { background: #fff1f2; color: #be123c; }

/* ========================================================
   USER ONLINE STATUS
======================================================== */
.online-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #22c55e; margin-right: 6px; vertical-align: middle;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.18);
}
.online-label { color: #15803d; font-weight: 700; font-size: 0.82rem; vertical-align: middle; }

/* 검사목록/최근현황 표 — 승인하기 버튼 유무와 무관하게 "승인" 컬럼 폭 고정
   (표가 auto layout이라 필터별로 버튼 유무가 갈리면 컬럼 폭이 달라져 보일 수 있음) */
#inspection-table-container td:nth-child(10),
#inspection-table-container th:nth-child(10),
#recent-list td:nth-child(10),
#recent-list th:nth-child(10) {
  min-width: 104px;
}

/* ========================================================
   ROLE PERMISSIONS TABLE (사용자 관리 하단)
======================================================== */
.roles-info-card {
  background: #fff; border: 1px solid #DCE3ED; border-radius: 12px;
  padding: 20px 24px; margin-top: 20px;
  box-shadow: 0 5px 16px rgba(15,23,42,0.11);
  max-width: 1000px;
  overflow: hidden;
}
.roles-info-card h4 {
  font-size: 0.88rem; font-weight: 700; color: var(--accent-dark);
  margin: -20px -24px 16px -24px; padding: 12px 24px;
  background: #fff; border-bottom: 1px solid var(--border-strong);
  transition: background 0.15s;
}
.roles-info-card h4:hover { background: var(--accent-light); }
.roles-info-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.roles-info-table th {
  background: #f8fafc; color: #334155; font-weight: 700; font-size: 0.8rem;
  padding: 8px 14px; text-align: center; border-bottom: 1.5px solid #DCE1E8;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.roles-info-table th:first-child { text-align: left; }
.roles-info-table td {
  padding: 9px 14px; border-bottom: 1px solid #F1F5F9; color: #374151;
  text-align: center;
}
.roles-info-table td:first-child { text-align: left; font-weight: 500; color: #1e293b; }
.roles-info-table td.ri-desc { text-align: left; color: #64748b; font-size: 0.76rem; white-space: normal; line-height: 1.4; }
.roles-info-table .ri-check { color: #4F46E5; font-weight: 900; font-size: 1rem; }
.roles-info-table .ri-admin { color: #be123c; font-weight: 900; font-size: 1rem; }

/* ========================================================
   PASSWORD VISIBILITY TOGGLE
======================================================== */
.pw-input-wrap {
  display: flex; align-items: stretch; gap: 0;
  border: 1.5px solid #E2E8F0; border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
  overflow: hidden;
}
.pw-input-wrap:focus-within {
  border-color: #4F46E5;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.pw-input-wrap input[type="password"],
.pw-input-wrap input[type="text"] {
  flex: 1; border: none !important; border-radius: 0 !important;
  box-shadow: none !important; outline: none !important;
  background: #fff; padding: 9px 12px;
  font-size: 0.875rem; font-family: inherit; color: #1e293b;
}
.pw-toggle {
  width: 42px; flex-shrink: 0;
  border: none; border-left: 1px solid #E2E8F0; border-radius: 0;
  background: #f8fafc; cursor: pointer; color: #94A3B8;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.pw-toggle:hover { background: #EEF2FF; color: #4F46E5; }
.pw-toggle.active { color: #4F46E5; background: #EEF2FF; }

/* ========================================================
   DATE BASIS TOGGLE (수주일자 / 검사일)
======================================================== */
.date-filter-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.date-basis-toggle { display: flex; border: 1.5px solid #E2E8F0; border-radius: 8px; overflow: hidden; }
.date-basis-btn {
  padding: 6px 13px; font-size: 0.76rem; font-weight: 600;
  background: #fff; border: none; cursor: pointer; color: #64748B;
  font-family: inherit; transition: all 0.15s;
}
.date-basis-btn + .date-basis-btn { border-left: 1.5px solid #E2E8F0; }
.date-basis-btn.active { background: #4F46E5; color: #fff; }
.date-basis-btn:hover:not(.active) { background: #EEF2FF; color: #4F46E5; }

/* ========================================================
   CALENDAR — 이벤트 + 상태 표시
======================================================== */
.cal-event-row {
  display: flex; align-items: center; gap: 0;
  margin-top: 3px; cursor: pointer; border-radius: 5px;
  background: #E0E7FF; border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
/* 제어반 시리즈별 색상 구분 — 4000: 초록 / 5000: 청색·네이비 / 6000: 보라(승인완료 배지와 동일 계열) (정렬도 이 순서)
   반투명(alpha) 배경으로 흰 배경에 섞여 연하게 + 진한 테두리로 경계를 또렷하게(문구/배지 색상은 그대로 유지) */
.cal-event-row.cal-series-4000 { background: rgba(175,248,202,0.5); border-color: rgba(43,171,90,0.28); }
.cal-event-row.cal-series-5000 { background: rgba(175,190,248,0.5); border-color: rgba(43,69,171,0.28); }
.cal-event-row.cal-series-6000 { background: rgba(229,175,248,0.5); border-color: rgba(138,43,171,0.28); }
.cal-event-row:hover { background: #4F46E5; border-color: #4F46E5; }
.cal-event-row:hover .cal-event { color: #fff; }
.cal-event-row:hover .cal-event-badge { color: #fff !important; background: transparent; }
.cal-event-badge {
  flex-shrink: 0; font-size: 0.72rem; font-weight: 600; padding: 3px 7px;
  white-space: nowrap; border: none; border-radius: 9px;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: color 0.12s, background 0.12s;
}
/* 배경은 흰색으로 통일하고 상태별 글자색만 유지 — 시리즈 배경 위에서 배지가 깔끔하게 떠 보이도록 */
.cal-ev-pending    { background: #fff; color: #78350f; }
.cal-ev-inprogress { background: #fff; color: #120B7E; }
.cal-ev-completed  { background: #fff; color: #064e3b; }
.cal-ev-approved   { background: #fff; color: #4c1d95; }
.cal-more-btn {
  font-size: 0.74rem; color: #fff; background: #4F46E5;
  border-radius: 8px; padding: 3px 10px; margin-top: 3px;
  font-weight: 700; border: none; cursor: pointer; font-family: inherit;
  display: inline-block; transition: background 0.15s;
}
.cal-more-btn:hover { background: #4338CA; }

/* ========================================================
   CALENDAR — STATS ENLARGED
======================================================== */
.cal-stat-label { font-size: 0.85rem; color: #475569; margin-bottom: 8px; font-weight: 700; }
.cal-stat-value { font-size: 2.2rem; font-weight: 800; color: #0F172A; line-height: 1; }
.cal-stat-sub { font-size: 0.8rem; color: #64748B; margin-top: 6px; }

/* ========================================================
   IMPROVEMENT STATUS BADGE
======================================================== */
.impr-status-sel {
  font-size: 0.75rem; border: 1.5px solid #E2E8F0; border-radius: 6px;
  padding: 4px 8px; cursor: pointer; font-family: inherit; color: #1e293b;
  background: #f8fafc; transition: border-color 0.15s;
}
.impr-status-sel:focus { outline: none; border-color: #4F46E5; }
.impr-status { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.impr-s-pending    { background: #FEF3C7; color: #92400E; }
.impr-s-inprogress { background: #DBEAFE; color: #1E40AF; }
.impr-s-done       { background: #D1FAE5; color: #065F46; }
.chart-legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
/* 차트 클릭 필터 — 호버 피드백 */
.chart-bar-rect.clickable { cursor: pointer; }
.chart-bar-rect.clickable:hover { filter: brightness(0.92); }
.chart-slice { cursor: pointer; transition: stroke-width 0.12s; }
.chart-slice:hover { stroke-width: 4; }
.chart-legend-item.clickable {
  cursor: pointer; padding: 3px 6px; margin: -3px -6px;
  border-radius: 6px; transition: background 0.12s;
}
.chart-legend-item.clickable:hover { background: #EEF2FF; }

/* ========================================================
   ACTIVE FILTER CHIP (차트 클릭 필터)
======================================================== */
.active-filter-chip {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  background: var(--accent-light); color: var(--accent-dark);
  border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 9px 14px; margin-bottom: 14px;
  font-size: 0.82rem; font-weight: 700;
}
.active-filter-chip button {
  background: none; border: none; cursor: pointer;
  color: var(--accent-dark); font-weight: 700; font-size: 0.78rem;
  font-family: inherit; padding: 3px 8px; border-radius: 6px;
  transition: background 0.15s;
}
.active-filter-chip button:hover { background: rgba(15,118,110,0.12); }

/* ========================================================
   숫자 정렬 (tabular-nums)
======================================================== */
.cal-stat-value, .td-id, .table-count, .insp-table td input[inputmode="decimal"] {
  font-variant-numeric: tabular-nums;
}

/* ========================================================
   접근성 — 키보드 포커스 링
======================================================== */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.sb-item:focus-visible { outline-offset: -2px; }

/* ========================================================
   BREADCRUMB (상단바 경로)
======================================================== */
.tb-title-wrap { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
#top-bar-breadcrumb {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.7rem; font-weight: 600; color: #94A3B8; letter-spacing: 0.01em;
}
#top-bar-breadcrumb .bc-sep { color: #CBD5E1; }
#top-bar-breadcrumb .bc-current { color: var(--accent-dark); }

/* ========================================================
   TOAST (우측 상단 알림)
======================================================== */
#toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 2000;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 11px;
  background: #fff; border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px; box-shadow: 0 14px 40px rgba(15,23,42,0.16);
  padding: 12px 14px; min-width: 260px; max-width: 380px;
  pointer-events: auto;
  animation: toast-in 0.22s cubic-bezier(.34,1.56,.64,1);
}
.toast.toast-out { animation: toast-out 0.2s ease forwards; }
.toast.toast-shake { animation: toast-shake 0.42s ease; }
@keyframes toast-in  { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px); } }
@keyframes toast-shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}
@media (prefers-reduced-motion: reduce) { .toast, .toast.toast-out, .toast.toast-shake { animation: none; } }
.toast-ic {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 0.9rem; margin-top: 1px;
}
.toast-body { flex: 1; min-width: 0; }
.toast-msg { font-size: 0.86rem; color: #1e293b; font-weight: 500; word-break: break-word; white-space: pre-line; line-height: 1.45; }
.toast-x {
  background: none; border: none; color: #94A3B8; cursor: pointer;
  font-size: 1rem; padding: 0 2px; flex-shrink: 0; font-family: inherit;
}
.toast-x:hover { color: #475569; }
.toast-success { border-left-color: #059669; }
.toast-success .toast-ic { background: #D1FAE5; color: #059669; }
.toast-error   { border-left-color: #DC2626; }
.toast-error   .toast-ic { background: #FEE2E2; color: #DC2626; }
.toast-info    { border-left-color: var(--accent); }
.toast-info    .toast-ic { background: var(--accent-light); color: var(--accent-dark); }
.toast-warn    { border-left-color: #D97706; }
.toast-warn    .toast-ic { background: #FEF3C7; color: #B45309; }

/* ========================================================
   CONFIRM / PROMPT DIALOG
======================================================== */
.confirm-dialog { max-width: 400px; width: 90%; }
.confirm-dialog .cd-title {
  font-size: 1rem; font-weight: 700; color: #0f172a; margin-bottom: 4px;
}
.confirm-dialog .cd-msg {
  font-size: 0.875rem; color: #475569; line-height: 1.55; white-space: pre-line;
  margin-bottom: 4px;
}
.confirm-dialog .cd-input {
  border: 1.5px solid #e2e8f0; border-radius: 8px; padding: 9px 12px;
  font-size: 0.875rem; font-family: inherit; color: #1e293b; width: 100%;
}
.confirm-dialog .cd-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

/* ========================================================
   SKELETON LOADER
======================================================== */
.skeleton-wrap {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 6px 18px rgba(15,23,42,0.08); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.skeleton-row {
  height: 16px; border-radius: 6px;
  background: linear-gradient(90deg, #eef2f7 25%, #e2e8f0 37%, #eef2f7 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.3s ease infinite;
}
.skeleton-row.sk-head { height: 22px; width: 40%; }
@keyframes skeleton-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton-row { animation: none; } }

/* ========================================================
   EMPTY STATE (아이콘 + 안내 + CTA)
======================================================== */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 56px 24px; gap: 6px;
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 6px 18px rgba(15,23,42,0.06);
}
.empty-state .es-ic {
  width: 56px; height: 56px; border-radius: 16px; margin-bottom: 8px;
  background: var(--accent-tint, #EEF2FF); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.empty-state .es-ic svg { width: 28px; height: 28px; }
.empty-state .es-title { font-size: 0.95rem; font-weight: 700; color: #334155; }
.empty-state .es-desc  { font-size: 0.84rem; color: #94A3B8; }
.empty-state .es-action { margin-top: 12px; }

/* ========================================================
   PAGINATION
======================================================== */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  padding: 14px 8px 2px; flex-wrap: wrap;
}
.pg-btn {
  min-width: 34px; height: 34px; padding: 0 10px;
  border: 1.5px solid #E2E8F0; border-radius: 8px; background: #fff;
  color: #475569; font-size: 0.82rem; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all 0.15s;
  display: inline-flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.pg-btn:hover:not(:disabled):not(.active) { background: #EEF2FF; border-color: var(--accent); color: var(--accent); }
.pg-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pg-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pg-ellipsis { color: #94A3B8; padding: 0 4px; }
.pg-info { margin-left: 10px; font-size: 0.78rem; color: #94A3B8; }

/* ========================================================
   TOPBAR USER DROPDOWN MENU
======================================================== */
.tb-user-wrap { position: relative; }
.tb-user-menu {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15,23,42,0.16); min-width: 190px; padding: 6px; z-index: 500;
}
.tb-user-menu.open { display: block; }
.tb-user-menu .tum-head {
  padding: 8px 12px 10px; border-bottom: 1px solid var(--border-soft, #EEF2F7); margin-bottom: 4px;
}
.tb-user-menu .tum-name { font-size: 0.86rem; font-weight: 700; color: #0f172a; }
.tb-user-menu .tum-role { font-size: 0.72rem; color: #94A3B8; margin-top: 2px; }
.tb-user-menu button.tum-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 12px; border: none; background: none; border-radius: 8px;
  font-size: 0.84rem; color: #374151; cursor: pointer; font-family: inherit; transition: background 0.12s;
}
.tb-user-menu button.tum-item:hover { background: #EEF2FF; color: var(--accent-dark); }
.tb-user-menu button.tum-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.tb-user-menu .tum-item.tum-danger:hover { background: #fef2f2; color: #b91c1c; }

/* ========================================================
   PART LIST — 부품 목록 구분 필터
======================================================== */
.pl-filter-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.pl-filter-btn {
  padding: 4px 13px; font-size: 0.76rem; font-weight: 700;
  border: 1.5px solid #E2E8F0; border-radius: 14px;
  background: #fff; color: #64748B; cursor: pointer; font-family: inherit;
  transition: all 0.15s;
}
.pl-filter-btn:hover:not(.active) { background: #EEF2FF; border-color: var(--accent); color: var(--accent); }
.pl-filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ========================================================
   PART LIST — 옵션코드 검색/요약 툴바
======================================================== */
.opt-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.opt-search {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 14px; width: 280px; max-width: 100%;
}
.opt-search svg { color: #64748b; flex-shrink: 0; }
.opt-search input {
  border: none; background: none; outline: none; width: 100%;
  font-size: 0.84rem; color: #374151; font-family: inherit;
}
.opt-search input::placeholder { color: #64748b; }
.opt-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.opt-selonly {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.82rem; font-weight: 600; color: #475569; cursor: pointer; user-select: none;
}
.opt-count {
  display: inline-flex; align-items: center;
  background: var(--accent-light); color: var(--accent-dark);
  border-radius: 20px; padding: 4px 12px; font-size: 0.78rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.opt-selected-chips {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px;
  padding: 10px 12px; background: var(--surface-soft, #f8fafc);
  border: 1px solid var(--border); border-radius: 10px;
}
.opt-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--accent); color: #fff; border: none;
  border-radius: 16px; padding: 4px 10px;
  font-size: 0.76rem; font-weight: 700; cursor: pointer; font-family: inherit;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  transition: background 0.15s;
}
.opt-chip:hover { background: var(--accent-dark); }
.opt-chip span { font-size: 0.9rem; line-height: 1; opacity: 0.85; }

/* ========================================================
   PART LIST — 부품목록 옵션코드 소그룹 헤더
======================================================== */
.insp-table tr.pl-opt-group td {
  background: #f8fafc !important;
  padding: 7px 12px !important;
  border-bottom: 1px solid #DCE1E8 !important;
}
.plg-code {
  display: inline-flex; align-items: center;
  color: #fff; font-weight: 800; font-size: 0.72rem;
  padding: 2px 9px; border-radius: 12px; margin-right: 8px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: 0.02em;
  vertical-align: middle;
}
.plg-name { font-weight: 700; font-size: 0.82rem; color: #334155; vertical-align: middle; }
.plg-cnt {
  margin-left: 8px; font-size: 0.72rem; font-weight: 700; color: #64748b;
  vertical-align: middle;
}

/* ========================================================
   PART LIST — 옵션 즐겨찾기(★)
======================================================== */
.opt-fav-section { background: #fffdf5; border: 1px solid #fde68a; border-radius: 12px; padding: 10px 12px; margin-bottom: 16px; }
.opt-fav-section .opt-code-section-title { color: #b45309; border-bottom-color: #fcd34d; }
/* 별(★)은 카드 맨 위 전용 띠에 배치 — 아래 원형 배지(선택 영역)와 세로로 분리되어 오클릭 방지 */
.opt-code-card { padding-top: 26px; cursor: default; }
/* 선택(체크) 영역 — label로 감싸 이 부분 클릭만 옵션 선택. 별 버튼은 label 밖 형제 요소 */
.opt-code-hit {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  width: 100%; cursor: pointer;
}
.opt-fav-btn {
  position: absolute; top: 3px; right: 3px; z-index: 3;
  width: 22px; height: 22px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none; border-radius: 50%; cursor: pointer;
  font-size: 0.9rem; line-height: 1; color: #cbd5e1; font-family: inherit;
  opacity: 0;  /* 평소엔 숨김 — 카드 호버 시에만 노출(오클릭·시각적 노이즈 방지) */
  transition: opacity 0.12s, background 0.12s, color 0.12s;
}
.opt-code-card:hover .opt-fav-btn,
.opt-fav-btn:focus-visible,
.opt-fav-btn.on { opacity: 1; }
.opt-fav-btn:hover { background: #fef3c7; color: #f59e0b; }
.opt-fav-btn.on { color: #f59e0b; }
/* 터치 기기는 호버가 없으므로 항상 표시 */
@media (pointer: coarse) { .opt-fav-btn { opacity: 1; } }
span.opt-fav-btn { cursor: default; }  /* 조회 전용 표시용 별(버튼 아님) */
.opt-code-card.is-fav .opt-code-circle { box-shadow: 0 0 0 2px #fcd34d; }
.opt-code-card.is-fav:has(input:checked) .opt-code-circle { box-shadow: 0 0 0 3px var(--accent-ring); }

/* ========================================================
   보드 시리얼 마법사 — 카메라 스캔 모달
======================================================== */
.bwiz-scan-content { max-width: 480px; align-items: center; }
.bwiz-scan-video {
  width: 100%;
  border-radius: 12px;
  background: #000;
}
.bwiz-scan-hint {
  font-size: 0.82rem;
  color: #64748b;
}

/* Part List 마스터 카탈로그 편집 격자 (PC 전용, 가로 스크롤) */
.pc-grid-wrap { overflow-x: auto; border: 1px solid #E6EAF0; border-radius: 8px; max-height: 70vh; overflow-y: auto; }
/* table-layout:fixed + colgroup 지정 폭 → 열 폭 예측 가능(용량 열 좁게, 텍스트 열 넓게 하여 잘림 최소화).
   전역 table{width:100%}가 fixed 레이아웃에서 colgroup 폭을 짓눌러 헤더까지 잘리므로 width:max-content로 덮어
   지정 폭 그대로 쓰고 가로 스크롤(.pc-grid-wrap)로 처리. 글꼴을 줄여 한 화면에 더 많이 표시. */
.pc-grid { border-collapse: collapse; font-size: 0.72rem; table-layout: fixed; width: max-content; }
/* padding에 !important — 전역 th/td{padding:...!important}(컴팩트 테이블 규칙)가 이 좁은
   편집 격자 의도(1px)를 덮어써 버리던 문제 수정. 격자를 촘촘히 유지해 한 화면에 더 많이 표시. */
.pc-grid th, .pc-grid td { border: 1px solid #DCE1E8; padding: 1px !important; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; font-size: 0.72rem !important; }
.pc-grid thead th { position: sticky; top: 0; background: #f1f5f9; z-index: 2; font-weight: 700; color: #334155; }
.pc-inp { width: 100%; border: none; padding: 3px 5px; font: inherit; background: transparent; }
.pc-inp:focus { outline: 2px solid var(--accent); background: #fff; position: relative; z-index: 3; }
.pc-inp-qty { text-align: center; padding: 3px 1px; }

/* 편집 중 사양(표준/LH) 배지 — LH를 한눈에 구분 */
.pc-variant-badge { display: inline-block; padding: 2px 12px; border-radius: 12px;
  font-weight: 700; font-size: 0.82rem; margin-right: 8px; vertical-align: middle; }
.pc-variant-lh { background: #ede9fe; color: #5b21b6; border: 1.5px solid #a78bfa; }
.pc-variant-std { background: #f1f5f9; color: #334155; border: 1.5px solid #cbd5e1; }
.pc-dropzone { border: 2px dashed #cbd5e1; border-radius: 10px; padding: 22px; text-align: center;
  color: #64748b; background: #f8fafc; transition: background .15s, border-color .15s; }
.pc-dropzone.dragover { border-color: var(--accent); background: var(--accent-light); color: var(--accent-dark); }

.pc-diff-box { max-height: 50vh; overflow: auto; text-align: left; font-size: 0.82rem;
  border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px; background: #f8fafc; }
.pc-diff-add { color: #166534; } .pc-diff-del { color: #991b1b; }
.pc-diff-box > div { padding: 4px 0; line-height: 1.5; }
.pc-diff-field { font-weight: 700; color: #334155; }
/* 변경 항목 — 가로형 표(열=변경 필드, 1행=변경 전 / 2행=변경 후) */
.pc-diff-chg-block { padding: 6px 0 10px; }
.pc-diff-table { width: auto; border-collapse: collapse; font-size: 0.8rem; }
.pc-diff-table th, .pc-diff-table td { border: 1px solid #DCE1E8; padding: 3px 10px; text-align: left; white-space: nowrap; }
.pc-diff-table thead th { background: #f1f5f9; color: #334155; font-weight: 700; }
.pc-diff-rowlbl { font-weight: 700; color: #334155; background: #f8fafc; }
.pc-diff-ctx { color: #475569; background: #fbfdff; }                /* 식별정보(안 바뀐) 컨텍스트 열 */
/* 변경이력 — 현재 적용 중(각 사양 최신) 버전 강조 */
.pc-cur-badge { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 10px;
  background: var(--accent, #4F46E5); color: #fff; font-size: 0.7rem; font-weight: 600; white-space: nowrap; }
.pc-cur-row > td { background: #ecfdf5 !important; }
.pc-cur-row > td:first-child { box-shadow: inset 3px 0 0 var(--accent, #4F46E5); }
.pc-diff-before { color: #64748b; text-decoration: line-through; }   /* 변경 전 */
.pc-diff-after { color: #dc2626; font-weight: 700; }                 /* 변경 후 */
