* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --secondary: #059669;
  --bg: #f1f5f9;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --transition: .2s ease;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.setup-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
}
.setup-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
}
.setup-logo { text-align: center; margin-bottom: 16px; }
.setup-card h1 { text-align: center; font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.setup-subtitle { text-align: center; color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 500; font-size: 14px; margin-bottom: 4px; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.form-group textarea { resize: vertical; min-height: 60px; }
.input-hint { display: block; font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.input-group { display: flex; gap: 8px; }
.input-group select { flex: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:hover { opacity: .9; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.admin-layout { min-height: 100vh; display: flex; }
.sidebar {
  width: 240px;
  background: #1e293b;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sidebar-brand { font-weight: 700; font-size: 18px; }
.sidebar-close { display: none; background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; }
.sidebar-nav { flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: rgba(255,255,255,.7);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.nav-icon { width: 20px; text-align: center; font-size: 11px; }
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,.1); display: flex; flex-direction: column; gap: 8px; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 99; }

.main-content {
  flex: 1;
  margin-left: 240px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  background: var(--bg-card);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.hamburger { display: none; background: none; border: none; font-size: 24px; cursor: pointer; padding: 4px; color: var(--text); }
.page-title { font-size: 18px; font-weight: 600; flex: 1; }
.topbar-store-name { font-size: 13px; color: var(--text-secondary); }

.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  z-index: 90;
  padding: 4px 0 env(safe-area-inset-bottom);
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  transition: color var(--transition);
}
.bottom-nav-item .nav-icon { font-size: 16px; }
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item:hover { text-decoration: none; }

.content-area { flex: 1; padding: 20px 24px; padding-bottom: 80px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.page-header h2 { font-size: 20px; font-weight: 700; }
.page-desc { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }
.page-actions { display: flex; gap: 8px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-value { display: block; font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.dash-section { background: var(--bg-card); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.dash-section h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }

.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
tr:hover td { background: #f8fafc; }
.empty-state { color: var(--text-secondary); font-size: 14px; padding: 32px 0; text-align: center; }

.filter-bar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.input-search { padding: 8px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 14px; flex: 1; min-width: 160px; }
.input-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.input-select { padding: 8px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 14px; background: #fff; }
.input-select:focus { outline: none; border-color: var(--primary); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
}
.badge-baru { background: var(--primary-light); color: var(--primary); }
.badge-diproses { background: var(--warning-light); color: var(--warning); }
.badge-dikirim { background: #f0f9ff; color: #0284c7; }
.badge-selesai { background: var(--success-light); color: var(--success); }
.badge-dibatalkan { background: var(--danger-light); color: var(--danger); }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-md);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h3 { font-size: 18px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 28px; cursor: pointer; color: var(--text); line-height: 1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

.order-item-row { display: flex; gap: 8px; align-items: center; }
.order-items-list { margin: 8px 0; }
.order-item { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.order-item-name { font-weight: 500; }
.order-item-remove { color: var(--danger); cursor: pointer; font-size: 18px; background: none; border: none; }

.settings-section { background: var(--bg-card); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.settings-section h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.settings-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.theme-option {
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}
.theme-option:hover { border-color: var(--primary); }
.theme-option.active { border-color: var(--primary); background: var(--primary-light); }

.share-url-row { display: flex; gap: 8px; margin-bottom: 12px; }
.share-input { flex: 1; padding: 8px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 13px; background: #f8fafc; }
.share-actions { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.qr-container { text-align: center; margin: 12px 0; padding: 16px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
#qr-code { margin: 0 auto 12px; min-height: 180px; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); }

.catalog-preview-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #fff;
}
.cpf-header { padding: 20px; text-align: center; border-bottom: 1px solid var(--border); }
.cpf-header h3 { font-size: 20px; font-weight: 700; }
.cpf-header p { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }
.cpf-search { padding: 12px; }
.cpf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 12px; }
.cpf-empty { grid-column: 1/-1; text-align: center; color: var(--text-secondary); padding: 40px 0; }
.cpf-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.cpf-card:hover { box-shadow: var(--shadow-md); }
.cpf-card-img { width: 100%; height: 140px; object-fit: cover; background: #e2e8f0; }
.cpf-card-body { padding: 10px; }
.cpf-card-name { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.cpf-card-price { color: var(--primary); font-weight: 700; font-size: 15px; }
.cpf-card-order { display: block; text-align: center; padding: 8px; margin-top: 8px; background: var(--success); color: #fff; border-radius: var(--radius); font-size: 13px; font-weight: 600; }
.cpf-card-order:hover { opacity: .9; text-decoration: none; }

.error-message { color: var(--danger); font-size: 13px; margin-top: 8px; text-align: center; }
.success-message { color: var(--success); font-size: 13px; margin-top: 4px; }

.dash-wa-notice {
  display: flex;
  gap: 12px;
  background: var(--warning-light);
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
  align-items: flex-start;
}
.dash-wa-notice-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: var(--warning);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
.dash-wa-notice-body {
  font-size: 13px;
  color: #92400e;
  line-height: 1.5;
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .topbar { padding: 12px 16px; }
  .hamburger { display: block; }
  .content-area { padding: 16px; padding-bottom: 80px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .cpf-grid { grid-template-columns: repeat(2, 1fr); }
  .bottom-nav { display: flex; justify-content: space-around; }
  .modal-content { padding: 16px; max-width: 100%; border-radius: var(--radius); }
  .filter-bar { flex-direction: column; }
  .filter-bar .input-search, .filter-bar .input-select { width: 100%; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .table-wrap table { min-width: 500px; }
  .bottom-nav-item { font-size: 10px; padding: 6px 2px; }
  .bottom-nav-item .nav-icon { font-size: 14px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 22px; }
  .cpf-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .cpf-card-img { height: 110px; }
  .order-item-row { flex-wrap: wrap; }
  .order-item-row select { width: 100%; }
  .order-item-row input[type="number"] { width: 60px !important; }
  .share-url-row { flex-direction: column; }
  .share-actions { flex-direction: column; }
  .settings-actions { flex-direction: column; }
  .sidebar { width: 260px; }
}

@media (max-width: 360px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .stat-card { padding: 10px; }
  .stat-value { font-size: 20px; }
  .bottom-nav-item { font-size: 9px; }
  .bottom-nav-item span:last-child { font-size: 9px; }
  .content-area { padding: 12px; padding-bottom: 76px; }
  .modal-content { padding: 12px; }
  .page-header h2 { font-size: 17px; }
  .form-group input, .form-group select, .form-group textarea { padding: 8px 10px; font-size: 13px; }
}
