* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0A0C10;
  --panel: #14171C;
  --panel-2: #191D23;
  --border: #1F242B;
  --text: #E8EAED;
  --text-dim: #8B93A1;
  --text-faint: #565D68;
  --accent: #3D8BFF;
  --accent-dim: #1E3A63;
  --ok: #34D399;
  --danger: #F0555A;
  --radius: 14px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  height: 100%;
  overscroll-behavior: none;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #0D0F13;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.02em;
}
.brand-dot { color: var(--accent); }

.balance-pill {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ok);
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 999px;
}

main#view {
  flex: 1;
  padding: 16px 16px 90px;
}

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: #12151B;
  border-top: 1px solid #262B33;
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
  z-index: 20;
}

.tab {
  flex: 1;
  background: none;
  border: none;
  color: #7A8290;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  border-radius: 10px;
  transition: color 0.15s ease;
  cursor: pointer;
}
.tab-icon { font-size: 20px; line-height: 1; }
.tab.active { color: var(--accent); }

/* section header */
.section-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 14px;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 6px;
}
.chip {
  flex-shrink: 0;
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 999px;
}
.chip.active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

/* product card */
.product-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.product-info { min-width: 0; }
.product-title {
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.product-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 4px;
  display: flex;
  gap: 10px;
}
.stock-ok { color: var(--ok); }
.stock-out { color: var(--danger); }

.product-price {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-faint);
}
.empty-state-icon { font-size: 32px; margin-bottom: 10px; opacity: 0.5; }

/* buttons */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  border-radius: 10px;
  border: none;
  padding: 13px 18px;
  cursor: pointer;
  width: 100%;
  transition: opacity 0.15s ease;
}
.btn:active { opacity: 0.7; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: rgba(240,85,90,0.12); color: var(--danger); }
.btn:disabled { opacity: 0.4; pointer-events: none; }

/* sheet / modal */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: flex-end;
  z-index: 50;
}
.sheet-overlay[hidden] {
  display: none;
}
.sheet {
  width: 100%;
  background: var(--panel);
  border-radius: 20px 20px 0 0;
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  max-height: 85vh;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}

.sheet-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 4px;
}
.sheet-sub {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 18px;
}

.sheet-price {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  margin: 14px 0;
}

.field-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
  display: block;
}
.field-input, .field-select, .field-textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
}
.field-textarea { resize: vertical; min-height: 70px; }

.pay-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.pay-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
}
.pay-option.selected { border-color: var(--accent); }
.pay-option-label { font-size: 14px; font-weight: 500; }

.order-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.order-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.order-id { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }
.order-status {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.status-pending { background: rgba(139,147,161,0.15); color: var(--text-dim); }
.status-paid { background: rgba(61,139,255,0.15); color: var(--accent); }
.status-delivered { background: rgba(52,211,153,0.15); color: var(--ok); }
.status-dispute { background: rgba(240,85,90,0.15); color: var(--danger); }

.warranty-note {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 6px;
}

.seller-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.stat-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.stat-label { font-size: 11px; color: var(--text-faint); margin-bottom: 6px; }
.stat-value { font-family: var(--font-mono); font-size: 20px; font-weight: 600; }

.loader {
  text-align: center;
  padding: 40px 0;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 13px;
}

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  z-index: 100;
}

.stock-textarea-hint {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: -8px;
  margin-bottom: 14px;
}
