:root {
  --gold: #b8860b;
  --gold-dark: #8a6508;
  --honey: #f7c948;
  --bg: #faf7f0;
  --card: #ffffff;
  --ink: #2c2419;
  --muted: #756d5e;
  --line: #e7e0d2;
  --green: #2e7d32;
  --red: #c62828;
  --radius: 14px;
  --tap: 48px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 20px;
  line-height: 1.4;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  background: var(--gold);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.app-header h1 {
  font-size: 1.15rem;
  margin: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  background: rgba(255,255,255,0.18);
  border: none;
  color: #fff;
  font-size: 1.3rem;
  min-width: 96px;
  height: 56px;
  padding: 0 12px;
  border-radius: 12px;
  cursor: pointer;
  flex: 0 0 auto;
}
.icon-btn:active { background: rgba(255,255,255,0.32); }

/* Hamburger menu */
.menu-wrap { position: relative; flex: 0 0 auto; }
.menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  padding: 6px;
  z-index: 20;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: var(--tap);
  padding: 0 14px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  border-radius: 10px;
  cursor: pointer;
}
.menu-item:active { background: #fbf6e9; }
.menu-item.danger { color: var(--red); }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  z-index: 30;
}

.view {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 16px calc(32px + env(safe-area-inset-bottom));
}

/* Cards / list items */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  min-height: var(--tap);
  cursor: pointer;
}
.list-item:active { background: #fbf6e9; }
.list-item .title { font-weight: 600; }
.list-item .sub { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }

.badge {
  background: var(--honey);
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.hive-badges {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.queen-ind {
  font-size: 1.0rem;
  line-height: 1;
}
.queen-ind.absent { filter: grayscale(0.2); }

.section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 24px 4px 10px;
  font-weight: 700;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 32px 16px;
}

/* Buttons */
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 20px;
  border-radius: 12px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--gold);
  color: #fff;
}
button.btn:active { background: var(--gold-dark); }
button.btn:disabled { opacity: 0.45; cursor: default; }
button.btn.secondary { background: #efe8d8; color: var(--ink); }
button.btn.danger { background: var(--red); }
button.btn.full { width: 100%; }
button.btn.tall { min-height: calc(var(--tap) * 2); }
button.btn.rec { background: var(--red); }
button.btn.rec.recording { animation: pulse 1.1s infinite; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(198,40,40,0.5); }
  50% { box-shadow: 0 0 0 8px rgba(198,40,40,0); }
}

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* Forms */
label.field { display: block; margin-bottom: 16px; }
label.field .lbl { display: block; font-weight: 600; margin-bottom: 6px; }
input[type="text"], input[type="number"], input[type="email"], input[type="password"] {
  width: 100%;
  min-height: var(--tap);
  padding: 0 14px;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}

.login-card { max-width: 420px; margin: 24px auto; }
.login-title { margin: 0 0 16px; font-size: 1.2rem; }
textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  resize: vertical;
}

.stepper {
  display: flex;
  align-items: stretch;
  gap: 10px;
}
.stepper input[type="number"] {
  flex: 1;
  text-align: center;
  -moz-appearance: textfield;
}
.stepper input[type="number"]::-webkit-inner-spin-button,
.stepper input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.step-btn {
  flex: 0 0 auto;
  width: 64px;
  min-height: var(--tap);
  border: none;
  border-radius: 12px;
  background: var(--gold);
  color: #fff;
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.step-btn:active { background: var(--gold-dark); }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row .lbl { font-weight: 500; }
input[type="checkbox"].switch {
  appearance: none;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: #cfc6b4;
  position: relative;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background 0.15s;
}
input[type="checkbox"].switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.15s;
}
input[type="checkbox"].switch:checked { background: var(--green); }
input[type="checkbox"].switch:checked::after { left: 25px; }

/* Recording status */
.rec-status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 8px;
  min-height: 24px;
}
.rec-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse 1.1s infinite;
}

.insp-card { cursor: pointer; }
.insp-card:active { background: #fbf6e9; }

.flag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip {
  background: #eef4ee;
  color: var(--green);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.8rem;
  font-weight: 600;
}

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.error { color: var(--red); font-weight: 600; margin-top: 8px; }
.row-actions { display: flex; gap: 8px; align-items: center; flex: 0 0 auto; }
.spacer { flex: 1; }
