/* ═══════════════════════════════════════════════════════════════════
   디자인 토큰 — 모바일 페이지 라이트 테마 기반
═══════════════════════════════════════════════════════════════════ */
:root {
  --bg:           #eef2f7;
  --panel:        #ffffff;
  --border:       #d1dce8;
  --sidebar:      #1a2e50;
  --header:       #1a2e50;
  --text:         #1a2535;
  --muted:        #4a6080;
  --accent:       #e02020;
  --accent2:      #c47800;
  --accent3:      #16a34a;
  --accent4:      #2563eb;
  --row-alt:      #f4f8fc;
  --row-hover:    #e8f0fb;
  --th-bg:        #1a2e50;
  --th-text:      #e8f4ff;
  --shadow:       0 2px 8px rgba(26,46,80,0.10);
  --shadow-lg:    0 4px 16px rgba(26,46,80,0.13);
}

/* ── 기본 ──────────────────────────────────────────────────────── */
* {
  box-sizing: border-box;
  word-break: keep-all;
  overflow-wrap: break-word;
}

html {
  font-family: 'Noto Sans KR', 'Malgun Gothic', '맑은 고딕', 'Segoe UI', 'Apple SD Gothic Neo', 'Roboto', sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: inherit;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

/* ── 앱 레이아웃 ────────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,16,28,0.5);
  z-index: 250;
}
.sidebar-backdrop.show { display: block; }

/* ── 사이드바 ───────────────────────────────────────────────────── */
.sidebar {
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 24px;
  background: var(--sidebar);
  border-right: 1px solid rgba(255,255,255,0.08);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: linear-gradient(135deg, #ed1c24 0%, #7f0f1a 100%);
  box-shadow: 0 2px 8px rgba(237,28,36,0.35);
  flex-shrink: 0;
}

.brand span {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav a {
  display: block;
  padding: 11px 16px;
  text-decoration: none;
  color: rgba(255,255,255,0.75);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav a:hover,
.nav a.active {
  background: rgba(255,255,255,0.15);
  color: #ffffff;
  border-color: rgba(255,255,255,0.18);
}

/* ── 반응형: 좁은 화면(태블릿/모바일 가로)에서는 사이드바를 드로어로 전환 ──── */
@media (max-width: 1200px) {
  .app-shell { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
  }
  .sidebar.open { transform: translateX(0); }
}
@media (min-width: 1201px) {
  .sidebar-backdrop { display: none !important; }
}

/* ── 메인 콘텐츠 ────────────────────────────────────────────────── */
.main-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  min-width: 0;
}

/* ── 탑바 ───────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 28px;
  height: 56px;
  background: var(--header);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.menu-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
  color: #e8f4ff;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-title {
  font-size: 1rem;
  font-weight: 700;
  color: #e8f4ff;
  letter-spacing: -0.01em;
}

.topbar-right {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(232,244,255,0.8);
}

/* ── 컨텐츠 영역 ─────────────────────────────────────────────────── */
.content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 28px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* ── 히어로 ─────────────────────────────────────────────────────── */
.hero {
  display: grid;
  gap: 2px;
  padding: 8px 28px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  color: var(--text);
  letter-spacing: -0.02em;
}

.hero-subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.2;
  min-height: 1.2em;
}

.hero-title,
.hero-subtitle,
.page-title {
  word-break: keep-all;
}

/* ── 공통 레이아웃 ─────────────────────────────────────────────── */
.layout-root {
  display: grid;
  gap: 18px;
}

.layout-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* ── 위젯 패널 (공통 카드) ─────────────────────────────────────── */
.widget-panel {
  padding: 20px 22px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.widget-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

/* ── 기본 테이블 ─────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text);
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

th {
  text-align: left;
  background: var(--th-bg);
  color: var(--th-text);
  font-size: 0.88rem;
  font-weight: 600;
}

tbody tr:hover {
  background: var(--row-hover);
}

tbody tr:nth-child(even) {
  background: var(--row-alt);
}

/* ── 필터 ────────────────────────────────────────────────────────── */
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  padding: 18px 0;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group label {
  font-size: 0.88rem;
  color: var(--muted);
}

.filter-group select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 0.88rem;
}

.filter-group select option {
  background: #ffffff;
  color: var(--text);
}

.filter-group select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

/* ── 카드 그리드 ─────────────────────────────────────────────────── */
.cards-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.info-card {
  padding: 20px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.info-label {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  color: var(--muted);
  word-break: keep-all;
}

.info-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--text);
}

.info-detail {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.red-card    { border-left: 5px solid #e02020; }
.yellow-card { border-left: 5px solid #c47800; }
.green-card  { border-left: 5px solid #16a34a; }
.blue-card   { border-left: 5px solid #2563eb; }

/* ── 차트 ────────────────────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1.2fr;
  gap: 18px;
}

.chart-box,
.table-card {
  padding: 20px 22px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.chart-title,
.card-title {
  margin-bottom: 14px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.chart-box canvas {
  width: 100% !important;
  height: 300px !important;
}

/* ── 대시보드 Stat Cards ─────────────────────────────────────────── */
.dash-stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.dash-stat-card {
  padding: 6px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 5px solid transparent;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow);
}

.dash-stat-title {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--text);
}

.dash-stat-body {
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 10px;
  align-items: center;
}

.dash-stat-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-stat-line {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 0.9rem;
}

.dash-stat-lbl {
  color: var(--muted);
  white-space: nowrap;
}

.dash-stat-num {
  color: var(--text);
  font-weight: 700;
}

.dash-stat-gauge {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

.dash-stat-gauge canvas {
  width: 100% !important;
  height: 100% !important;
}

.dash-stat-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
}

.ring-lbl {
  font-size: 0.6rem;
  color: var(--muted);
}

.ring-pct {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

/* ── 대시보드 Middle Section ─────────────────────────────────────── */
.dash-mid-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}

.dash-mid-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dash-mid-right {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dash-line-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dash-line-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
}

.dash-line-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ── Progress Panel ─────────────────────────────────────────────── */
.dash-progress-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 22px;
}

.prog-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prog-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
}

.prog-num {
  color: var(--text);
  font-weight: 700;
  font-size: 0.95rem;
  margin-left: 4px;
}

.prog-track {
  height: 28px;
  background: #e8eff8;
  border-radius: 6px;
  overflow: hidden;
}

.prog-fill {
  height: 100%;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 60px;
  transition: width 0.7s ease;
}

.prog-pct {
  padding-right: 14px;
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.grad-red-yellow   { background: linear-gradient(90deg, #e02020 0%, #c47800 100%); }
.grad-orange-green { background: linear-gradient(90deg, #d97706 0%, #16a34a 100%); }
.grad-blue-cyan     { background: linear-gradient(90deg, #2563eb 0%, #06b6d4 100%); }

/* ── Distribution Panel ─────────────────────────────────────────── */
.dash-dist-panel {
  padding: 12px 22px;
}

.dash-dist-panel .widget-header {
  margin-bottom: 8px;
}

.dash-dist-body {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 14px;
  align-items: center;
}

.dash-dist-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
}

.dash-dist-item {
  font-size: 0.88rem;
  color: var(--muted);
  display: flex;
  gap: 3px;
}

.dash-dist-name { color: var(--muted); }
.dash-dist-val  { color: var(--text); font-weight: 700; }

.dash-dist-total {
  grid-column: 1 / -1;
  margin-top: 6px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  border-top: 1px solid var(--border);
  padding-top: 6px;
}

.dash-dist-donut { width: 110px; height: 110px; flex-shrink: 0; }
.dash-dist-donut canvas { width: 100% !important; height: 100% !important; }

/* ═══════════════════════════════════════════════════════════════════
   생산실적 (production) — 한 화면에 맞춰 3개 패널이 세로로 채워짐
═══════════════════════════════════════════════════════════════════ */
.layout-root.prod-fill {
  flex: 1;
  min-height: 0;
  grid-template-rows: auto 1fr;
}

.prod-target-panel { padding: 12px 22px; }
.prod-target-panel .widget-header { margin-bottom: 8px; }

.prod-target-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.prod-target-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prod-target-label {
  font-size: 0.92rem;
  color: var(--muted);
}

.prod-target-num {
  color: var(--text);
  font-weight: 700;
  margin-left: 4px;
}

.prod-chart-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.prod-chart-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
}

.prod-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ── Equipment Bars ─────────────────────────────────────────────── */
.dash-equip-section { overflow: hidden; }

.equip-bars-wrap {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  overflow-x: auto;
  height: 210px;
  padding-bottom: 2px;
  scrollbar-width: thin;
  scrollbar-color: #c8d6e5 transparent;
}

.equip-bars-wrap::-webkit-scrollbar { height: 4px; }
.equip-bars-wrap::-webkit-scrollbar-thumb { background: #c8d6e5; border-radius: 2px; }

.equip-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 46px;
  flex: 1;
  height: 100%;
}

.equip-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 34px;
  font-size: 0.62rem;
  color: #e02020;
  line-height: 1.3;
  text-align: center;
  font-weight: 600;
}

.equip-track {
  flex: 1;
  width: 100%;
  background: #e0eaf4;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.equip-fill {
  width: 100%;
  border-radius: 4px 4px 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 4px;
  transition: height 0.6s ease;
}

.equip-pct {
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  padding-top: 4px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.equip-name {
  font-size: 0.62rem;
  color: var(--muted);
  text-align: center;
  margin-top: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ── 공통 Stat Card (다른 페이지용) ──────────────────────────────── */
.dashboard-stat-card {
  padding: 8px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow);
}

.dashboard-stat-header {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.dashboard-stat-value {
  color: var(--text);
  font-size: 1.6rem;
  font-weight: 700;
}

.dashboard-top-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.dashboard-summary-section {
  display: grid;
  grid-template-columns: 1.8fr 1.2fr;
  gap: 18px;
  margin-bottom: 18px;
}

.dashboard-summary-left,
.dashboard-summary-right { display: grid; gap: 18px; }

.progress-row {
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  margin-bottom: 8px;
  font-size: 0.88rem;
}

.progress-values {
  display: flex;
  justify-content: space-between;
  color: var(--text);
  font-weight: 700;
  margin-bottom: 8px;
}

.progress-bar {
  height: 10px;
  background: #e0eaf4;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #e02020, #c47800);
}

.distribution-list { display: grid; gap: 10px; }

.distribution-item {
  display: flex;
  justify-content: space-between;
  color: var(--text);
  font-size: 0.92rem;
}

.utilization-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.utilization-bar-card {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.utilization-name {
  color: var(--muted);
  margin-bottom: 8px;
  font-size: 0.88rem;
}

.utilization-value {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.utilization-bar-track {
  width: 100%;
  height: 10px;
  background: #e0eaf4;
  border-radius: 999px;
  overflow: hidden;
}

.utilization-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #16a34a, #2563eb);
}

.stat-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.stat-card {
  padding: 20px 22px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.stat-card .info-label  { margin-bottom: 10px; }
.stat-card .info-value  { font-size: 1.9rem; font-weight: 700; }
.stat-card .info-detail { margin-top: 8px; color: var(--muted); }

.table-wrapper { overflow-x: auto; }

.tables-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.error-msg {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

/* ── 시뮬레이션 Form ──────────────────────────────────────────────── */
.simulation-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.simulation-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.92rem;
  color: var(--muted);
}

.simulation-form input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 0.88rem;
}

.primary-btn {
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: var(--accent4);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.9rem;
}

.primary-btn:hover { background: #1d4ed8; }

/* ── 가동현황 필터 ────────────────────────────────────────────────── */
#layoutRoot.util-page { gap: 8px; }

.util-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
}

.util-content {
  gap: 14px;
}

.util-filter-label {
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
}

.util-plant-select {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 0.88rem;
  cursor: pointer;
  min-width: 140px;
}

.util-plant-select option { background: #ffffff; color: var(--text); }
.util-plant-select:focus  { outline: none; border-color: var(--accent4); }

/* ── 재고현황 ─────────────────────────────────────────────────────── */
#layoutRoot.inv-page { gap: 8px; }

.inv-section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0;
}

.inv-section-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
}

.inv-unit { color: var(--muted); font-size: 0.82rem; }

.inv-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 20px;
  align-items: start;
}

.inv-table-col { overflow-x: auto; }

.inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.inv-table thead th {
  background: var(--th-bg);
  color: var(--th-text);
  padding: 10px 10px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.1);
  font-weight: 600;
  white-space: nowrap;
}

.inv-table td {
  padding: 8px 10px;
  border: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.inv-td-plant {
  text-align: center;
  background: var(--row-alt);
  font-weight: 600;
  white-space: nowrap;
}

.inv-td-name  { color: var(--accent4); font-weight: 600; }
.inv-td-num   { text-align: right; font-variant-numeric: tabular-nums; }
.inv-td-center { text-align: center; }

.inv-row-subtotal td {
  background: #e8f0fa;
  font-weight: 600;
  color: var(--text);
}

.inv-row-total td {
  background: #dce8f5;
  font-weight: 700;
  color: var(--text);
}

.inv-charts-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.inv-plant-section {
  padding: 14px 16px 18px;
}

.inv-plant-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 10px;
}

.inv-chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.inv-chart-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.inv-chart-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.inv-chart-box canvas { width: 100% !important; height: 200px !important; }

/* ─── Scheduling / Simulation ─────────────────────────────────────── */
.sched-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
}

.sched-settings-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sched-plant-tabs { display: flex; gap: 8px; }

.sched-tab {
  padding: 6px 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 600;
  transition: background 0.15s;
}

.sched-tab.active {
  background: var(--th-bg);
  color: #fff;
  border-color: var(--th-bg);
}

.sched-req-btn {
  padding: 7px 20px;
  background: var(--accent4);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
}

.sched-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.sched-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.sched-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.sched-hist-filter {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sched-table-wrap { overflow-x: auto; }

.sched-hist-wrap {
  max-height: 340px;
  overflow-y: auto;
}

.sched-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 600px;
}

.sched-table th {
  background: var(--th-bg);
  color: var(--th-text);
  padding: 8px 10px;
  text-align: center;
  border-bottom: 2px solid rgba(255,255,255,0.1);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 0.8rem;
}

.sched-table td {
  padding: 7px 10px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}

.sched-table tr:hover td        { background: var(--row-hover); }
.sched-table tr:nth-child(even) td { background: var(--row-alt); }
.sched-table tr:nth-child(even):hover td { background: var(--row-hover); }

.sched-link      { color: var(--accent4) !important; cursor: pointer; }
.sched-small     { font-size: 0.72rem; }
.sched-bold      { font-weight: 700; color: var(--text) !important; }
.sched-highlight { color: #0369a1 !important; font-weight: 600; }

.sched-empty {
  text-align: center;
  color: var(--muted);
  padding: 22px;
}

.sched-label     { color: var(--muted); font-size: 0.83rem; }

.sched-date-input {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
}

.sched-green-date {
  background: #f0fff4;
  border-color: #16a34a;
  color: #15803d;
}

.sched-search-btn {
  padding: 5px 14px;
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}

.sched-del-btn {
  padding: 5px 14px;
  background: #dc2626;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}

.sched-del-req {
  color: var(--accent) !important;
  cursor: pointer;
  font-weight: 700;
}

.sched-gray-btn {
  padding: 5px 14px;
  background: #f0f4f8;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
}

.sched-blue-btn {
  padding: 7px 20px;
  background: var(--accent4);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.sched-orders-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 340px);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
}

.sched-orders-table { min-width: 900px; }

.sched-action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #f0f4f8;
  border: 1px solid var(--border);
  border-radius: 6px;
  flex-wrap: wrap;
}

.sched-select {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.82rem;
}

.sched-name-input {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  width: 180px;
}

#layoutRoot.sim-downtime-page { gap: 8px; }

.sched-plant-label {
  color: #c47800;
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 0;
}

.sched-downtime-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  flex-wrap: wrap;
}

.sched-filter-right {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.sched-sel-bar { display: flex; gap: 5px; margin-bottom: -6px; }

.sched-selall-btn {
  padding: 2px 8px;
  background: #f0f4f8;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.68rem;
}

.sched-downtime-wrap {
  max-height: calc(100vh - 360px);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 0;
}

.sched-bottom-bar { display: flex; justify-content: flex-end; }
.sched-start-btn  { min-width: 130px; }
.sched-elapsed    { color: #f59e0b !important; font-weight: 800; font-size: 1.25rem; text-align: center; }
.simr-name-link   { cursor: pointer; text-decoration: underline; }

/* ── Simulation result ─────────────────────────────────────────── */
#layoutRoot.sim-result-page { gap: 8px; }

.simr-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
  flex-wrap: wrap;
}

.simr-plant-lbl {
  color: #c47800;
  font-weight: 800;
  font-size: 1rem;
  min-width: 50px;
}

.simr-mode-lbl {
  color: #c47800;
  font-weight: 700;
  font-size: 0.9rem;
  flex: 1;
  text-align: center;
}

.simr-top-btns { display: flex; gap: 8px; margin-left: auto; }

.simr-top-btn {
  padding: 7px 18px;
  background: #f0f4f8;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.simr-top-btn:hover { background: #e0eaf4; }

.simr-table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 280px);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 0;
}

.simr-table    { min-width: 1100px; font-size: 0.78rem; }
.simr-table th { font-size: 0.76rem; padding: 7px 6px; }
.simr-table td { padding: 6px 6px; }

.simr-seq  { font-weight: 700; color: var(--accent4) !important; }
.simr-proj { text-align: left !important; max-width: 160px; white-space: normal; word-break: keep-all; }
.simr-zone { font-weight: 700; color: var(--text) !important; white-space: nowrap; }
.simr-dt   { font-size: 0.74rem; line-height: 1.5; white-space: nowrap; }
.simr-date { color: var(--muted) !important; }

.simr-overdue {
  color: #fff !important;
  background: #dc2626;
  font-weight: 700;
  border-radius: 3px;
  padding: 2px 6px;
}

.simr-special {
  background: #c47800;
  color: #fff !important;
  font-weight: 700;
  border-radius: 3px;
}

.simr-order-cell { white-space: nowrap; }

.simr-arrow-btn {
  background: transparent;
  border: none;
  color: #16a34a;
  font-size: 1rem;
  cursor: pointer;
  padding: 0 3px;
  line-height: 1;
}

.simr-arrow-btn:hover { color: #15803d; }

.simr-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  flex-wrap: wrap;
  gap: 10px;
}

.simr-sched-name { color: var(--text); font-size: 1rem; font-weight: 600; }
.simr-bottom-btns { display: flex; gap: 8px; }

.simr-confirm-btn {
  padding: 7px 20px;
  background: var(--accent4);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.simr-confirm-btn:disabled { cursor: default; background: #93c5fd; }

/* ═══════════════════════════════════════════════════════════════════
   설비 그룹별 생산현황 (equip-production)
═══════════════════════════════════════════════════════════════════ */
.ep-filter-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 16px;
  background: #eaf0f8;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
}

.ep-product-lbl {
  font-size: 1.1rem;
  font-weight: 800;
  color: #c47800;
  white-space: nowrap;
}

.ep-select {
  padding: 6px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  font-size: 0.85rem;
  min-width: 160px;
}

.ep-select-sm { min-width: 140px; }

.ep-cb-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

.ep-cb-wrap input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--th-bg); }

.ep-table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 340px);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 14px;
}

.ep-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  min-width: 700px;
}

.ep-table thead th {
  background: var(--th-bg);
  color: var(--th-text);
  padding: 8px 10px;
  text-align: center;
  border-bottom: 2px solid rgba(255,255,255,0.1);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.ep-table td {
  padding: 7px 10px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.ep-table tr:hover td        { background: var(--row-hover); }
.ep-table tr:nth-child(even) td { background: var(--row-alt); }
.ep-table tr:nth-child(even):hover td { background: var(--row-hover); }
.ep-table tr.ep-row-done td        { background: rgba(22,163,74,0.10) !important; }
.ep-table tr.ep-row-done:hover td  { background: rgba(22,163,74,0.18) !important; }
.ep-table tr.ep-row-overdue td     { background: rgba(220,38,38,0.09) !important; }
.ep-table tr.ep-row-overdue:hover td { background: rgba(220,38,38,0.16) !important; }

.ep-td-proj    { text-align: left !important; max-width: 180px; white-space: normal; word-break: keep-all; }
.ep-td-product { white-space: nowrap; }
.ep-td-num     { text-align: right !important; font-variant-numeric: tabular-nums; }

.ep-overdue {
  background: #dc2626 !important;
  color: #fff !important;
  font-weight: 700;
  border-radius: 3px;
  padding: 2px 6px;
}

.ep-btn-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.ep-detail-btn {
  padding: 12px 48px;
  background: var(--th-bg);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 8px rgba(26,46,80,0.25);
}

.ep-detail-btn:hover { background: #243f6a; }

.ep-mobile-btn {
  padding: 12px 28px;
  background: #f0fff4;
  color: #15803d;
  border: 1px solid #16a34a;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.ep-mobile-btn:hover { background: #dcfce7; }

/* ═══════════════════════════════════════════════════════════════════
   생산 스케줄 확정 (schedule-confirm)
═══════════════════════════════════════════════════════════════════ */
#layoutRoot.sc-page { gap: 8px; }

.sc-filter-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: #eaf0f8;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 0;
}

.sc-cb-lbl {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.sc-cb-lbl input { width: 16px; height: 16px; accent-color: var(--th-bg); }

.sc-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.sc-sel {
  padding: 5px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  font-size: 0.82rem;
  min-width: 100px;
}

.sc-date {
  padding: 5px 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  font-size: 0.82rem;
}

.sc-table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 320px);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 0;
}

.sc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 1100px;
}

.sc-table thead th {
  background: var(--th-bg);
  color: var(--th-text);
  padding: 8px 8px;
  text-align: center;
  border-bottom: 2px solid rgba(255,255,255,0.1);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.sc-table td {
  padding: 6px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}

.sc-table tr:hover td        { background: var(--row-hover); }
.sc-table tr:nth-child(even) td { background: var(--row-alt); }
.sc-table tr:nth-child(even):hover td { background: var(--row-hover); }

.sc-seq   { font-weight: 700; color: var(--accent4) !important; }
.sc-link  { color: var(--accent4) !important; cursor: pointer; }
.sc-equip { color: #c47800 !important; font-weight: 700; }
.sc-proj  { text-align: left !important; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-zone  { font-weight: 700; color: var(--text) !important; max-width: 90px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-dt    { font-size: 0.72rem; line-height: 1.5; }
.sc-num   { text-align: right !important; font-variant-numeric: tabular-nums; }

.sc-overdue {
  background: #dc2626 !important;
  color: #fff !important;
  font-weight: 700;
  border-radius: 3px;
  padding: 2px 4px;
}

.sc-footer {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 12px 18px;
  background: #eaf0f8;
  border: 1px solid var(--border);
  border-radius: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.sc-footer-stat { color: var(--muted); font-size: 0.92rem; }
.sc-footer-stat strong { color: var(--text); font-size: 1.05rem; margin-left: 4px; }

.sc-footer-btns { margin-left: auto; display: flex; gap: 10px; }

.sc-btn-blue {
  padding: 8px 24px;
  background: var(--accent4);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.sc-btn-orange {
  padding: 8px 24px;
  background: #c47800;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════════
   설비 상세현황 (equip-detail)
═══════════════════════════════════════════════════════════════════ */
.ed-shell {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  align-items: start;
  min-height: calc(100vh - 220px);
}

.ed-left {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 16px;
  box-shadow: var(--shadow);
}

.ed-top-row { display: flex; align-items: center; gap: 12px; }

.ed-product-lbl {
  font-size: 1.15rem;
  font-weight: 800;
  color: #c47800;
  min-width: 60px;
}

.ed-equip-sel {
  flex: 1;
  padding: 7px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 700;
}

.ed-doc-box {
  background: #f4f8fc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.ed-doc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.ed-doc-lbl    { color: var(--muted); font-size: 0.82rem; }
.ed-doc-num    { color: var(--accent4); font-size: 1.1rem; font-weight: 700; flex: 1; }
.ed-doc-status { color: var(--muted); font-size: 0.82rem; }

.ed-prog-track {
  height: 28px;
  background: #e0eaf4;
  border-radius: 6px;
  overflow: hidden;
}

.ed-prog-fill {
  height: 100%;
  background: linear-gradient(90deg, #16a34a, #22c55e);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 40px;
  transition: width 0.6s ease;
}

.ed-prog-pct { padding-right: 10px; font-size: 0.85rem; font-weight: 700; color: #fff; }

.ed-nav-row { display: flex; align-items: stretch; gap: 8px; }

.ed-nav-btn {
  width: 32px;
  flex-shrink: 0;
  background: #f0f4f8;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  align-self: center;
  padding: 16px 0;
}

.ed-nav-btn:hover { background: #e0eaf4; color: var(--text); }

.ed-info-card {
  flex: 1;
  background: #f4f8fc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ed-info-row { display: flex; align-items: flex-start; gap: 8px; font-size: 0.9rem; }

.ed-info-row-split { display: flex; gap: 12px; align-items: flex-start; }

.ed-info-lbl { color: var(--muted); white-space: nowrap; }
.ed-info-val { color: var(--text); font-weight: 600; word-break: keep-all; }

.ed-photo {
  flex-shrink: 0;
  width: 80px;
  height: 90px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.ed-photo-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a2e50, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
}

.ed-status-row { display: flex; align-items: center; gap: 14px; padding-top: 4px; }
.ed-status-lbl { color: var(--muted); font-size: 0.92rem; }

.ed-status-btn {
  padding: 10px 32px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  flex: 1;
}

.ed-active   { background: #16a34a; color: #fff; }
.ed-inactive { background: #dc2626; color: #fff; }

.ed-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 16px;
  min-height: calc(100vh - 220px);
  box-shadow: var(--shadow);
}

.ed-right-header {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

.ed-daily-prog-wrap { padding: 4px 0 6px; }

.ed-daily-prog-track {
  position: relative;
  height: 32px;
  background: #e0eaf4;
  border-radius: 6px;
  overflow: hidden;
}

.ed-daily-prog-fill {
  height: 100%;
  background: linear-gradient(90deg, #16a34a, #22c55e);
  border-radius: 6px;
  min-width: 4px;
  transition: width 0.6s ease;
}

.ed-daily-prog-pct {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.ed-right-table-wrap {
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.ed-right-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 960px;
  table-layout: fixed;
}

.ed-right-table thead th {
  background: var(--th-bg);
  color: var(--th-text);
  padding: 7px 8px;
  text-align: center;
  border-bottom: 2px solid rgba(255,255,255,0.1);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.ed-right-table td {
  padding: 6px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}

.ed-right-table tr:hover td        { background: var(--row-hover); }
.ed-right-table tr:nth-child(even) td { background: var(--row-alt); }
.ed-right-table tr.ed-row-done td        { background: rgba(22,163,74,0.10) !important; }
.ed-right-table tr.ed-row-done:hover td  { background: rgba(22,163,74,0.18) !important; }
.ed-right-table tr.ed-row-overdue td     { background: rgba(220,38,38,0.09) !important; }
.ed-right-table tr.ed-row-overdue:hover td { background: rgba(220,38,38,0.16) !important; }

.ed-proj    { text-align: left !important; white-space: normal; word-break: break-all; overflow-wrap: break-word; max-width: 180px; overflow: hidden; }
.ed-num     { text-align: right !important; font-variant-numeric: tabular-nums; }
.ed-dt      { font-size: 0.72rem; }
.ed-overdue { background: #dc2626 !important; color: #fff !important; font-weight: 700; border-radius: 3px; padding: 2px 4px; }

@media (max-width: 900px) { .ed-shell { grid-template-columns: 1fr; } }

/* ═══════════════════════════════════════════════════════════════════
   철선소요예정량 (wire-req)
═══════════════════════════════════════════════════════════════════ */
.wr-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.wr-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.wr-table-wrap { overflow-x: auto; }

.wr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  min-width: 600px;
}

.wr-orange-row th {
  background: #c47800;
  color: #fff;
  padding: 10px 12px;
  text-align: center;
  border: 1px solid #a36200;
  font-weight: 700;
  white-space: nowrap;
}

.wr-table td {
  padding: 9px 12px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  color: var(--text);
}

.wr-table tr:nth-child(even) td { background: var(--row-alt); }
.wr-table tr:hover td           { background: var(--row-hover); }

.wr-center { text-align: center !important; }
.wr-num    { text-align: right !important; font-variant-numeric: tabular-nums; }

/* ═══════════════════════════════════════════════════════════════════
   계획대비 출하현황 (shipment)
═══════════════════════════════════════════════════════════════════ */
#layoutRoot.sh-page { gap: 10px; }

.sh-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

.sh-factory-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.sh-factory-col {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.sh-factory-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.sh-factory-name { font-size: 1rem; font-weight: 700; color: var(--text); }
.sh-unit         { font-size: 0.78rem; color: var(--muted); }

.sh-table-wrap { overflow-x: auto; margin-bottom: 12px; }

.sh-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.sh-table thead th {
  background: var(--th-bg);
  color: var(--th-text);
  padding: 7px 10px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.1);
  white-space: nowrap;
}

.sh-table td {
  padding: 7px 10px;
  border: 1px solid var(--border);
  color: var(--text);
  text-align: center;
}

.sh-table tr:hover td { background: var(--row-hover); }

.sh-name { text-align: left !important; font-weight: 600; }
.sh-num  { text-align: right !important; font-variant-numeric: tabular-nums; }

.sh-subtotal td {
  background: #e8f0fa;
  font-weight: 700;
  color: var(--text);
}

.sh-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.sh-chart-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sh-chart-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  text-align: center;
}

.sh-chart-box canvas { width: 100% !important; height: 200px !important; }

.sh-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 10px 18px;
  background: #eaf0f8;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.sh-footer-item { display: flex; align-items: baseline; gap: 12px; }
.sh-footer-lbl  { color: var(--muted); font-size: 0.92rem; }
.sh-footer-val  { color: var(--text); font-size: 1.3rem; font-weight: 800; }

/* ═══════════════════════════════════════════════════════════════════
   공통 팝업 모달
═══════════════════════════════════════════════════════════════════ */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.popup-box {
  background: #1a2535;
  color: #e8f4ff;
  border-radius: 10px;
  min-width: 460px;
  max-width: 660px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px 32px 24px;
  position: relative;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.popup-box-wide { min-width: 540px; }

.popup-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #e8f4ff;
  margin-bottom: 22px;
}

.popup-close-btn {
  position: absolute;
  top: 16px;
  right: 18px;
  background: none;
  border: none;
  color: #a0b4d6;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.popup-close-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }

.popup-section-label {
  font-size: 0.8rem;
  color: #7a99c0;
  margin-bottom: 8px;
  margin-top: 4px;
}

.popup-reqno {
  font-size: 1.25rem;
  font-weight: 800;
  color: #5b9dff;
  margin-bottom: 16px;
}

.popup-info-box {
  background: #243352;
  border: 1px solid #344f78;
  border-radius: 7px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.popup-priority-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.92rem;
  color: #c8d8ee;
}

.popup-priority-input {
  width: 88px;
  padding: 6px 10px;
  background: #1a2535;
  border: 1px solid #4a6080;
  border-radius: 4px;
  color: #e8f4ff;
  font-size: 0.92rem;
  text-align: center;
}

.popup-detail-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
  margin-bottom: 6px;
  font-size: 0.86rem;
  color: #c8d8ee;
}
.popup-detail-row-full {
  margin-bottom: 6px;
  font-size: 0.86rem;
  color: #c8d8ee;
}

.popup-lbl {
  color: #7a99c0;
  display: inline-block;
  min-width: 56px;
}

.popup-bottom {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* 팝업 폼 공통 */
.popup-form-row {
  display: flex;
  align-items: center;
  margin-bottom: 13px;
  gap: 10px;
  font-size: 0.9rem;
}

.popup-form-lbl {
  min-width: 86px;
  color: #a0b4d6;
  text-align: right;
  flex-shrink: 0;
}

.popup-form-val {
  color: #e8f4ff;
  font-weight: 600;
}

.popup-form-sel,
.popup-form-input,
.popup-form-date {
  flex: 1;
  padding: 7px 10px;
  background: #1a2535;
  border: 1px solid #4a6080;
  border-radius: 5px;
  color: #e8f4ff;
  font-size: 0.88rem;
  min-width: 0;
}

.popup-form-input-sm {
  width: 110px;
  padding: 7px 10px;
  background: #1a2535;
  border: 1px solid #4a6080;
  border-radius: 5px;
  color: #e8f4ff;
  font-size: 0.88rem;
}

.popup-form-date {
  flex: none;
  width: auto;
  padding: 6px 10px;
  background: #28a745;
  border-color: #28a745;
  color: #fff;
  cursor: pointer;
}
.popup-form-date::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }

.popup-check-row {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 0.9rem;
  color: #c8d8ee;
}
.popup-check-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.popup-check-row input[type="checkbox"] { width: 15px; height: 15px; accent-color: #2563eb; cursor: pointer; }

/* 복수 추가 설비 테이블 */
.popup-equip-ctrl {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.popup-equip-table-wrap {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid #344f78;
  border-radius: 5px;
  margin-bottom: 12px;
}

.popup-equip-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.popup-equip-table th {
  background: #0f1d33;
  color: #a0b4d6;
  padding: 7px 10px;
  text-align: center;
  position: sticky;
  top: 0;
}

.popup-equip-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #2a3f62;
  color: #c8d8ee;
  text-align: center;
}

.popup-equip-table tr:hover td { background: #1e3050; }
.popup-equip-table tr.equip-selected td { background: #1e3050; }

.popup-date-range {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.popup-date-sep { color: #a0b4d6; }

/* 팝업 버튼 공통 */
.popup-btn-apply  { padding: 8px 26px; background: #2563eb; color: #fff; border: none; border-radius: 6px; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.popup-btn-reg    { padding: 8px 26px; background: #2563eb; color: #fff; border: none; border-radius: 6px; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.popup-btn-cancel { padding: 8px 20px; background: #4a6080; color: #e8f4ff; border: none; border-radius: 6px; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.popup-btn-edit   { padding: 8px 20px; background: #2563eb; color: #fff; border: none; border-radius: 6px; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.popup-btn-reset  { padding: 8px 20px; background: #4a6080; color: #e8f4ff; border: none; border-radius: 6px; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.popup-btn-del    { padding: 8px 20px; background: #c0392b; color: #fff; border: none; border-radius: 6px; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.popup-btn-xs     { padding: 4px 10px; background: #4a6080; color: #e8f4ff; border: none; border-radius: 4px; font-size: 0.8rem; cursor: pointer; }
.popup-btn-xs:hover { background: #2563eb; color: #fff; }
.popup-btn-xs-red { padding: 4px 10px; background: #7a1a1a; color: #fca5a5; border: none; border-radius: 4px; font-size: 0.8rem; cursor: pointer; }
.popup-btn-xs-red:hover { background: #c0392b; color: #fff; }

/* ── 반응형 ─────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .cards-row,
  .charts-grid,
  .tables-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .dash-stat-row   { grid-template-columns: repeat(2, 1fr); }
  .dash-mid-section { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sh-factory-row { grid-template-columns: 1fr; }
  .sh-footer      { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════
   콤팩트 모드 — 4:3 비율 등 세로 공간이 좁은 화면에서 한 화면에 맞춤
   (타이틀/여백을 줄여 스크롤 없이 최대한 표시)
═══════════════════════════════════════════════════════════════════ */
@media (max-height: 820px) {
  /* 사이드바 */
  .sidebar   { padding: 14px; gap: 14px; }
  .brand     { gap: 10px; }
  .logo      { width: 36px; height: 36px; border-radius: 10px; }
  .brand span{ font-size: 1rem; }
  .nav a     { padding: 8px 12px; font-size: 0.85rem; }

  /* 탑바 */
  .topbar     { height: 42px; padding: 0 18px; }
  .page-title { font-size: 0.86rem; }

  /* 콘텐츠 여백 */
  .content     { padding: 12px 18px; gap: 10px; }
  .layout-root { gap: 10px; }
  .layout-grid { gap: 10px; }

  /* 히어로(페이지 타이틀) */
  .hero          { padding: 10px 18px; gap: 3px; border-radius: 10px; }
  .hero-title    { font-size: 1.3rem; }
  .hero-subtitle { font-size: 0.76rem; }

  /* 위젯 패널 공통 */
  .widget-panel  { padding: 12px 14px; border-radius: 10px; }
  .widget-header { margin-bottom: 8px; }
  .widget-title  { font-size: 0.88rem; }
  .card-title    { margin-bottom: 8px; font-size: 0.86rem; }

  /* 표 공통 (기본 + 페이지별 테이블) */
  th, td,
  .inv-table th, .inv-table td,
  .sched-table th, .sched-table td,
  .ep-table th, .ep-table td,
  .sc-table th, .sc-table td,
  .ed-right-table th, .ed-right-table td,
  .wr-table th, .wr-table td,
  .sh-table th, .sh-table td {
    padding: 5px 8px;
  }
  .inv-table, .sched-table, .ep-table, .sc-table,
  .ed-right-table, .wr-table, .sh-table {
    font-size: 0.74rem;
  }
  .sched-hist-wrap { max-height: 200px; }
  .sched-section   { padding: 10px 12px; margin-bottom: 10px; }

  /* 대시보드 차트/카드 */
  .chart-box canvas      { height: 210px !important; }
  .dash-stat-card  { padding: 12px 14px; gap: 8px; }
  .dash-stat-body  { grid-template-columns: 1fr 80px; }
  .dash-stat-gauge { width: 80px; height: 80px; }
  .dash-mid-section{ gap: 10px; }
  .dash-mid-left   { gap: 10px; }
  .dash-progress-panel { gap: 12px; }
  .dash-dist-donut { width: 96px; height: 96px; }
  .equip-bars-wrap { height: 140px; }

  /* 재고/출하 차트 */
  .inv-chart-box canvas { height: 140px !important; }
  .sh-chart-box canvas  { height: 140px !important; }

  /* 설비상세 */
  .ed-right { min-height: calc(100vh - 150px); }
}
