/* ══════════════════════════════════════════════════════════════
   BED CARDS v3.8 — Filter pills, new cards, detail drawer
══════════════════════════════════════════════════════════════ */

/* ── Filter pill row ── */
.bed-filter-pills {
  display: flex;
  gap: 6px;
  padding: 10px 0 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
}
.bed-filter-pills::-webkit-scrollbar { display: none; }
.bed-filter-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--border-tan);
  background: #FAF7F2;
  color: var(--ink);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  user-select: none;
}
.bed-filter-pill:hover { background: #F0E8D8; border-color: #C4A882; }
.bed-filter-pill.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.bed-filter-pill.harvest-pill { background: #FDF0EB; color: #B9482E; border-color: #F0C4B4; }
.bed-filter-pill.harvest-pill.active { background: #B9482E; color: #FAF7F2; border-color: #B9482E; }

/* ── Group header row ── */
.bed-group-header-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.075em;
  text-transform: uppercase;
  padding: 6px 0 8px;
  margin-top: 14px;
}
.bed-group-header-row:first-child { margin-top: 4px; }
.bed-group-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── New card ── */
.bed-card-new {
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  cursor: pointer;
  transition: box-shadow 0.15s, outline-color 0.1s;
  position: relative;
  min-height: 76px;
}
.bed-card-new:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.11); }
.bed-card-new.card-selected { outline-offset: 1px; }
.bed-card-stripe { width: 4px; flex-shrink: 0; }
.bed-card-body {
  flex: 1;
  padding: 10px 11px 9px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bed-card-hd {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 5px;
}
.bed-card-name {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.bed-status-pill {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  flex-shrink: 0;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}
.bed-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.bed-card-crop {
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}
.bed-card-var {
  font-family: var(--f-accent);
  font-style: italic;
  font-size: 12px;
  opacity: 1;
}
.bed-card-prog-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.bed-card-prog-track {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
}
.bed-card-prog-fill { height: 100%; border-radius: 2px; }
.bed-card-prog-lbl { font-size: 11px; white-space: nowrap; flex-shrink: 0; }
.bed-card-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.bed-card-chip {
  font-size: 10px;
  border-radius: 3px;
  padding: 1px 5px;
}
.bed-hh-badge {
  font-size: 9px;
  background: rgba(139,94,60,0.12);
  color: #8B5E3C;
  border-radius: 3px;
  padding: 1px 5px;
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}
.bed-card-alert { font-size: 11px; font-weight: 600; }
.bed-card-empty { font-size: 12px; font-style: italic; }
.bed-card-assign {
  font-size: 0.68rem;
  font-weight: 600;
  color: #B9482E;
  background: #FDF0EB;
  border: 1px solid #F0C4B4;
  border-radius: 5px;
  padding: 3px 9px;
  cursor: pointer;
  display: inline-block;
  margin-top: 2px;
}
.bed-card-assign:hover { background: #F8E2DA; }

/* ── Bed detail drawer ── */
#bedDetailDrawer {
  background: #FAF7F2;
  border-left: 1px solid var(--border-rule);
  overflow: hidden;
  z-index: 100;
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.bed-drawer-drag-handle {
  width: 36px;
  height: 4px;
  background: #D5BA97;
  border-radius: 2px;
  margin: 8px auto 4px;
  flex-shrink: 0;
}
.bed-drawer-header {
  padding: 14px 16px 10px;
  background: #FAF7F2;
  border-bottom: 1px solid var(--border-rule);
  flex-shrink: 0;
}
.bed-drawer-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
}
.bed-drawer-title { font-size: 1.05rem; font-weight: 600; color: var(--ink); line-height: 1.2; }
.bed-drawer-close {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #F0EBE3;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.7rem;
  color: var(--ink);
  opacity: 0.55;
  flex-shrink: 0;
  transition: opacity 0.1s;
  line-height: 1;
}
.bed-drawer-close:hover { opacity: 0.9; }
.bed-drawer-zone { font-size: 0.68rem; color: #6a7560; margin-bottom: 8px; line-height: 1.4; }
.bed-drawer-status-row { display: flex; align-items: center; gap: 6px; }
.bed-drawer-scroll { flex: 1; overflow-y: auto; }
.bed-drawer-section { padding: 12px 16px; border-top: 1px solid var(--border-rule); }
.bed-drawer-section-lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.55;
  margin-bottom: 8px;
}
.bed-drawer-crop-block { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.bed-drawer-fam-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.bed-drawer-c-name { font-size: 15px; font-weight: 500; color: var(--ink); line-height: 1.2; }
.bed-drawer-c-var {
  font-family: var(--f-accent);
  font-style: italic;
  font-size: 12px;
  color: var(--ink);
  opacity: 0.70;
  margin-top: 2px;
}
.bed-drawer-prog-wrap { margin-bottom: 8px; }
.bed-drawer-prog-labels { display: flex; justify-content: space-between; margin-bottom: 4px; }
.bed-drawer-prog-lbl-l { font-size: 11px; color: #6a7560; }
.bed-drawer-prog-lbl-r { font-size: 11px; font-weight: 500; }
.bed-drawer-track { height: 5px; background: #E8DFD0; border-radius: 3px; overflow: hidden; }
.bed-drawer-fill { height: 100%; border-radius: 3px; }
.bed-harvest-banner {
  background: #FDF0EB;
  border: 1px solid #F0C4B4;
  border-radius: 6px;
  padding: 7px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}
.bed-harvest-banner .hb-label { font-size: 0.68rem; font-weight: 500; color: #B9482E; }
.bed-harvest-banner .hb-date  { font-size: 0.68rem; color: #B9482E; opacity: 0.7; }
.bed-drawer-task-list { display: flex; flex-direction: column; gap: 6px; }
.bed-drawer-task-row { display: flex; align-items: flex-start; gap: 8px; }
.bed-drawer-tcheck {
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--border-tan);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
  position: relative;
}
.bed-drawer-tcheck.done { background: var(--forest); border-color: var(--forest); }
.bed-drawer-tcheck.done::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 2px;
  width: 7px;
  height: 4px;
  border-left: 1.5px solid #FAF7F2;
  border-bottom: 1.5px solid #FAF7F2;
  transform: rotate(-45deg);
}
.bed-drawer-task-txt { font-size: 13px; color: var(--ink); line-height: 1.4; }
.bed-drawer-task-txt.done { text-decoration: line-through; opacity: 0.4; }
.bed-drawer-task-due { font-size: 11px; font-weight: 500; margin-top: 1px; }
.bed-drawer-task-due.urgent { color: #B9482E; }
.bed-drawer-task-due.ok { color: var(--ink); opacity: 0.70; }
.bed-soil-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.bed-soil-tile { background: var(--bg-subtle); border-radius: 6px; padding: 7px 9px; }
.bed-soil-lbl { font-size: 10px; font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase; color: var(--ink); opacity: 0.55; margin-bottom: 2px; }
.bed-soil-val { font-size: 13px; color: var(--ink); font-weight: 500; }
.bed-soil-sub { font-size: 11px; color: #6a7560; margin-top: 1px; }
.bed-notes-box { font-size: 12px; color: var(--ink); opacity: 0.70; line-height: 1.6; font-style: italic; background: var(--bg-subtle); border-radius: 6px; padding: 8px 10px; }
.bed-drawer-action-bar {
  padding: 12px 16px;
  border-top: 1px solid var(--border-rule);
  display: flex;
  gap: 6px;
  background: #FAF7F2;
  flex-shrink: 0;
}
.bed-drw-btn-primary {
  flex: 1;
  background: #B9482E;
  color: #FAF7F2;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 8px 0;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  text-align: center;
}
.bed-drw-btn-primary:hover { background: #a03e27; }
.bed-drw-btn-secondary {
  flex: 1;
  background: #FAF7F2;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 8px 0;
  border-radius: 7px;
  border: 1px solid var(--border-tan);
  cursor: pointer;
  text-align: center;
}
.bed-drw-btn-secondary:hover { background: #F0E8D8; }
@media (max-width: 767px) {
  #bedDetailDrawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    height: 60vh;
    border-top: 1px solid var(--border-rule);
    border-left: none;
    border-radius: 12px 12px 0 0;
    z-index: 100;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
  }
}
@media (min-width: 768px) {
  .bed-drawer-drag-handle { display: none; }
}

/* ── Dark mode: bed card / drawer overrides ── */
:root.dark .bed-filter-pill { background: var(--bg-subtle); color: var(--amber-text); border-color: var(--border-mid); }
:root.dark .bed-filter-pill:hover { background: var(--bg-modal); border-color: var(--border-tan); }
:root.dark .bed-filter-pill.active { background: var(--bg-olive); color: var(--text-primary); border-color: var(--green-text); }
:root.dark .bed-filter-pill.harvest-pill { background: var(--terra-tint); color: var(--terra-text); border-color: var(--terra-tint); }
:root.dark .bed-filter-pill.harvest-pill.active { background: var(--terra); color: #fff; border-color: var(--terra); }
:root.dark .bed-card-assign { background: var(--terra-tint); color: var(--terra-text); border-color: var(--terra-tint); }
:root.dark .bed-hh-badge { background: rgba(200,140,80,0.18); color: var(--amber-text); }
:root.dark #bedDetailDrawer { background: var(--bg-base); border-color: var(--border-rule); }
:root.dark .bed-drawer-header { background: var(--bg-base); border-bottom-color: var(--border-rule); }
:root.dark .bed-drawer-close { background: var(--bg-subtle); color: var(--text-primary); }
:root.dark .bed-harvest-banner { background: var(--terra-tint); border-color: var(--terra-tint); }
:root.dark .bed-harvest-banner .hb-label, :root.dark .bed-harvest-banner .hb-date { color: var(--terra-text); }
:root.dark .bed-drawer-tcheck.done { background: var(--green); border-color: var(--green); }
:root.dark .bed-soil-tile { background: var(--bg-subtle); }
:root.dark .bed-notes-box { background: var(--bg-subtle); color: var(--text-body); opacity: 1; }
:root.dark .bed-drawer-action-bar { background: var(--bg-base); border-top-color: var(--border-rule); }
:root.dark .bed-drw-btn-secondary { background: var(--bg-subtle); color: var(--text-primary); border-color: var(--border-mid); }
:root.dark .bed-drw-btn-secondary:hover { background: var(--bg-modal); }

