/* 공정관리 공통 스타일.
 * Bootstrap 5.3 (CDN, 버전 고정) 위에 얹는다. Sass 빌드 없이 Bootstrap CSS 변수를 덮어써서 테마를 맞춘다.
 * 색은 rva_link 시제품 색, 배치 · 부품 느낌은 Skote 세로 메뉴 레이아웃을 참고해 새로 작성했다 (Skote 소스 복사 없음).
 *
 * 순서: 1 토큰 → 2 Bootstrap 변수 → 3 Bootstrap 부품 보정 → 4 화면 틀 → 5 공통 부품 → 6 보조 클래스
 * 상태 색 약속: 정상 success · 교체 임박 warning · 교체 초과/고장 danger · 정비 중 info · 정지/미보고 secondary
 */

/* 1. 토큰 ---------------------------------------------------------------- */
:root {
  --c-primary: #1f7a68;
  --c-primary-rgb: 31, 122, 104;
  --c-primary-hover: #1a6858;
  --c-primary-active: #16594c;
  --c-primary-soft: #dcefe9;

  --c-success: #1f7a68;  --c-success-rgb: 31, 122, 104;  --c-success-soft: #dcefe9;  --c-success-ink: #16594c;
  --c-warning: #b7791f;  --c-warning-rgb: 183, 121, 31;  --c-warning-soft: #fdf0d6;
  --c-danger:  #b4332b;  --c-danger-rgb: 180, 51, 43;    --c-danger-soft: #fbe3e1;
  --c-info:    #3b5ea8;  --c-info-rgb: 59, 94, 168;      --c-info-soft: #e3eaf8;
  --c-muted:   #6b7d77;  --c-muted-rgb: 107, 125, 119;   --c-muted-soft: #eceff0;

  --c-ink: #18221f;
  --c-ink-rgb: 24, 34, 31;
  --c-text-muted: #5f6e68;
  --c-bg: #f3f5f4;
  --c-panel: #fff;
  --c-line: #e3e8e6;
  --c-table-head: #f6f8f7;

  --side-bg: #14201c;
  --side-ink: #c9d6d1;
  --side-ink-2: #a3b5ae;
  --side-muted: #7f9890;
  --side-accent: #7fd6c2;
  --brand-works: #7fd6c2;  /* 로고 "Works" 색. 관리자 테마에서도 바꾸지 않는다 */
  --side-hover: rgba(255, 255, 255, 0.06);
  --side-active: #23392f;
  --sidebar-w: 240px;
  --topbar-h: 64px;

  --shadow-card: 0 0.75rem 1.5rem rgba(20, 32, 28, 0.04);
  --shadow-pop: 0 0.5rem 1.5rem rgba(20, 32, 28, 0.12);
  --radius: 6px;
  --gutter: 24px;

  --font: "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
}

/* 1-1. 관리자 테마 (SJ코리아산업 · 서울소프트 계정). base.html 이 관리자 로그인일 때 <html class="theme-admin"> 을 붙인다.
 * 도입기업은 위의 녹색 그대로. 포인트 색(주색 · 왼쪽 메뉴)만 바꾸고 상태 색(정상 녹색 · 임박 · 초과 …)은 그대로 둔다.
 * 페트롤 블루: 녹색과 같은 깊은 청록 계열이라 '살짝' 다르면서 한눈에 구분된다. 정비 중(info 파랑 #3b5ea8)보다 초록 쪽으로 치우쳐 겹치지 않는다.
 */
html.theme-admin {
  --c-primary: #1f6f8b;
  --c-primary-rgb: 31, 111, 139;
  --c-primary-hover: #1a5f77;
  --c-primary-active: #164f63;
  --c-primary-soft: #dcecf2;
  --bs-primary-border-subtle: #b3d3df;
  --bs-link-hover-color-rgb: 22, 79, 99;

  --side-bg: #121c24;
  --side-accent: #7fc6dc;
  --side-active: #1f3340;
}

/* 2. Bootstrap 변수 덮어쓰기 ------------------------------------------- */
:root {
  --bs-body-font-family: var(--font);
  --bs-body-font-size: 0.875rem;
  --bs-body-line-height: 1.55;
  --bs-body-color: var(--c-ink);
  --bs-body-color-rgb: var(--c-ink-rgb);
  --bs-body-bg: var(--c-bg);
  --bs-secondary-color: var(--c-text-muted);
  --bs-emphasis-color: var(--c-ink);
  --bs-heading-color: var(--c-ink);
  --bs-border-color: var(--c-line);
  --bs-border-radius: var(--radius);
  --bs-border-radius-sm: 4px;
  --bs-border-radius-lg: 8px;
  --bs-tertiary-bg: var(--c-table-head);

  --bs-primary: var(--c-primary);
  --bs-primary-rgb: var(--c-primary-rgb);
  --bs-primary-bg-subtle: var(--c-primary-soft);
  --bs-primary-text-emphasis: var(--c-primary-active);
  --bs-primary-border-subtle: #b5dcd1;
  --bs-success: var(--c-success);
  --bs-success-rgb: var(--c-success-rgb);
  --bs-success-bg-subtle: var(--c-success-soft);
  --bs-success-text-emphasis: var(--c-success-ink);
  --bs-warning: var(--c-warning);
  --bs-warning-rgb: var(--c-warning-rgb);
  --bs-warning-bg-subtle: var(--c-warning-soft);
  --bs-warning-text-emphasis: #8a5a14;
  --bs-danger: var(--c-danger);
  --bs-danger-rgb: var(--c-danger-rgb);
  --bs-danger-bg-subtle: var(--c-danger-soft);
  --bs-danger-text-emphasis: #8c2620;
  --bs-info: var(--c-info);
  --bs-info-rgb: var(--c-info-rgb);
  --bs-info-bg-subtle: var(--c-info-soft);
  --bs-info-text-emphasis: #2c4780;
  --bs-secondary: var(--c-muted);
  --bs-secondary-rgb: var(--c-muted-rgb);
  --bs-secondary-bg-subtle: var(--c-muted-soft);

  --bs-link-color: var(--c-primary);
  --bs-link-color-rgb: var(--c-primary-rgb);
  --bs-link-hover-color: var(--c-primary-active);
  --bs-link-hover-color-rgb: 22, 89, 76;
  --bs-focus-ring-color: rgba(var(--c-primary-rgb), 0.2);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }
a:hover { text-decoration: underline; }

/* 3. Bootstrap 부품 보정 (클래스 안에 색이 박혀 있는 것들) -------------- */
.btn {
  --bs-btn-font-size: 0.875rem;
  --bs-btn-padding-x: 0.875rem;
  --bs-btn-padding-y: 0.45rem;
  --bs-btn-font-weight: 500;
}
.btn-sm { --bs-btn-font-size: 0.8125rem; --bs-btn-padding-x: 0.625rem; --bs-btn-padding-y: 0.25rem; }
.btn-primary {
  --bs-btn-bg: var(--c-primary);
  --bs-btn-border-color: var(--c-primary);
  --bs-btn-hover-bg: var(--c-primary-hover);
  --bs-btn-hover-border-color: var(--c-primary-hover);
  --bs-btn-active-bg: var(--c-primary-active);
  --bs-btn-active-border-color: var(--c-primary-active);
  --bs-btn-disabled-bg: var(--c-primary);
  --bs-btn-disabled-border-color: var(--c-primary);
  --bs-btn-focus-shadow-rgb: var(--c-primary-rgb);
}
.btn-outline-primary {
  --bs-btn-color: var(--c-primary);
  --bs-btn-border-color: var(--c-primary);
  --bs-btn-hover-bg: var(--c-primary);
  --bs-btn-hover-border-color: var(--c-primary);
  --bs-btn-active-bg: var(--c-primary-active);
  --bs-btn-active-border-color: var(--c-primary-active);
  --bs-btn-disabled-color: var(--c-primary);
  --bs-btn-disabled-border-color: var(--c-primary);
  --bs-btn-focus-shadow-rgb: var(--c-primary-rgb);
}
.btn-light {
  --bs-btn-bg: #eef1f0;
  --bs-btn-border-color: #eef1f0;
  --bs-btn-hover-bg: #e2e7e5;
  --bs-btn-hover-border-color: #e2e7e5;
  --bs-btn-active-bg: #d8dfdc;
}

.form-label { font-size: 0.8125rem; font-weight: 500; margin-bottom: 0.375rem; }
.form-control, .form-select { font-size: 0.875rem; border-color: var(--c-line); }
.form-control:focus, .form-select:focus {
  border-color: rgba(var(--c-primary-rgb), 0.5);
  box-shadow: 0 0 0 0.2rem rgba(var(--c-primary-rgb), 0.12);
}
.form-check-input:checked { background-color: var(--c-primary); border-color: var(--c-primary); }
.form-check-input:focus { border-color: rgba(var(--c-primary-rgb), 0.5); box-shadow: 0 0 0 0.2rem rgba(var(--c-primary-rgb), 0.12); }
.form-text { color: var(--c-text-muted); }

.dropdown-menu {
  --bs-dropdown-font-size: 0.875rem;
  --bs-dropdown-border-color: var(--c-line);
  --bs-dropdown-box-shadow: var(--shadow-pop);
  --bs-dropdown-link-active-bg: var(--c-primary-soft);
  --bs-dropdown-link-active-color: var(--c-primary-active);
  --bs-dropdown-item-padding-y: 0.45rem;
  box-shadow: var(--bs-dropdown-box-shadow);
}
.nav-pills { --bs-nav-pills-link-active-bg: var(--c-primary); }
.nav-tabs { --bs-nav-tabs-link-active-color: var(--c-primary); }
.nav-tabs-line { border-bottom: 1px solid var(--c-line); gap: 4px; }
.nav-tabs-line .nav-link { color: var(--c-text-muted); border: 0; border-bottom: 2px solid transparent; padding: 0.6rem 1rem; }
.nav-tabs-line .nav-link.active { color: var(--c-primary); border-bottom-color: var(--c-primary); font-weight: 600; background: none; }
.pagination {
  --bs-pagination-color: var(--c-ink);
  --bs-pagination-font-size: 0.8125rem;
  --bs-pagination-border-color: var(--c-line);
  --bs-pagination-hover-color: var(--c-primary);
  --bs-pagination-focus-color: var(--c-primary);
  --bs-pagination-focus-box-shadow: 0 0 0 0.2rem rgba(var(--c-primary-rgb), 0.12);
  --bs-pagination-active-bg: var(--c-primary);
  --bs-pagination-active-border-color: var(--c-primary);
  margin-bottom: 0;
}
.progress { --bs-progress-bar-bg: var(--c-success); --bs-progress-bg: #e7ecea; }
.alert { --bs-alert-padding-y: 0.75rem; font-size: 0.875rem; border: 0; }

/* 4. 화면 틀: 왼쪽 세로 메뉴(어두움) + 상단바(흰색) + 본문 --------------- */
.app { min-height: 100vh; }
.app-main {
  min-height: 100vh;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  transition: margin-left 0.2s ease;
}

/* 왼쪽 메뉴 */
.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--side-bg);
  color: var(--side-ink);
  transition: transform 0.2s ease;
}
.brand {
  flex: none;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  color: #fff;
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.brand:hover { color: #fff; text-decoration: none; }
.brand .brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--c-primary);
  color: #fff;
  font-size: 1rem;
}
.brand em { font-style: normal; color: var(--brand-works); font-weight: 700; }

.side-nav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
/* 대메뉴(공정관리 · 생산관리 · 운영관리) 구역 제목 */
.side-label {
  margin-top: 10px;
  padding: 14px 12px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--side-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.side-gap { height: 12px; }
.side-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 2px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--side-ink);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
}
.side-link > .bi:first-child { font-size: 1.1rem; width: 20px; text-align: center; color: var(--side-muted); }
.side-link > span { flex: 1; }
.side-link:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.side-link:hover > .bi:first-child { color: #fff; }
.side-link.active { color: #fff; }
.side-link.active > .bi:first-child { color: var(--side-accent); }
a.side-link.active { background: var(--side-active); font-weight: 600; }
.side-link.placeholder { color: var(--side-muted); font-style: normal; cursor: default; }
.side-link.placeholder:hover { background: none; color: var(--side-muted); }
.side-link.placeholder:hover > .bi:first-child { color: var(--side-muted); }
.side-toggle .caret { font-size: 0.7rem; transition: transform 0.2s ease; }
.side-toggle.collapsed .caret { transform: rotate(-90deg); }
.side-sub {
  list-style: none;
  margin: 0 0 6px;
  padding: 2px 0 4px;
}
.side-sub a {
  position: relative;
  display: block;
  padding: 7px 12px 7px 44px;
  border-radius: var(--radius);
  color: var(--side-ink-2);
  font-size: 0.84375rem;
}
.side-sub a::before {
  content: "";
  position: absolute;
  left: 21px;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
}
.side-sub a:hover { color: #fff; background: var(--side-hover); text-decoration: none; }
.side-sub a.active { color: #fff; background: var(--side-active); font-weight: 600; }
.side-sub a.active::before { background: var(--side-accent); opacity: 1; }

/* 넓은 화면: ☰ 로 메뉴를 접음 */
@media (min-width: 992px) {
  .sidebar-collapsed .sidebar { transform: translateX(-100%); }
  .sidebar-collapsed .app-main { margin-left: 0; }
}
/* 좁은 화면: 메뉴는 숨겨 두고 ☰ 로 겹쳐서 연다 */
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .app-main { margin-left: 0; }
  .sidebar-open .sidebar { transform: none; box-shadow: var(--shadow-pop); }
  .sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1035;
    background: rgba(20, 32, 28, 0.45);
  }
}

/* 상단바 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 calc(var(--gutter) - 10px) 0 calc(var(--gutter) - 10px);
  background: var(--c-panel);
  box-shadow: 0 1px 0 var(--c-line), var(--shadow-card);
}
.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}
.topbar-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--c-text-muted);
  font-size: 0.875rem;
  white-space: nowrap;
}
.topbar-btn:hover, .topbar-btn[aria-expanded="true"] { background: var(--c-bg); color: var(--c-ink); text-decoration: none; }
.topbar-btn > .bi { font-size: 1.2rem; }
.topbar-btn > .bi-list { font-size: 1.5rem; }
.topbar-btn .dot {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--c-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.topbar-company { width: 220px; max-width: 32vw; }
.topbar-company .ac-toggle { height: 36px; }

/* 관리자 모드 표시 (상단바 정중앙). 왼쪽 메뉴를 접어도 · 고객사 이름 길이가 바뀌어도 위치가 흔들리지 않게 가운데 고정 */
.topbar-mode {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 34%;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--c-primary-soft);
  color: var(--c-primary-active);
  font-size: 0.8125rem;
  white-space: nowrap;
  pointer-events: none;
}
.topbar-mode > .bi { font-size: 0.95rem; }
.topbar-mode-scope { display: inline-flex; gap: 4px; min-width: 0; font-weight: 500; }
.topbar-mode-name { overflow: hidden; text-overflow: ellipsis; max-width: 160px; font-weight: 700; }
.topbar-mode.scoped { background: var(--c-primary); color: #fff; box-shadow: 0 2px 8px rgba(var(--c-primary-rgb), 0.3); }
@media (max-width: 1399.98px) { .topbar-mode-scope { display: none; } }   /* 중간 폭: '관리자 모드' 만 */
@media (max-width: 991.98px) { .topbar-mode b { display: none; } .topbar-mode { padding: 6px 9px; } }  /* 좁은 폭: 방패만 */
@media (max-width: 575.98px) { .topbar-mode { display: none; } }
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--c-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.8125rem;
}

/* 본문 */
.page-content {
  flex: 1;
  padding: var(--gutter) 0 calc(var(--gutter) * 2);
}
.page-content > .container-fluid,
.app-footer > .container-fluid { padding-left: var(--gutter); padding-right: var(--gutter); }
.page-title-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: var(--gutter);
}
.page-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
}
.page-title-box .breadcrumb {
  margin: 0;
  font-size: 0.8125rem;
  --bs-breadcrumb-divider-color: var(--c-text-muted);
  --bs-breadcrumb-item-active-color: var(--c-text-muted);
}
.page-title-box .breadcrumb a { color: var(--c-ink); }

.app-footer {
  padding: 16px 0;
  border-top: 1px solid var(--c-line);
  background: var(--c-panel);
  color: var(--c-text-muted);
  font-size: 0.8125rem;
}
@media (max-width: 575.98px) {
  :root { --gutter: 16px; }
}

/* 5. 공통 부품 ------------------------------------------------------------ */

/* 카드: 테두리 없이 옅은 그림자 */
.card {
  --bs-card-border-width: 0;
  --bs-card-spacer-y: 1.25rem;
  --bs-card-spacer-x: 1.25rem;
  --bs-card-cap-bg: transparent;
  --bs-card-cap-padding-y: 1rem;
  box-shadow: var(--shadow-card);
  margin-bottom: var(--gutter);
}
.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--c-line);
}
.card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  margin: 0;
}
.card-header .card-title { flex: 1; }
.card-body > .card-title { margin-bottom: 1rem; }
.card-subtitle { color: var(--c-text-muted); font-size: 0.8125rem; }

/* 요약 숫자 카드: 왼쪽 라벨 · 숫자, 오른쪽 원형 아이콘 */
.stat-card .card-body {
  display: flex;
  align-items: center;
  gap: 12px;
}
.stat-card .stat-body { flex: 1; min-width: 0; }
.stat-card .stat-label { color: var(--c-text-muted); font-size: 0.8125rem; font-weight: 500; margin-bottom: 6px; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-card .stat-foot { margin-top: 6px; font-size: 0.8125rem; color: var(--c-text-muted); }

/* 원형 아이콘 (stat 카드 · 목록 앞 아이콘) */
.icon-circle {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--c-primary);
  color: #fff;
  font-size: 1.35rem;
}
.icon-circle.sm { width: 36px; height: 36px; font-size: 1.05rem; }
.icon-circle.soft-primary { background: var(--c-primary-soft); color: var(--c-primary); }
.icon-circle.soft-success { background: var(--c-success-soft); color: var(--c-success); }
.icon-circle.soft-warning { background: var(--c-warning-soft); color: var(--c-warning); }
.icon-circle.soft-danger  { background: var(--c-danger-soft);  color: var(--c-danger); }
.icon-circle.soft-info    { background: var(--c-info-soft);    color: var(--c-info); }
.icon-circle.soft-secondary { background: var(--c-muted-soft); color: var(--c-muted); }

/* 배지: 연한 배경 + 진한 글자 (상태 표시용) */
.badge { font-weight: 600; padding: 0.4em 0.65em; letter-spacing: 0; }
.badge-soft-primary   { background: var(--c-primary-soft); color: var(--c-primary-active); }
.badge-soft-success   { background: var(--c-success-soft); color: var(--c-success-ink); }
.badge-soft-warning   { background: var(--c-warning-soft); color: #8a5a14; }
.badge-soft-danger    { background: var(--c-danger-soft);  color: #8c2620; }
.badge-soft-info      { background: var(--c-info-soft);    color: #2c4780; }
.badge-soft-secondary { background: var(--c-muted-soft);   color: #4f5e59; }
.badge-dot::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 0.1em;
}

/* 연한 버튼 (보조 동작) */
.btn-soft-primary, .btn-soft-danger, .btn-soft-secondary, .btn-soft-warning {
  --bs-btn-border-color: transparent;
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-border-color: transparent;
  --bs-btn-hover-color: #fff;
  --bs-btn-active-color: #fff;
}
.btn-soft-primary { --bs-btn-color: var(--c-primary); --bs-btn-bg: var(--c-primary-soft); --bs-btn-hover-bg: var(--c-primary); --bs-btn-active-bg: var(--c-primary-active); }
.btn-soft-danger  { --bs-btn-color: var(--c-danger);  --bs-btn-bg: var(--c-danger-soft);  --bs-btn-hover-bg: var(--c-danger);  --bs-btn-active-bg: var(--c-danger); }
.btn-soft-secondary { --bs-btn-color: #4f5e59; --bs-btn-bg: var(--c-muted-soft); --bs-btn-hover-bg: var(--c-muted); --bs-btn-active-bg: var(--c-muted); }
.btn-soft-warning { --bs-btn-color: #8a5a14; --bs-btn-bg: var(--c-warning-soft); --bs-btn-hover-bg: var(--c-warning); --bs-btn-active-bg: var(--c-warning); }
.btn > .bi { margin-right: 4px; }
.btn-icon { --bs-btn-padding-x: 0.5rem; }
.btn-icon > .bi { margin-right: 0; }

/* 표 */
.table {
  --bs-table-color: var(--c-ink);
  --bs-table-border-color: var(--c-line);
  --bs-table-hover-bg: rgba(var(--c-primary-rgb), 0.035);
  --bs-table-striped-bg: rgba(var(--c-ink-rgb), 0.02);
  margin-bottom: 0;
  vertical-align: middle;
}
.table > :not(caption) > * > * { padding: 0.75rem 0.75rem; }
.table > thead > tr > th {
  background: var(--c-table-head);
  color: var(--c-text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  border-bottom-width: 1px;
}
.table-sm > :not(caption) > * > * { padding: 0.45rem 0.6rem; }
.table-nowrap th, .table-nowrap td { white-space: nowrap; }
.table .num, .table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table a.row-link { color: var(--c-ink); font-weight: 600; }
.table a.row-link:hover { color: var(--c-primary); }

/* 표 머리 정렬 (ui.sortable). btn_blue 의 sort-icon 과 같은 모양: CSS 삼각형 두 개, 위 = 오름차순 · 아래 = 내림차순 */
.table > thead > tr > th.sortable { cursor: pointer; user-select: none; }
.table > thead > tr > th.sortable:hover { color: var(--c-ink); }
.sort-icon {
  display: inline-block;
  position: relative;
  width: 12px;
  height: 12px;
  margin-right: 5px;
  vertical-align: middle;
}
.sort-icon::before,
.sort-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-style: solid;
  border-color: transparent;
}
.sort-icon::before { top: -2px; border-width: 0 5px 5px 5px; border-bottom-color: #cdd5d2; }
.sort-icon::after { bottom: 0; border-width: 5px 5px 0 5px; border-top-color: #cdd5d2; }
.sort-icon.asc::before { border-bottom-color: var(--c-primary); }
.sort-icon.desc::after { border-top-color: var(--c-primary); }
/* 카드 안 표: 카드 좌우 여백까지 붙인다 */
.card > .table-responsive > .table > thead > tr > th:first-child,
.card > .table-responsive > .table > tbody > tr > td:first-child { padding-left: 1.25rem; }
.card > .table-responsive > .table > thead > tr > th:last-child,
.card > .table-responsive > .table > tbody > tr > td:last-child { padding-right: 1.25rem; }
.card > .table-responsive:last-child > .table > tbody > tr:last-child > td { border-bottom: 0; }

/* 페이지 버튼 (ui.pager). btn_blue 와 같은 모양: 테두리 없음, 현재 페이지는 크게 · 밑줄 · 주색 */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pager > li > a {
  position: relative;
  display: block;
  padding: 6px 10px;
  color: #595757;
  font-size: 0.8125rem;
  line-height: 1.4;
  text-decoration: none;
}
.pager > li > a:hover { font-weight: 700; color: var(--c-ink); text-decoration: none; }
.pager > li.active > a {
  top: -1px;
  color: var(--c-primary);
  font-size: 1.0625rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: default;
}
.pager > li.disabled > a { color: #c9caca; cursor: not-allowed; font-weight: 400; }

/* 목록 위 조건줄 */
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.toolbar .form-control, .toolbar .form-select { width: auto; min-width: 160px; }
.toolbar .spacer { flex: 1; }

/* 항목 · 값 목록 (상세 화면) */
.kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px 16px;
  margin: 0;
}
.kv dt { color: var(--c-text-muted); font-weight: 500; }
.kv dd { margin: 0; }

/* 진행 막대 (교체 주기 진행률) */
.progress-thin { height: 6px; }
.progress-thin.due { --bs-progress-bar-bg: var(--c-danger); }
.progress-thin.soon { --bs-progress-bar-bg: var(--c-warning); }

/* 데이터 없음 · 불러오는 중 */
.empty-state {
  padding: 40px 16px;
  text-align: center;
  color: var(--c-text-muted);
}
.empty-state > .bi { display: block; font-size: 2rem; margin-bottom: 8px; color: #b3c0bb; }

/* 가동시간 기간 입력: 표 자체 스크롤 없이 페이지 스크롤 하나만. 머리는 상단바 바로 아래, 합계는 화면 맨 아래에 붙는다
 * (overflow 를 주면 그 안에서만 sticky 가 되므로 table-responsive 를 쓰지 않는다) */
.range-table-wrap thead th { position: sticky; top: var(--topbar-h); z-index: 2; }
.range-table-wrap tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--c-table-head);
  box-shadow: 0 -1px 0 var(--c-line);
}
.range-table-wrap tr.weekend > td:nth-child(-n+2) { color: var(--c-danger); }
.range-table-wrap tr.weekend { background: rgba(var(--c-ink-rgb), 0.015); }
.range-table-wrap tr.future { opacity: 0.45; }
.range-table-wrap tr.changed > td:first-child { box-shadow: inset 3px 0 0 var(--c-warning); }
.range-table-wrap tr.flash > td { animation: row-flash 1.6s ease; }
@keyframes row-flash { 0%, 40% { background: var(--c-warning-soft); } 100% { background: transparent; } }

/* SVG 그래프 (web/js/chart.js). 계열색은 검증 스크립트를 통과한 값만 쓴다:
 * 가동 #0f8c6c · 공회전 #6250d6 (흰 바탕, 색약 구분 ΔE 21 · 일반 ΔE 27, 대비 3:1 이상) */
:root {
  --viz-run: #0f8c6c;
  --viz-idle: #6250d6;
  --viz-grid: #eef1f0;
  --viz-base: #cfd7d4;
  --viz-ref: #5f6e68;
}
.viz-box { position: relative; width: 100%; }
.viz-box svg { display: block; overflow: visible; }
.viz-grid { stroke: var(--viz-grid); stroke-width: 1; }
.viz-base { stroke: var(--viz-base); stroke-width: 1; }
.viz-ref { stroke: var(--viz-ref); stroke-width: 1.5; stroke-dasharray: 5 4; }
.viz-tick { fill: var(--c-text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz-label { fill: var(--c-ink); font-size: 12.5px; }
.viz-value { fill: var(--c-text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.viz-ref-label { fill: var(--viz-ref); font-size: 11px; font-weight: 600; }
.viz-hit { fill: transparent; cursor: default; outline: none; }
.viz-hit:focus-visible { stroke: var(--c-ink); stroke-width: 1; stroke-dasharray: 2 2; }
.viz-col { transition: opacity 0.12s ease; }
.viz-col.viz-dim { opacity: 0.35; }
.viz-tip {
  display: none;
  position: absolute;
  z-index: 5;
  min-width: 130px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--c-panel);
  box-shadow: var(--shadow-pop);
  font-size: 12px;
  pointer-events: none;
}
.viz-tip-title { font-weight: 700; margin-bottom: 4px; }
.viz-tip-row { display: flex; align-items: center; gap: 6px; line-height: 1.6; }
.viz-tip-row b { font-variant-numeric: tabular-nums; min-width: 44px; }
.viz-tip-row span:last-child { color: var(--c-text-muted); }
.viz-tip-key { display: inline-block; width: 10px; height: 3px; border-radius: 2px; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--c-text-muted); }
.viz-legend .key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.viz-legend .key-line { display: inline-block; width: 16px; height: 0; border-top: 1.5px dashed var(--viz-ref); margin-right: 6px; vertical-align: 3px; }
.viz-loading { opacity: 0.45; transition: opacity 0.15s ease; }

/* 가동시간 입력 현황 (표 · 달력). 기록 있음 = 가동 계열색, 없음 = 연한 빨강 + 테두리, 쉬는 날 = 빗금, 등록 전 · 미래 = 빈 칸 */
.cov-c { display: block; width: 16px; height: 16px; border-radius: 3px; }
.cov-c.key-cell { display: inline-block; width: 11px; height: 11px; margin-right: 6px; vertical-align: -1px; }
.c-log { background: var(--viz-run); }
.c-miss { background: #fbe3e1; box-shadow: inset 0 0 0 1px #e3a19b; cursor: pointer; }
.c-miss:hover { background: #f6c9c5; }
.c-off { background: repeating-linear-gradient(45deg, #e7ecea 0 2px, transparent 2px 5px); box-shadow: inset 0 0 0 1px #e7ecea; }
.c-before { background: transparent; box-shadow: inset 0 0 0 1px #eef1f0; }
.cov-table { border-collapse: separate; border-spacing: 2px; font-size: 12px; }
.cov-table th, .cov-table td { padding: 0; white-space: nowrap; vertical-align: middle; }
.cov-table thead th { font-weight: 500; color: var(--c-text-muted); text-align: center; font-size: 10.5px; height: 30px; }
.cov-table thead th.sun { color: var(--c-danger); }
.cov-table .cov-name { padding-right: 12px; text-align: left; font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.cov-table .cov-num { padding: 0 8px; text-align: right; font-variant-numeric: tabular-nums; color: var(--c-ink); }
.cov-table .cov-num.muted { color: var(--c-text-muted); }
.cov-table .cov-week { width: 26px; height: 16px; border-radius: 3px; }
.cov-cal-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px 24px; }
.cov-cal-title { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.cov-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cov-cal .wd { font-size: 10.5px; color: var(--c-text-muted); text-align: center; }
.cov-cal .wd.sun { color: var(--c-danger); }
.cov-cal .cell { position: relative; height: 38px; border-radius: 4px; padding: 3px 4px; font-size: 11px; line-height: 1.2; }
.cov-cal .cell.c-log { color: #fff; }
.cov-cal .cell .h { display: block; font-weight: 700; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.cov-cal .cell.out { visibility: hidden; }

/* 작은 막대 그래프 (대시보드 최근 14일 가동). 차트 라이브러리 없이 CSS 로 */
.mini-bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.mini-bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.mini-bar > span { display: block; width: 100%; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--c-primary); opacity: 0.85; }
.mini-bar:hover > span { opacity: 1; }
.mini-bar > small { font-size: 10px; color: var(--c-text-muted); line-height: 1; }

/* 권한 체크박스 묶음 (고객사 · 사용자 관리): 대메뉴 → 모듈 → 메뉴 */
.perm-module + .perm-module { margin-top: 12px; }
.perm-module-title { font-size: 0.8125rem; font-weight: 700; margin-bottom: 6px; }
.perm-off-note { display: none; font-weight: 400; color: var(--c-text-muted); font-size: 0.75rem; }
.perm-module.off .perm-off-note { display: inline; }
.perm-module.off .perm-grid { opacity: 0.55; }
.module-checks { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  background: var(--c-table-head);
}
.perm-group-title { font-size: 0.75rem; font-weight: 700; color: var(--c-text-muted); margin-bottom: 6px; }
.perm-item { margin-bottom: 4px; }
.perm-item.disabled .form-check-label { color: #a9b5b1; text-decoration: line-through; }

/* 짧은 알림 (ui.toast) */
.toast-box {
  position: fixed;
  top: calc(var(--topbar-h) + 12px);
  right: 16px;
  z-index: 1090;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}
.toast-box .alert { margin: 0; }

/* 로그인 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(160deg, var(--side-bg) 0, var(--side-bg) 38%, var(--c-bg) 38%);
}
.login-card { width: 100%; max-width: 380px; margin: 0; }
.login-card .card-body { padding: 32px 28px; }
.login-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 1.375rem;
  font-weight: 800;
}
.login-brand .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--c-primary);
  color: #fff;
  font-size: 1.05rem;
}
.login-brand em { font-style: normal; color: var(--c-primary); }
.login-foot { margin-top: 16px; color: var(--c-text-muted); font-size: 0.8125rem; }

.topbar-company-name { color: var(--c-text-muted); font-size: 0.8125rem; margin-right: 8px; white-space: nowrap; }

/* 자동완성 셀렉트 (ui.autocomplete). 닫혀 있을 땐 보통 셀렉트처럼, 열면 검색칸 + 목록 */
.ac { position: relative; min-width: 0; }
.ac-toggle { width: 100%; text-align: left; white-space: nowrap; }
.ac-text { display: block; overflow: hidden; text-overflow: ellipsis; }
.ac-menu {   /* 위치 · 폭은 열 때 JS 가 정한다 (fixed: 모달 · 스크롤 영역에 잘리지 않게) */
  display: none;
  position: fixed;
  z-index: 1070;
  padding: 6px;
  background: var(--c-panel);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
}
.ac.open .ac-menu { display: block; }
.ac-list { list-style: none; margin: 6px 0 0; padding: 0; max-height: 264px; overflow-y: auto; }
.ac-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 10px;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  cursor: pointer;
}
.ac-item-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-item-sub { color: var(--c-text-muted); font-size: 0.75rem; white-space: nowrap; }
.ac-item.active { background: var(--c-primary-soft); }
.ac-item.selected { color: var(--c-primary); font-weight: 700; }
.ac-empty { padding: 10px; color: var(--c-text-muted); font-size: 0.8125rem; text-align: center; }

/* 사용 리포트 (보고용 문서). 화면에선 종이처럼, 인쇄하면 문서만 A4 로 */
.report-toolbar { margin-bottom: 16px; }
.report-doc {
  max-width: 1040px;
  margin: 0 auto;
  padding: 36px 40px 28px;
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  color: #1c2521;
  font-size: 0.8125rem;
}
.rd-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding-bottom: 16px; border-bottom: 2px solid #1c2521; margin-bottom: 20px; }
.rd-title { font-size: 1.375rem; font-weight: 800; margin: 0 0 10px; letter-spacing: -0.01em; }
.rd-meta { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; margin: 0; }
.rd-meta dt { color: var(--c-text-muted); font-weight: 500; }
.rd-meta dd { margin: 0; font-weight: 600; }
.rd-muted { color: var(--c-text-muted); font-weight: 400; }
.rd-sign { border-collapse: collapse; flex: none; }
.rd-sign th, .rd-sign td { border: 1px solid #9aa8a3; width: 64px; text-align: center; }
.rd-sign th { padding: 3px 0; background: #f3f6f5; font-weight: 600; font-size: 0.75rem; }
.rd-sign td { height: 52px; }
.rd-section { margin-bottom: 22px; }
.rd-h { font-size: 0.9375rem; font-weight: 700; margin: 0 0 8px; padding-left: 8px; border-left: 3px solid var(--c-primary); }
.rd-h small { font-size: 0.75rem; font-weight: 400; color: var(--c-text-muted); margin-left: 6px; }
.rd-kpis { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--c-line); border-radius: var(--radius); overflow: hidden; }
.rd-kpi { padding: 10px 14px; border-right: 1px solid var(--c-line); border-bottom: 1px solid var(--c-line); }
.rd-kpi:nth-child(3n) { border-right: 0; }
.rd-kpi:nth-last-child(-n+3) { border-bottom: 0; }
.rd-kpi-label { color: var(--c-text-muted); font-size: 0.75rem; font-weight: 500; }
.rd-kpi-value { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.35; }
.rd-kpi-value small { font-size: 0.75rem; font-weight: 500; margin-left: 2px; color: var(--c-text-muted); }
.rd-kpi-foot { color: var(--c-text-muted); font-size: 0.75rem; }
.rd-delta { color: #4f5e59; font-weight: 600; white-space: nowrap; }
.rd-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.rd-table th, .rd-table td { padding: 5px 8px; border-bottom: 1px solid #e3e8e6; vertical-align: top; }
.rd-table thead th { background: #f3f6f5; border-top: 1px solid #c9d3cf; border-bottom: 1px solid #c9d3cf; font-weight: 600; font-size: 0.75rem; white-space: nowrap; }
.rd-table tfoot th { border-top: 1px solid #c9d3cf; border-bottom: 0; }
.rd-table .num { text-align: right; white-space: nowrap; }
.rd-table .badge { font-size: 0.6875rem; }
.rd-grid th, .rd-grid td { padding: 5px 5px; }
.rd-sub { color: var(--c-text-muted); font-size: 0.75rem; }
.rd-empty { text-align: center; color: var(--c-text-muted); padding: 14px 8px !important; }
.rd-future td { color: #b3c0bb; }
.rd-warn { color: var(--c-danger); font-weight: 700; }
.rd-chart { margin-bottom: 8px; }
.rd-note { min-height: 72px; padding: 10px 12px; border: 1px solid #c9d3cf; border-radius: var(--radius); white-space: pre-wrap; outline: none; }
.rd-note:focus { border-color: var(--c-primary); box-shadow: 0 0 0 0.2rem rgba(var(--c-primary-rgb), 0.12); }
.rd-note:empty::before { content: attr(data-placeholder); color: #9aa8a3; }
.rd-foot { display: flex; justify-content: space-between; margin-top: 18px; padding-top: 8px; border-top: 1px solid var(--c-line); color: var(--c-text-muted); font-size: 0.75rem; }
@media screen and (max-width: 767.98px) {   /* screen 만: A4 인쇄 폭도 768px 보다 좁아서 여기 걸리지 않게 */
  .report-doc { padding: 20px 16px; overflow-x: auto; }
  .rd-head { flex-direction: column; }
  .rd-kpis { grid-template-columns: repeat(2, 1fr); }
}

@media print {
  @page { size: A4; margin: 12mm 10mm; }
  html, body { background: #fff !important; }
  .sidebar, .sidebar-backdrop, .topbar, .app-footer, .page-title-box, .report-noprint, .toast-container { display: none !important; }
  .app-main { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  .page-content > .container-fluid { padding: 0 !important; }
  .report-doc { max-width: none; padding: 0; border: 0; box-shadow: none; font-size: 9.5pt; }
  .rd-section { break-inside: auto; }
  .rd-h, .rd-kpis, .rd-chart { break-inside: avoid; break-after: avoid; }
  .rd-table tr { break-inside: avoid; }
  .rd-table thead { display: table-header-group; }
  .rd-note { border-color: #9aa8a3; }
  .rd-note:empty::before { content: ''; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* 6. 보조 클래스 ---------------------------------------------------------- */
.text-num { font-variant-numeric: tabular-nums; }
.fs-12 { font-size: 0.75rem !important; }
.fs-13 { font-size: 0.8125rem !important; }
.fs-15 { font-size: 0.9375rem !important; }
.fw-medium { font-weight: 500 !important; }
.min-w-0 { min-width: 0; }

/* 견본 화면(/ui/) 전용 */
.swatch { height: 56px; border-radius: var(--radius); }
.ui-section-title { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; color: var(--c-text-muted); margin: 8px 0 12px; }
