:root {
  --bg:       #0f0f1a;
  --surface:  #1a1a2e;
  --surface2: #16213e;
  --border:   #2a2a4a;
  --primary:  #1565c0;
  --primary-l:#1976d2;
  --green:    #2e7d32;
  --green-l:  #43a047;
  --red:      #c62828;
  --text:     #eaeaea;
  --muted:    #888;
  --radius:   14px;
  --shadow:   0 4px 24px rgba(0,0,0,0.5);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  font-size: 15px;
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 32px;
}

.hidden { display: none !important; }

/* ── Header ── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  position: sticky; top: 0; z-index: 10;
}
.header-inner { display: flex; align-items: center; gap: 10px; }
.header-title { font-size: 1rem; font-weight: 700; flex: 1; }
.header-sub { font-size: 0.72rem; color: var(--muted); }

/* ── Card ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  margin: 12px 16px 0;
}
.card-title { font-size: 0.78rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 12px; }

/* ── Pair grid ── */
.pair-grid { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 0; }

.pair-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .18s, background .18s;
  user-select: none;
}
.pair-card:active { background: var(--surface2); }
.pair-card.selected {
  border-color: var(--primary);
  background: rgba(21,101,192,0.10);
}
.pair-label { font-size: 0.95rem; font-weight: 700; margin-bottom: 6px; }
.pair-detail {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.78rem; color: var(--muted);
}
.pair-arrow { color: var(--primary); font-size: 1rem; }
.pair-ratio-badge {
  margin-left: auto;
  background: rgba(21,101,192,0.15);
  color: #7ecfff;
  font-size: 0.72rem; font-weight: 700;
  padding: 3px 8px; border-radius: 20px;
}

/* ── Qty section ── */
.qty-section { padding: 0 16px; margin-top: 12px; }
.qty-label { font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; }
.qty-row { display: flex; gap: 10px; align-items: center; }
.qty-input {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text);
  font-size: 1.5rem; font-weight: 700; text-align: center;
  padding: 12px; outline: none;
}
.qty-input:focus { border-color: var(--primary); }
.qty-unit { font-size: 0.85rem; color: var(--muted); min-width: 36px; }

/* ── Preview ── */
.preview-box {
  margin: 10px 16px 0;
  background: rgba(21,101,192,0.08);
  border: 1px solid rgba(21,101,192,0.25);
  border-radius: 10px; padding: 12px 14px;
}
.preview-row { display: flex; justify-content: space-between; font-size: 0.85rem; padding: 3px 0; }
.preview-out { color: #ef9a9a; font-weight: 700; }
.preview-in  { color: #a5d6a7; font-weight: 700; }

/* ── Form group ── */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 5px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 10px 12px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 0.9rem; outline: none;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary); }
.form-group textarea { resize: none; min-height: 72px; }

/* ── Buttons ── */
.btn {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  font-size: 1rem; font-weight: 700; cursor: pointer; transition: opacity .15s;
}
.btn:active { opacity: .82; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary   { background: var(--primary);  color: #fff; }
.btn-approve   { background: var(--green);    color: #fff; }
.btn-reject    { background: var(--red);      color: #fff; }
.btn-outline   { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-sm { padding: 8px 14px; font-size: 0.82rem; border-radius: 8px; width: auto; }

/* ── Status ── */
.status-badge {
  display: inline-block; padding: 4px 12px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 700;
}
.status-pending  { background: rgba(255,213,79,.15); color: #ffd54f; }
.status-approved { background: rgba(76,175,80,.15);  color: #81c784; }
.status-rejected { background: rgba(239,154,154,.15);color: #ef9a9a; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: #333; color: #fff; padding: 10px 20px;
  border-radius: 24px; font-size: 0.88rem;
  transition: transform .3s, opacity .3s; opacity: 0; z-index: 999;
  white-space: nowrap; pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }

/* ── Loading ── */
.loading { text-align: center; padding: 40px 16px; color: var(--muted); font-size: 0.9rem; }
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty ── */
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-ico { font-size: 2.5rem; display: block; margin-bottom: 10px; }

/* ── Section title ── */
.section-title {
  font-size: 0.72rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
  padding: 16px 16px 6px;
}

/* ── List item ── */
.item-list { padding: 0 16px; }
.list-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 8px;
}
.list-item-info { flex: 1; min-width: 0; }
.list-item-name { font-size: 0.9rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-sub  { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }

.btn-icon {
  background: none; border: none; cursor: pointer; padding: 6px 8px;
  border-radius: 6px; color: var(--muted); font-size: 0.9rem; flex-shrink: 0;
}
.btn-icon:active { background: rgba(255,255,255,.08); }
.btn-icon.del:active { color: var(--red); }

/* ── Search dropdown ── */
.search-dropdown {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; margin-top: 4px; max-height: 220px; overflow-y: auto;
}
.search-item { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.search-item:last-child { border-bottom: none; }
.search-item:active { background: var(--surface2); }
.si-sku  { font-size: 0.72rem; color: #7ecfff; font-weight: 700; }
.si-name { font-size: 0.85rem; }

/* ── History table ── */
.hist-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.hist-table th {
  background: var(--surface2); padding: 8px 10px; text-align: left;
  color: var(--muted); font-size: 0.72rem; text-transform: uppercase;
  border-bottom: 2px solid var(--border);
}
.hist-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.hist-table tr:hover td { background: var(--surface2); }

/* ── Approve page specific ── */
.approve-shell { padding: 16px; }
.approve-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 16px;
}
.approve-header { padding: 14px 16px; font-weight: 700; font-size: 0.95rem; }
.approve-body   { padding: 14px 16px; }
.info-row { display: flex; justify-content: space-between;
  font-size: 0.85rem; padding: 4px 0; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--muted); }
.qty-out { color: #ef9a9a; font-weight: 700; }
.qty-in  { color: #a5d6a7; font-weight: 700; }
.action-row { display: flex; gap: 10px; margin-top: 8px; }
.action-row .btn { flex: 1; }

/* ── Overlay ── */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: none; align-items: flex-end; justify-content: center; z-index: 100;
}
.overlay.show { display: flex; }
.sheet {
  background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 20px 16px 32px; width: 100%; max-height: 90vh; overflow-y: auto;
}
.sheet-title { font-size: 1rem; font-weight: 700; margin-bottom: 16px; }

/* ── Admin tabs ── */
.tabs { display: flex; gap: 6px; padding: 12px 16px 0; }
.tab-btn {
  flex: 1; padding: 10px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; color: var(--muted); font-size: 0.82rem; cursor: pointer;
}
.tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Damaged Good items ── */
.dg-item {
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); margin-bottom: 6px;
  transition: border-color .15s, background .15s;
}
.dg-item:active { background: var(--surface2); }
.dg-item.dg-selected {
  border-color: #ffd54f;
  background: rgba(255,213,79,.08);
}

/* ── Stock badge ── */
.stock-badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600;
}
.stock-ok  { background: rgba(76,175,80,.15);  color: #81c784; }
.stock-low { background: rgba(239,83,80,.15);  color: #ef9a9a; }

/* ── filter/search row ── */
.toolbar { display: flex; gap: 8px; padding: 12px 16px 0; flex-wrap: wrap; }
.toolbar input[type="search"], .toolbar select {
  flex: 1; min-width: 0; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 0.82rem; outline: none;
}
.toolbar input:focus, .toolbar select:focus { border-color: var(--primary); }
