@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css');

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

:root {
  --sidebar-w: 220px;
  --sidebar-bg: #0f172a;
  --sidebar-border: rgba(255,255,255,0.06);
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #f1f5f9;
  --sidebar-hover: rgba(255,255,255,0.05);
  --sidebar-active: rgba(59,130,246,0.15);
  --sidebar-accent: #3b82f6;

  --bg: #f8fafc;
  --bg2: #ffffff;
  --bg3: #f1f5f9;
  --border: #e2e8f0;
  --border2: #cbd5e1;
  --text1: #0f172a;
  --text2: #475569;
  --text3: #94a3b8;
  --blue: #3b82f6;
  --blue-light: #eff6ff;
  --blue-dark: #1d4ed8;
  --green: #10b981;
  --green-light: #ecfdf5;
  --red: #ef4444;
  --red-light: #fef2f2;
  --amber: #f59e0b;
  --amber-light: #fffbeb;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Pretendard', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text1);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex; min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  height: 100vh;
  position: fixed; top: 0; left: 0;
  display: flex; flex-direction: column;
  overflow-y: auto; z-index: 100;
  flex-shrink: 0;
}
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 0.5px solid var(--sidebar-border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo-icon {
  width: 28px; height: 28px; background: var(--blue); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: #fff; font-weight: 700; flex-shrink: 0;
}
.sidebar-logo-text { font-size: 13px; font-weight: 600; color: var(--sidebar-text-active); }
.sidebar-logo-sub { font-size: 10px; color: var(--sidebar-text); margin-top: 1px; }

.sidebar-section { padding: 16px 12px 8px; }
.sidebar-section-label { font-size: 10px; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: 0.08em; padding: 0 8px; margin-bottom: 4px; }

.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px;
  color: var(--sidebar-text); font-size: 13px;
  text-decoration: none; transition: all 0.15s;
  margin-bottom: 1px;
}
.sidebar-link:hover { background: var(--sidebar-hover); color: var(--sidebar-text-active); }
.sidebar-link.active { background: var(--sidebar-active); color: var(--sidebar-text-active); }
.sidebar-link.active .nav-icon { color: var(--sidebar-accent); }
.nav-icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-badge {
  margin-left: auto; font-size: 10px; background: var(--blue); color: #fff;
  padding: 1px 6px; border-radius: 100px; font-weight: 600;
}

.sidebar-footer {
  margin-top: auto; padding: 12px;
  border-top: 0.5px solid var(--sidebar-border);
}
.sidebar-footer a { display: block; font-size: 11px; color: #475569; padding: 4px 8px; text-decoration: none; }
.sidebar-footer a:hover { color: var(--sidebar-text); }

/* ── MAIN CONTENT ── */
.main { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: var(--bg2); border-bottom: 1px solid var(--border);
  padding: 0 28px; height: 52px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 15px; font-weight: 600; color: var(--text1); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-badge { font-size: 11px; color: var(--text3); background: var(--bg3); padding: 3px 10px; border-radius: 100px; border: 1px solid var(--border); }

.content { padding: 28px; flex: 1; }
.page-title { font-size: 20px; font-weight: 700; color: var(--text1); margin-bottom: 4px; }
.page-desc { font-size: 13px; color: var(--text2); margin-bottom: 24px; }

/* ── CARDS ── */
.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow);
}
.card-title { font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.card-title::before { content: ''; width: 3px; height: 14px; background: var(--blue); border-radius: 2px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow); }
.stat-label { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text1); }
.stat-sub { font-size: 11px; color: var(--text3); margin-top: 4px; }
.stat-card.blue { border-top: 2px solid var(--blue); }
.stat-card.green { border-top: 2px solid var(--green); }
.stat-card.red { border-top: 2px solid var(--red); }
.stat-card.amber { border-top: 2px solid var(--amber); }

/* ── FORMS ── */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text2); }
.form-input, .form-select {
  padding: 9px 12px; border: 1px solid var(--border2); border-radius: var(--radius);
  font-size: 14px; font-family: inherit; outline: none; background: var(--bg2); color: var(--text1);
  transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.form-input[readonly] { background: var(--bg3); color: var(--text2); cursor: default; }
.form-hint { font-size: 11px; color: var(--text3); }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table.erp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.erp-table thead tr { background: var(--bg3); }
.erp-table th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border); white-space: nowrap; }
.erp-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text2); }
.erp-table tr:last-child td { border-bottom: none; }
.erp-table tr:hover td { background: var(--bg3); }
.erp-table .num { text-align: right; font-weight: 600; color: var(--text1); font-variant-numeric: tabular-nums; }
.erp-table .total-row td { font-weight: 700; color: var(--text1); background: var(--blue-light); }
.erp-table .total-row .num { color: var(--blue-dark); }
.erp-table .deduct-row td { color: var(--red); }
.erp-table .deduct-row .num { color: var(--red); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all 0.15s; border: 1px solid var(--border2);
  background: var(--bg2); color: var(--text2);
}
.btn:hover { background: var(--bg3); }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-success { background: var(--green); color: #fff; border-color: var(--green); }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 100px; font-size: 11px; font-weight: 600; }
.badge-blue { background: var(--blue-light); color: var(--blue-dark); }
.badge-green { background: var(--green-light); color: #065f46; }
.badge-red { background: var(--red-light); color: #991b1b; }
.badge-amber { background: var(--amber-light); color: #92400e; }
.badge-gray { background: var(--bg3); color: var(--text2); }

/* ── AD SLOT ── */
.ad-slot { background: var(--bg3); border: 1px dashed var(--border2); border-radius: var(--radius); padding: 14px; text-align: center; margin: 20px 0; }
.ad-slot p { font-size: 11px; color: var(--text3); }

/* ── DIVIDER ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── RESULT BOX ── */
.result-box { background: var(--blue-light); border: 1px solid #bfdbfe; border-radius: var(--radius-lg); padding: 20px; margin-top: 20px; }
.result-main { font-size: 32px; font-weight: 800; color: var(--blue-dark); }
.result-label { font-size: 12px; color: var(--blue); font-weight: 600; margin-bottom: 6px; }
.result-sub { font-size: 12px; color: #3b82f6; margin-top: 6px; }

/* ── PRINT ── */
@media print {
  .sidebar, .topbar, .ad-slot, .btn-row, .no-print { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; }
  body { background: white; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main { margin-left: 0; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}
