:root {
  --bg: #f4f3ee;
  --surface: #ffffff;
  --border: #e3e1d8;
  --border-strong: #cfccc0;
  --text: #2c2c2a;
  --text-muted: #6b6a64;
  --text-faint: #94938c;
  --accent: #1d7a5f;
  --accent-bg: #e1f5ee;
  --accent-text: #0f6e56;
  --danger: #a32d2d;
  --danger-bg: #fcebeb;
  --amber-bg: #faeeda;
  --amber-text: #854f0b;
  --green-bg: #e1f5ee;
  --green-text: #0f6e56;
  --red-bg: #fcebeb;
  --red-text: #a32d2d;
  --radius: 10px;
  --radius-sm: 7px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 72px;
}

.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 10px;
}
.brand { font-weight: 600; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
}
.topbar-badge {
  margin-left: auto; font-size: 12px; color: var(--text-muted);
  background: var(--bg); padding: 4px 11px; border-radius: var(--radius-sm);
}

.content { max-width: 560px; margin: 0 auto; padding: 16px; }

.flash {
  padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 14px;
}
.flash-success { background: var(--green-bg); color: var(--green-text); }
.flash-error { background: var(--danger-bg); color: var(--danger); }

h2.screen-title { font-size: 16px; font-weight: 600; margin: 4px 0 14px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
}

label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 5px; }
input[type="text"], input[type="date"], select {
  width: 100%; padding: 10px 12px; font-size: 15px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); margin-bottom: 14px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; font-size: 14px; font-weight: 500;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--accent-bg); color: var(--accent-text); border-color: var(--accent); }
.btn-primary:hover { background: #d2efe5; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .name { font-size: 15px; }
.list-item .dates { font-size: 12px; color: var(--text-faint); }
.iconbtn {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius-sm); padding: 7px 9px; cursor: pointer; font-size: 14px;
  color: var(--text-muted);
}
.iconbtn:hover { background: var(--bg); }
.iconbtn.danger { color: var(--danger); }

.pct {
  font-size: 13px; font-weight: 600; padding: 4px 10px;
  border-radius: var(--radius-sm); white-space: nowrap;
}
.pct-green { background: var(--green-bg); color: var(--green-text); }
.pct-amber { background: var(--amber-bg); color: var(--amber-text); }
.pct-red { background: var(--red-bg); color: var(--red-text); }

.muted { color: var(--text-muted); font-size: 13px; }
.section-label { font-size: 13px; font-weight: 600; color: var(--text-muted); margin: 18px 0 6px; }

/* Calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-month { font-weight: 600; font-size: 15px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--text-faint); padding: 2px 0; }
.cal-cell {
  aspect-ratio: 1; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 4px; font-size: 12px; display: flex; flex-direction: column;
  text-decoration: none; color: var(--text-muted); background: var(--surface);
}
.cal-cell.empty { border: none; background: transparent; }
.cal-cell.has-events { cursor: pointer; }
.cal-cell.has-events:hover { border-color: var(--border-strong); }
.cal-cell.today { border-color: var(--accent); background: var(--accent-bg); }
.cal-cell.today .daynum { color: var(--accent-text); font-weight: 600; }
.cal-count {
  margin-top: auto; align-self: flex-start;
  background: #cecbf6; color: #3c3489;
  font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 8px;
}
.cal-band {
  margin-top: auto; align-self: center;
  font-size: 10px; font-weight: 600; padding: 1px 5px; border-radius: 6px;
}
.cal-hint { margin-top: 12px; font-size: 12px; color: var(--text-faint); }

.day-detail { margin-top: 16px; }
.day-detail .row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}

.band-chip {
  display: inline-block; background: var(--bg); font-size: 12px;
  padding: 4px 9px; border-radius: var(--radius-sm); margin: 0 5px 5px 0;
}

/* Bottom nav */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; background: var(--surface); border-top: 1px solid var(--border);
}
.navitem {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 4px; font-size: 11px; text-decoration: none; color: var(--text-faint);
  border-right: 1px solid var(--border);
}
.navitem:last-child { border-right: none; }
.navitem.active { color: var(--accent-text); background: var(--accent-bg); }
.navicon { font-size: 18px; line-height: 1; }

/* --- Added: batch tag, icon-button SVGs, per-product threshold rows --- */
.batch-tag {
  display: inline-block; font-size: 11px; font-weight: 600;
  color: var(--text-muted); background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 1px 7px; margin-left: 6px; vertical-align: middle; white-space: nowrap;
}
.iconbtn { display: inline-flex; align-items: center; justify-content: center; }
.iconbtn svg { display: block; }

.thr-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.thr-row:last-of-type { border-bottom: none; }
.thr-row .grow { flex: 1; min-width: 0; }
.thr-row .name { font-size: 15px; }
.thr-row .dates { font-size: 12px; color: var(--text-faint); }
.thr-select { width: auto; margin-bottom: 0; flex: 0 0 auto; }
