/* ============================================================
   ISO 심사 플랫폼 — 공통 CSS
   색상: 네이비 #1B3A6B | 골드 #C9A84C | 다크 #0F2545
   ============================================================ */

:root {
  --navy:      #1B3A6B;
  --navy-dark: #0F2545;
  --navy-mid:  #234880;
  --gold:      #C9A84C;
  --gold-lt:   #E8C870;
  --gold-dk:   #A07830;
  --white:     #FFFFFF;
  --gray-100:  #F8F9FC;
  --gray-200:  #EEF1F7;
  --gray-300:  #D8DDE8;
  --gray-400:  #A8B0C0;
  --gray-500:  #6B7490;
  --gray-700:  #374060;
  --success:   #2E7D52;
  --danger:    #C0392B;
  --warning:   #D4780A;
  --info:      #1A6FA0;
  --iso-9001:  #1B3A6B;
  --iso-14001: #4A7C59;
  --iso-45001: #C9A84C;
  --iso-21001: #6B4FA0;
  --iso-21902: #2A9D8F;
  --iso-53001: #8B1A1A;

  --sidebar-w: 260px;
  --header-h:  64px;
  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 2px 16px rgba(15,37,69,.10);
  --shadow-md: 0 4px 24px rgba(15,37,69,.14);
  --transition: .2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }
body {
  font-family: 'Pretendard', 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif;
  background: var(--gray-100);
  color: var(--gray-700);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── 레이아웃 ── */
.iso-layout {
  display: flex;
  min-height: 100vh;
}

/* ── 사이드바 ── */
.iso-sidebar {
  width: var(--sidebar-w);
  background: var(--navy-dark);
  color: #fff;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
}
.iso-sidebar::-webkit-scrollbar { width: 4px; }
.iso-sidebar::-webkit-scrollbar-track { background: transparent; }
.iso-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

.sidebar-logo {
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: .75rem;
}
.sidebar-logo .logo-icon {
  width: 38px; height: 38px;
  background: var(--gold);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: var(--navy-dark); font-weight: 900;
  flex-shrink: 0;
}
.sidebar-logo .logo-text { font-size: .82rem; color: rgba(255,255,255,.85); line-height: 1.3; }
.sidebar-logo .logo-text strong { display: block; color: var(--gold); font-size: .95rem; }

.sidebar-nav { flex: 1; padding: .75rem 0; }
.nav-section { padding: .5rem 1.25rem .25rem; font-size: .68rem; color: rgba(255,255,255,.4); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem 1.25rem;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: .84rem;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(201,168,76,.1); color: var(--gold); border-left-color: var(--gold); }
.nav-item .nav-icon { width: 18px; text-align: center; font-size: .9rem; flex-shrink: 0; }
.nav-sub { padding-left: 2.1rem; }
.nav-sub .nav-item { font-size: .8rem; padding: .42rem 1.25rem .42rem .5rem; border-left: none; }
.nav-sub .nav-item.active { background: rgba(201,168,76,.08); color: var(--gold-lt); }

.sidebar-user {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: .65rem;
}
.sidebar-user .user-avatar {
  width: 34px; height: 34px;
  background: var(--gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; color: var(--navy-dark); font-weight: 800;
  flex-shrink: 0;
}
.sidebar-user .user-info { flex: 1; overflow: hidden; }
.sidebar-user .user-name { font-size: .82rem; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: .7rem; color: rgba(255,255,255,.45); }
.sidebar-user .logout-btn {
  background: none; border: none; color: rgba(255,255,255,.4);
  cursor: pointer; font-size: .9rem; transition: color var(--transition);
  flex-shrink: 0;
}
.sidebar-user .logout-btn:hover { color: #ff8080; }

/* ── 메인 컨텐츠 영역 ── */
.iso-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── 상단 헤더 ── */
.iso-header {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center;
  padding: 0 1.75rem;
  gap: 1rem;
  position: sticky; top: 0; z-index: 90;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.header-title { font-size: 1.05rem; font-weight: 700; color: var(--navy); flex: 1; }
.header-actions { display: flex; align-items: center; gap: .5rem; }
.header-btn {
  width: 36px; height: 36px;
  background: var(--gray-100); border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm); display: flex; align-items: center;
  justify-content: center; cursor: pointer; color: var(--gray-500);
  font-size: .9rem; transition: all var(--transition); position: relative;
}
.header-btn:hover { background: var(--gray-200); color: var(--navy); }
.badge-dot {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px; background: var(--danger); border-radius: 50%;
  border: 1.5px solid #fff;
}

/* ── 페이지 바디 ── */
.iso-body { flex: 1; padding: 1.75rem; }
.page-title {
  font-size: 1.35rem; font-weight: 800; color: var(--navy);
  margin-bottom: 1.5rem; display: flex; align-items: center; gap: .6rem;
}
.page-title .pt-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #fff;
}

/* ── 카드 ── */
.iso-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.iso-card .card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; padding-bottom: .85rem;
  border-bottom: 1px solid var(--gray-200);
}
.iso-card .card-title { font-size: .95rem; font-weight: 700; color: var(--navy); display: flex; align-items: center; gap: .45rem; }

/* ── 통계 카드 ── */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 1rem;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent, var(--gold));
}
.stat-icon {
  width: 48px; height: 48px;
  background: var(--icon-bg, rgba(201,168,76,.1));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.stat-info .stat-num { font-size: 1.9rem; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-info .stat-label { font-size: .75rem; color: var(--gray-500); margin-top: .25rem; font-weight: 500; }

/* ── 그리드 ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

/* ── 버튼 ── */
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .55rem 1.15rem;
  border-radius: var(--radius-sm);
  border: none; cursor: pointer;
  font-size: .84rem; font-weight: 600;
  transition: all var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-mid); }
.btn-gold { background: var(--gold); color: var(--navy-dark); }
.btn-gold:hover { background: var(--gold-lt); }
.btn-outline { background: transparent; color: var(--navy); border: 1.5px solid var(--gray-300); }
.btn-outline:hover { border-color: var(--navy); background: var(--gray-100); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a93226; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #236040; }
.btn-sm { padding: .38rem .8rem; font-size: .78rem; }
.btn-lg { padding: .75rem 1.75rem; font-size: .95rem; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── 폼 ── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .8rem; font-weight: 600; color: var(--gray-700); margin-bottom: .4rem; }
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: .6rem .85rem;
  border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm);
  font-size: .85rem; color: var(--gray-700);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(27,58,107,.08);
}
.form-textarea { min-height: 100px; resize: vertical; }
.form-hint { font-size: .72rem; color: var(--gray-400); margin-top: .3rem; }

/* ── 배지 ── */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .65rem; border-radius: 20px;
  font-size: .7rem; font-weight: 700;
}
.badge-navy  { background: rgba(27,58,107,.12); color: var(--navy); }
.badge-gold  { background: rgba(201,168,76,.15); color: var(--gold-dk); }
.badge-success { background: rgba(46,125,82,.12); color: var(--success); }
.badge-danger  { background: rgba(192,57,43,.12); color: var(--danger); }
.badge-warning { background: rgba(212,120,10,.12); color: var(--warning); }
.badge-gray    { background: var(--gray-200); color: var(--gray-500); }
.badge-major   { background: rgba(192,57,43,.15); color: var(--danger); border: 1px solid rgba(192,57,43,.2); }
.badge-minor   { background: rgba(212,120,10,.15); color: var(--warning); border: 1px solid rgba(212,120,10,.2); }
.badge-obs     { background: rgba(26,111,160,.12); color: var(--info); border: 1px solid rgba(26,111,160,.2); }

/* ── 테이블 ── */
.iso-table { width: 100%; border-collapse: collapse; }
.iso-table th {
  background: var(--gray-100); color: var(--gray-500);
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; padding: .7rem 1rem; text-align: left;
  border-bottom: 1.5px solid var(--gray-200);
}
.iso-table td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--gray-200);
  font-size: .84rem; color: var(--gray-700);
  vertical-align: middle;
}
.iso-table tr:last-child td { border-bottom: none; }
.iso-table tr:hover td { background: var(--gray-100); }

/* ── 규격 뱃지 ── */
.spec-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .18rem .6rem; border-radius: 4px;
  font-size: .7rem; font-weight: 700; color: #fff;
  white-space: nowrap;
}
.spec-9001  { background: var(--iso-9001); }
.spec-14001 { background: var(--iso-14001); }
.spec-45001 { background: #8B6914; }
.spec-21001 { background: var(--iso-21001); }
.spec-21902 { background: var(--iso-21902); }
.spec-53001 { background: var(--iso-53001); }

/* ── 알림/토스트 ── */
#iso-toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
  display: flex; flex-direction: column; gap: .6rem; align-items: flex-end;
}
.iso-toast {
  background: #fff; border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200); box-shadow: var(--shadow-md);
  padding: .85rem 1.25rem; min-width: 280px; max-width: 380px;
  display: flex; align-items: flex-start; gap: .75rem;
  animation: toastIn .25s ease;
}
.iso-toast.out { animation: toastOut .25s ease forwards; }
@keyframes toastIn  { from { opacity:0; transform: translateY(12px) scale(.97); } to { opacity:1; transform: none; } }
@keyframes toastOut { to   { opacity:0; transform: translateY(8px); } }
.toast-icon { font-size: 1.1rem; flex-shrink:0; margin-top:.05rem; }
.toast-title { font-size: .83rem; font-weight: 700; color: var(--navy); }
.toast-msg   { font-size: .78rem; color: var(--gray-500); margin-top: .1rem; }

/* ── 모달 ── */
.iso-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45); backdrop-filter: blur(3px);
  z-index: 500; display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.iso-modal {
  background: #fff; border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  width: 100%; max-width: 600px; max-height: 90vh;
  overflow-y: auto; display: flex; flex-direction: column;
  animation: modalIn .25s ease;
}
@keyframes modalIn { from { opacity:0; transform: scale(.96) translateY(-10px); } to { opacity:1; transform: none; } }
.modal-header {
  padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-title { font-size: 1rem; font-weight: 700; color: var(--navy); }
.modal-close {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--gray-200); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; color: var(--gray-500);
  transition: all var(--transition);
}
.modal-close:hover { background: var(--gray-300); color: var(--gray-700); }
.modal-body { padding: 1.5rem; flex: 1; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: .6rem; }

/* ── 체크리스트 아이템 ── */
.checklist-section { margin-bottom: 1rem; }
.checklist-section-title {
  background: var(--gray-100); padding: .55rem .85rem;
  font-size: .8rem; font-weight: 700; color: var(--navy);
  border-radius: var(--radius-sm); margin-bottom: .4rem;
  border-left: 3px solid var(--navy);
}
.checklist-item {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .65rem .85rem; border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200); background: #fff;
  margin-bottom: .4rem; transition: border-color var(--transition);
}
.checklist-item:hover { border-color: var(--gray-300); }
.checklist-item.conform   { border-left: 3px solid var(--success); background: rgba(46,125,82,.025); }
.checklist-item.nonconform{ border-left: 3px solid var(--danger); background: rgba(192,57,43,.025); }
.checklist-item.na        { border-left: 3px solid var(--gray-300); background: var(--gray-100); opacity: .7; }
.checklist-item .item-clause { font-size: .72rem; color: var(--gray-400); white-space: nowrap; min-width: 40px; }
.checklist-item .item-text { flex: 1; font-size: .82rem; color: var(--gray-700); }
.checklist-btns { display: flex; gap: .3rem; flex-shrink: 0; }
.check-btn {
  padding: .25rem .55rem; border-radius: 4px; border: 1.5px solid var(--gray-300);
  background: #fff; font-size: .72rem; cursor: pointer; font-weight: 600;
  transition: all var(--transition); white-space: nowrap;
}
.check-btn.conform-btn.active   { background: var(--success); border-color: var(--success); color: #fff; }
.check-btn.nonconform-btn.active{ background: var(--danger);  border-color: var(--danger);  color: #fff; }
.check-btn.na-btn.active        { background: var(--gray-400);border-color: var(--gray-400);color: #fff; }
.check-btn:hover:not(.active)   { border-color: var(--navy); color: var(--navy); }

/* ── STEP 진행 바 ── */
.step-bar { display: flex; align-items: center; margin-bottom: 2rem; }
.step-item { display: flex; align-items: center; flex: 1; }
.step-circle {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gray-200); color: var(--gray-400);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; flex-shrink: 0;
  border: 2px solid var(--gray-300); transition: all .3s;
}
.step-circle.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.step-circle.done   { background: var(--success); color: #fff; border-color: var(--success); }
.step-label { font-size: .72rem; color: var(--gray-400); margin-left: .5rem; font-weight: 600; white-space: nowrap; }
.step-label.active { color: var(--navy); }
.step-label.done   { color: var(--success); }
.step-line { flex: 1; height: 2px; background: var(--gray-200); margin: 0 .5rem; }
.step-line.done { background: var(--success); }

/* ── 스위치 ── */
.toggle-switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--gray-300); border-radius: 24px; transition: .3s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: .3s;
}
input:checked + .toggle-slider { background: var(--navy); }
input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── 반응형 ── */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2    { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .iso-sidebar { transform: translateX(-100%); }
  .iso-sidebar.open { transform: translateX(0); }
  .iso-main { margin-left: 0; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .iso-body  { padding: 1rem; }
}

/* ── 스크롤바 ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }

/* ── 로딩 스피너 ── */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.3); border-radius: 50%; border-top-color: #fff; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 섹션 구분선 ── */
.section-divider { border: none; border-top: 1px solid var(--gray-200); margin: 1.5rem 0; }
