/* ================================================
   MES 공통 스타일 - 자동차 도어 차체라인 공급용 MES
   ================================================ */

:root {
  --primary: #1a3c5e;
  --primary-light: #2563a8;
  --primary-dark: #0f2340;
  --secondary: #00a0b0;
  --secondary-light: #00c8dc;
  --accent: #f0a500;
  --accent-dark: #d08000;
  --danger: #dc2626;
  --danger-light: #ef4444;
  --success: #16a34a;
  --success-light: #22c55e;
  --warning: #d97706;
  --warning-light: #f59e0b;
  --info: #0284c7;
  --bg-dark: #0a1628;
  --bg-main: #0d1f3c;
  --bg-card: #1a2d4a;
  --bg-card2: #1f3555;
  --bg-table: #162840;
  --border: #2a4a6a;
  --border-light: #3a5a7a;
  --text-primary: #e8f0ff;
  --text-secondary: #8ba8c8;
  --text-muted: #5a7a9a;
  --sidebar-w: 260px;
  --header-h: 60px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --transition: all 0.2s ease;
  --font-mono: 'Courier New', 'D2Coding', monospace;
}

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

html, body {
  height: 100%;
  font-family: 'Segoe UI', 'Malgun Gothic', '맑은 고딕', Arial, sans-serif;
  font-size: 13px;
  background: var(--bg-dark);
  color: var(--text-primary);
  overflow: hidden;
}

/* ── 레이아웃 ── */
.mes-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── 사이드바 ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-main);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  z-index: 100;
}

.sidebar-logo {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: var(--primary-dark);
  border-bottom: 2px solid var(--secondary);
  flex-shrink: 0;
}

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--secondary), var(--primary-light));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-right: 10px;
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  display: flex;
  flex-direction: column;
}

.sidebar-logo .logo-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.sidebar-logo .logo-sub {
  font-size: 10px;
  color: var(--secondary);
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.nav-group {
  margin-bottom: 4px;
}

.nav-group-title {
  padding: 8px 16px 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 9px 16px;
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
  color: var(--text-secondary);
  text-decoration: none;
  gap: 10px;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-left-color: var(--border-light);
}

.nav-item.active {
  background: rgba(0, 160, 176, 0.15);
  color: var(--secondary-light);
  border-left-color: var(--secondary);
  font-weight: 600;
}

.nav-item .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

.nav-item .nav-label {
  flex: 1;
  font-size: 12.5px;
}

.nav-item .nav-badge {
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.nav-item .nav-badge.green { background: var(--success); }
.nav-item .nav-badge.yellow { background: var(--warning); }
.nav-item .nav-badge.blue { background: var(--info); }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--primary-dark);
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-footer .sys-time {
  font-family: var(--font-mono);
  color: var(--secondary);
  font-size: 12px;
  font-weight: 600;
}

/* ── 메인 영역 ── */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-dark);
}

/* ── 헤더 ── */
.page-header {
  height: var(--header-h);
  background: var(--bg-main);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
}

.page-header .page-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-header .page-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.header-spacer { flex: 1; }

.header-status {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-dot {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
}

.status-dot .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: pulse 2s infinite;
}

.status-dot .dot.warn { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.status-dot .dot.err { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.status-dot .dot.off { background: var(--text-muted); box-shadow: none; animation: none; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── 컨텐츠 영역 ── */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.page-content::-webkit-scrollbar { width: 6px; }
.page-content::-webkit-scrollbar-track { background: transparent; }
.page-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── 카드 ── */
.mes-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}

.mes-card-header {
  padding: 12px 16px;
  background: var(--bg-card2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.mes-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.mes-card-title .icon {
  color: var(--secondary);
}

.mes-card-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.mes-card-body {
  padding: 16px;
}

/* ── 그리드 ── */
.grid {
  display: grid;
  gap: 16px;
}

.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ── KPI 카드 ── */
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--secondary);
}

.kpi-card.primary::before { background: var(--primary-light); }
.kpi-card.success::before { background: var(--success); }
.kpi-card.warning::before { background: var(--warning); }
.kpi-card.danger::before { background: var(--danger); }
.kpi-card.info::before { background: var(--info); }
.kpi-card.accent::before { background: var(--accent); }

.kpi-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.kpi-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

.kpi-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}

.kpi-trend.up { color: var(--success-light); }
.kpi-trend.down { color: var(--danger-light); }

/* ── 버튼 ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 14px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary-light);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #1e77d0;
  box-shadow: 0 4px 12px rgba(37, 99, 168, 0.4);
}

.btn-secondary {
  background: var(--secondary);
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--secondary-light);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: var(--success-light);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-light);
}

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-warning:hover:not(:disabled) {
  background: var(--warning-light);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.btn-outline:hover:not(:disabled) {
  background: var(--bg-card2);
  color: var(--text-primary);
  border-color: var(--secondary);
}

.btn-sm {
  padding: 4px 9px;
  font-size: 11px;
}

.btn-lg {
  padding: 10px 20px;
  font-size: 14px;
}

.btn-icon {
  padding: 6px;
  width: 30px;
  height: 30px;
}

/* ── 폼 요소 ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.form-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
  transition: var(--transition);
  width: 100%;
}

.form-control:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 2px rgba(0, 160, 176, 0.15);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M0 0l6 8 6-8z' fill='%235a7a9a'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

select.form-control option {
  background: var(--bg-card);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* ── 테이블 ── */
.table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  max-height: calc(100vh - 280px);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.table-wrapper::-webkit-scrollbar { width: 6px; height: 6px; }
.table-wrapper::-webkit-scrollbar-track { background: transparent; }
.table-wrapper::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.mes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap;
}

.mes-table thead {
  position: sticky;
  top: 0;
  z-index: 5;
}

.mes-table th {
  background: var(--bg-card2);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.mes-table th:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.mes-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.mes-table tbody tr {
  background: var(--bg-table);
  transition: background 0.1s;
}

.mes-table tbody tr:nth-child(even) {
  background: rgba(26, 45, 74, 0.6);
}

.mes-table tbody tr:hover {
  background: rgba(0, 160, 176, 0.08) !important;
  cursor: pointer;
}

.mes-table tbody tr.selected {
  background: rgba(0, 160, 176, 0.15) !important;
}

.mes-table .mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
}

/* ── 배지 ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-N { background: rgba(100, 140, 180, 0.2); color: #8ba8c8; border: 1px solid rgba(100,140,180,0.3); }
.badge-Y { background: rgba(22, 163, 74, 0.2); color: #4ade80; border: 1px solid rgba(22,163,74,0.3); }
.badge-R { background: rgba(217, 119, 6, 0.2); color: #fbbf24; border: 1px solid rgba(217,119,6,0.3); }
.badge-P { background: rgba(37, 99, 168, 0.2); color: #60a5fa; border: 1px solid rgba(37,99,168,0.3); }
.badge-E { background: rgba(220, 38, 38, 0.2); color: #f87171; border: 1px solid rgba(220,38,38,0.3); }
.badge-S { background: rgba(0, 160, 176, 0.2); color: #22d3ee; border: 1px solid rgba(0,160,176,0.3); }

.badge-FRT_LH { background: rgba(37, 99, 168, 0.25); color: #60a5fa; border: 1px solid rgba(37,99,168,0.4); }
.badge-FRT_RH { background: rgba(16, 185, 129, 0.25); color: #34d399; border: 1px solid rgba(16,185,129,0.4); }
.badge-RR_LH  { background: rgba(217, 119, 6, 0.25);  color: #fbbf24; border: 1px solid rgba(217,119,6,0.4); }
.badge-RR_RH  { background: rgba(220, 38, 38, 0.25);  color: #f87171; border: 1px solid rgba(220,38,38,0.4); }

.badge-RUN   { background: rgba(22,163,74,0.2);  color: #4ade80; border: 1px solid rgba(22,163,74,0.3); }
.badge-STOP  { background: rgba(90,120,150,0.2); color: #8ba8c8; border: 1px solid rgba(90,120,150,0.3); }
.badge-WARN  { background: rgba(217,119,6,0.2);  color: #fbbf24; border: 1px solid rgba(217,119,6,0.3); }
.badge-ERROR { background: rgba(220,38,38,0.2);  color: #f87171; border: 1px solid rgba(220,38,38,0.3); }

/* ── 검색 툴바 ── */
.search-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-card2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.search-toolbar .search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 300px;
}

.search-toolbar .search-input-wrap .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 12px;
}

.search-toolbar .search-input-wrap input {
  padding-left: 30px;
}

/* ── 툴바 ── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── 페이지네이션 ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-card2);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.pagination-info {
  font-size: 11px;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-dark);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  transition: var(--transition);
}

.page-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.page-btn.active { background: var(--primary-light); border-color: var(--primary-light); color: white; }

/* ── 모달 ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: slideUp 0.2s ease;
}

.modal-lg { max-width: 900px; }
.modal-xl { max-width: 1100px; }
.modal-sm { max-width: 460px; }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.modal-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bg-dark);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--danger);
  color: white;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* ── 탭 ── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  background: var(--bg-card2);
  overflow-x: auto;
}

.tab-btn {
  padding: 10px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  transition: var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.03);
}

.tab-btn.active {
  color: var(--secondary-light);
  border-bottom-color: var(--secondary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ── 알림/토스트 ── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px 16px;
  min-width: 280px;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
  pointer-events: all;
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--info); }

.toast-icon { font-size: 16px; }
.toast.success .toast-icon { color: var(--success-light); }
.toast.error .toast-icon { color: var(--danger-light); }
.toast.warning .toast-icon { color: var(--warning-light); }
.toast.info .toast-icon { color: var(--info); }

.toast-msg { flex: 1; font-size: 12px; color: var(--text-primary); line-height: 1.4; }
.toast-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px; }

/* ── 로그 패널 ── */
.log-panel {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11px;
  height: 200px;
  overflow-y: auto;
  padding: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.log-panel::-webkit-scrollbar { width: 4px; }
.log-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.log-entry {
  display: flex;
  gap: 8px;
  padding: 2px 4px;
  border-radius: 3px;
  line-height: 1.5;
  word-break: break-all;
}

.log-entry:hover { background: rgba(255,255,255,0.03); }
.log-entry .log-time { color: var(--text-muted); flex-shrink: 0; }
.log-entry .log-proc { color: var(--secondary); flex-shrink: 0; min-width: 80px; }
.log-entry .log-msg { color: var(--text-secondary); flex: 1; }
.log-entry.log-ok .log-msg { color: var(--success-light); }
.log-entry.log-err .log-msg { color: var(--danger-light); }
.log-entry.log-warn .log-msg { color: var(--warning-light); }
.log-entry.log-info .log-msg { color: var(--info); }

/* ── 프로세스 카드 ── */
.proc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.proc-card.running { border-color: rgba(22,163,74,0.4); }
.proc-card.running::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--success), transparent);
  animation: scanline 2s linear infinite;
}

.proc-card.warning { border-color: rgba(217,119,6,0.5); }
.proc-card.error { border-color: rgba(220,38,38,0.5); }
.proc-card.stopped { border-color: rgba(90,120,150,0.3); }

@keyframes scanline {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

.proc-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.proc-thread {
  font-size: 11px;
  color: var(--secondary);
  font-family: var(--font-mono);
}

.proc-stat-row {
  display: flex;
  gap: 12px;
  font-size: 11px;
}

.proc-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.proc-stat-label { color: var(--text-muted); }
.proc-stat-value { color: var(--text-primary); font-family: var(--font-mono); }

.hb-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.hb-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ── PLC 비트맵 시각화 ── */
.bit-map {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.bit-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bit-label {
  width: 100px;
  color: var(--text-muted);
  text-align: right;
  flex-shrink: 0;
}

.bits {
  display: flex;
  gap: 2px;
}

.bit {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  cursor: default;
}

.bit-0 { background: rgba(90,120,150,0.2); color: var(--text-muted); border: 1px solid rgba(90,120,150,0.3); }
.bit-1 { background: rgba(0,160,176,0.3); color: var(--secondary-light); border: 1px solid rgba(0,160,176,0.5); }
.bit-sep { width: 6px; }

/* ── 반응형 ── */
@media (max-width: 1200px) {
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .sidebar { width: 200px; }
  --sidebar-w: 200px;
  .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr 1fr; }
}

/* ── 유틸리티 ── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-mono { font-family: var(--font-mono); }
.text-sm { font-size: 11px; }
.text-xs { font-size: 10px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success-light); }
.text-danger { color: var(--danger-light); }
.text-warning { color: var(--warning-light); }
.text-info { color: var(--info); }
.text-accent { color: var(--accent); }

.fw-bold { font-weight: 700; }
.fw-600 { font-weight: 600; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }

.hidden { display: none !important; }

/* ── 구분선 ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

/* ── 스피너 ── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--secondary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── 데이터 없음 ── */
.no-data {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.no-data .no-data-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.no-data .no-data-text {
  font-size: 13px;
}

/* ── 파일 업로드 ── */
.file-drop-zone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-dark);
}

.file-drop-zone:hover,
.file-drop-zone.dragging {
  border-color: var(--secondary);
  background: rgba(0, 160, 176, 0.05);
}

.file-drop-zone .drop-icon {
  font-size: 36px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.file-drop-zone .drop-text {
  font-size: 13px;
  color: var(--text-secondary);
}

.file-drop-zone .drop-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── 수신 원문 미리보기 ── */
.raw-preview {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  word-break: break-all;
  white-space: pre-wrap;
  max-height: 120px;
  overflow-y: auto;
}

/* ── 라인 컬러 구분 ── */
.line-frt-lh { color: #60a5fa; }
.line-frt-rh { color: #34d399; }
.line-rr-lh  { color: #fbbf24; }
.line-rr-rh  { color: #f87171; }
