:root {
  --primary: #FF3B5C;
  --primary-light: #FF6B81;
  --primary-dark: #E0274A;
  --secondary: #1A1A2E;
  --accent: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --background: #FFF8F5;
  --foreground: #1A1A2E;
  --muted: #64748b;
  --card-bg: #ffffff;
  --border: #e8e0db;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Pretendard Variable', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--background);
  color: var(--foreground);
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.75rem 1.5rem; border: none; border-radius: 0.75rem;
  font-size: 1rem; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all 0.2s; gap: 0.5rem;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; }
.btn-secondary { background: var(--background); color: var(--foreground); }
.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--accent); color: white; }
.btn-outline { background: white; color: var(--primary); border: 1px solid var(--primary); }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1.125rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Form */
.input-group { margin-bottom: 1rem; }
.input-group label {
  display: block; font-size: 0.875rem; font-weight: 500;
  margin-bottom: 0.5rem; color: var(--muted);
}
.input-group input, .input-group select, .input-group textarea {
  width: 100%; padding: 0.875rem 1rem;
  border: 1px solid var(--border); border-radius: 0.75rem;
  font-size: 1rem; font-family: inherit; transition: border-color 0.2s;
  background: white;
}
.input-group input:focus, .input-group select:focus, .input-group textarea:focus {
  outline: none; border-color: var(--primary);
}

/* Cards */
.card {
  background: var(--card-bg); border-radius: 0.75rem;
  border: 1px solid var(--border); padding: 1.25rem;
}

/* Toast */
.toast {
  position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: white;
  padding: 0.75rem 1.25rem; border-radius: 0.75rem;
  font-size: 0.875rem; z-index: 300; opacity: 0; transition: opacity 0.3s;
  pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.success { background: var(--accent); }
.toast.error { background: var(--danger); }

/* Modal */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); display: none;
  align-items: flex-end; justify-content: center; z-index: 200;
}
.modal-overlay.active { display: flex; }
.modal {
  width: 100%; max-width: 500px; background: white;
  border-radius: 1.5rem 1.5rem 0 0; padding: 1.5rem;
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
  animation: slideUp 0.3s ease; max-height: 90vh; overflow-y: auto;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 1.5rem;
}
.modal-title { font-size: 1.25rem; font-weight: 700; }
.modal-close {
  width: 36px; height: 36px; border: none;
  background: var(--background); border-radius: 50%;
  font-size: 1.25rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.modal-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }
.modal-actions .btn { flex: 1; }

/* Summary Cards */
.summary { padding: 1rem; display: flex; gap: 0.75rem; background: linear-gradient(135deg, #FFF8F5, #FFEFEA); }
.summary-card {
  flex: 1; background: white; padding: 0.875rem; border-radius: 0.75rem;
  text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.summary-card .label { font-size: 0.75rem; color: var(--muted); margin-bottom: 0.25rem; }
.summary-card .value { font-size: 1.25rem; font-weight: 700; color: var(--primary); }
.summary-card.clickable { cursor: pointer; transition: all 0.2s; }
.summary-card.clickable:active { transform: scale(0.97); }
.summary-card.clickable.active {
  border: 2px solid var(--primary);
  background: linear-gradient(135deg, rgba(255,59,92,0.1), rgba(255,59,92,0.05));
}

/* Search */
.search-bar {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem; background: white; border-bottom: 1px solid var(--border);
}
.search-bar input {
  flex: 1; border: none; font-size: 1rem; font-family: inherit; outline: none;
}
.search-bar input::placeholder { color: #9ca3af; }
.search-clear {
  width: 24px; height: 24px; border: none; background: var(--border);
  border-radius: 50%; font-size: 1rem; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* Brand Tabs */
.brand-tabs {
  display: flex; gap: 0.5rem; padding: 0.75rem 1rem;
  background: white; border-bottom: 1px solid var(--border);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.brand-tabs::-webkit-scrollbar { display: none; }
.brand-tab {
  flex-shrink: 0; padding: 0.5rem 1rem;
  border: 1px solid var(--border); border-radius: 9999px;
  background: white; font-size: 0.875rem; font-family: inherit;
  cursor: pointer; transition: all 0.2s; color: var(--muted);
}
.brand-tab:active { transform: scale(0.97); }
.brand-tab.active { background: var(--primary); border-color: var(--primary); color: white; }

/* Product Item */
.product-item {
  background: white; border: 1px solid var(--border);
  border-radius: 0.75rem; padding: 1rem; margin-bottom: 0.75rem;
  transition: all 0.2s;
}
.product-item:active { background: #f8fafc; }
.product-item.set-product {
  border-left: 4px solid #ec4899;
  background: linear-gradient(135deg, rgba(236,72,153,0.05), rgba(255,255,255,1));
}
.product-header {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 0.75rem; gap: 0.75rem;
}
.product-name { font-weight: 600; font-size: 1rem; }
.product-price { font-size: 0.875rem; color: var(--muted); }
.product-stock { display: flex; align-items: center; justify-content: space-between; }
.stock-display { display: flex; align-items: baseline; gap: 0.25rem; }
.stock-number { font-size: 1.5rem; font-weight: 700; }
.stock-number.low { color: var(--danger); }
.stock-number.medium { color: var(--warning); }
.stock-number.good { color: var(--accent); }
.stock-unit { font-size: 0.875rem; color: var(--muted); }

/* Stock Actions */
.stock-actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.75rem; }
.qty-input {
  width: 60px; height: 38px; padding: 0 0.5rem;
  border: 1px solid var(--border); border-radius: 0.5rem;
  font-size: 1rem; text-align: center; font-family: inherit;
}
.qty-input:focus { outline: none; border-color: var(--primary); }
.action-btn {
  flex: 1; height: 38px; padding: 0 0.5rem; border: none; border-radius: 0.5rem;
  font-size: 0.875rem; font-weight: 600; cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center;
}
.action-btn.sale { background: var(--danger); color: white; }
.action-btn.return { background: var(--accent); color: white; }
.action-btn:active { transform: scale(0.97); }

/* Product Menu */
.product-menu {
  display: flex; gap: 0.5rem; margin-top: 0.75rem;
  padding-top: 0.75rem; border-top: 1px solid var(--border);
}
.menu-btn {
  height: 38px; width: 38px; padding: 0; border: none;
  background: var(--background); border-radius: 0.5rem;
  font-size: 0.75rem; color: var(--muted); cursor: pointer;
  font-family: inherit; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.menu-btn:active { background: var(--border); }

/* Checkbox */
.product-checkbox { position: relative; display: flex; align-items: center; cursor: pointer; flex-shrink: 0; padding-top: 0.125rem; }
.product-checkbox input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.product-checkbox .checkmark {
  width: 22px; height: 22px; border: 2px solid var(--border);
  border-radius: 0.375rem; background: white; transition: all 0.2s;
}
.product-checkbox input:checked ~ .checkmark { background: var(--primary); border-color: var(--primary); }
.product-checkbox .checkmark:after {
  content: ""; position: absolute; display: none;
  left: 8px; top: 4px; width: 5px; height: 10px;
  border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.product-checkbox input:checked ~ .checkmark:after { display: block; }

/* Set Badge */
.set-badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  background: linear-gradient(135deg, #ec4899, #be185d);
  color: white; font-size: 0.625rem; font-weight: 600;
  padding: 0.125rem 0.5rem; border-radius: 9999px; margin-right: 0.5rem;
}
.set-items-info { font-size: 0.75rem; color: var(--muted); margin-top: 0.25rem; padding-left: 0.5rem; border-left: 2px solid var(--border); }

/* Pagination */
.pagination { display: flex; justify-content: center; align-items: center; gap: 0.5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.page-btn {
  padding: 0.5rem 1rem; border: 1px solid var(--border); background: white;
  border-radius: 0.5rem; font-size: 0.875rem; cursor: pointer; font-family: inherit;
}
.page-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.page-info { font-size: 0.875rem; color: var(--muted); }

/* History */
.history-list { max-height: 400px; overflow-y: auto; }
.history-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 0; border-bottom: 1px solid var(--border);
}
.history-item:last-child { border-bottom: none; }
.history-qty { font-size: 1.125rem; font-weight: 700; min-width: 50px; }
.history-qty.plus { color: var(--accent); }
.history-qty.minus { color: var(--danger); }
.history-type { font-size: 0.875rem; }
.history-memo { font-size: 0.75rem; color: var(--muted); }
.history-time { font-size: 0.75rem; color: var(--muted); text-align: right; }
.history-worker { font-size: 0.625rem; color: var(--primary); }

/* Quantity Input (Modal) */
.quantity-input { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1.5rem 0; }
.quantity-btn {
  width: 56px; height: 56px; border: none; border-radius: 50%;
  font-size: 1.5rem; font-weight: 600; cursor: pointer;
}
.quantity-btn.minus { background: #fee2e2; color: var(--danger); }
.quantity-btn.plus { background: #d1fae5; color: var(--accent); }
.quantity-value { font-size: 2.5rem; font-weight: 700; min-width: 80px; text-align: center; }

/* Batch Sale */
.batch-sale-list { max-height: 350px; overflow-y: auto; }
.batch-sale-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 0; border-bottom: 1px solid var(--border); gap: 0.75rem;
}
.batch-sale-item:last-child { border-bottom: none; }
.batch-sale-info { flex: 1; min-width: 0; }
.batch-sale-name { font-weight: 500; font-size: 0.9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.batch-sale-stock { font-size: 0.75rem; color: var(--muted); }
.batch-sale-qty {
  width: 60px; padding: 0.5rem; border: 1px solid var(--border);
  border-radius: 0.5rem; font-size: 1rem; text-align: center; font-family: inherit; flex-shrink: 0;
}
.batch-sale-remove {
  width: 28px; height: 28px; border: none; background: #fee2e2;
  color: var(--danger); border-radius: 0.375rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* Excel Upload */
.excel-upload-zone {
  border: 2px dashed var(--border); border-radius: 0.75rem;
  padding: 1.5rem; text-align: center; cursor: pointer; transition: all 0.2s;
}
.excel-upload-zone:hover, .excel-upload-zone.dragover {
  border-color: var(--primary); background: rgba(255,59,92,0.05);
}

/* Utility */
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none !important; }
