/* MINSE */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #a5b4fc;
  --bg: #f8fafc;
  --bg-dark: #0f172a;
  --card-bg: #ffffff;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --info: #3b82f6;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

/* HEADER */
.app-header {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
  color: white;
  padding: 10px 20px 8px;
  flex-shrink: 0;
  z-index: 100;
  position: relative;
}

.app-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.app-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.3px;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.app-title::before {
  content: '📦';
  font-size: 16px;
}

.app-sub {
  font-size: 11px;
  opacity: 0.7;
  font-weight: 400;
}

.tab-bar {
  margin-top: 10px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  position: relative;
}

.tab-btn {
  flex: 1;
  min-width: 60px;
  padding: 7px 10px;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.tab-btn:hover {
  background: rgba(255,255,255,0.15);
  color: white;
}

.tab-btn.active {
  background: white;
  color: #312e81;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* CONTAINER & CARDS */
.container {
  width: 100%;
  margin: 0;
  padding: 12px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.table-scroll {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 0 4px;
  font-size: 13px;
  color: #64748b;
  flex-shrink: 0;
}
.pagination-bar button {
  padding: 4px 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 13px;
}
.pagination-bar button:disabled { opacity: 0.3; cursor: default; }
.pagination-bar button:not(:disabled):hover { background: #f1f5f9; }

.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
}

/* 테이블 섹션에서 마지막 카드가 남은 공간 채움 */
#sectionCustomer.active > .card:last-child,
#sectionProduct.active > .card:last-child,
#sectionSales.active > .card:last-child,
#sectionAuction.active > .card:last-child,
#sectionInventory.active > .card:last-child {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0;
}

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

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-title::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--primary);
  border-radius: 2px;
}

/* BUTTONS */
.btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn:hover::before { opacity: 1; }

.btn:active { transform: translateY(0); }

.btn.red { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4); }
.btn.green { background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%); box-shadow: 0 4px 14px rgba(34, 197, 94, 0.4); }
.btn.orange { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4); }
.btn.yellow { background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%); color: #1e293b; box-shadow: 0 4px 14px rgba(251, 191, 36, 0.4); }
.btn.gray { background: linear-gradient(135deg, #64748b 0%, #475569 100%); box-shadow: 0 4px 14px rgba(100, 116, 139, 0.4); }
.btn.purple { background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%); box-shadow: 0 4px 14px rgba(168, 85, 247, 0.4); }

.btn.outline {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
  box-shadow: none;
}

.btn.outline:hover {
  background: var(--primary);
  color: white;
}

.btn.sm { padding: 4px 10px; font-size: 11px; border-radius: 6px; }

.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.2s;
}

.icon-btn.edit { background: #e0f2fe; color: #0284c7; }
.icon-btn.edit:hover { background: #bae6fd; transform: scale(1.1); }
.icon-btn.delete { background: #fee2e2; color: #dc2626; }
.icon-btn.delete:hover { background: #fecaca; transform: scale(1.1); }

/* TABLES */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

thead {
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 10;
}

th {
  padding: 6px 8px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr:hover {
  background: #f0f9ff;
}

/* SECTIONS */
.section { display: none; }
.section.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* 대시보드/통계/설정은 자연 스크롤 */
#sectionDashboard.active,
#sectionStats.active,
#sectionSettings.active {
  overflow: auto;
}


/* MODALS & OVERLAYS */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
    display: none;
  justify-content: center;
  align-items: center;
  z-index: 200;
}

.overlay.show { display: flex; }

.modal {
  width: 750px;
  max-width: 95vw;
  max-height: 90vh;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  padding: 16px;
  display: flex;
  flex-direction: column;
}


.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.modal-body { overflow: auto; flex: 1; padding-right: 4px; font-size: 13px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--border); }

/* POPUPS */
.popup {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
    display: none;
  justify-content: center;
  align-items: center;
  z-index: 210;
}

.popup-box {
  background: white;
  width: 650px;
  max-width: 95vw;
  max-height: 85vh;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.popup-box h3 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.popup-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.popup-footer-left, .popup-footer-right { display: flex; gap: 10px; }

/* FORM ELEMENTS */
.input-row { margin-bottom: 16px; }

.input-row label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input-row input,
.input-row textarea,
.input-row select {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: #f8fafc;
  transition: all 0.2s;
}

.input-row input:focus,
.input-row textarea:focus,
.input-row select:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.input-row input[readonly] { background: #e2e8f0; color: var(--text-muted); }
.input-row input.locked { background: #fef3c7; color: #92400e; border-color: #fbbf24; }
textarea { resize: vertical; min-height: 80px; }

.pill-input-row { display: flex; gap: 10px; align-items: center; }
.pill-input-row input { flex: 1; }

.address-row { display: flex; gap: 10px; align-items: flex-start; }
.address-detail { margin-top: 10px; }

/* TAGS */
.tag-area { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s;
  border: 2px solid transparent;
}

.tag:hover { background: #e2e8f0; color: var(--text); }

.tag.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.tag.green { background: #dcfce7; color: #16a34a; }
.tag.green.active { background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%); color: white; }

/* STATUS BADGES */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.status-badge.cancel { background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%); color: #dc2626; }
.status-badge.exchange { background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%); color: #ea580c; }
.status-badge.refund { background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%); color: #9333ea; }
.status-badge.complete { background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%); color: #16a34a; }
.status-badge.paid { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); color: #2563eb; }

.status-btn {
  opacity: 0.5;
  transform: scale(0.95);
  transition: all 0.2s;
}

.status-btn.active {
  opacity: 1;
  transform: scale(1);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.15);
}

.bulk-status-btn { opacity: 0.5; transform: scale(0.95); transition: all 0.2s; }
.bulk-status-btn.active { opacity: 1; transform: scale(1); box-shadow: 0 0 0 3px rgba(0,0,0,0.2); }

/* TRANSACTION BADGES */
.badge-in {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.badge-out {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.trans-badge {
  display: inline-flex;
  background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.auction-badge {
  display: inline-flex;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}

/* STOCK STATUS */
.stock-danger {
  color: white !important;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 700;
}

.stock-warning {
  color: #ea580c !important;
  background: #ffedd5 !important;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 600;
}

.stock-normal { color: var(--primary); font-weight: 600; }

/* SEARCH BOX */
.search-box { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.search-box input {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  width: 240px;
  font-size: 14px;
  transition: all 0.2s;
  background: #f8fafc;
}

.search-box input:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* FILTER BAR */
.filter-bar {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 20px;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.filter-group { display: flex; gap: 10px; align-items: center; }

.filter-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.filter-group input[type="date"],
.filter-group select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  background: #f8fafc;
  transition: all 0.2s;
}

.filter-group input[type="date"]:focus,
.filter-group select:focus {
  border-color: var(--primary);
  background: white;
}

/* STAT CARDS */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: var(--radius);
  padding: 20px;
  color: white;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
  transition: transform 0.5s;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.stat-card:hover::before { transform: translate(20%, -20%); }

.stat-card.blue { background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%); }
.stat-card.green { background: linear-gradient(135deg, #22c55e 0%, #15803d 100%); }
.stat-card.orange { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.stat-card.red { background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%); }
.stat-card.purple { background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%); }

.stat-card .stat-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 40px;
  opacity: 0.2;
}

.stat-card .stat-label {
  font-size: 12px;
  opacity: 0.9;
  margin-bottom: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
}

.stat-card .stat-sub {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 4px;
}

/* CHARTS */
.chart-container {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.chart-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: color 0.2s;
}

.chart-title:hover { color: var(--primary); }
.chart-title .hint { font-size: 11px; color: var(--text-muted); font-weight: 500; }

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 200px;
  padding: 10px 0;
  border-bottom: 2px solid var(--border);
}

.bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; }

.bar {
  width: 100%;
  max-width: 60px;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 10px 10px 0 0;
  transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 4px;
  position: relative;
}

.bar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0.2) 0%, transparent 100%);
  border-radius: inherit;
}

.bar-label { font-size: 11px; color: var(--text-muted); text-align: center; font-weight: 500; }
.bar-value { font-size: 13px; font-weight: 700; color: var(--text); }

/* RANKING */
.ranking-list { list-style: none; padding: 0; margin: 0; max-height: 220px; overflow-y: auto; }

.ranking-item {
  display: flex;
  align-items: center;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 8px;
  margin-bottom: 4px;
}

.ranking-item:hover { background: #f8fafc; transform: translateX(4px); }
.ranking-item:last-child { border-bottom: none; }

.ranking-num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  margin-right: 12px;
}

.ranking-num.gold { background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%); color: white; }
.ranking-num.silver { background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%); color: white; }
.ranking-num.bronze { background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); color: white; }
.ranking-num.normal { background: #f1f5f9; color: var(--text-muted); }

.ranking-info { flex: 1; }
.ranking-name { font-weight: 600; font-size: 14px; color: var(--text); }
.ranking-sub { font-size: 11px; color: var(--text-muted); }
.ranking-value { font-weight: 800; font-size: 14px; color: var(--primary); }

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

/* SUB TABS */
.sub-tab-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  background: #f1f5f9;
  padding: 6px;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.sub-tab {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s;
}

.sub-tab:hover { color: var(--text); }

.sub-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.sub-tab.orange.active { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); color: white; }

/* STATS TABLE */
.stats-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.stats-table th { background: #f8fafc; padding: 14px 12px; text-align: center; border-bottom: 2px solid var(--border); font-weight: 700; }
.stats-table td { padding: 12px; text-align: center; border-bottom: 1px solid var(--border); }
.stats-table .text-left { text-align: left; }
.stats-table .text-right { text-align: right; }
.stats-table .col-in { background: #eff6ff; color: #2563eb; font-weight: 600; }
.stats-table .col-out { background: #fef2f2; color: #dc2626; font-weight: 600; }
.stats-table .col-buy { background: #fff7ed; color: #ea580c; font-weight: 600; }
.stats-table .col-sell { background: #f0fdf4; color: #16a34a; font-weight: 600; }
.stats-table tfoot tr { background: #f8fafc; font-weight: 700; }

/* CROSS TABLE */
.cross-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; border-radius: var(--radius-sm); overflow: hidden; }
.cross-table th, .cross-table td { padding: 12px 10px; border: 1px solid var(--border); text-align: center; }
.cross-table th { background: #f8fafc; font-weight: 700; }
.cross-table .row-header { background: #eff6ff; font-weight: 600; text-align: left; }
.cross-table .col-total { background: #fff7ed; font-weight: 600; }
.cross-table .grand-total { background: #f0fdf4; font-weight: 800; }
.cross-table .cell-count { font-weight: 700; color: #2563eb; }
.cross-table .cell-amount { font-size: 11px; color: var(--text-muted); }

/* CUSTOMER TABLE */
.customer-table { width: 100%; margin-top: 16px; font-size: 12px; }
.customer-table th { background: #f8fafc; text-align: center; padding: 10px 8px; font-weight: 700; }
.customer-table td { text-align: center; padding: 10px 8px; }
.customer-table input {
  width: 80px;
  text-align: right;
  padding: 6px 8px;
  border: 2px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  transition: all 0.2s;
}
.customer-table input:focus { border-color: var(--primary); }
.customer-table input.locked { background: #fef3c7; width: 80px; border-color: #fbbf24; }
.total-row { background: #f0fdf4 !important; font-weight: 700; }
.total-row td { border-top: 2px solid #22c55e; }

/* ORDER INPUT */
.order-input {
  width: 80px !important;
  text-align: center !important;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  font-size: 13px;
  transition: all 0.2s;
}

.order-input:focus { border-color: var(--primary); }

.order-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  min-width: 32px;
}

/* INFO BOX */
.info-box {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #93c5fd;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
  font-size: 13px;
}

.info-box .row { display: flex; gap: 20px; margin-bottom: 8px; align-items: center; }
.info-box .row:last-child { margin-bottom: 0; }
.info-box .label { color: var(--text-muted); min-width: 70px; font-weight: 500; }
.info-box .value { color: var(--text); font-weight: 600; }

@keyframes spin { to { transform: rotate(360deg); } }

/* PRODUCT GROUP STYLES */
.product-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  background: white;
  transition: all 0.3s;
}

.product-group:hover { box-shadow: var(--shadow); }

.product-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s;
}

.product-group-header:hover { background: #f1f5f9; }

.product-group-header.expanded {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-bottom: 2px solid #93c5fd;
}

.product-group-info { display: flex; align-items: center; gap: 16px; }

.product-group-toggle {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: transform 0.3s;
}

.product-group-header.expanded .product-group-toggle { transform: rotate(90deg); }

.product-group-name { font-weight: 700; font-size: 15px; color: var(--text); }

.product-group-meta { display: flex; gap: 20px; font-size: 13px; color: var(--text-muted); }

.product-group-count {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.product-group-body { display: none; padding: 0; }
.product-group-body.show { display: block; }
.product-group-body table { margin: 0; border-radius: 0; }
.product-group-body thead { background: #f8fafc; }

.version-row { transition: background 0.2s; }
.version-row:hover { background: #f8fafc; }
.version-row.inactive { background: #f1f5f9; opacity: 0.6; }
.version-row.inactive td { color: #94a3b8; }

.version-badge {
  display: inline-flex;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: #2563eb;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

/* TOGGLE SWITCH */
.toggle-switch { position: relative; width: 48px; height: 26px; display: inline-block; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  transition: 0.3s;
  border-radius: 26px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider { background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(22px); }

.toggle-label { font-size: 11px; color: var(--text-muted); margin-left: 8px; font-weight: 500; }

/* VIEW MODE TOGGLE */
.view-mode-toggle {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-sm);
}

.view-mode-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s;
}

.view-mode-btn.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* SETTINGS MANAGER */
.settings-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.settings-page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-page-title::before {
  content: '';
  width: 5px;
  height: 28px;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 3px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 24px;
}

.settings-category-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(0,0,0,0.04);
}

.settings-category-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.settings-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
}

.settings-category-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
}

.settings-category-header span {
  font-weight: 700;
  font-size: 16px;
  color: white;
  position: relative;
}

.settings-category-header .btn {
  background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
  color: white;
  font-weight: 600;
  box-shadow: none;
}

.settings-category-header .btn:hover {
  background: rgba(255,255,255,0.3);
}

.settings-category-card[data-category="customer_type"] .settings-category-header { background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%); }
.settings-category-card[data-category="color"] .settings-category-header { background: linear-gradient(135deg, #ec4899 0%, #db2777 100%); }
.settings-category-card[data-category="size"] .settings-category-header { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); }
.settings-category-card[data-category="material"] .settings-category-header { background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%); }
.settings-category-card[data-category="transaction_type"] .settings-category-header { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }

.settings-list {
  padding: 16px;
  max-height: 640px;
  overflow-y: auto;
  background: #fafbfc;
}

.settings-list::-webkit-scrollbar { width: 6px; }
.settings-list::-webkit-scrollbar-track { background: transparent; }
.settings-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

.settings-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  margin-bottom: 8px;
  background: white;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: all 0.2s;
}

.settings-item:hover {
  box-shadow: var(--shadow);
  transform: translateX(4px);
}

.settings-item:active { cursor: grabbing; }
.settings-item.dragging { opacity: 0.5; box-shadow: var(--shadow-lg); }

.settings-item-value { font-size: 14px; color: var(--text); flex: 1; font-weight: 500; }

.settings-item-order {
  font-size: 11px;
  color: white;
  padding: 4px 12px;
  border-radius: 999px;
  margin-right: 12px;
  font-weight: 700;
  min-width: 32px;
  text-align: center;
}

.settings-item-actions { display: flex; gap: 6px; opacity: 0; transition: opacity 0.2s; }
.settings-item:hover .settings-item-actions { opacity: 1; }

.settings-item-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s;
}

.settings-item-btn.edit { background: #e0f2fe; color: #0284c7; }
.settings-item-btn.edit:hover { background: #bae6fd; transform: scale(1.1); }
.settings-item-btn.delete { background: #fee2e2; color: #dc2626; }
.settings-item-btn.delete:hover { background: #fecaca; transform: scale(1.1); }

.settings-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 14px;
  background: white;
  border-radius: var(--radius-sm);
  margin: 8px;
}

.settings-empty::before { content: '📭'; display: block; font-size: 40px; margin-bottom: 16px; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .app-header { padding: 8px 12px; }
  .app-title { font-size: 15px; }
  .container { padding: 0 8px; margin: 8px auto; }
  .card { padding: 10px; border-radius: var(--radius); }
  .modal, .popup-box { width: 95vw; padding: 12px; }
  .stat-card .stat-value { font-size: 20px; }
  .tab-btn { min-width: 50px; font-size: 10px; padding: 6px 4px; }
  .search-box { flex-direction: column; align-items: stretch; }
  .search-box input { width: 100%; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-group { flex-wrap: wrap; }
  table { font-size: 11px; }
  th, td { padding: 8px 6px; }
  .product-group-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .settings-grid { grid-template-columns: 1fr; }
}
