:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #16202b;
  --muted: #67737f;
  --brand: #0e7a5f;
  --brand-dark: #0a5c48;
  --accent: #ff7a3c;
  --danger: #c8402f;
  --line: #e3e7ec;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(20, 30, 40, 0.08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
h1, h2, h3 { margin: 0 0 .5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
a { color: var(--brand); }

.topbar {
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .logo { font-weight: 800; font-size: 1.2rem; letter-spacing: -0.5px; }
.topbar .logo span { color: #ffd9a8; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: .85rem; opacity: .9; white-space: nowrap; }
.topbar > button { background: rgba(255,255,255,.15); color: #fff; border: none; }
.topbar > button:hover { background: rgba(255,255,255,.3); }

.tabs {
  display: flex;
  gap: 4px;
  /* On narrow screens the strip scrolls sideways instead of overflowing. */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  max-width: 100%;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  background: transparent; color: #d9efe8; border: none;
  padding: 8px 12px; border-radius: 8px; font-weight: 600;
  white-space: nowrap; flex-shrink: 0;
}
.tabs button.active { background: rgba(255,255,255,.22); color: #fff; }
.tabs button .badge { margin-left: 4px; }

.container { max-width: 1000px; margin: 24px auto; padding: 0 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.card.clickable { cursor: pointer; }
.card.clickable:hover { border-color: var(--brand); }

.grid { display: grid; gap: 14px; }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

button {
  font: inherit;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: var(--brand-dark); }
button.secondary { background: #eef1f4; color: var(--ink); }
button.secondary:hover { background: #e0e5ea; }
button.danger { background: var(--danger); }
button.small { padding: 5px 10px; font-size: .85rem; }
button:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 10px;
}
textarea { min-height: 80px; resize: vertical; }
label { display: block; font-size: .82rem; font-weight: 700; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .03em; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

.muted { color: var(--muted); font-size: .88rem; }
.small { font-size: .85rem; }

.badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: #e8f0ed;
  color: var(--brand-dark);
  text-transform: uppercase;
  letter-spacing: .04em;
  vertical-align: middle;
}
.badge:empty { display: none; }
.badge.warn { background: #fdeedd; color: #9a5b13; }
.badge.danger { background: #fbe3df; color: var(--danger); }
.badge.info { background: #e3ecfb; color: #2456a8; }
.badge.neutral { background: #edf0f3; color: var(--muted); }

.cat-tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 10px;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
}
.cat-tile:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.cat-tile .icon { font-size: 1.8rem; display: block; margin-bottom: 6px; }
.cat-tile.selected { border-color: var(--brand); background: #eaf5f1; }

.statline {
  display: flex; gap: 12px; flex-wrap: wrap;
}
.stat {
  flex: 1; min-width: 130px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; text-align: center;
}
.stat .num { font-size: 1.6rem; font-weight: 800; color: var(--brand-dark); }
.stat .lbl { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.timeline { list-style: none; margin: 8px 0 0; padding: 0; }
.timeline li { padding: 4px 0 4px 18px; position: relative; font-size: .88rem; }
.timeline li::before {
  content: ""; position: absolute; left: 4px; top: 10px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand);
}

.progress-steps { display: flex; gap: 4px; margin: 10px 0; }
.progress-steps .step {
  flex: 1; height: 6px; border-radius: 3px; background: #e0e5ea;
}
.progress-steps .step.done { background: var(--brand); }

.vendor-card { display: flex; gap: 14px; align-items: flex-start; }
.vendor-card .avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem; flex-shrink: 0;
}
.vendor-card .body { flex: 1; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; padding: 8px; border-bottom: 2px solid var(--line); }
td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }

.notice { background: #eaf5f1; border: 1px solid #bedfd4; border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: .9rem; }
.notice.warn { background: #fdf3e4; border-color: #f0d9b0; }
.error-box { background: #fbe3df; border: 1px solid #f0b9b0; color: var(--danger); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; font-size: .9rem; }

.auth-wrap { max-width: 420px; margin: 7vh auto; padding: 0 16px; }
.auth-hero { text-align: center; margin-bottom: 22px; }
.auth-hero .logo { font-size: 2rem; font-weight: 800; color: var(--brand-dark); }
.auth-hero .logo span { color: var(--accent); }
.demo-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 99px;
  font-size: .9rem; box-shadow: 0 4px 14px rgba(0,0,0,.25); z-index: 50;
  animation: fadeup .25s ease;
}
@keyframes fadeup { from { opacity: 0; transform: translate(-50%, 8px); } }

.notif-item { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.notif-item.unread { font-weight: 600; }
.notif-item .when { color: var(--muted); font-size: .78rem; font-weight: 400; }

.header-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.checkline { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; margin-bottom: 12px; }
.checkline input { width: auto; margin: 3px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 99px; padding: 5px 12px; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.chip.selected { background: var(--brand); border-color: var(--brand); color: #fff; }
.stars { color: #e8a40c; font-size: 1.1rem; letter-spacing: 2px; cursor: pointer; user-select: none; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ------------------------------------------------------------- mobile ---- */
@media (max-width: 700px) {
  .topbar { padding: 8px 12px; }
  /* Tabs drop to their own full-width row and scroll sideways. */
  .tabs { order: 10; width: 100%; }
  .topbar .who { margin-left: auto; }
}
@media (max-width: 640px) {
  .container { margin: 14px auto; }
  .card { padding: 14px; }
  .row { flex-direction: column; gap: 0; }
  .stat { min-width: 100px; padding: 10px; }
  .stat .num { font-size: 1.3rem; }
  .grid.cols-4 { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .vendor-card .avatar { width: 40px; height: 40px; }
}
