:root {
  font-family: 'Malgun Gothic', system-ui, sans-serif;
  color: #111827;
  background: #f3f4f6;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: #0f172a; color: white; padding: 24px 16px; }
.logo { font-size: 20px; font-weight: 700; margin-bottom: 24px; }
.menu { width: 100%; text-align: left; background: transparent; color: #cbd5e1; border: 0; padding: 12px 14px; border-radius: 10px; margin-bottom: 8px; }
.menu.active, .menu:hover { background: #1e293b; color: white; }
.content { flex: 1; padding: 24px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; }
.userbox { background: white; padding: 10px 14px; border-radius: 10px; }
.card { background: white; border-radius: 16px; padding: 20px; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08); }
.grid { display: grid; gap: 16px; }
.grid.four { grid-template-columns: repeat(4, 1fr); }
.grid.two { grid-template-columns: repeat(2, 1fr); }
.kpi-card { min-height: 120px; }
.kpi-label { color: #6b7280; margin-bottom: 12px; }
.kpi-value { font-size: 34px; font-weight: 700; }
.mt16 { margin-top: 16px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid #e5e7eb; text-align: left; vertical-align: middle; white-space: nowrap; }
th { background: #f8fafc; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.form-row input, .form-row select, .stack-form input, .stack-form select, .search-input { border: 1px solid #d1d5db; padding: 10px 12px; border-radius: 10px; }
.primary, .form-row button, .fake-button { background: #2563eb; color: white; border: 0; padding: 10px 14px; border-radius: 10px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.secondary { background: #0f766e; color: white; }
.ghost-button { background: #eef2ff; color: #3730a3; border: 0; padding: 8px 12px; border-radius: 10px; }
.danger-button { background: #fee2e2; color: #b91c1c; border: 0; padding: 8px 12px; border-radius: 10px; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.inventory-page { display: flex; flex-direction: column; gap: 20px; }
.tab-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.tab-buttons .menu { width: auto; margin-bottom: 0; background: #f1f5f9; color: #334155; }
.tab-buttons .menu.active, .tab-buttons .menu:hover { background: #1e293b; color: white; }
.search-input { min-width: 280px; }
.table-sort { width: 100%; text-align: left; border: 0; background: transparent; color: inherit; padding: 0; font-weight: 700; }
.stack-form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; gap: 12px; }
.form-grid.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.full-span { grid-column: 1 / -1; }
.form-section-title { margin-top: 6px; padding-top: 14px; border-top: 1px solid #e5e7eb; font-weight: 700; color: #0f172a; }
.form-section-title:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 700; color: #374151; }
.field-hint { font-size: 12px; color: #6b7280; line-height: 1.4; }
.help-text { color: #6b7280; font-size: 13px; }
.message-box { background: #eff6ff; color: #1d4ed8; padding: 12px 14px; border-radius: 10px; }
.uploader-card { border: 1px dashed #cbd5e1; border-radius: 14px; padding: 14px; }
.uploader-actions { display: flex; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.image-preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; margin-top: 12px; }
.preview-thumb, .table-thumb { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 12px; background: #e5e7eb; }
.table-thumb { width: 52px; border-radius: 10px; }
.empty-thumb, .empty-photo { display: flex; align-items: center; justify-content: center; color: #6b7280; font-size: 12px; }
.photo-card { border: 1px solid #e5e7eb; border-radius: 12px; padding: 8px; }
.photo-card-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.badge-primary { background: #dbeafe; color: #1d4ed8; padding: 8px 12px; border-radius: 999px; font-size: 12px; text-align: center; }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #f8fafc; }
.detail-panel { margin-top: 20px; border-top: 1px solid #e5e7eb; padding-top: 20px; }
.photo-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pill { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; background: #f1f5f9; color: #334155; font-size: 12px; }
.scanner-panel { border: 1px solid #d1d5db; border-radius: 12px; padding: 12px; background: #f8fafc; }
.scanner-panel video { width: 100%; max-height: 360px; background: #111827; border-radius: 10px; display: block; margin-bottom: 10px; object-fit: cover; }
.barcode-controls { margin-top: 12px; }
.barcode-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; margin-top: 20px; }
.barcode-label { background: white; border: 1px solid #d1d5db; border-radius: 8px; padding: 14px; text-align: center; break-inside: avoid; }
.barcode-location { font-size: 11px; font-weight: 600; color: #4b5563; margin-top: 4px; }
.qr-svg { width: 128px; height: 128px; fill: #111827; display: block; margin: 0 auto 8px; }
.barcode-code { font-size: 13px; font-weight: 800; letter-spacing: .5px; margin-top: 4px; }
@media print {
  body { background: white; }
  .sidebar, .topbar, .barcode-toolbar { display: none !important; }
  .content { padding: 0; }
  .barcode-sheet { grid-template-columns: repeat(3, 1fr); gap: 6mm; margin: 0; }
  .barcode-label { box-shadow: none; border: 1px solid #111827; border-radius: 0; padding: 4mm; }
  .qr-svg { width: 42mm; height: 42mm; }
}
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .grid.four, .grid.two, .form-grid.two-col { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}
