/* Berry Bomb Packaging Tracker — "Habitz"-style pastel UI (mobile-first).
   Soft lavender ground, white rounded cards, purple primary, playful accents,
   Poppins throughout. */
:root {
  --purple: #7c3aed;
  --purple-deep: #6d28d9;
  --purple-soft: #ede9fe;
  --lav: #f5f3fc;

  --pink: #ec4899;
  --pink-soft: #fce7f1;
  --orange: #f97316;
  --orange-soft: #ffedd5;
  --teal: #14b8a6;
  --teal-soft: #d3f4ef;
  --blue: #6366f1;
  --blue-soft: #e5e7fd;
  --yellow: #f59e0b;
  --yellow-soft: #fef3c7;
  --green: #10b981;
  --green-soft: #d1fae5;
  --red: #ef4444;
  --red-soft: #fde4e4;

  --ink: #2c2838;
  --ink-soft: #837c99;
  --cream: #ffffff;
  --bg: #f5f3fc;
  --line: #ece7f6;

  --good: #0e9f6e;
  --good-bg: #d5f5e7;
  --warn: #b7791f;
  --warn-bg: #fef3c7;
  --bad: #e0455e;
  --bad-bg: #fde4e6;

  --radius: 20px;
  --shadow: 0 6px 18px rgba(124, 58, 237, 0.10);
  font-size: 17px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(120deg, var(--purple-soft), var(--lav));
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand .berry { font-size: 1.3rem; }
.brand .sub { color: var(--purple); }
.who { display: flex; align-items: center; gap: 10px; }
.chip { padding: 6px 13px; border-radius: 999px; font-weight: 700; font-size: .8rem; }
.chip-admin { background: var(--purple); color: #fff; }
.chip-staff { background: var(--purple-soft); color: var(--purple-deep); }
.logout { color: var(--ink-soft); font-size: .85rem; text-decoration: none; }

/* Admin nav */
.adminnav {
  display: flex; gap: 6px; overflow-x: auto; padding: 10px 12px;
  background: #fff; border-bottom: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}
.adminnav a {
  white-space: nowrap; padding: 8px 15px; border-radius: 999px;
  background: var(--purple-soft); color: var(--purple-deep); text-decoration: none;
  font-weight: 600; font-size: .85rem;
}
.adminnav a:hover { background: var(--purple); color: #fff; }

.wrap { max-width: 720px; margin: 0 auto; padding: 18px 16px; }

h1 { font-size: 1.55rem; font-weight: 800; margin: 4px 0; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; font-weight: 700; margin: 24px 0 12px; }
.muted { color: var(--ink-soft); }
.center { text-align: center; }

/* Flash messages */
.flash { padding: 13px 16px; border-radius: 14px; margin-bottom: 14px; font-weight: 600; }
.flash-success { background: var(--good-bg); color: var(--good); }
.flash-error { background: var(--bad-bg); color: var(--bad); }
.flash-warn { background: var(--warn-bg); color: var(--warn); }
.flash-info { background: var(--purple-soft); color: var(--purple-deep); }

/* Cards */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.card-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }

/* Big action cards (staff home) — colorful gradients like the habit cards */
.action-card {
  display: block; text-decoration: none; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); margin-bottom: 16px;
  position: relative; overflow: hidden;
}
.action-card:active { transform: scale(.99); }
.action-card .big-num { font-size: 2.7rem; font-weight: 800; line-height: 1; }
.action-card .label { font-size: 1.2rem; font-weight: 700; margin-top: 6px; }
.action-card .hint { color: var(--ink-soft); font-size: .9rem; margin-top: 2px; }
/* Gradient variants (white text) */
.action-card.acc-pink,
.action-card.acc-orange,
.action-card.acc-teal { color: #fff; border: none; }
.action-card.acc-pink { background: linear-gradient(135deg, #f472b6, #ec4899); }
.action-card.acc-orange { background: linear-gradient(135deg, #fb923c, #f97316); }
.action-card.acc-teal { background: linear-gradient(135deg, #2dd4bf, #12a594); }
.action-card.acc-pink .hint,
.action-card.acc-orange .hint,
.action-card.acc-teal .hint { color: rgba(255, 255, 255, .9); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px 18px; border: none; border-radius: 14px;
  font-family: inherit; font-size: 1.02rem; font-weight: 700; cursor: pointer;
  text-decoration: none; color: var(--purple-deep); background: var(--purple-soft);
}
.btn:active { transform: scale(.99); }
.btn-primary { background: var(--purple); color: #fff; }
.btn-primary:hover { background: var(--purple-deep); }
.btn-good { background: var(--green); color: #fff; }
.btn-bad { background: var(--red); color: #fff; }
.btn-ghost { background: #fff; border: 2px solid var(--line); color: var(--ink); }
.btn-sm { width: auto; padding: 10px 16px; font-size: .9rem; }
.btn-row { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 8px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }

/* Forms */
label { display: block; font-weight: 600; margin: 12px 0 6px; }
input[type=text], input[type=password], input[type=email], input[type=number],
select, textarea {
  width: 100%; padding: 14px; font-size: 1.02rem; border: 2px solid var(--line);
  border-radius: 13px; background: #fff; color: var(--ink); font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--purple); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Stepper (+/-) */
.stepper { display: flex; align-items: center; gap: 14px; justify-content: center; margin: 8px 0; }
.stepper button {
  width: 62px; height: 62px; border-radius: 50%; border: none; font-size: 2rem; font-weight: 700;
  background: var(--purple-soft); color: var(--purple); cursor: pointer; font-family: inherit;
}
.stepper button:active { background: var(--purple); color: #fff; }
.stepper .value { font-size: 2.4rem; font-weight: 800; min-width: 90px; text-align: center; }
.stepper-label { text-align: center; font-weight: 600; color: var(--ink-soft); }

/* Pack cards / grid */
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.pack {
  border-radius: 16px; padding: 12px 8px; text-align: center; text-decoration: none;
  border: 2px solid var(--line); background: #fff; color: var(--ink);
}
.pack .short { font-size: 1.35rem; font-weight: 800; }
.pack .full { font-size: .62rem; color: var(--ink-soft); word-break: break-all; }
.pack .badge { margin-top: 6px; }
.pack.selectable { cursor: pointer; }
.pack.selected { border-color: var(--purple); background: var(--purple-soft); }
.pack.disabled { opacity: .55; background: #f8f6fc; cursor: not-allowed; }

/* Status badges */
.badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: .68rem; font-weight: 700; letter-spacing: .02em;
}
.b-MASTER { background: var(--yellow-soft); color: var(--warn); }
.b-IN_TRANSIT { background: var(--blue-soft); color: #4338ca; }
.b-SHOP_UNVERIFIED { background: var(--pink-soft); color: var(--pink); }
.b-SHOP_VERIFIED { background: var(--teal-soft); color: #0f766e; }
.b-OPENED { background: var(--purple-soft); color: var(--purple-deep); }
.b-EXCEPTION { background: var(--red-soft); color: var(--bad); }
.b-RECOUNT { background: var(--red-soft); color: var(--bad); }

/* Lists */
.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 4px; border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: none; }
.code { font-weight: 700; }
.code .full { font-size: .72rem; color: var(--ink-soft); font-weight: 500; }

/* Tables (reports) */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--ink-soft); font-size: .72rem; text-transform: uppercase; font-weight: 600; }

/* Dashboard tiles */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { background: var(--lav); border: 1px solid var(--line); border-radius: 14px; padding: 11px; text-align: center; }
.tile .n { font-size: 1.4rem; font-weight: 800; }
.tile .t { font-size: .66rem; color: var(--ink-soft); text-transform: uppercase; font-weight: 600; }
.tile.alert .n { color: var(--bad); }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 18px 24px; border-left: 2px solid var(--purple-soft); }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--purple);
}
.timeline .when { font-size: .78rem; color: var(--ink-soft); }
.timeline .ev { font-weight: 700; }

/* Staff selector on login */
.staff-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.staff-btn {
  padding: 18px; border-radius: 16px; border: 2px solid var(--purple-soft); background: #fff;
  font-weight: 700; font-size: 1.05rem; cursor: pointer; text-align: center; font-family: inherit;
  color: var(--ink);
}
.staff-btn.active { background: var(--purple); color: #fff; border-color: var(--purple); }

/* PIN pad */
.pin-display { text-align: center; font-size: 2.4rem; letter-spacing: .5rem; margin: 10px 0; min-height: 3rem; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 320px; margin: 0 auto; }
.pinpad button {
  padding: 20px; font-size: 1.6rem; font-weight: 700; border: none; border-radius: 16px;
  background: var(--purple-soft); color: var(--purple-deep); cursor: pointer; font-family: inherit;
}
.pinpad button:active { background: var(--purple); color: #fff; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tabs button {
  flex: 1; padding: 12px; border: 2px solid var(--line); border-radius: 13px; font-weight: 700;
  cursor: pointer; background: #fff; color: var(--ink-soft); font-family: inherit;
}
.tabs button.active { background: var(--purple-soft); color: var(--purple-deep); border-color: var(--purple); }

.photo-preview { max-width: 100%; border-radius: 16px; margin-top: 10px; display: none; }
.spacer { height: 8px; }
.hidden { display: none; }
details.correct-box summary { cursor: pointer; font-weight: 600; color: var(--purple); }

/* Bottom navigation tabs */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: #fff; border-top: 1px solid var(--line);
  box-shadow: 0 -4px 14px rgba(124, 58, 237, 0.06);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav-inner {
  max-width: 720px; margin: 0 auto;
  display: flex; justify-content: space-around; align-items: stretch;
  padding: 6px 4px;
}
.bottomnav-inner a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  text-decoration: none; color: var(--ink-soft); font-size: .66rem; font-weight: 600;
  padding: 6px 2px; border-radius: 12px;
}
.bottomnav-inner a .ic { font-size: 1.4rem; line-height: 1; }
.bottomnav-inner a.active { color: var(--purple); background: var(--purple-soft); }
