:root {
  --erp-navy: #152238;
  --erp-navy-2: #1f3150;
  --erp-accent: #3264d6;
  --erp-bg: #f4f6f9;
  --erp-card: #ffffff;
  --erp-text: #172033;
  --erp-muted: #778195;
  --erp-line: #e2e7ef;
  --erp-sidebar-w: 248px;
  --erp-radius: 14px;
  --erp-shadow: 0 10px 30px rgba(20, 34, 56, .08);
}

* { box-sizing: border-box; }

body.erp-shell-active {
  margin: 0;
  background: var(--erp-bg);
  color: var(--erp-text);
  font-family: "Pretendard", "Noto Sans KR", Arial, sans-serif;
}

.erp-shell { min-height: 100vh; }

.erp-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1100;
  width: var(--erp-sidebar-w);
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
  background: linear-gradient(180deg, var(--erp-navy) 0%, #101b2e 100%);
  color: #fff;
  box-shadow: 8px 0 28px rgba(16, 27, 46, .14);
}

.erp-brand {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 18px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}

.erp-brand-link { color: #fff; text-decoration: none; display: flex; flex-direction: column; }
.erp-brand-mark { font-family: "신라문화체", serif; font-size: 38px; line-height: 1; letter-spacing: -.04em; }
.erp-brand-meta { margin-top: 7px; font-size: 10px; font-weight: 700; letter-spacing: .22em; color: rgba(255,255,255,.48); }
.erp-sidebar-close { display: none; border: 0; background: none; color: #fff; font-size: 32px; cursor: pointer; }
.erp-sidebar-label { padding: 22px 12px 9px; font-size: 11px; font-weight: 800; letter-spacing: .13em; color: rgba(255,255,255,.38); }
.erp-nav { display: flex; flex-direction: column; gap: 6px; }

.erp-nav-link {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 14px;
  border-radius: 11px;
  color: rgba(255,255,255,.72);
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.erp-nav-link:hover { color: #fff; background: rgba(255,255,255,.08); transform: translateX(2px); }
.erp-nav-link.active { color: #fff; background: linear-gradient(135deg, #3d70de, #2b57b7); box-shadow: 0 8px 18px rgba(25,73,174,.30); }
.erp-nav-icon { width: 26px; height: 26px; display: grid; place-items: center; font-size: 17px; font-weight: 800; }

.erp-sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 12px;
  background: rgba(255,255,255,.05);
}
.erp-sidebar-footer strong, .erp-sidebar-footer span { display: block; }
.erp-sidebar-footer strong { font-size: 13px; }
.erp-sidebar-footer span { margin-top: 2px; font-size: 11px; color: rgba(255,255,255,.50); }
.erp-status-dot { width: 9px; height: 9px; border-radius: 50%; background: #49d483; box-shadow: 0 0 0 5px rgba(73,212,131,.12); }

.erp-workspace { min-height: 100vh; margin-left: var(--erp-sidebar-w); }
.erp-topbar {
  position: sticky;
  top: 0;
  z-index: 900;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--erp-line);
  backdrop-filter: blur(12px);
}
.erp-topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.erp-page-heading { min-width: 0; }
.erp-page-kicker { display: block; margin-bottom: 5px; color: var(--erp-muted); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.erp-page-heading h1 { margin: 0; color: var(--erp-text); font-family: "신라문화체", serif; font-size: 31px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.erp-topbar-actions { display: flex; align-items: center; gap: 10px; }
.erp-home-link, .erp-live-badge { display: inline-flex; align-items: center; min-height: 36px; padding: 0 13px; border-radius: 9px; font-size: 12px; font-weight: 800; }
.erp-home-link { color: var(--erp-text); text-decoration: none; border: 1px solid var(--erp-line); background: #fff; }
.erp-home-link:hover { border-color: #bdc8d9; background: #f8fafc; }
.erp-factory-switch { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 0 13px; border: 1px solid #cfd8e7; border-radius: 10px; background: #fff; color: var(--erp-text); text-decoration: none; }
.erp-factory-switch span { font-size: 13px; font-weight: 900; }
.erp-factory-switch small { padding-left: 9px; border-left: 1px solid var(--erp-line); color: var(--erp-muted); font-size: 10px; font-weight: 800; }
.erp-factory-switch:hover { border-color: #9eb3d5; background: #f8faff; }
.erp-live-badge { gap: 7px; color: #217447; background: #eaf8f0; }
.erp-live-badge i { width: 7px; height: 7px; border-radius: 50%; background: #35b76f; }
.erp-menu-toggle { display: none; width: 42px; height: 42px; border: 1px solid var(--erp-line); border-radius: 10px; background: #fff; cursor: pointer; }
.erp-menu-toggle span { display: block; width: 18px; height: 2px; margin: 4px auto; background: var(--erp-text); border-radius: 2px; }

body.erp-shell-active .page-title-bar,
body.erp-shell-active > .navbar { display: none !important; }

.erp-content {
  margin: 0 !important;
  padding: 28px 32px 48px !important;
  max-width: none;
}

/* 기존 화면을 ERP 카드 안에 자연스럽게 정돈 */
.erp-content > form,
.erp-content > table,
.erp-content > .table-wrap,
.erp-content > .container,
.erp-content > .content-box,
.erp-content > section {
  border-radius: var(--erp-radius);
}

.erp-content table {
  background: #fff;
  box-shadow: 0 1px 0 rgba(20,34,56,.04);
}
.erp-content th { background: #f3f6fa; color: #354159; font-weight: 800; }
.erp-content th, .erp-content td { border-color: #dfe5ee; }
.erp-content input, .erp-content select, .erp-content textarea { border-radius: 7px; border-color: #cfd7e3; }
.erp-content button, .erp-content .btn { transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease; }
.erp-content button:hover, .erp-content .btn:hover { transform: translateY(-1px); }

.erp-overlay { display: none; }

@media (max-width: 1100px) {
  :root { --erp-sidebar-w: 220px; }
  .erp-content { padding-left: 22px !important; padding-right: 22px !important; }
  .erp-topbar { padding-left: 22px; padding-right: 22px; }
}

@media (max-width: 820px) {
  .erp-sidebar { transform: translateX(-105%); transition: transform .22s ease; width: 260px; }
  body.erp-menu-open .erp-sidebar { transform: translateX(0); }
  .erp-sidebar-close, .erp-menu-toggle { display: block; }
  .erp-workspace { margin-left: 0; }
  .erp-overlay { display: block; position: fixed; inset: 0; z-index: 1050; background: rgba(8,18,35,.46); }
  .erp-overlay[hidden] { display: none; }
  .erp-topbar { min-height: 76px; padding: 11px 16px; }
  .erp-page-heading h1 { font-size: 25px; }
  .erp-page-kicker { display: none; }
  .erp-content { padding: 18px 14px 36px !important; overflow-x: auto; }
  .erp-live-badge { display: none; }
}

@media (max-width: 520px) {
  .erp-home-link { display: none; }
  .erp-factory-switch small { display: none; }
  .erp-page-heading h1 { font-size: 22px; }
}
