/* ── RESET & BASE ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #f5f7fa;
  --white:    #ffffff;
  --border:   #e2e6ea;
  --text:     #1a1d23;
  --muted:    #6b7280;
  --accent:   #f97316;
  --blue:     #2563eb;
  --green:    #16a34a;
  --red:      #dc2626;
  --amber:    #d97706;
  --radius:   14px;
  --sidebar:  260px;
  --topbar:   60px;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

/* ── LOGIN ───────────────────────────────────────────────────────── */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fff7ed 0%, #eff6ff 100%);
  padding: 24px;
}

.login-wrap { width: 100%; max-width: 420px; }

.login-logo {
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 4px;
  color: var(--text);
}
.login-logo span { color: var(--accent); }

.login-sub {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 28px;
  letter-spacing: 0.5px;
}

.login-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.08);
}

.login-card label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  margin-top: 16px;
  color: var(--text);
}
.login-card label:first-child { margin-top: 0; }

/* ── INPUTS ──────────────────────────────────────────────────────── */
input[type=text], input[type=password], input[type=number],
input[type=search], input[type=email], select, textarea {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder { color: #adb5bd; }

/* ── BUTTONS ─────────────────────────────────────────────────────── */
button { cursor: pointer; font-family: inherit; border: none; outline: none; }

.btn-primary {
  width: 100%;
  padding: 15px;
  margin-top: 22px;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  font-size: 17px;
  font-weight: 700;
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover  { background: #ea6c0a; }
.btn-primary:active { transform: scale(0.98); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-orange { background: var(--accent); color: #fff; }
.btn-blue   { background: var(--blue);   color: #fff; }
.btn-green  { background: var(--green);  color: #fff; }
.btn-red    { background: var(--red);    color: #fff; }
.btn-ghost  { background: #f1f3f5; color: var(--text); border: 1px solid var(--border); }
.btn:hover  { opacity: 0.88; }

.btn-signout {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  background: #fee2e2;
  color: var(--red);
}
.btn-signout:hover { background: #fecaca; }

/* ── TOPBAR ──────────────────────────────────────────────────────── */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar);
  background: var(--white);
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 200;
  gap: 12px;
}

#topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 17px;
}

#topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

#topbar-user {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

#menu-toggle {
  background: none;
  font-size: 22px;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}
#menu-toggle:hover { background: var(--bg); }

/* ── LAYOUT ──────────────────────────────────────────────────────── */
#layout {
  display: flex;
  min-height: 100vh;
  padding-top: var(--topbar);
}

/* ── SIDEBAR ─────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar);
  min-height: calc(100vh - var(--topbar));
  background: var(--white);
  border-right: 2px solid var(--border);
  padding: 16px 10px;
  flex-shrink: 0;
  position: sticky;
  top: var(--topbar);
  height: calc(100vh - var(--topbar));
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  text-align: left;
  margin-bottom: 4px;
  transition: all 0.15s;
}
.nav-item:hover  { background: #fff7ed; color: var(--accent); }
.nav-item.active { background: #fff7ed; color: var(--accent); }
.nav-icon { font-size: 20px; width: 26px; text-align: center; }

#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 149;
}

/* ── PAGE CONTENT ────────────────────────────────────────────────── */
#page-content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  overflow-x: hidden;
}

/* ── PAGE HEADER ─────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
}
.page-title small {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}

/* ── CARDS ───────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

/* ── STAT CARDS ──────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  margin-bottom: 6px;
}
.stat-val {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}
.stat-val.orange { color: var(--accent); }
.stat-val.blue   { color: var(--blue); }
.stat-val.green  { color: var(--green); }
.stat-val.red    { color: var(--red); }

/* ── TABLES ──────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--white); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead tr { background: #f8f9fa; }
th {
  padding: 12px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
  white-space: nowrap;
  border-bottom: 2px solid var(--border);
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f3f5;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fffbf7; }
.tr { text-align: right; }
.mono { font-family: 'Courier New', monospace; font-size: 13px; }
.sm   { font-size: 12px; color: var(--muted); }

/* ── STATUS BADGES ───────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-imported  { background: #f1f3f5; color: #495057; }
.badge-picked    { background: #dbeafe; color: #1d4ed8; }
.badge-packed    { background: #ffedd5; color: #c2410c; }
.badge-shipped   { background: #dcfce7; color: #15803d; }
.badge-exception { background: #fee2e2; color: #b91c1c; }

/* ── SCAN INPUT ──────────────────────────────────────────────────── */
.scan-box {
  width: 100%;
  padding: 20px;
  font-size: 22px;
  font-family: 'Courier New', monospace;
  text-align: center;
  border: 3px solid var(--border);
  border-radius: 12px;
  background: #fff;
  letter-spacing: 2px;
  transition: border-color 0.2s;
}
.scan-box:focus { border-color: var(--accent); outline: none; }
.scan-box::placeholder { letter-spacing: 0; font-size: 16px; font-family: inherit; color: #adb5bd; }

/* ── RESULT CARDS ────────────────────────────────────────────────── */
.result-card {
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
  border: 2px solid transparent;
}
.result-ok   { background: #f0fdf4; border-color: #86efac; }
.result-err  { background: #fef2f2; border-color: #fca5a5; }
.result-warn { background: #fffbeb; border-color: #fcd34d; }
.result-title { font-size: 20px; font-weight: 800; margin-bottom: 10px; }
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 6px 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  font-size: 15px;
  gap: 12px;
}
.result-row:last-child { border-bottom: none; }
.result-row span:first-child { color: var(--muted); font-size: 13px; flex-shrink: 0; }
.result-row span:last-child  { font-weight: 600; text-align: right; }

/* ── UPLOAD ZONE ─────────────────────────────────────────────────── */
.upload-zone {
  border: 3px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fafbfc;
}
.upload-zone:hover, .upload-zone.drag {
  border-color: var(--accent);
  background: #fff7ed;
}
.upload-icon  { font-size: 48px; margin-bottom: 12px; }
.upload-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.upload-sub   { color: var(--muted); font-size: 14px; }

/* ── MESSAGES ────────────────────────────────────────────────────── */
.msg-error { color: var(--red);   font-weight: 600; font-size: 14px; margin-top: 10px; }
.msg-ok    { color: var(--green); font-weight: 600; font-size: 14px; margin-top: 10px; }

/* ── FILTER ROW ──────────────────────────────────────────────────── */
.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}
.filter-row input  { max-width: 280px; font-size: 15px; }
.filter-row select { max-width: 180px; font-size: 15px; }

/* ── MODAL ───────────────────────────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--white);
  border-radius: 20px;
  padding: 28px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.modal .modal-sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.modal label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-top: 14px;
  margin-bottom: 5px;
}
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── REPORT TABS ─────────────────────────────────────────────────── */
.tab-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  background: #f1f3f5;
  padding: 4px;
  border-radius: 10px;
  width: fit-content;
}
.tab-btn {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  background: none;
  color: var(--muted);
  border: none;
  transition: all 0.15s;
}
.tab-btn.active { background: var(--white); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,0.1); }

/* ── MISC ────────────────────────────────────────────────────────── */
.flex-row   { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.divider    { height: 1px; background: var(--border); margin: 18px 0; }
.loading    { padding: 60px; text-align: center; color: var(--muted); font-size: 16px; }
.empty      { padding: 48px; text-align: center; color: var(--muted); font-size: 15px; }
.text-right { text-align: right; }
.section-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; color: var(--text); }

/* ── MOBILE ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    top: var(--topbar);
    left: 0;
    height: calc(100vh - var(--topbar));
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  }
  #sidebar.open { transform: translateX(0); }
  #sidebar-overlay.open { display: block; }
  #page-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .filter-row input, .filter-row select { max-width: 100%; }
  #topbar-user { display: none; }
  .scan-box { font-size: 18px; padding: 16px; }
}
@media (min-width: 769px) {
  #menu-toggle { display: none; }
}

/* ── PHOTO GALLERY ───────────────────────────────────────────── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.photo-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.photo-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.photo-img-wrap {
  position: relative;
  width: 100%;
  height: 200px;
  background: #f8f9fa;
  overflow: hidden;
}
.photo-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-missing {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  gap: 4px;
}

.photo-card-body   { padding: 12px; }
.photo-card-sku    { font-family: monospace; font-size: 12px; color: var(--accent); font-weight: 700; margin-bottom: 4px; }
.photo-card-name   { font-size: 14px; font-weight: 600; line-height: 1.3; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-card-variation { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.photo-card-meta   { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 3px; gap: 8px; }
.photo-card-meta strong { color: var(--text); }
.photo-card-tracking { font-family: monospace; font-size: 11px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 600px) {
  .photo-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .photo-img-wrap { height: 140px; }
  .photo-card-body { padding: 8px; }
  .photo-card-name { font-size: 12px; }
}

/* ── DASHBOARD GRID ──────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.dash-card {
  border-radius: 16px;
  padding: 20px 16px;
  text-align: center;
  border: 2px solid transparent;
  transition: transform 0.15s, box-shadow 0.15s;
  user-select: none;
}
.dash-card.clickable {
  cursor: pointer;
}
.dash-card.clickable:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.dash-card.clickable:active { transform: scale(0.97); }

.dash-icon  { font-size: 32px; margin-bottom: 8px; }
.dash-num   { font-size: 42px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.dash-label { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.dash-sub   { font-size: 11px; opacity: 0.7; }

.dash-card-blue   { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.dash-card-blue   .dash-num { color: #1d4ed8; }
.dash-card-orange { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.dash-card-orange .dash-num { color: #f97316; }
.dash-card-purple { background: #faf5ff; border-color: #e9d5ff; color: #7c3aed; }
.dash-card-purple .dash-num { color: #7c3aed; }
.dash-card-green  { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.dash-card-green  .dash-num { color: #16a34a; }
.dash-card-green2 { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.dash-card-green2 .dash-num { color: #059669; }
.dash-card-red    { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.dash-card-red    .dash-num { color: #dc2626; }
.dash-card-teal   { background: #f0fdfa; border-color: #99f6e4; color: #0f766e; }
.dash-card-teal   .dash-num { color: #0d9488; }

@media (max-width: 600px) {
  .dash-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dash-num  { font-size: 32px; }
  .dash-icon { font-size: 24px; }
}

/* ── COLLECTED STATUS BADGE ──────────────────────────────────── */
.badge-collected { background: #f0fdf4; color: #059669; border: 1px solid #6ee7b7; }

/* ── COLLECTION PAGE ─────────────────────────────────────────── */

/* ── PICK LIST — full height, no scroll clipping ────────────────── */
#picklist-container .table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  max-height: none;
}
#picklist-container table {
  width: 100%;
}
#picklist-container td {
  vertical-align: middle;
}

/* Delivered badge */
.badge-delivered { background:#f0fdf4; color:#15803d; border:1px solid #86efac; }


/* Do Not Send badge */
.badge-do_not_send { background:#fef2f2; color:#dc2626; border:1px solid #fca5a5; font-weight:700; }
