/*
 * Z-index scale (keep in sync when adding new layers):
 *   1      – in-field controls (voice button)
 *   10     – sticky header
 *   100    – bottom nav, modal overlays
 *   1000   – feature modal, add-item modal
 *   2000   – lightbox modal
 *   2001   – lightbox content (above its backdrop)
 *   9998   – offline indicator (system-level)
 *   9999   – PWA install banner (topmost)
 */

/* ── Offline Status Indicator ──────────────────────────────────────────── */
.offline-indicator {
  position: fixed;
  bottom: calc(4.5rem + env(safe-area-inset-bottom)); /* clears bottom-nav height */
  left: 50%;
  transform: translateX(-50%);
  background: #2c1a00;
  color: #fff;
  padding: 0.6rem 1.2rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  z-index: 9998; /* system-level overlay — see z-index scale */
  display: flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}

.offline-indicator.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.offline-indicator.offline {
  background: #c0392b;
}

.offline-indicator.syncing {
  background: #f5a623;
  color: #2c1a00;
}

.offline-indicator.synced {
  background: #3a7d44;
}

.offline-indicator-icon {
  font-size: 1rem;
  line-height: 1;
}

.offline-indicator-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(44, 26, 0, 0.3);
  border-top-color: #2c1a00;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
  .offline-indicator {
    bottom: calc(3.5rem + env(safe-area-inset-bottom)); /* shorter mobile bottom-nav */
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
  }
}

/* Offline queue badge in header */
.queue-badge {
  background: #f5a623;
  color: #2c1a00;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-left: 0.5rem;
  display: inline-block;
  cursor: help;
}

.queue-badge.syncing {
  background: #3a7d44;
  color: #fff;
}

/* ── PWA Install Prompt ────────────────────────────────────────────────── */
.install-prompt-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #f5a623 0%, #f8c13a 100%);
  color: #2c1a00;
  padding: 1rem 1.2rem;
  box-shadow: 0 4px 12px rgba(245, 166, 35, 0.3);
  z-index: 9999; /* topmost — PWA install banner */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transform: translateY(-100%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.install-prompt-banner.install-prompt-visible {
  transform: translateY(0);
  opacity: 1;
}

.install-prompt-banner.install-prompt-hiding {
  transform: translateY(-100%);
  opacity: 0;
}

.install-prompt-content {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex: 1;
}

.install-prompt-icon {
  font-size: 1.8rem;
  line-height: 1;
  flex-shrink: 0;
}

.install-prompt-text {
  flex: 1;
  min-width: 0;
}

.install-prompt-title {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: #2c1a00;
}

.install-prompt-instructions {
  font-size: 0.85rem;
  line-height: 1.4;
  margin: 0;
  color: #3d2600;
}

.install-prompt-instructions strong {
  font-weight: 700;
  color: #2c1a00;
}

.install-prompt-action-btn {
  margin-top: 0.5rem;
  background: #2c1a00;
  color: #f5a623;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
}

.install-prompt-action-btn:hover {
  background: #1a0f00;
}

.install-prompt-dismiss {
  background: rgba(44, 26, 0, 0.15);
  border: none;
  color: #2c1a00;
  font-size: 1.2rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
  line-height: 1;
  font-weight: 400;
}

.install-prompt-dismiss:hover {
  background: rgba(44, 26, 0, 0.25);
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .install-prompt-banner {
    padding: 0.85rem 1rem;
  }

  .install-prompt-icon {
    font-size: 1.5rem;
  }

  .install-prompt-title {
    font-size: 0.9rem;
  }

  .install-prompt-instructions {
    font-size: 0.8rem;
  }

  .install-prompt-dismiss {
    width: 28px;
    height: 28px;
    font-size: 1.1rem;
  }
}

@media (max-width: 400px) {
  .install-prompt-content {
    gap: 0.6rem;
  }

  .install-prompt-instructions {
    font-size: 0.75rem;
  }
}

/* ── New Feature Highlight ─────────────────────────────────────────────── */
.feature-new {
  position: relative;
  animation: feature-glow 1.2s infinite alternate;
  box-shadow: 0 0 0 2px var(--honey), 0 0 8px 2px #f5a62355;
  border-radius: var(--radius);
}
@keyframes feature-glow {
  from { box-shadow: 0 0 0 2px var(--honey), 0 0 8px 2px #f5a62355; }
  to   { box-shadow: 0 0 0 4px var(--honey), 0 0 16px 4px #f5a62399; }
}

.feature-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(44,26,0,0.18);
  z-index: 1000; /* feature modal */
  display: flex;
  align-items: center;
  justify-content: center;
}
.feature-modal-content {
  background: #fffbe8;
  border: 2px solid var(--honey);
  border-radius: 14px;
  box-shadow: 0 4px 32px #2c1a0033;
  padding: 2.2rem 2.5rem 1.5rem 2.5rem;
  max-width: 380px;
  width: 90vw;
  text-align: left;
}
.feature-modal-content h2 {
  margin-bottom: 1rem;
  color: var(--honey);
  font-size: 1.3rem;
  font-weight: 700;
}
.feature-modal-content ul {
  margin-bottom: 1.2rem;
  padding-left: 1.1em;
}
.feature-modal-content li {
  margin-bottom: .7em;
  font-size: 1.04em;
}
#feature-dismiss-btn {
  background: var(--honey);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: .5em 1.3em;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 4px #2c1a0022;
  transition: background .15s;
}
#feature-dismiss-btn:hover {
  background: #e89b1c;
}
/* ── Reset & base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Primary honey/amber palette */
  --honey:        #c8881a;
  --honey-deep:   #a06a0c;
  --honey-soft:   #f4dca5;
  --honey-softer: #fbecc6;

  /* Background & surfaces */
  --bg:           #fbf6ec;
  --cream:        #fbf6ec;  /* keep for compatibility */
  --surface:      #ffffff;
  --surface-alt:  #f5ecd9;
  --card:         #ffffff;  /* keep for compatibility */

  /* Ink/text colors */
  --dark:         #1c1308;  /* updated from #2c1a00 */
  --ink-900:      #1c1308;
  --ink-700:      #3d2c14;
  --ink-500:      #6b5a3e;
  --ink-400:      #9b8a6c;
  --ink-300:      #c4b89b;

  /* Borders & dividers */
  --border:       rgba(28,19,8,0.08);
  --divider:      rgba(28,19,8,0.08);
  --divider-strong: rgba(28,19,8,0.14);

  /* Status colors */
  --forest:       #4a7c4e;
  --forest-soft:  #dcebd4;
  --rust:         #b85432;
  --rust-soft:    #f5d8c8;
  --amber-warn:   #c9651b;
  --amber-soft:   #fbe1c2;
  --green:        #4a7c4e;  /* keep for compatibility */
  --red:          #b85432;  /* keep for compatibility */

  --muted:        #6b5a3e;  /* updated to ink-500 */
  --radius:       10px;
  --shadow:       0 2px 12px rgba(28,19,8,.10);
  --brand-dark:   #241809;
}

html { font-size: 16px; }

/* Larger text for mobile (better outdoor readability) */
@media (max-width: 768px) {
  html { font-size: 18px; }
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink-900);
  min-height: 100vh;
}

/* ── Impersonation banner ──────────────────────────────────────────────── */
.impersonate-banner {
  background: #fff3cd;
  color: #856404;
  text-align: center;
  padding: .55rem 1rem;
  font-size: .88rem;
  font-weight: 500;
  border-bottom: 2px solid #ffc107;
}
.impersonate-stop {
  background: transparent;
  border: 1.5px solid #856404;
  color: #856404;
  border-radius: 6px;
  padding: .2rem .7rem;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: .6rem;
  transition: all .15s;
}
.impersonate-stop:hover { background: #856404; color: #fff; }

/* ── Header ────────────────────────────────────────────────────────────── */
/* ── New Compact Header ───────────────────────────────────────────────── */
.z-header {
  background: var(--bg);
  border-bottom: 1px solid var(--divider);
  position: sticky;
  top: 0;
  z-index: 10;
}

.z-header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.z-header-logo {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.z-header-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.2px;
}

.z-header-spacer {
  flex: 1;
}

.z-header-icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--divider);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-700);
  transition: all 0.15s;
}

.z-header-icon-btn:hover {
  background: var(--surface-alt);
  border-color: var(--divider-strong);
}

.z-header-profile-btn {
  width: 36px;
  height: 36px;
  border-radius: 99px;
  background: var(--honey-softer);
  border: 1px solid var(--honey-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  position: relative;
}

.z-header-profile-btn:hover {
  background: var(--honey-soft);
  border-color: var(--honey);
}

.z-header-profile-initials {
  font-size: 12px;
  font-weight: 700;
  color: var(--honey-deep);
}

/* Profile menu dropdown */
.profile-menu {
  position: absolute;
  top: 60px;
  right: 18px;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(28, 19, 8, 0.12);
  min-width: 220px;
  z-index: 100;
  overflow: hidden;
}

.profile-menu.hidden {
  display: none;
}

.profile-menu-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--divider);
}

.profile-menu-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-900);
}

.profile-menu-email {
  font-size: 12px;
  color: var(--ink-500);
  margin-top: 2px;
}

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--ink-900);
  text-decoration: none;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.profile-menu-item:hover {
  background: var(--surface-alt);
}

.profile-menu-item svg {
  color: var(--ink-500);
  flex-shrink: 0;
}

.profile-menu-divider {
  height: 1px;
  background: var(--divider);
  margin: 4px 0;
}

.profile-menu-logout {
  color: var(--rust);
}

.profile-menu-logout svg {
  color: var(--rust);
}

.usage-badge {
  font-size: .72rem;
  padding: .15rem .5rem;
  border-radius: 10px;
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.75);
  white-space: nowrap;
  cursor: default;
}
.usage-badge.usage-warn {
  background: rgba(231,76,60,.25);
  color: #fbb;
}
.usage-badge.usage-full {
  background: rgba(231,76,60,.5);
  color: #fff;
}

/* ── Bottom Navigation ─────────────────────────────────────────────────── */
.z-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--divider);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
  display: flex;
  justify-content: space-around;
  height: 60px;
  align-items: center;
}

.z-nav-item {
  flex: 1;
  height: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-500);
  padding: 0;
  transition: color 0.15s;
}

.z-nav-item.active {
  color: var(--honey-deep);
}

.z-nav-item.active .z-nav-icon {
  stroke-width: 2;
}

.z-nav-icon {
  flex-shrink: 0;
}

.z-nav-label {
  font-size: 10.5px;
  font-weight: 500;
}

.z-nav-item.active .z-nav-label {
  font-weight: 700;
}

/* More menu */
.more-menu {
  position: fixed;
  bottom: calc(60px + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--divider);
  box-shadow: 0 -4px 16px rgba(28, 19, 8, 0.08);
  z-index: 99;
  max-height: 50vh;
  overflow-y: auto;
}

.more-menu.hidden {
  display: none;
}

.more-menu-header {
  padding: 16px 18px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--divider);
}

.more-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-900);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.more-menu-item:hover {
  background: var(--surface-alt);
}

.more-menu-item svg {
  color: var(--ink-500);
  flex-shrink: 0;
}

.more-menu-divider {
  height: 1px;
  background: var(--divider);
  margin: 8px 0;
}

.more-menu-section-label {
  padding: 12px 18px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.more-menu-badges {
  padding: 0 18px 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Main layout ───────────────────────────────────────────────────────── */
main {
  max-width: 860px;
  margin: 2rem auto;
  padding: 0 1.5rem calc(60px + env(safe-area-inset-bottom) + 2rem);
}

@media (max-width: 640px) {
  main {
    margin: 1.2rem auto;
    padding: 0 1rem calc(60px + env(safe-area-inset-bottom) + 1rem);
  }
}

@media (max-width: 400px) {
  main {
    padding: 0 .75rem calc(60px + env(safe-area-inset-bottom) + 1rem);
  }
}

.tab { display: none; }
.tab.active { display: block; }

h2 {
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
  color: var(--dark);
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--border);
}

/* ── Forms ─────────────────────────────────────────────────────────────── */
.form-row {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-bottom: 1.1rem;
}
label { font-size: .85rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: .6rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--card);
  transition: border-color .2s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--honey);
}
textarea { resize: vertical; }

.hive-select-row { display: flex; gap: .5rem; }
.hive-select-row select,
.hive-select-row input { flex: 1; }

.hive-picker-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hive-button-select {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: .5rem;
}

.hive-choice-btn {
  min-height: 56px;
  width: 100%;
  padding: .65rem .8rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.3;
  background: var(--card);
  color: var(--dark);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, transform .08s, background .15s;
}

.hive-choice-btn:hover,
.hive-choice-btn:focus {
  border-color: var(--honey);
  background: #fff8e6;
  outline: none;
}

.hive-choice-btn:active {
  transform: scale(.98);
}

.hive-choice-btn.active {
  border-color: #d08d16;
  background: linear-gradient(180deg, #ffe8ad 0%, #ffd97a 100%);
  box-shadow: 0 0 0 2px rgba(245,166,35,.2);
}

.hive-choice-btn.hive-choice-aux {
  font-weight: 500;
  color: var(--muted);
  background: #fbfaf6;
}
.hive-choice-btn.hive-choice-dead {
  opacity: .55;
  text-decoration: line-through;
  font-style: italic;
}
.hive-choice-btn.hive-choice-dead.active {
  opacity: .75;
  border-color: #999;
  background: #f0eded;
}

.hive-choice-empty {
  color: var(--muted);
  font-size: .9rem;
  padding: .45rem .55rem;
}

/* Queen marking color dot on hive buttons */
.queen-mark {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid;
  vertical-align: middle;
  margin-right: .4rem;
  flex-shrink: 0;
}

/* ── Hive Selector (Inline) ────────────────────────────────────────────── */
.hive-selector-inline {
  margin-bottom: 0.75rem;
}
.hive-selector-section {
  margin-bottom: 20px;
}
.hive-selector-section:last-child {
  margin-bottom: 0;
}
.hive-selector-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 2px;
}
.hive-selector-label > span:first-child {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--ink-500);
  text-transform: uppercase;
}
.hive-selector-subtitle {
  font-size: 11.5px;
  color: var(--ink-400);
}
.hive-selector-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--honey-deep);
}
.hive-selector-toggle:hover {
  text-decoration: underline;
}

/* Apiary segmented control */
.hive-selector-apiaries {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--divider);
}
.hive-selector-apiary-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-500);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.hive-selector-apiary-btn.active {
  background: var(--surface);
  color: var(--ink-900);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(28, 19, 8, 0.08);
}
.hive-selector-apiary-btn .apiary-icon {
  color: var(--ink-400);
}
.hive-selector-apiary-btn.active .apiary-icon {
  color: var(--honey-deep);
}
.hive-selector-apiary-count {
  font-size: 11px;
  color: var(--ink-400);
}
.hive-selector-apiary-btn.active .hive-selector-apiary-count {
  color: var(--ink-500);
}

/* Hive pills */
.hive-selector-hives {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.hive-selector-hive-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-700);
  border: 1px solid var(--divider-strong);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.hive-selector-hive-btn.active {
  background: var(--ink-900);
  color: var(--bg);
  border-color: var(--ink-900);
}
.hive-selector-hive-btn.dead {
  opacity: 0.55;
}
.hive-selector-hive-dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  flex: none;
}
.hive-selector-hive-btn:not(.active) .hive-selector-hive-dot {
  border: 1px solid rgba(0, 0, 0, 0.12);
}
.hive-selector-hive-btn.active .hive-selector-hive-dot {
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.hive-selector-hive-btn.active .hive-selector-hive-dot.no-queen {
  background: rgba(255, 255, 255, 0.4);
}
.hive-selector-hive-btn:not(.active) .hive-selector-hive-dot.no-queen {
  background: var(--ink-300);
}
.hive-selector-hive-archived {
  font-size: 10px;
  opacity: 0.7;
}
.hive-selector-empty {
  font-size: 12.5px;
  color: var(--ink-500);
  padding: 8px 4px;
}

.hidden { display: none !important; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--honey);
  color: var(--dark);
  border: none;
  padding: .65rem 1.6rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
}
.btn-primary:hover  { opacity: .88; }
.btn-primary:active { transform: scale(.97); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--muted);
  padding: .6rem 1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .2s, color .2s;
}
.btn-outline:hover { border-color: var(--honey); color: var(--dark); }

.btn-danger {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--red);
  padding: .3rem .7rem;
  border-radius: 6px;
  font-size: .8rem;
  cursor: pointer;
  transition: all .2s;
}
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* ── Messages ──────────────────────────────────────────────────────────── */
.msg {
  margin-top: 1rem;
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
}
.msg.success { background: #e6f4ea; color: var(--green); }
.msg.error   { background: #fce8e6; color: var(--red); }

.loading { margin-top: 1.5rem; color: var(--muted); font-style: italic; }

.tab-intro {
  color: var(--muted);
  font-size: .93rem;
  margin: -.25rem 0 1.25rem;
  line-height: 1.5;
}

.ai-disclaimer {
  background: #fff2f2;
  border: 2px solid #ef5350;
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #b71c1c;
}

.ai-disclaimer strong {
  font-weight: 700;
  color: #b71c1c;
}

.ai-disclaimer a {
  color: #b71c1c;
  text-decoration: underline;
  font-weight: 600;
}

.ai-disclaimer a:hover {
  color: #d32f2f;
}

/* ── Answer box ────────────────────────────────────────────────────────── */
.answer-box {
  margin-top: 1.5rem;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-left: 4px solid var(--honey);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  line-height: 1.7;
  box-shadow: var(--shadow);
}

/* Markdown prose inside the answer box */
.answer-box p          { margin: 0 0 .75rem; }
.answer-box p:last-child { margin-bottom: 0; }
.answer-box ul,
.answer-box ol         { margin: 0 0 .75rem 1.4rem; }
.answer-box li         { margin-bottom: .25rem; }
.answer-box h1, .answer-box h2,
.answer-box h3, .answer-box h4 {
  margin: 1rem 0 .4rem;
  font-weight: 600;
  line-height: 1.3;
}
.answer-box h1 { font-size: 1.2rem; }
.answer-box h2 { font-size: 1.1rem; }
.answer-box h3 { font-size: 1rem; }
.answer-box strong     { font-weight: 600; }
.answer-box code       {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: .1em .35em;
  font-family: monospace;
  font-size: .9em;
}
.answer-box pre        {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  overflow-x: auto;
  margin: 0 0 .75rem;
}
.answer-box pre code   {
  background: none;
  border: none;
  padding: 0;
}
.answer-box blockquote {
  border-left: 3px solid var(--honey);
  margin: 0 0 .75rem;
  padding-left: .85rem;
  color: #666;
}
.answer-box hr         { border: none; border-top: 1px solid var(--border); margin: .75rem 0; }
.answer-box table      { border-collapse: collapse; width: 100%; margin-bottom: .75rem; }
.answer-box th, .answer-box td {
  border: 1px solid var(--border);
  padding: .35rem .6rem;
  text-align: left;
}
.answer-box th         { background: var(--bg); font-weight: 600; }

/* ── View tab ──────────────────────────────────────────────────────────── */
.logbook-filter {
  margin-bottom: 1rem;
}
.logbook-filter input {
  width: 100%;
  max-width: 400px;
}

/* Add inspection button & panel */
.btn-add-record {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 13px 16px;
  margin-bottom: 1rem;
  border: none;
  border-radius: 12px;
  background: var(--honey);
  color: var(--ink-900);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
  text-align: center;
  box-shadow: 0 4px 12px rgba(200, 136, 26, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.btn-add-record:hover {
  background: var(--honey-deep);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(200, 136, 26, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.btn-add-record-open {
  background: var(--honey-deep);
  color: var(--ink-900);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(200, 136, 26, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.add-record-panel {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 1.2rem;
  box-shadow: var(--shadow);
}

/* Voice dictation */
.notes-input-wrap {
  position: relative;
}
.notes-input-wrap textarea {
  padding-right: 5rem;
}
.btn-voice {
  position: absolute;
  top: .5rem;
  right: .5rem;
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .35rem .6rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  z-index: 1; /* sits above textarea */
}
.btn-voice:hover {
  background: #fff8e1;
  border-color: var(--honey);
  color: var(--dark);
}
.btn-voice.recording {
  background: #fee2e2;
  border-color: #ef4444;
  color: #dc2626;
  animation: pulse-recording 1.5s ease-in-out infinite;
}
.btn-voice.recording .voice-label::after {
  content: "…";
}
@keyframes pulse-recording {
  0%, 100% { opacity: 1; }
  50% { opacity: .6; }
}
.voice-status {
  font-size: .8rem;
  color: var(--muted);
  margin-top: .3rem;
  line-height: 1.4;
}
.voice-status.error { color: #dc2626; }

.record-photo-section {
  background: #fffdf5;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  margin-top: 1rem;
}

.rec-photo-preview {
  margin-top: .6rem;
  padding: .5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: .6rem;
}

.rec-photo-preview img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  flex: none;
}

.rec-photo-thumb-fallback {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--ink-500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  flex: none;
}

.rec-photo-preview-info {
  flex: 1;
  min-width: 0;
  font-size: .8rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.rec-photo-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.rec-photo-remove {
  background: transparent;
  border: 1.5px solid var(--red);
  color: var(--red);
  padding: .25rem .6rem;
  border-radius: 6px;
  font-size: .8rem;
  cursor: pointer;
  transition: all .15s;
}

.rec-photo-remove:hover {
  background: var(--red);
  color: #fff;
}

.form-row-inline {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .75rem;
}
.form-row-inline label {
  font-weight: 600;
  white-space: nowrap;
}
.form-row-inline input[type="date"] {
  flex: 0 0 auto;
}

.filter-row {
  display: flex;
  gap: .75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.filter-row select { max-width: 220px; }
.filter-row input  { flex: 1; min-width: 160px; }
.toggle-label {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .85rem;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
}
.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-track {
  position: relative;
  width: 2.2rem;
  height: 1.25rem;
  background: #ccc;
  border-radius: .625rem;
  transition: background .2s;
  flex-shrink: 0;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: .15rem;
  left: .15rem;
  width: .95rem;
  height: .95rem;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.toggle-input:checked + .toggle-track {
  background: var(--honey);
}
.toggle-input:checked + .toggle-track::after {
  transform: translateX(.95rem);
}

.record-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: .9rem;
  box-shadow: var(--shadow);
  transition: border-color .2s;
}
.record-card:hover { border-color: var(--honey); }
.record-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: .5rem;
}
.record-card-actions {
  display: flex;
  gap: .4rem;
  align-items: center;
}
.record-card-actions .btn-outline {
  padding: .3rem .7rem;
  font-size: .8rem;
}
.record-date { font-weight: 700; font-size: 1rem; color: var(--dark); }
.record-notes { color: #444; line-height: 1.6; white-space: pre-wrap; font-size: .95rem; }

.record-card-dead {
  opacity: .7;
  border-left: 3px solid #999;
}
.dead-hive-banner {
  background: #f5f0eb;
  border: 1.5px solid #d5cfc8;
  border-radius: var(--radius);
  padding: .65rem 1rem;
  margin-bottom: 1rem;
  font-size: .9rem;
  color: #666;
  text-align: center;
}

.record-edit-textarea {
  width: 100%;
  padding: .6rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .95rem;
  font-family: inherit;
  background: var(--card);
  color: var(--dark);
  resize: vertical;
}

.record-edit-actions {
  margin-top: .6rem;
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
}

.record-edit-date-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .5rem;
}
.record-edit-date-row label {
  font-weight: 600;
  font-size: .9rem;
  color: var(--muted);
}
.record-edit-date {
  padding: .35rem .55rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: inherit;
  background: var(--card);
  color: var(--dark);
}

.record-edit-error {
  margin: .5rem 0 0;
  padding: .5rem .75rem;
  background: #fdeaea;
  border: 1px solid #f5c6cb;
  border-radius: var(--radius);
  color: #842029;
  font-size: .9rem;
}

.no-records { color: var(--muted); font-style: italic; padding: 1rem 0; }

/* ── Reminder panel ────────────────────────────────────────────────────── */
.reminder-panel {
  margin-top: 1rem;
  background: #fff8e1;
  border: 1.5px solid var(--honey);
  border-left: 4px solid #e67e00;
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  box-shadow: var(--shadow);
}
.reminder-header {
  font-weight: 700;
  margin-bottom: .6rem;
  color: #7a4a00;
}
.reminder-panel ul {
  margin: 0 0 .9rem 1.3rem;
  color: var(--dark);
  line-height: 1.8;
}
.reminder-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

@media (max-width: 540px) {
  .hive-button-select { grid-template-columns: 1fr; }

  /* Smaller header on mobile */
  .z-header-inner {
    padding: 8px 14px;
  }

  .z-header-logo {
    width: 24px;
    height: 24px;
  }

  .z-header-title {
    font-size: 16px;
  }

  .z-header-icon-btn,
  .z-header-profile-btn {
    width: 32px;
    height: 32px;
  }

  .profile-menu {
    right: 14px;
  }
}

/* Additional breakpoint for very narrow screens (iPhone SE, etc.) */
@media (max-width: 400px) {
  .z-header-inner {
    padding: 8px 12px;
  }
}

/* ── Manage tab ─────────────────────────────────────────────────────────── */
.manage-toolbar { display: flex; gap: .75rem; margin-bottom: 1.5rem; flex-wrap: wrap; }

.inline-form {
  background: var(--card);
  border: 1.5px solid var(--honey);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.inline-form-title { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; color: var(--dark); }
.inline-form-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: .5rem; }
.form-section-title {
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 1.2rem;
  margin-bottom: .6rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Manage list container */
#manage-list {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* Apiary section */
.apiary-section {
  margin-bottom: 2rem;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.apiary-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: .6rem 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.apiary-title { font-size: 1.1rem; font-weight: 700; flex: 1; }
.apiary-location { font-size: .85rem; color: var(--muted); }
.apiary-actions { display: flex; gap: .5rem; }

/* Hive cards */
.hive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 1rem;
  width: 100%;
}

@media (max-width: 640px) {
  .hive-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.hive-manage-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: .6rem;
  transition: border-color .2s;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.hive-manage-card:hover { border-color: var(--honey); }
.hive-manage-card.status-dead  { opacity: .6; border-style: dashed; }
.hive-manage-card.status-merged { opacity: .6; border-style: dashed; }

.hive-card-header { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.hive-card-name { font-weight: 700; font-size: 1rem; flex: 1; }
.hive-type-label {
  font-size: .85rem;
  color: var(--muted);
  font-weight: 500;
  margin-top: -.3rem;
}

/* ── Feedback footer ───────────────────────────────────────────────────── */
.page-feedback {
  margin-top: 2.5rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid #e0ddd6;
  border-radius: var(--radius);
  background: #f7f5f0;
  box-shadow: none;
}

.feedback-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: .2rem;
}

.feedback-subtitle {
  color: #a09a8c;
  font-size: .82rem;
  margin-bottom: .8rem;
}

.feedback-form {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  align-items: flex-start;
}

.feedback-form textarea {
  flex: 1;
  min-width: 220px;
  min-height: 80px;
}

.btn-feedback {
  background: #e0ddd6;
  color: #5a5245;
  border: 1px solid #ccc8be;
  padding: .55rem 1.2rem;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.btn-feedback:hover {
  background: #d4d0c7;
  color: #3a3428;
}

.feedback-msg {
  margin-top: .65rem;
  font-size: .86rem;
  font-weight: 600;
}

.feedback-msg.success { color: var(--green); }
.feedback-msg.error { color: var(--red); }

.feedback-thanks {
  text-align: center;
  padding: 1.2rem .5rem;
}

.feedback-thanks-icon {
  font-size: 2.2rem;
  display: block;
  margin-bottom: .4rem;
}

.feedback-thanks-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: .3rem;
}

.feedback-thanks-text {
  font-size: .92rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ── Hive Images ──────────────────────────────────────────────────────────── */
.hive-images-section {
  margin: .8rem 0;
}

.hive-images-preview {
  position: relative;
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 200px;
  transition: transform .2s;
}

.hive-images-preview:hover {
  transform: scale(1.02);
}

@media (max-width: 640px) {
  .hive-images-preview {
    max-width: 100%;
  }

  .hive-images-section {
    margin: .6rem 0;
  }
}

.logbook-hive-preview {
  margin: 1rem 0 1.5rem 0;
  padding: 1rem;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.logbook-hive-preview.hidden {
  display: none;
}

.hive-preview-thumb {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
}

.hive-preview-badge {
  position: absolute;
  bottom: .5rem;
  right: .5rem;
  background: rgba(0,0,0,0.75);
  color: white;
  font-size: .7rem;
  font-weight: 600;
  padding: .25rem .5rem;
  border-radius: 20px;
}

.hive-images-empty {
  font-size: .85rem;
  color: var(--muted);
  font-style: italic;
  margin: .5rem 0;
}

.btn-photo {
  background: var(--honey);
  color: white;
  border: none;
  cursor: pointer;
  transition: background .15s;
}

.btn-photo:hover {
  background: #e89b1c;
}

.file-upload-hint {
  font-size: .8rem;
  color: var(--muted);
  margin-top: .35rem;
  line-height: 1.5;
}

.file-upload-hint strong {
  color: var(--dark);
  font-weight: 600;
}

/* ── Lightbox Modal ───────────────────────────────────────────────────────── */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000; /* lightbox backdrop */
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-modal.hidden {
  display: none;
}

.lightbox-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.9);
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  z-index: 2001; /* lightbox content, above its backdrop */
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-image {
  max-width: 100%;
  max-height: calc(90vh - 80px);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: transparent;
  border: none;
  color: white;
  font-size: 2.5rem;
  cursor: pointer;
  line-height: 1;
  padding: .2rem .5rem;
  transition: transform .2s;
}

.lightbox-close:hover {
  transform: scale(1.2);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.7);
  border: none;
  color: white;
  font-size: 3rem;
  cursor: pointer;
  padding: .5rem 1rem;
  line-height: 1;
  border-radius: var(--radius);
  transition: background .2s;
}

.lightbox-nav:hover {
  background: rgba(0,0,0,0.9);
}

.lightbox-prev {
  left: 1rem;
}

.lightbox-next {
  right: 1rem;
}

.lightbox-info {
  margin-top: 1rem;
  text-align: center;
  color: white;
  max-width: 600px;
}

.lightbox-caption {
  font-size: 1rem;
  margin-bottom: .5rem;
  line-height: 1.4;
}

.lightbox-meta {
  font-size: .85rem;
  color: #ccc;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.lightbox-delete {
  margin-top: 1rem;
  font-size: .9rem;
  padding: .4rem 1rem;
}

/* Mobile-friendly lightbox */
@media (max-width: 768px) {
  .lightbox-nav {
    font-size: 2rem;
    padding: .3rem .6rem;
  }

  .lightbox-prev {
    left: .5rem;
  }

  .lightbox-next {
    right: .5rem;
  }

  .lightbox-close {
    top: -35px;
    font-size: 2rem;
  }
}

/* ── Admin feedback list ───────────────────────────────────────────────── */
.admin-feedback-list {
  margin-top: 1.8rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 1rem 1.05rem;
}

.admin-feedback-list h2 {
  margin: 0 0 .8rem;
  border: none;
  padding: 0;
  font-size: 1.1rem;
}

.feedback-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .7rem .8rem;
  margin-bottom: .6rem;
  background: #fffdfa;
}

.feedback-item:last-child { margin-bottom: 0; }

.feedback-item-meta {
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: .35rem;
}

.feedback-page-badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  padding: .15rem .5rem;
  margin-left: .5rem;
  border-radius: 4px;
  background: #f5a62320;
  color: #a67425;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.feedback-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .35rem;
}

.feedback-item-text {
  white-space: pre-wrap;
  line-height: 1.55;
  color: #3f2f18;
}

.status-badge {
  font-size: .72rem;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-active  { background: #e6f4ea; color: var(--green); }
.badge-dead    { background: #fce8e6; color: var(--red); }
.badge-merged  { background: #ede7f6; color: #6a3da8; }

.queen-info {
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.5;
  border-left: 3px solid var(--honey);
  padding-left: .6rem;
}
.queen-lineage-step { font-size: .78rem; color: #a09070; margin-top: .15rem; }

.hive-events-log { font-size: .78rem; color: var(--muted); }
.hive-event-item { margin-bottom: .2rem; }

.hive-card-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: .6rem;
}

.btn-sm {
  font-size: .82rem;
  padding: .4rem .7rem;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

.btn-sm:hover { border-color: var(--honey); color: var(--dark); }
.btn-sm.btn-split  { color: #1a6e4a; }
.btn-sm.btn-merge  { color: #6a3da8; }
.btn-sm.btn-dieout { color: var(--red); }
.btn-sm.btn-edit   { color: var(--dark); }
.btn-sm.btn-del    { color: var(--red); }
.btn-sm.btn-photo  { color: var(--honey); font-weight: 600; }

/* Mobile improvements for manage section */
@media (max-width: 640px) {
  .apiary-header {
    flex-direction: column;
    align-items: flex-start;
    gap: .6rem;
  }

  .apiary-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .hive-manage-card {
    padding: .9rem;
  }

  .hive-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: .4rem;
  }

  .hive-card-name {
    font-size: 1.05rem;
  }

  .hive-card-actions {
    gap: .5rem;
  }

  .btn-sm {
    font-size: .85rem;
    padding: .45rem .75rem;
    min-height: 44px;
    flex: 1 1 auto;
    min-width: calc(50% - .25rem);
    justify-content: center;
  }

  /* Make photo button full width and prominent */
  .btn-sm.btn-photo {
    flex: 1 1 100%;
    background: #fffbf0;
    border-color: var(--honey);
    font-size: .9rem;
  }

  .manage-toolbar {
    gap: .6rem;
  }

  .inline-form {
    padding: 1rem;
  }
}

@media (max-width: 400px) {
  .btn-sm {
    font-size: .8rem;
    padding: .4rem .6rem;
  }

  .hive-card-actions {
    gap: .4rem;
  }
}
.btn-sm.btn-photo  {
  background: var(--honey);
  color: white;
  border-color: var(--honey);
}
.btn-sm.btn-photo:hover {
  background: #e89b1c;
  border-color: #e89b1c;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 100; /* generic modal overlay */
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.8rem;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.modal-box h3 { margin-bottom: 1.2rem; font-size: 1.1rem; }
.modal-actions { display: flex; gap: .75rem; margin-top: 1.2rem; flex-wrap: wrap; }


/* ── Spinner ───────────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 18px; height: 18px;
  border: 3px solid var(--border);
  border-top-color: var(--honey);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

/* ── Mite Counter tab ──────────────────────────────────────────────────── */
.mite-subtitle {
  color: var(--muted);
  margin-bottom: 1.25rem;
}

/* Unified Mite Counter Layout */
.mite-unified-selector {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.mite-empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
  font-size: 1rem;
}

.mite-records-section {
  margin-bottom: 2rem;
}

.mite-records-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.mite-records-header h3 {
  margin: 0;
  color: var(--dark);
}

.mite-records-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mite-record-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  gap: 1rem;
  align-items: start;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.mite-record-thumbnail {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.mite-record-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mite-record-content {
  flex: 1;
  min-width: 0;
  padding-right: 10rem;
}

@media (max-width: 600px) {
  .mite-record-content {
    padding-right: 0;
    padding-bottom: 2.5rem;
  }
}

.mite-record-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.mite-record-date {
  font-size: 0.9rem;
  color: var(--muted);
}

.mite-record-count {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark);
}

.mite-record-method {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.mite-per-day {
  font-size: 0.9rem;
  color: var(--honey);
  font-weight: 600;
  margin-top: 0.3rem;
}

.mite-confidence-small {
  display: flex;
  gap: 0.5rem;
  font-size: 0.75rem;
  margin-top: 0.4rem;
}

.mite-confidence-small .conf-high { color: #e74c3c; }
.mite-confidence-small .conf-medium { color: #f39c12; }
.mite-confidence-small .conf-low { color: #1a6e4a; }

.mite-record-notes {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--dark);
  font-style: italic;
}

.mite-record-actions {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 0.5rem;
}

.mite-record-edit,
.mite-record-delete {
  background: transparent;
  border: 1.5px solid var(--border);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.mite-record-edit {
  color: var(--honey);
}

.mite-record-edit:hover {
  background: var(--honey);
  color: white;
  border-color: var(--honey);
}

.mite-record-delete {
  color: var(--red);
}

.mite-record-delete:hover {
  background: var(--red);
  color: white;
  border-color: var(--red);
}

/* Mobile responsive for record cards */
@media (max-width: 600px) {
  .mite-record-card {
    flex-direction: column;
  }

  .mite-record-thumbnail {
    width: 100%;
    height: 150px;
  }

  .mite-record-actions {
    position: static;
    justify-content: flex-end;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
  }
}

/* Add New Record Section */
.mite-add-section {
  margin-top: 3rem;
}

.mite-add-section h3 {
  margin-bottom: 1rem;
  color: var(--dark);
}

.mite-add-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.form-section {
  margin-bottom: 1.5rem;
}

.section-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--dark);
}

.form-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

.mite-photo-upload {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.mite-upload-msg {
  font-size: .85rem;
  color: var(--muted);
}

.mite-analysis-result {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.mite-thumbnail-preview {
  width: 100px;
  height: 100px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.mite-thumbnail-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mite-count-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--honey);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
}

.mite-count-num {
  font-size: 1.5rem;
}

.mite-count-label {
  font-size: 0.9rem;
}

.mite-confidence-info {
  display: flex;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.mite-confidence-info .conf-high { color: #e74c3c; font-weight: 600; }
.mite-confidence-info .conf-medium { color: #f39c12; font-weight: 600; }
.mite-confidence-info .conf-low { color: #1a6e4a; font-weight: 600; }

.mite-loading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 1rem;
}

.mite-loading .spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--honey);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Legacy cleanup - remove old unused styles */
.mite-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.mite-upload-label { cursor: pointer; }

.mite-upload-msg {
  font-size: .85rem;
  color: var(--muted);
}

/* Gallery: thumbnail cards */
.mite-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.5rem;
}

.mite-thumb-card {
  width: 140px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--card);
  box-shadow: var(--shadow);
  transition: border-color .15s, transform .12s;
  position: relative;
}
.mite-thumb-card:hover  { border-color: var(--honey); transform: translateY(-2px); }
.mite-thumb-card.active { border-color: var(--honey); box-shadow: 0 0 0 3px rgba(245,166,35,.25); }

.mite-thumb-delete {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  background: rgba(231, 76, 60, 0.95);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
  z-index: 10;
}
.mite-thumb-card:hover .mite-thumb-delete {
  opacity: 1;
}
.mite-thumb-delete:hover {
  background: rgba(192, 57, 43, 1);
}

.mite-thumb-card img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}
.mite-thumb-info {
  padding: .35rem .5rem;
  font-size: .75rem;
  color: var(--muted);
  line-height: 1.4;
}
.mite-thumb-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  color: var(--dark);
}
.mite-thumb-hive {
  font-size: .7rem;
  font-weight: 600;
  color: var(--honey);
  margin-bottom: 0.2rem;
}
.mite-thumb-status {
  font-size: .7rem;
}
.mite-thumb-status.done { color: #1a6e4a; }
.mite-thumb-status.pending { color: var(--muted); }

/* Viewer */
.mite-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1rem;
}

.mite-count-badge {
  background: linear-gradient(135deg, #fff8ec, #fff3da);
  border: 2px solid var(--honey);
  border-radius: var(--radius);
  padding: .6rem 1.2rem;
  text-align: center;
  min-width: 120px;
}
.mite-count-num {
  display: block;
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--honey);
  line-height: 1;
}
.mite-count-label {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.mite-confidence-info {
  margin-top: 0.8rem;
  padding: 0.6rem 0.9rem;
  background: #f5f5f5;
  border-radius: var(--radius);
  font-size: 0.85rem;
}
.mite-conf-breakdown {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}
.mite-conf-label {
  font-weight: 600;
  color: var(--dark);
  margin-right: 0.3rem;
}
.mite-conf-high {
  color: #e74c3c;
  font-weight: 600;
}
.mite-conf-medium {
  color: #ff9800;
  font-weight: 600;
}
.mite-conf-low {
  color: #f9a825;
  font-weight: 600;
}

.mite-quality-notes {
  margin-top: 0.6rem;
  padding: 0.5rem 0.7rem;
  background: #e8f5e9;
  border-left: 3px solid #4caf50;
  border-radius: 3px;
  font-size: 0.8rem;
  color: #2e7d32;
  line-height: 1.4;
}

.mite-viewer-actions {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}
.mite-current-name {
  font-size: .85rem;
  color: var(--muted);
  font-style: italic;
}

.mite-loading {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .9rem 1.1rem;
  background: #fffbf0;
  border: 1px solid var(--honey);
  border-radius: var(--radius);
  color: var(--dark);
  margin-bottom: 1rem;
}

.mite-accuracy-note {
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: .6rem;
  font-style: italic;
}

.mite-legend {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
  padding: 0.5rem 0.7rem;
  background: #fafafa;
  border-radius: var(--radius);
  font-size: 0.8rem;
  flex-wrap: wrap;
}
.mite-legend-title {
  font-weight: 600;
  color: var(--dark);
}
.mite-legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
}
.mite-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.1);
}

/* Image + SVG overlay */
.mite-canvas-wrap {
  position: relative;
  display: block;
  line-height: 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.mite-canvas-wrap img {
  width: 100%;
  height: auto;
  display: block;
}

.mite-save-form {
  background: var(--card);
  border: 2px solid var(--honey);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1.5rem;
}

.manual-entry-header {
  margin-bottom: 1.5rem;
}

.manual-entry-header h3 {
  margin: 0 0 0.5rem 0;
  color: var(--dark);
  font-size: 1.4rem;
}

.manual-entry-header .tab-intro {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.manual-entry-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  max-width: 700px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.manual-entry-card .form-row {
  margin-bottom: 1.5rem;
}

.manual-entry-card .form-row:last-of-type {
  margin-bottom: 0;
}

.manual-entry-card label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--dark);
  font-size: 0.95rem;
}

.manual-entry-card select,
.manual-entry-card input[type="number"],
.manual-entry-card input[type="date"],
.manual-entry-card textarea {
  width: 100%;
  max-width: 100%;
}

.manual-entry-card .form-hint {
  margin: 0.4rem 0 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.manual-entry-card .form-actions {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.mite-save-form h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--honey);
  font-size: 1.1rem;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 2rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.history-header h3 {
  margin: 0 0 0.5rem 0;
  color: var(--dark);
  font-size: 1.4rem;
}

.history-header .tab-intro {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.mite-history-filters {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card);
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
}

.mite-history-filters label {
  font-weight: 600;
  color: var(--dark);
  font-size: 0.9rem;
  white-space: nowrap;
}

.mite-history-filters select {
  min-width: 200px;
  margin: 0;
}

.mite-history-list {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.mite-count-record {
  border-bottom: 1px solid var(--border);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
}

.mite-count-record:last-child {
  border-bottom: none;
}

.mite-count-record:hover {
  background: var(--bg-hover);
}

.mite-count-info {
  flex: 1;
}

.mite-count-main {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.mite-count-number {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--honey);
}

.mite-count-date {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

.mite-count-method {
  font-size: 0.85rem;
  color: var(--dark);
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.mite-count-notes {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 0.4rem;
}

.mite-count-confidence {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

.mite-count-actions {
  display: flex;
  gap: 0.5rem;
}

.mite-count-actions button {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}
.mite-canvas-wrap svg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

/* ── Inventory ─────────────────────────────────────────────────────────── */
.inv-planning-card, .inv-stock-card, .inv-log {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  margin-bottom: 1rem;
}

/* Planning Assistant */
.inv-planning-card {
  background: linear-gradient(135deg, #fefaf1 0%, #f8f3e8 100%);
}
.inv-planning-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--dark);
  margin: 0 0 .5rem;
}
.inv-planning-intro {
  font-size: .88rem;
  color: var(--muted);
  margin-bottom: 1rem;
}
.inv-quick-questions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}
.inv-quick-question {
  font-size: .82rem;
  padding: .4rem .8rem;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  color: var(--dark);
  cursor: pointer;
  transition: all .15s;
}
.inv-quick-question:hover {
  background: var(--honey);
  border-color: var(--honey);
  color: white;
}
.inv-ask-form {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
}
.inv-ask-form input {
  flex: 1;
  font-size: .92rem;
  padding: .6rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--card);
}
.inv-ask-answer {
  background: white;
  border: 1.5px solid #e8dfc0;
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
  font-size: .92rem;
  line-height: 1.6;
}
.inv-ask-answer h3, .inv-ask-answer h4 {
  margin-top: 1rem;
  margin-bottom: .5rem;
}
.inv-ask-answer ul, .inv-ask-answer ol {
  margin-left: 1.5rem;
}
.inv-loading {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .88rem;
  color: var(--muted);
  margin-top: 1rem;
}

/* View Toggle */
.inv-view-toggle {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.5rem;
  padding: .3rem;
  background: #f8f3e8;
  border-radius: 8px;
  border: 1.5px solid var(--border);
}
.inv-view-btn {
  flex: 1;
  padding: .6rem 1rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  font-size: .92rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}
.inv-view-btn.active {
  background: var(--card);
  color: var(--dark);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.inv-view-btn:hover:not(.active) {
  color: var(--dark);
}

/* Stock Card */
.inv-stock-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  margin-bottom: 1rem;
}
.inv-stock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.inv-stock-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--dark);
  margin: 0;
}
.inv-category {
  margin-bottom: 1.5rem;
}
.inv-category:last-child {
  margin-bottom: 0;
}
.inv-category-title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 0 0 .8rem;
}
.inv-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .8rem;
}
.inv-item-card {
  background: #fefaf1;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: .9rem;
  transition: box-shadow .15s;
}
.inv-item-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.inv-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: .6rem;
}
.inv-item-name {
  font-size: .92rem;
  font-weight: 600;
  color: var(--dark);
  line-height: 1.3;
  flex: 1;
}
.inv-item-delete {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all .15s;
}
.inv-item-delete:hover {
  background: #fee;
  color: #c33;
}
.inv-item-quantity {
  margin-bottom: .6rem;
}
.inv-item-total {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--honey);
  margin-bottom: .3rem;
}
.inv-item-breakdown {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  font-size: .75rem;
}
.inv-available {
  color: #27ae60;
  font-weight: 600;
}
.inv-assigned {
  color: var(--muted);
  font-weight: 600;
}
.inv-assigned-detail {
  font-size: .75rem;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.4;
  margin-top: .2rem;
}
.inv-item-controls {
  display: flex;
  gap: .4rem;
}
.inv-item-btn {
  flex: 1;
  font-size: 1rem;
  font-weight: 700;
  padding: .35rem;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  color: var(--dark);
  cursor: pointer;
  transition: all .15s;
}
.inv-item-btn:hover {
  background: var(--honey);
  border-color: var(--honey);
  color: white;
}
.inv-empty {
  color: var(--muted);
  font-size: .88rem;
  font-style: italic;
  text-align: center;
  padding: 2rem 0;
}

/* Add Item Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000; /* add-item modal */
  padding: 1rem;
}
.modal-content {
  background: var(--card);
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1.5px solid var(--border);
}
.modal-header h2 {
  font-size: 1.2rem;
  margin: 0;
  color: var(--dark);
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 30px;
  height: 30px;
}
.modal-close:hover {
  color: var(--dark);
}
.modal-body {
  padding: 1.5rem;
}
.inv-add-section {
  margin-bottom: 1.5rem;
}
.inv-add-section:last-child {
  margin-bottom: 0;
}
.inv-add-section h3 {
  font-size: .95rem;
  font-weight: 700;
  color: var(--dark);
  margin: 0 0 .8rem;
}
.inv-templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .6rem;
}
.inv-template-btn {
  font-size: .85rem;
  padding: .6rem .8rem;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--dark);
  cursor: pointer;
  text-align: left;
  transition: all .15s;
}
.inv-template-btn:hover {
  background: #fef9ed;
  border-color: var(--honey);
}
.inv-add-divider {
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
  margin: 1.5rem 0;
  position: relative;
}
.inv-add-divider::before,
.inv-add-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border);
}
.inv-add-divider::before { left: 0; }
.inv-add-divider::after { right: 0; }
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: .3rem;
}
.form-group input,
.form-group select {
  width: 100%;
  font-size: .92rem;
  padding: .6rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  font-family: inherit;
}
#tab-inventory .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .8rem;
}

/* Log */
.inv-log {
  padding: 0;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
}
.inv-log-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: 1rem 1.2rem;
  cursor: pointer;
  user-select: none;
  list-style: none;
  background: var(--card);
  border-radius: var(--radius);
  transition: background .15s;
}
.inv-log-toggle:hover {
  background: #f8f3e8;
}
.inv-log-toggle::-webkit-details-marker { display: none; }
.inv-log-toggle-left {
  display: flex;
  align-items: center;
  gap: .6rem;
}
.inv-log-toggle-arrow {
  font-size: 1.2rem;
  color: var(--honey);
  transition: transform .2s;
  font-weight: 700;
}
.inv-log[open] .inv-log-toggle-arrow {
  transform: rotate(90deg);
}
.inv-log-toggle h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark);
  margin: 0;
}
.inv-log-toggle-hint {
  font-size: .75rem;
  color: var(--muted);
  font-weight: 500;
  font-style: italic;
}
.inv-log-list {
  padding: 0 1.2rem 1.2rem;
  margin-top: .5rem;
}
.inv-log-entry {
  padding: .7rem 0;
  border-bottom: 1px solid #f0ead8;
}
.inv-log-entry:last-child { border-bottom: none; }
.inv-log-date {
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: .3rem;
}
.inv-log-details {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  flex-wrap: wrap;
  font-size: .92rem;
}
.inv-log-item {
  font-weight: 600;
  color: var(--dark);
}
.inv-log-increase {
  color: #27ae60;
  font-weight: 700;
}
.inv-log-decrease {
  color: #c0392b;
  font-weight: 700;
}
.inv-log-arrow {
  color: var(--muted);
}
.inv-log-new {
  font-weight: 600;
  color: var(--honey);
}
.inv-log-notes {
  width: 100%;
  font-size: .85rem;
  color: var(--muted);
  margin-top: .2rem;
}

/* Hive Equipment View */
.inv-hive-equipment-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.inv-hive-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}
.inv-hive-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: .8rem;
  padding-bottom: .6rem;
  border-bottom: 1.5px solid #f0ead8;
}
.inv-hive-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--dark);
  margin: 0;
}
.inv-hive-apiary {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 600;
}
.inv-hive-equipment {
  min-height: 80px;
  margin-bottom: .8rem;
}
.inv-empty-hive {
  color: var(--muted);
  font-size: .85rem;
  font-style: italic;
  text-align: center;
  padding: 1.5rem 0;
}
.inv-equipment-group {
  margin-bottom: .8rem;
}
.inv-equipment-group:last-child {
  margin-bottom: 0;
}
.inv-equipment-category {
  font-size: .75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: .4rem;
}
.inv-equipment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .6rem;
  margin-bottom: .3rem;
  background: #fefaf1;
  border-radius: 6px;
  border: 1px solid #f0ead8;
}
.inv-equipment-item:last-child {
  margin-bottom: 0;
}
.inv-equipment-name {
  font-size: .88rem;
  font-weight: 600;
  color: var(--dark);
}
.inv-equipment-actions {
  display: flex;
  gap: .3rem;
}
.btn-icon {
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--muted);
  cursor: pointer;
  padding: .2rem .4rem;
  border-radius: 4px;
  transition: all .15s;
}
.btn-icon:hover {
  background: #e8e0c8;
  color: var(--dark);
}
.inv-move-btn:hover {
  background: #d4e8f7;
  color: #2196F3;
}
.inv-return-btn:hover {
  background: #d4f7e8;
  color: #27ae60;
}
.inv-add-equipment-btn {
  width: 100%;
  padding: .5rem;
  background: var(--cream);
  border: 1.5px dashed var(--border);
  border-radius: 6px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}
.inv-add-equipment-btn:hover {
  background: #f8f3e8;
  border-color: var(--honey);
  color: var(--dark);
}

/* Form hint */
.form-hint {
  display: block;
  font-size: .8rem;
  color: var(--muted);
  margin-top: .3rem;
}

/* Modal variations */
.inv-adjust-modal .modal-content,
.inv-confirm-modal .modal-content {
  max-width: 400px;
}

.inv-adjust-modal #adjust-qty,
.inv-adjust-modal #adjust-notes {
  font-size: 1rem;
}

.modal-actions {
  display: flex;
  gap: .5rem;
  margin-top: 1rem;
  justify-content: flex-end;
}

.inv-confirm-modal p {
  margin-bottom: 1rem;
  line-height: 1.5;
}

.inv-confirm-modal strong {
  color: var(--dark);
  font-weight: 700;
}

/* ── Tasks ─────────────────────────────────────────────────────────────── */
.task-add-card {
  background: var(--cream);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  margin-bottom: 1rem;
}
.task-add-card input[type="text"] {
  width: 100%;
  font-family: inherit;
  font-size: .95rem;
  padding: .6rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--card);
}
.task-add-actions {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-top: .6rem;
  flex-wrap: wrap;
}
.task-add-actions input[type="date"] {
  font-size: .85rem;
  padding: .35rem .5rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--muted);
}
.task-empty {
  color: var(--muted);
  font-size: .88rem;
  font-style: italic;
}
.task-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .7rem 1rem;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: .5rem;
}
.task-item.task-overdue {
  border-color: #c0392b;
  background: #fdecea;
}
.task-item.task-done {
  opacity: .55;
}
.task-item.task-done .task-text {
  text-decoration: line-through;
}
.task-check-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 1;
  cursor: pointer;
  min-width: 0;
}
.task-check {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  accent-color: var(--honey);
}
.task-text {
  font-size: .95rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-due {
  font-size: .8rem;
  color: var(--muted);
  white-space: nowrap;
}
.task-item.task-overdue .task-due {
  color: #c0392b;
  font-weight: 600;
}
.task-delete {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: .2rem .4rem;
  border-radius: 4px;
}
.task-delete:hover {
  color: #c0392b;
  background: #fdecea;
}

/* ── Sharing Modal & UI ─────────────────────────────────────────────────── */

/* Share Modal - Mobile First Design */
.share-modal-content {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.share-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}

.share-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #333;
  font-weight: 600;
}

.share-modal-close {
  background: none;
  border: none;
  font-size: 1.75rem;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.share-modal-close:hover {
  background: #f5f5f5;
  color: #333;
}

.share-modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

.share-modal-footer {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid #e0e0e0;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* Form fields */
.share-form-field {
  margin-bottom: 1.25rem;
}

.share-form-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #666;
  margin-bottom: 0.5rem;
}

.share-permission-note {
  font-size: 0.85rem;
  color: #666;
  margin: 0;
  padding: 0.75rem;
  background: #f9f9f9;
  border-radius: 6px;
  border-left: 3px solid var(--primary);
}

#share-email-input {
  font-size: 0.95rem;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid #e0e0e0;
  border-radius: 6px;
  width: 100%;
  transition: all 0.2s;
}

#share-email-input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.1);
}


/* Button styles */
.btn-secondary {
  padding: 0.6rem 1.25rem;
  border: 1.5px solid #e0e0e0;
  border-radius: 6px;
  background: white;
  color: #666;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

/* Share badges */
.share-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  background: #e3f2fd;
  color: #1976d2;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-left: 0.5rem;
}

/* Owner badge - shows who shared the resource */
.owner-badge {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffb74d;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

/* Share button styling */
.btn-share {
  background: #4caf50 !important;
  color: white !important;
  border-color: #4caf50 !important;
}

.btn-share:hover {
  background: #45a049 !important;
  border-color: #45a049 !important;
}

/* Existing shares list - Mobile First */
.share-item {
  padding: 0.85rem;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 0.65rem;
  background: white;
  transition: all 0.15s;
}

.share-item:hover {
  border-color: #ccc;
  background: #fafafa;
}

.share-item-info {
  margin-bottom: 0.75rem;
}

.share-item-name {
  font-weight: 600;
  color: #333;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.share-item-email {
  font-size: 0.8rem;
  color: #666;
  word-break: break-all;
  line-height: 1.3;
}

.share-item-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.share-remove-btn {
  padding: 0.5rem 0.85rem;
  border: 1.5px solid #f44336;
  border-radius: 6px;
  background: white;
  color: #f44336;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.share-remove-btn:hover {
  background: #f44336;
  color: white;
}

/* Desktop: side-by-side layout for actions */
@media (min-width: 400px) {
  .share-item-email {
    word-break: normal;
  }

}

/* Mobile responsive */
@media (max-width: 600px) {
  .modal-content {
    padding: 1.5rem;
    max-width: 100%;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions button {
    width: 100%;
  }
}

/* ── Swarm Risk Alert ─────────────────────────────────────────────────── */
.swarm-alert {
  margin-top: 12px;
  margin-bottom: 16px;
  border-radius: 16px;
  padding: 14px;
  position: relative;
}
.swarm-alert-moderate {
  background: #fbe1c2;
  border: 1px solid rgba(201, 101, 27, 0.2);
}
.swarm-alert-high {
  background: #f5d8c8;
  border: 1px solid rgba(184, 84, 50, 0.2);
}
.swarm-alert-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.swarm-alert-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.swarm-alert-moderate .swarm-alert-icon {
  color: #c9651b;
}
.swarm-alert-high .swarm-alert-icon {
  color: #b85432;
}
.swarm-alert-header-content {
  flex: 1;
}
.swarm-alert-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.swarm-alert-moderate .swarm-alert-label {
  color: #7d3a0c;
}
.swarm-alert-high .swarm-alert-label {
  color: #7a2f1c;
}
.swarm-alert-title {
  font-size: 14.5px;
  font-weight: 600;
  color: #3a2814;
  margin-top: 1px;
  text-transform: capitalize;
}
.swarm-alert-dismiss {
  width: 26px;
  height: 26px;
  border-radius: 99px;
  border: none;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.swarm-alert-moderate .swarm-alert-dismiss {
  color: #7d3a0c;
}
.swarm-alert-high .swarm-alert-dismiss {
  color: #7a2f1c;
}
.swarm-alert-dismiss:hover {
  background: rgba(255, 255, 255, 0.75);
}
.swarm-alert-reasons {
  margin: 0;
  padding: 0 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.swarm-alert-reasons li {
  font-size: 12.5px;
  color: #3a2814;
  line-height: 1.45;
}
.swarm-alert-suggestion {
  margin-top: 12px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  color: #3a2814;
  line-height: 1.5;
}
.swarm-alert-suggestion strong {
  font-weight: 600;
}

/* ── Weather Badge ────────────────────────────────────────────────────── */
.weather-badge {
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 0.15rem 0.6rem;
  white-space: nowrap;
}

/* ── Geolocation Controls ─────────────────────────────────────────────── */
.geo-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.geo-status {
  font-size: 0.85rem;
  color: var(--muted);
}
.btn-small {
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
}

/* ── Apiary location map ──────────────────────────────────────────────── */
.map-row .map-wrap { width: 100%; }
.apiary-map {
  height: 280px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: crosshair;
}
.map-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.4rem 0 0;
}
@media (max-width: 600px) {
  .apiary-map { height: 220px; }
}

/* ── Sub-tab bar (Ask / Report toggle) ────────────────────────────────── */
.subtab-bar { display: flex; gap: .5rem; margin-bottom: 1.2rem; }
.subtab-btn {
  padding: .45rem 1.1rem; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--card); color: var(--muted); font-weight: 600; font-size: .88rem; cursor: pointer;
}
.subtab-btn.active { background: var(--honey); color: #fff; border-color: var(--honey); }

/* ── Hive Performance Report (inline) ─────────────────────────────────── */
.report-loading { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.report-empty   { text-align: center; padding: 2rem 1rem; color: var(--muted); }

.summary-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .8rem; margin-bottom: 1.5rem; }
.summary-card { background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 1rem; text-align: center; box-shadow: var(--shadow); }
.summary-card .big { font-size: 1.8rem; font-weight: 700; color: var(--honey); }
.summary-card .label { font-size: .8rem; color: var(--muted); margin-top: .25rem; }

.report-section { margin-bottom: 1.8rem; }
.report-section h3 { font-size: 1.05rem; font-weight: 700; color: var(--dark); margin-bottom: .6rem; border-bottom: 2px solid var(--honey); padding-bottom: .35rem; }

.hive-report-card { background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: .8rem; box-shadow: var(--shadow); }
.hive-report-card.best { border-color: var(--honey); border-width: 2px; }
.hive-card-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .6rem; flex-wrap: wrap; gap: .4rem; }
.hive-card-name { font-size: 1rem; font-weight: 700; color: var(--dark); }
.hive-card-badge { font-size: .75rem; padding: .18rem .55rem; border-radius: 12px; font-weight: 600; }
.badge-star { background: #fef3c7; color: #92400e; }
.badge-ok { background: #d1fae5; color: #065f46; }
.badge-warn { background: #fce8e6; color: #991b1b; }
.hive-card-meta { font-size: .8rem; color: var(--muted); margin-bottom: .6rem; }

.score-bars { display: grid; gap: .4rem; }
.score-row { display: grid; grid-template-columns: 110px 1fr 36px; align-items: center; gap: .4rem; }
.score-label { font-size: .8rem; color: var(--muted); text-align: right; }
.score-track { height: 16px; background: var(--cream); border-radius: 8px; overflow: hidden; }
.score-fill { height: 100%; border-radius: 8px; transition: width .6s ease; min-width: 2px; }
.score-val { font-size: .8rem; font-weight: 600; color: var(--dark); }
.fill-honey   { background: linear-gradient(90deg, #f4a300, #fbbf24); }
.fill-queen   { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.fill-temper  { background: linear-gradient(90deg, #10b981, #34d399); }
.fill-disease { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.fill-swarm   { background: linear-gradient(90deg, #f97316, #fb923c); }
.fill-overall { background: linear-gradient(90deg, #f4a300, #e89800); }

.apiary-summary-card { background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: .6rem; box-shadow: var(--shadow); }
.apiary-summary-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .5rem; flex-wrap: wrap; gap: .3rem; }
.apiary-summary-name { font-weight: 700; color: var(--dark); }
.apiary-summary-meta { font-size: .8rem; color: var(--muted); }

.tips-list { list-style: none; padding: 0; }
.tips-list li { background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: .5rem; font-size: .9rem; line-height: 1.5; box-shadow: var(--shadow); }
.tips-list li::before { content: "\01F4A1"; margin-right: .4rem; }

@media (max-width: 640px) {
  .score-row { grid-template-columns: 85px 1fr 32px; }
  .summary-row { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════════════════════════════════════════════════
   Treatment Records
   ══════════════════════════════════════════════════════════════════════════════ */

.treatment-hive-selector {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.treatment-hive-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: var(--card);
}

.treatment-hive-group-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.treatment-hive-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  cursor: pointer;
  font-size: 0.95rem;
}

.treatment-hive-checkbox input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
}

.treatment-filters {
  display: flex;
  gap: 1rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.treatment-filters label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.treatment-filters select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font-size: 0.95rem;
}

.treatment-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.treatment-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.treatment-batch-card {
  border-left: 4px solid var(--primary);
}

.treatment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.treatment-date {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}

.treatment-hive {
  font-size: 0.9rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
}

.treatment-batch-badge {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(245, 166, 35, 0.1);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
}

.treatment-apiary-group {
  display: block;
  margin: 0.25rem 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.treatment-detail {
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.treatment-detail strong {
  font-weight: 600;
  color: var(--text-muted);
  min-width: 110px;
  display: inline-block;
}

.treatment-notes {
  margin-top: 0.75rem;
  padding: 0.6rem;
  background: var(--bg);
  border-left: 3px solid var(--border);
  border-radius: 4px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
}

.treatment-actions {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
}

.btn-edit-treatment {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--muted);
  padding: .3rem .7rem;
  border-radius: var(--radius);
  font-size: .8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .2s, color .2s, background .2s;
}

.btn-edit-treatment:hover {
  border-color: var(--honey);
  color: var(--dark);
  background: rgba(245, 166, 35, 0.05);
}

.btn-delete-treatment {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--red);
  padding: .3rem .7rem;
  border-radius: var(--radius);
  font-size: .8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s;
}

.btn-delete-treatment:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

@media (max-width: 640px) {
  .treatment-filters {
    flex-direction: column;
    gap: 0.75rem;
  }

  .treatment-filters label {
    flex-direction: column;
    align-items: flex-start;
  }

  .treatment-filters select {
    width: 100%;
  }

  .treatment-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

/* ══════════════════════════════════════════════════════════════════════
   LOGBOOK REDESIGN - New Design System Components
   ══════════════════════════════════════════════════════════════════════ */

/* Typography - Instrument Serif for numbers and headings */
.serif-num {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  line-height: 1.05;
}

/* Status Pill Component */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1px;
  white-space: nowrap;
}

.status-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.status-pill.complete {
  background: var(--forest-soft);
  color: #2c5a30;
}
.status-pill.complete .status-pill-dot {
  background: var(--forest);
}

.status-pill.active {
  background: var(--amber-soft);
  color: #7d3a0c;
}
.status-pill.active .status-pill-dot {
  background: var(--amber-warn);
}

.status-pill.withdraw {
  background: var(--rust-soft);
  color: #7a2f1c;
}
.status-pill.withdraw .status-pill-dot {
  background: var(--rust);
}

.status-pill.neutral {
  background: rgba(28,19,8,0.06);
  color: var(--ink-700);
}
.status-pill.neutral .status-pill-dot {
  background: var(--ink-400);
}

/* Hive Switcher - Breadcrumb Style */
.hive-switcher {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
  margin-top: 14px;
}

.hive-switcher-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--honey-softer);
  color: var(--honey-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.hive-switcher-content {
  flex: 1;
  min-width: 0;
}

.hive-switcher-apiary {
  font-size: 11px;
  color: var(--ink-500);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-weight: 600;
}

.hive-switcher-hive {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-900);
  display: flex;
  align-items: center;
  gap: 6px;
}

.queen-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.15);
}

.queen-dot.red { background: #c0392b; }
.queen-dot.blue { background: #2e6bbf; }
.queen-dot.green { background: #3a8a44; }
.queen-dot.yellow { background: #dfa000; }
.queen-dot.white { background: #fff; }

/* AI Insight Card */
.insight-card {
  margin-top: 12px;
  border: 1px solid rgba(201,101,27,0.2);
  border-radius: 16px;
  padding: 14px;
  position: relative;
}

.insight-card.high {
  background: var(--rust-soft);
  border-color: rgba(184,84,50,0.2);
}

.insight-card.moderate {
  background: var(--amber-soft);
  border-color: rgba(201,101,27,0.2);
}

.insight-card.low {
  background: var(--forest-soft);
  border-color: rgba(74,124,78,0.2);
}

.insight-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.insight-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.insight-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #3a2814;
}

.insight-title {
  font-size: 14.5px;
  font-weight: 600;
  color: #3a2814;
  margin-top: 1px;
  text-transform: capitalize;
}

.insight-reasons {
  margin: 0;
  padding: 0 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.insight-reasons li {
  font-size: 12.5px;
  color: #3a2814;
  line-height: 1.45;
}

.insight-suggestion {
  margin-top: 12px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.55);
  font-size: 12px;
  color: #3a2814;
  line-height: 1.5;
}

.insight-action {
  margin-top: 10px;
  width: 100%;
  background: var(--ink-900);
  color: var(--bg);
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Observation Chips */
.obs-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 6px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
}

.obs-chip.positive {
  background: var(--forest-soft);
  color: #2c5a30;
}

.obs-chip.negative {
  background: rgba(28,19,8,0.06);
  color: var(--ink-400);
}

.obs-chip-icon {
  width: 11px;
  height: 11px;
}

/* Inspection Card - Calendar Date Widget */
.inspection-date-widget {
  width: 44px;
  flex: none;
  text-align: center;
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 6px 0;
}

.inspection-date-day {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--honey-deep);
  text-transform: uppercase;
}

.inspection-date-num {
  font-size: 19px;
  font-weight: 700;
  color: var(--ink-900);
  line-height: 1.05;
  font-family: 'Instrument Serif', serif;
}

.inspection-date-month {
  font-size: 9.5px;
  color: var(--ink-500);
}

/* Weather Badge */
.weather-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  background: var(--surface-alt);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--ink-700);
  font-weight: 500;
}

/* Mini Stats (for Hive Hero) */
.mini-stat {
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 7px 10px;
}

.mini-stat-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--ink-500);
  text-transform: uppercase;
}

.mini-stat-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 1px;
}

.mini-stat-number {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-900);
  font-family: 'Instrument Serif', serif;
  line-height: 1;
}

.mini-stat-sub {
  font-size: 10.5px;
  color: var(--ink-500);
}

/* Updated button styles for new honey color */
.btn-primary {
  background: var(--honey);
  color: #fff;
  box-shadow: 0 4px 12px rgba(200,136,26,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn-primary:hover {
  background: var(--honey-deep);
}

/* ── Inspection Actions Modal ──────────────────────────────────────────── */
.inspection-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.inspection-modal.hidden {
  display: none;
}

.inspection-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(28, 19, 8, 0.5);
  backdrop-filter: blur(2px);
}

.inspection-modal-content {
  position: relative;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 -4px 24px rgba(28, 19, 8, 0.15);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.inspection-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--divider);
}

.inspection-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-900);
}

.inspection-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--surface-alt);
  color: var(--ink-700);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.inspection-modal-close:hover {
  background: var(--divider);
}

.inspection-modal-body {
  padding: 18px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
}

.inspection-date-label {
  font-size: 12.5px;
  color: var(--ink-500);
  margin-top: 2px;
  margin-bottom: 8px;
}

.inspection-action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.inspection-action-btn:hover {
  background: var(--surface-alt);
}

.inspection-action-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--ink-700);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.inspection-action-icon-danger {
  background: var(--rust-soft);
  color: var(--rust);
}

.inspection-action-text {
  flex: 1;
  min-width: 0;
}

.inspection-action-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-900);
}

.inspection-action-danger .inspection-action-label {
  color: var(--rust);
}

.inspection-action-sub {
  font-size: 11.5px;
  color: var(--ink-500);
  margin-top: 1px;
}

.inspection-action-chevron {
  color: var(--ink-400);
  flex-shrink: 0;
}

.inspection-action-divider {
  height: 1px;
  background: var(--divider);
  margin: 10px 0;
}

/* Delete warning */
.delete-warning {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 12px;
  background: var(--rust-soft);
  border: 1px solid rgba(192, 57, 43, 0.2);
  margin-top: 4px;
}

.delete-warning-icon {
  color: var(--rust);
  flex-shrink: 0;
}

.delete-warning-text {
  font-size: 13px;
  color: #5a1f0c;
  line-height: 1.5;
}

.delete-warning-text strong {
  font-weight: 600;
}

.delete-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.btn-secondary {
  flex: 1;
  background: var(--surface);
  color: var(--ink-700);
  border: 1px solid var(--divider-strong);
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:hover {
  background: var(--surface-alt);
  border-color: var(--divider);
}

.btn-danger-solid {
  flex: 1;
  background: var(--rust);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-danger-solid:hover {
  background: #b03328;
  transform: translateY(-1px);
}

@media (min-width: 640px) {
  .inspection-modal {
    align-items: center;
  }

  .inspection-modal-content {
    border-radius: 16px;
    max-width: 500px;
  }
}

/* ── Inspection Card Edit/Delete Buttons ───────────────────────────────── */
.btn-edit-inspection:hover {
  background: var(--divider) !important;
  border-color: var(--divider-strong) !important;
}

.btn-delete-inspection:hover {
  background: var(--rust-soft) !important;
  border-color: var(--rust) !important;
}
/* ── Structured Inspection Form ────────────────────────────────────────── */
.inspection-section {
  margin-bottom: 20px;
}
.inspection-section:last-child {
  margin-bottom: 0;
}
.inspection-section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--ink-500);
  text-transform: uppercase;
  margin: 0 0 8px 0;
}
.inspection-section-subtitle {
  font-size: 11.5px;
  color: var(--ink-400);
  margin: -4px 0 8px 0;
}

/* Observation Toggles (Yes/No) */
.observation-toggle-group {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.observation-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--divider);
}
.observation-toggle:last-child {
  border-bottom: none;
}
.observation-label {
  flex: 1;
  font-size: 14px;
  color: var(--ink-900);
}
.toggle-buttons {
  display: flex;
  gap: 6px;
}
.toggle-btn {
  padding: 5px 12px;
  border-radius: 99px;
  border: none;
  cursor: pointer;
  background: rgba(28, 19, 8, 0.06);
  color: var(--ink-500);
  font-size: 12.5px;
  font-weight: 600;
  transition: all 0.15s;
}
.toggle-btn:hover {
  background: rgba(28, 19, 8, 0.1);
}
.toggle-btn.active[data-value="true"] {
  background: var(--forest-soft);
  color: #2c5a30;
}
.toggle-btn.active[data-value="false"] {
  background: var(--rust-soft);
  color: #7a2f1c;
}

/* Frame Steppers */
.frame-stepper-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.frame-stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--divider-strong);
  border-radius: 10px;
  padding: 8px 10px;
}
.frame-stepper-info {
  flex: 1;
  min-width: 0;
}
.frame-stepper-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-900);
}
.frame-stepper-sub {
  font-size: 11px;
  color: var(--ink-500);
  margin-top: 1px;
}
.frame-btn {
  width: 30px;
  height: 30px;
  border-radius: 99px;
  border: none;
  background: rgba(28, 19, 8, 0.07);
  color: var(--ink-700);
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.frame-btn:hover {
  background: rgba(28, 19, 8, 0.12);
}
.frame-btn:active {
  transform: scale(0.95);
}
.frame-value {
  min-width: 28px;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink-900);
  font-family: 'Instrument Serif', serif;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  user-select: none;
}
.frame-value:hover {
  background: rgba(28, 19, 8, 0.06);
}
input.frame-value-input {
  width: 3.2em;
  min-width: 3.2em;
  border: 1px solid var(--honey-soft);
  background: var(--surface);
  outline: none;
  cursor: text;
  user-select: text;
  /* Hide native spinner controls so the look matches the static number */
  -moz-appearance: textfield;
}
input.frame-value-input::-webkit-outer-spin-button,
input.frame-value-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Inline Steppers (Queen Cells / Play Cups) */
.stepper-group {
  display: flex;
  gap: 8px;
}
.stepper-inline {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--divider-strong);
  border-radius: 10px;
  padding: 6px 8px;
}
.stepper-label {
  flex: 1;
  font-size: 12px;
  color: var(--ink-500);
}
.stepper-btn {
  width: 24px;
  height: 24px;
  border-radius: 99px;
  border: none;
  background: rgba(28, 19, 8, 0.07);
  color: var(--ink-700);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.stepper-btn:hover {
  background: rgba(28, 19, 8, 0.12);
}
.stepper-btn:active {
  transform: scale(0.95);
}
.stepper-value {
  min-width: 18px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 4px;
  user-select: none;
}
.stepper-value:hover {
  background: rgba(28, 19, 8, 0.06);
}
input.stepper-value-input {
  width: 2.4em;
  min-width: 2.4em;
  border: 1px solid var(--honey-soft);
  background: var(--surface);
  outline: none;
  cursor: text;
  user-select: text;
  -moz-appearance: textfield;
}
input.stepper-value-input::-webkit-outer-spin-button,
input.stepper-value-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Temperament Chips */
.temperament-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.temperament-chip {
  padding: 7px 14px;
  border-radius: 99px;
  border: 1px solid var(--divider-strong);
  background: var(--surface);
  color: var(--ink-700);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.temperament-chip:hover {
  background: var(--surface-alt);
}
.temperament-chip.active {
  background: var(--honey-softer);
  border-color: var(--honey-soft);
  color: var(--honey-deep);
  font-weight: 600;
}

/* Voice button alternative style */
.btn-voice-alt {
  margin-top: 8px;
  padding: 7px 12px;
  border-radius: 99px;
  border: 1px solid var(--honey-soft);
  background: var(--honey-softer);
  color: var(--honey-deep);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.btn-voice-alt:hover {
  background: var(--honey-soft);
}

/* ── Record card: structured summary chips ─────────────────────────────── */
.record-obs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.record-frames-row {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--ink-500);
}
.record-frames-row strong {
  color: var(--ink-700);
  font-weight: 600;
}
.record-temp-row {
  margin-top: 8px;
}
.obs-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 6px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 500;
}
.obs-chip-yes {
  background: var(--forest-soft);
  color: #2c5a30;
}
.obs-chip-no {
  background: rgba(28, 19, 8, 0.06);
  color: var(--ink-400);
}
.obs-flag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
}
.obs-flag-rust {
  background: var(--rust-soft);
  color: #7a2f1c;
}
.obs-flag-amber {
  background: var(--amber-soft, #f7e0b8);
  color: #7d3a0c;
}
.obs-flag-honey {
  background: var(--honey-softer);
  color: var(--honey-deep);
}
