/* Hourly Entry - Timeline View Design */

:root {
  /* Shared brand tokens (duplicated — shared-base.css not loaded on this page) */
  --gold: #e4aa4f;
  --green: #668971;
  --green-dark: #4a6b54;
  --danger: #c45c4a;
  /* Page-specific: forced dark theme values */
  --gold-dark: #c48a2f;
  --green-bright: #7a9d87;
  --bg-dark: #1a1a1a;
  --bg-card: #2d2d2d;
  --bg-input: #3d3d3d;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --border-color: #404040;
  --success: #4ade80;
  --error: #f87171;

  /* Aliases for SHARED components. src/js/shared/toast.js injects its own CSS
     using shared-base token names with light-theme fallbacks — `--text` falls
     back to #1a1a1a, which on this page's dark --bg-card is black text on a
     near-black panel. Defining the names here is what makes a shared component
     render correctly on a page that does not load shared-base.css. */
  --text: #ffffff;
  --text-muted: #a0a0a0;
  --font-ui: 'Outfit', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --border-light: #404040;
  --info: #62758d;
  --ro-green: #668971;
  --ro-gold: #e4aa4f;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  color-scheme: dark;
}

body {
  font-family: 'Outfit', system-ui, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden; /* Prevent any scrolling */
}

/* ===================
   VIEW SYSTEM
   =================== */
.view {
  display: none;
  height: 100vh;
  overflow: hidden;
}

.view.active {
  display: flex;
  flex-direction: column;
}

/* ===================
   DASHBOARD GRID
   =================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr; /* Use fr units to properly account for gaps */
  gap: 20px;
  padding: 20px 24px;
  height: calc(100vh - 56px); /* Full height minus header */
  overflow: hidden;
  box-sizing: border-box;
  background: var(--bg-dark);
}

.dashboard-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.card-header {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  position: relative;
}

/* Subtle gradient accent under card headers */
.card-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  opacity: 0.6;
}

.card-hourly .card-header::after {
  background: linear-gradient(90deg, var(--green), transparent 80%);
}

.card-barcode .card-header::after {
  background: linear-gradient(90deg, var(--gold), transparent 80%);
}

.card-timer .card-header::after {
  background: linear-gradient(90deg, rgba(95, 189, 132, 0.5), transparent 80%);
  transition: background 0.5s ease;
}

.card-timer.timer-yellow .card-header::after {
  background: linear-gradient(90deg, rgba(229, 188, 85, 0.5), transparent 80%);
}

.card-timer.timer-red .card-header::after {
  background: linear-gradient(90deg, rgba(217, 116, 101, 0.5), transparent 80%);
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.card-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
}

/* Card-specific adjustments */
.card-hourly .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-hourly .card-title {
  flex-shrink: 0;
}

.card-hourly .card-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* In-card view toggle */
.card-view {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.card-view.active {
  display: flex;
}

/* Timeline view within card - fill the space */
#timeline-content {
  gap: 0;
  padding: 0;
}

#timeline-content .progress-summary {
  flex-shrink: 0;
  padding: 6px 12px;
  margin: 0;
  background: transparent;
  border-bottom: 1px solid var(--border-color);
}

#timeline-content .progress-header {
  margin-bottom: 4px;
}

#timeline-content .progress-value {
  font-size: 24px;
}

#timeline-content .progress-bar-container {
  margin-bottom: 2px;
  height: 6px;
}

#timeline-content .progress-details {
  font-size: 13px;
}

#timeline-content .timeline-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(5, 1fr);
  gap: 6px;
}

/* Timeline slots - compact single-row layout */
.card-hourly .timeline-slot {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6px 12px;
  font-size: 14px;
  min-height: 0;
  gap: 2px;
}

.card-hourly .slot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.card-hourly .slot-time {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-hourly .slot-cultivar {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.card-hourly .slot-lbs {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
}

.card-hourly .slot-lbs.empty {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
}

.card-hourly .slot-smalls {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-left: 4px;
}

.card-hourly .slot-target {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--text-muted, #888);
  opacity: 0.8;
}

.card-hourly .slot-target.met {
  color: var(--green);
}

.card-hourly .slot-target.missed {
  color: var(--danger);
}

.card-hourly .slot-eff {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #e4aa4f;
  opacity: 0.9;
  margin-left: 4px;
}

.card-hourly .slot-status {
  font-size: 14px;
  flex-shrink: 0;
}

/* Timeline Slot States */
.card-hourly .timeline-slot {
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
}

/* Completed slots - green accent */
.card-hourly .timeline-slot.has-data {
  background: rgba(102, 137, 113, 0.15);
  border-left-color: var(--green);
}

.card-hourly .timeline-slot.has-data:hover {
  background: rgba(102, 137, 113, 0.25);
  box-shadow: inset 0 0 20px rgba(102, 137, 113, 0.15);
}

/* Current hour slot - gold accent with subtle pulse */
.card-hourly .timeline-slot.current {
  background: rgba(228, 170, 79, 0.15);
  border-left-color: var(--gold);
  animation: current-slot-pulse 3s ease-in-out infinite;
}

.card-hourly .timeline-slot.current:hover {
  background: rgba(228, 170, 79, 0.25);
  box-shadow: inset 0 0 20px rgba(228, 170, 79, 0.15);
}

@keyframes current-slot-pulse {
  0%, 100% { box-shadow: inset 0 0 15px rgba(228, 170, 79, 0.1); }
  50% { box-shadow: inset 0 0 25px rgba(228, 170, 79, 0.2); }
}

/* Empty future slots - neutral hover */
.card-hourly .timeline-slot:not(.has-data):not(.current):hover {
  background: rgba(255, 255, 255, 0.05);
  border-left-color: var(--border-color);
}

/* Placeholder for hidden slots (maintains grid alignment) */
.card-hourly .timeline-slot-placeholder {
  visibility: hidden;
}

/* Override legacy max-width for in-card layout */
.card-hourly .timeline-list,
.card-hourly #editor-content {
  max-width: none;
  margin: 0;
}

/* Inline editor header - improved navigation */
.editor-header-inline {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

/* Day View button - grid icon + text */
.back-btn-day {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(102, 137, 113, 0.2);
  border: 1px solid var(--ro-green);
  border-radius: 8px;
  color: var(--ro-green);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
}

.back-btn-day .day-icon {
  font-size: 18px;
  line-height: 1;
}

.back-btn-day .day-label {
  font-family: 'Outfit', sans-serif;
}

.back-btn-day:hover {
  background: rgba(102, 137, 113, 0.35);
  transform: scale(1.02);
}

/* Step pill in header */
.step-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(228, 170, 79, 0.15);
  border: 1px solid var(--gold);
  border-radius: 20px;
  flex: 1;
  min-width: 0;
}

.step-pill .step-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gold);
  color: #1a1a1a;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.step-pill .step-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Step states */
.step-pill.step-complete {
  background: rgba(102, 137, 113, 0.15);
  border-color: var(--green);
}

.step-pill.step-complete .step-icon {
  background: var(--green);
}

.step-pill.step-celebrate {
  background: rgba(102, 137, 113, 0.2);
  border-color: var(--green);
}

.step-pill.step-celebrate .step-icon {
  background: var(--green);
}

.step-pill.step-missed {
  background: rgba(196, 92, 74, 0.15);
  border-color: var(--danger);
}

.step-pill.step-missed .step-icon {
  background: var(--danger);
}

/* Hour navigation group */
.hour-nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 4px;
}

.editor-time-inline {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  font-weight: 600;
  color: var(--gold);
  min-width: 80px;
  text-align: center;
}

/* Prev/Next hour buttons - chevron style */
.nav-btn-hour {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 300;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn-hour:hover:not(:disabled) {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.nav-btn-hour:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Editor view within card - compact layout */
#editor-content {
  padding: 8px;
  gap: 8px;
  overflow-y: auto;
}

#editor-content .editor-section {
  padding: 8px;
  margin: 0;
  background: rgba(255,255,255,0.02);
  border-radius: 6px;
}

#editor-content .section-label {
  font-size: 14px;
  margin-bottom: 6px;
}

#editor-content .subsection-label {
  font-size: 13px;
  margin: 4px 0;
}

#editor-content .crew-grid {
  gap: 6px;
}

#editor-content .crew-field label {
  font-size: 12px;
}

#editor-content .number-input {
  height: 32px;
}

#editor-content .number-input input {
  font-size: 13px;
}

#editor-content .number-input button {
  width: 28px;
  font-size: 14px;
}

#editor-content .production-grid {
  gap: 6px;
}

#editor-content .production-field label {
  font-size: 12px;
}

#editor-content .lbs-input {
  padding: 6px 10px;
  font-size: 13px;
  height: 32px;
}

#editor-content .cultivar-select {
  font-size: 13px;
  padding: 6px 10px;
  height: 32px;
}

#editor-content .qc-textarea {
  padding: 6px 10px;
  font-size: 12px;
  min-height: 40px;
}

#editor-content .save-indicator {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding: 6px;
  font-size: 12px;
}

/* Compact hourly target display */
#editor-content .hourly-target-display {
  padding: 10px;
}

#editor-content .hourly-target-display .target-label {
  font-size: 12px;
  margin-bottom: 4px;
}

#editor-content .hourly-target-display .target-value {
  font-size: 22px;
}

/* ===================
   BARCODE CARD
   =================== */

/* Barcode Tabs */
.barcode-tabs {
  display: flex;
  gap: 4px;
  width: 100%;
}

.barcode-tab {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.barcode-tab:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.barcode-tab.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg-dark);
}

.barcode-tab-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.barcode-tab-content.hidden {
  display: none;
}

/* Scanner Tab Styles */
.scanner-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.pool-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.pool-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 600;
  text-align: center;
}

.pool-input:focus {
  outline: none;
  border-color: var(--green);
  background: rgba(102, 137, 113, 0.1);
}

.pool-unit {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.scanner-btn {
  padding: 14px 16px;
  border: 2px solid var(--green);
  border-radius: 10px;
  background: rgba(102, 137, 113, 0.2);
  color: var(--green-bright);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.scanner-btn:hover {
  background: rgba(102, 137, 113, 0.4);
  transform: scale(1.02);
}

.scanner-btn:active {
  transform: scale(0.98);
}

.scanner-btn.btn-pool {
  background: linear-gradient(135deg, rgba(102, 137, 113, 0.3), rgba(102, 137, 113, 0.15));
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
  will-change: background, border-color;
}

/* Update button changes color based on pool type */
#tab-scanner[data-pool-type="tops"] .scanner-btn.btn-pool {
  background: linear-gradient(135deg, rgba(228, 170, 79, 0.3), rgba(228, 170, 79, 0.15));
  border-color: var(--gold);
  color: var(--gold);
}

#tab-scanner[data-pool-type="tops"] .scanner-btn.btn-pool:hover {
  background: rgba(228, 170, 79, 0.4);
}

.scan-input {
  width: 100%;
  padding: 16px;
  border: 2px solid var(--gold);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  text-align: center;
}

.scan-input:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(228, 170, 79, 0.1);
  box-shadow: 0 0 0 3px rgba(228, 170, 79, 0.2);
}

.scan-input::placeholder {
  color: var(--text-secondary);
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 400;
}

.scan-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(102, 137, 113, 0.1);
  border-radius: 6px;
  font-size: 14px;
}

.scan-status-label {
  color: var(--text-secondary);
}

.scan-status-value {
  font-family: 'JetBrains Mono', monospace;
  color: var(--green-bright);
  font-weight: 500;
}

.scan-status.success .scan-status-value {
  color: var(--success);
}

.scan-status.error .scan-status-value {
  color: var(--error);
}

/* Pool Type Toggle */
.pool-type-toggle {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  margin-bottom: 6px;
}

.pool-type-btn {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  will-change: background, box-shadow;
}

.pool-type-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.pool-type-btn.active {
  color: white;
  font-weight: 700;
}

.pool-type-btn[data-pool-type="smalls"].active {
  background: var(--green);
  box-shadow: 0 2px 8px rgba(102, 137, 113, 0.4);
}

.pool-type-btn[data-pool-type="tops"].active {
  background: var(--gold);
  box-shadow: 0 2px 8px rgba(228, 170, 79, 0.4);
}

/* Current Pool Display - styles moved to enhanced version below */

/* Operation Selector */
.operation-selector {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}

.operation-btn {
  flex: 1;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.operation-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.operation-btn.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg-dark);
  box-shadow: 0 2px 6px rgba(228, 170, 79, 0.3);
}

/* Pool Note Input */
.pool-note-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
  font-family: 'Outfit', system-ui, sans-serif;
}

.pool-note-input:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(228, 170, 79, 0.05);
}

.pool-note-input::placeholder {
  color: var(--text-secondary);
  font-style: italic;
}

/* Pool Update Result */
.pool-update-result {
  padding: 12px;
  background: rgba(102, 137, 113, 0.1);
  border: 1px solid var(--green);
  border-radius: 8px;
  margin-top: 8px;
  transition: all 0.3s ease;
}

#tab-scanner[data-pool-type="tops"] .pool-update-result {
  background: rgba(228, 170, 79, 0.1);
  border-color: var(--gold);
}

#tab-scanner[data-pool-type="tops"] .pool-update-result .result-row.new span:last-child {
  color: var(--gold);
}

.pool-update-result .result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
}

.pool-update-result .result-row + .result-row {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pool-update-result .result-row span:first-child {
  color: var(--text-secondary);
  font-weight: 500;
}

.pool-update-result .result-row span:last-child {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--text-primary);
}

.pool-update-result .result-row.change span:last-child {
  color: var(--gold);
  font-size: 16px;
}

.pool-update-result .result-row.new span:last-child {
  color: var(--green-bright);
  font-size: 18px;
}

/* Label with Refresh Button */
.label-with-refresh {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.refresh-pool-btn {
  padding: 4px 8px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease, background 0.2s ease;
  will-change: transform;
}

.refresh-pool-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  transform: rotate(90deg);
}

.refresh-pool-btn:active {
  transform: rotate(90deg) scale(0.95);
}

/* Enhanced Current Pool Display */
.current-pool-display {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: rgba(102, 137, 113, 0.15);
  border: 2px solid var(--green);
  border-radius: 6px;
  margin-top: 6px;
  transition: background 0.3s ease, border-color 0.3s ease;
  will-change: background, border-color;
}

/* Pool display colors change based on active pool type */
#tab-scanner[data-pool-type="tops"] .current-pool-display {
  background: rgba(228, 170, 79, 0.15);
  border-color: var(--gold);
}

#tab-scanner[data-pool-type="tops"] .pool-value {
  color: var(--gold) !important;
}

.pool-display-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pool-stale-indicator {
  font-size: 16px;
  color: var(--gold);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.pool-values {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.pool-value-item {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.pool-value-item .pool-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--green-bright);
}

.pool-value-item .pool-unit {
  font-size: 13px;
  color: var(--text-secondary);
}

.pool-display-row .pool-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.pool-value-divider {
  color: var(--text-secondary);
  font-size: 16px;
}

/* Unit Toggle */
.unit-toggle {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  padding: 2px;
  flex-shrink: 0;
}

.unit-btn {
  padding: 6px 10px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 38px;
  white-space: nowrap;
}

.unit-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.unit-btn.active {
  background: var(--gold);
  color: var(--bg-dark);
  box-shadow: 0 1px 4px rgba(228, 170, 79, 0.3);
}

/* Preview Calculation */
.pool-preview {
  padding: 8px;
  background: rgba(228, 170, 79, 0.1);
  border: 1px solid var(--gold);
  border-radius: 6px;
  margin-bottom: 6px;
}

.preview-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 13px;
}

.preview-row + .preview-row {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.preview-text {
  color: var(--text-secondary);
  font-weight: 500;
}

.preview-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--text-primary);
}

.preview-row.new-value {
  margin-top: 3px;
  padding-top: 6px;
  border-top: 2px solid rgba(255, 255, 255, 0.2) !important;
}

.preview-row.new-value .preview-value {
  color: var(--gold);
  font-size: 16px;
}

/* Quick Add Buttons */
.quick-add-section {
  padding-top: 8px;
}

.quick-add-buttons {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.btn-quick-add {
  flex: 1;
  padding: 14px 12px !important;
  text-align: center;
  font-size: 15px !important;
}

.btn-quick-add .quick-add-weight {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.5px;
}

.btn-quick-add:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Shake animation for no-strain-selected feedback */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

.shake {
  animation: shake 0.4s ease;
}

/* Recent Changes Section */
.recent-changes-section {
  max-height: 200px;
  overflow-y: auto;
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.refresh-btn {
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.refresh-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  transform: rotate(90deg);
}

.recent-changes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.no-changes {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  font-style: italic;
}

.change-entry {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 13px;
}

.change-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.change-entry-product {
  font-weight: 600;
  color: var(--text-primary);
}

.change-entry-timestamp {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}

.change-entry-details {
  display: flex;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 12px;
}

.change-entry-action {
  padding: 2px 6px;
  background: rgba(228, 170, 79, 0.2);
  border-radius: 4px;
  color: var(--gold);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
}

.change-entry-action.add {
  background: rgba(102, 137, 113, 0.2);
  color: var(--green-bright);
}

.change-entry-action.subtract {
  background: rgba(196, 92, 74, 0.2);
  color: var(--error);
}

.change-entry-note {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-style: italic;
  font-size: 12px;
}

.card-barcode .card-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.barcode-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.barcode-label {
  font-size: 15px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.barcode-select {
  width: 100%;
  padding: 18px 22px;
  border: 2px solid var(--border-color);
  border-left: 4px solid var(--gold);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23e4aa4f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 52px;
}

.barcode-select:focus {
  outline: none;
  border-color: var(--gold);
  border-left-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(228, 170, 79, 0.2);
}

/* Dropdown option styling for dark theme */
.barcode-select option {
  background-color: var(--bg-card);
  color: var(--text-primary);
  padding: 12px;
}

/* Strain selected state */
.barcode-select.has-selection {
  background-color: rgba(102, 137, 113, 0.15);
  border-left-color: var(--green);
  border-color: var(--green);
  color: var(--text-primary) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23668971' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* ===================
   CUSTOM SELECT DROPDOWN
   =================== */
.custom-select {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  width: 100%;
  padding: 18px 52px 18px 22px;
  border: 2px solid var(--border-color);
  border-left: 4px solid var(--gold);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  font-family: inherit;
}

.custom-select-trigger:hover {
  border-color: var(--gold);
}

.custom-select-trigger:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(228, 170, 79, 0.2);
}

.custom-select-value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-value.placeholder {
  color: var(--text-secondary);
}

.custom-select-arrow {
  color: var(--gold);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 12px;
}

.custom-select.open .custom-select-arrow {
  transform: rotate(180deg);
}

/* Selected state */
.custom-select.has-selection .custom-select-trigger {
  background-color: rgba(102, 137, 113, 0.15);
  border-left-color: var(--green);
  border-color: var(--green);
}

.custom-select.has-selection .custom-select-arrow {
  color: var(--green);
}

/* Dropdown menu */
.custom-select-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  will-change: opacity, transform;
  z-index: 1000;
  max-height: 320px;
  display: flex;
  flex-direction: column;
}

.custom-select.open .custom-select-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Search input */
.custom-select-search {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
}

.custom-select-search-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.custom-select-search-input::placeholder {
  color: var(--text-secondary);
}

.custom-select-search-input:focus {
  outline: none;
  border-color: var(--gold);
}

/* Options container */
.custom-select-options {
  overflow-y: auto;
  flex: 1;
  padding: 8px;
}

/* Individual option */
.custom-select-option {
  padding: 14px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-primary);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.custom-select-option .option-name {
  flex: 1;
  min-width: 0;
}

.custom-select-option .option-weight {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.custom-select-option:hover {
  background: rgba(228, 170, 79, 0.15);
}

.custom-select-option:hover .option-weight {
  color: var(--gold);
}

.custom-select-option.selected .option-weight {
  color: var(--gold);
}

.custom-select-option.selected {
  background: rgba(102, 137, 113, 0.2);
  color: var(--green-bright);
  font-weight: 500;
}

.custom-select-option.selected::before {
  content: '✓';
  color: var(--green);
  font-weight: bold;
}

.custom-select-option.highlighted {
  background: rgba(228, 170, 79, 0.2);
}

/* No results state */
.custom-select-no-results {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

/* Hide native select when using custom */
.custom-select input[type="hidden"] {
  display: none;
}

.barcode-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.barcode-btn {
  flex: 1;
  min-height: 64px;
  padding: 16px;
  border: 2px solid var(--gold);
  border-radius: 12px;
  background: rgba(228, 170, 79, 0.1);
  color: var(--gold);
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.barcode-btn:hover {
  transform: scale(1.02);
}

.barcode-btn:active {
  transform: scale(0.98);
}

/* 5kg Button - Green identity */
.barcode-btn.btn-5kg {
  background: linear-gradient(135deg, rgba(102, 137, 113, 0.3), rgba(102, 137, 113, 0.15));
  border-color: var(--green);
  color: #8fbf9d;
}

.barcode-btn.btn-5kg:hover {
  background: linear-gradient(135deg, rgba(102, 137, 113, 0.5), rgba(102, 137, 113, 0.3));
  box-shadow: inset 0 0 25px rgba(102, 137, 113, 0.2);
}

/* 10lb Tops Button - Gold identity */
.barcode-btn.btn-tops {
  background: linear-gradient(135deg, rgba(228, 170, 79, 0.3), rgba(228, 170, 79, 0.15));
  border-color: var(--gold);
  color: #f0c87a;
}

.barcode-btn.btn-tops:hover {
  background: linear-gradient(135deg, rgba(228, 170, 79, 0.5), rgba(228, 170, 79, 0.3));
  box-shadow: inset 0 0 25px rgba(228, 170, 79, 0.2);
}

/* 10lb Smalls Button - Copper identity */
.barcode-btn.btn-smalls {
  background: linear-gradient(135deg, rgba(196, 130, 80, 0.3), rgba(196, 130, 80, 0.15));
  border-color: #c48250;
  color: #daa070;
}

.barcode-btn.btn-smalls:hover {
  background: linear-gradient(135deg, rgba(196, 130, 80, 0.5), rgba(196, 130, 80, 0.3));
  box-shadow: inset 0 0 25px rgba(196, 130, 80, 0.2);
}

/* ===================
   BAG TIMER CARD
   =================== */
/* ========================================
   CARD-TIMER — Scoreboard V2 Style
   Glassmorphism panel with metallic rings
   ======================================== */
.card-timer {
  transition: background 0.5s ease;
  position: relative;
  overflow: hidden;
}

/* State-dependent edge glow (scoreboard-v2 style) */
.card-timer.timer-green::before {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, transparent, rgba(95, 189, 132, 0.3), transparent);
  pointer-events: none;
  z-index: 1;
}

.card-timer.timer-yellow::before {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, transparent, rgba(229, 188, 85, 0.3), transparent);
  pointer-events: none;
  z-index: 1;
}

.card-timer.timer-red::before {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, transparent, rgba(217, 116, 101, 0.3), transparent);
  pointer-events: none;
  z-index: 1;
  animation: panelPulse 1.5s ease-in-out infinite;
}

.card-timer.timer-neutral::before {
  content: none;
}

@keyframes panelPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* Timer panel background states */
.card-timer.timer-green {
  background: rgba(28, 34, 32, 0.5);
  border-color: rgba(95, 189, 132, 0.15);
}

.card-timer.timer-yellow {
  background: rgba(28, 34, 32, 0.5);
  border-color: rgba(229, 188, 85, 0.15);
}

.card-timer.timer-red {
  background: rgba(28, 34, 32, 0.5);
  border-color: rgba(217, 116, 101, 0.15);
}

.card-timer.timer-neutral {
  background: rgba(28, 34, 32, 0.5);
}

/* Glassmorphism content area */
.timer-panel-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  height: 100%;
  padding: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow-y: auto;
  scrollbar-width: none;
}

.timer-panel-content::-webkit-scrollbar { display: none; }

/* ========================================
   SCALE RING — Metallic bezel, scoreboard-v2
   ======================================== */
.scale-section {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.scale-header,
.timer-header {
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(242, 239, 232, 0.5);
  margin-bottom: 8px;
}

.scale-display {
  position: relative;
  width: min(90%, 340px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #1c2220;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 0 3px rgba(245, 195, 109, 0.12),
    0 8px 24px rgba(0, 0, 0, 0.5),
    inset 0 2px 4px rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.scale-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.scale-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.035);
  stroke-width: 2;
}

.scale-ring-progress {
  fill: none;
  stroke: var(--gold);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 597;
  stroke-dashoffset: 597;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.scale-ring-progress.filling {
  stroke: var(--gold);
}

.scale-ring-progress.near-target {
  stroke: #e5bc55;
}

.scale-ring-progress.at-target {
  stroke: #5fbd84;
}

.scale-ring-progress.stale {
  stroke: rgba(255, 255, 255, 0.15);
}

.scale-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.scale-value {
  font-family: 'Bebas Neue', 'Impact', sans-serif;
  font-size: 38px;
  font-weight: 400;
  color: #f2efe8;
  line-height: 1;
  letter-spacing: 0.02em;
  text-shadow: 0 0 16px rgba(242, 239, 232, 0.08);
}

.scale-value.filling {
  color: var(--gold);
}

.scale-value.near-target {
  color: #e5bc55;
}

.scale-value.at-target {
  color: #5fbd84;
}

.scale-value.stale {
  color: rgba(242, 239, 232, 0.5);
}

.scale-label {
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(242, 239, 232, 0.5);
  margin-top: 4px;
}

.scale-status-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6b7370;
  transition: all 0.15s;
}

.scale-status-dot.connected {
  background: #5fbd84;
  box-shadow: 0 0 8px rgba(95, 189, 132, 0.6);
  animation: dotPulse 3s ease-in-out infinite;
}

.scale-status-dot.stale {
  background: #d97465;
  animation: none;
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(95, 189, 132, 0.6); }
  50% { opacity: 0.6; box-shadow: 0 0 4px rgba(95, 189, 132, 0.3); }
}

.scale-display.filling .scale-ring-progress { stroke: var(--gold); }
.scale-display.near-target .scale-ring-progress { stroke: #e5bc55; }
.scale-display.at-target .scale-ring-progress { stroke: #5fbd84; }

/* ========================================
   TIMER RING — Metallic bezel, scoreboard-v2
   ======================================== */
.timer-section {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timer-ring-container {
  position: relative;
  width: min(90%, 380px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #1c2220;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 0 3px rgba(245, 195, 109, 0.12),
    0 8px 24px rgba(0, 0, 0, 0.5),
    inset 0 2px 4px rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.timer-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.035);
  stroke-width: 2;
}

.timer-ring-progress {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}

.timer-ring-progress.green {
  stroke: #5fbd84;
}

.timer-ring-progress.yellow {
  stroke: #e5bc55;
  animation: timerPulseYellow 4s ease-in-out infinite;
}

.timer-ring-progress.red {
  stroke: #d97465;
  animation: timerPulseRed 1.5s ease-in-out infinite;
}

.timer-ring-progress.neutral {
  stroke: rgba(242, 239, 232, 0.22);
  filter: none;
}

@keyframes timerPulseYellow {
  0%, 100% { filter: none; }
  50% { filter: drop-shadow(0 0 6px rgba(229, 188, 85, 0.3)); }
}

@keyframes timerPulseRed {
  0%, 100% { filter: none; }
  50% { filter: drop-shadow(0 0 8px rgba(217, 116, 101, 0.4)); }
}

/* Ring glow layer */
.timer-ring-glow {
  transition: opacity 0.6s;
  opacity: 0;
}

.card-timer.timer-green .timer-ring-glow { opacity: 0.3; }
.card-timer.timer-yellow .timer-ring-glow { opacity: 0.5; animation: glowBreatheYellow 4s ease-in-out infinite; }
.card-timer.timer-red .timer-ring-glow { opacity: 0.7; animation: glowBreathe 1.5s ease-in-out infinite; }

@keyframes glowBreathe {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.8; }
}

@keyframes glowBreatheYellow {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

.timer-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.timer-value {
  font-family: 'Bebas Neue', 'Impact', sans-serif;
  font-size: 48px;
  font-weight: 400;
  color: #f2efe8;
  line-height: 1;
  letter-spacing: 0.02em;
  text-shadow: 0 0 16px rgba(242, 239, 232, 0.08);
}

.timer-value.green {
  color: #5fbd84;
  text-shadow: 0 0 20px rgba(95, 189, 132, 0.2);
}

.timer-value.yellow {
  color: #e5bc55;
  text-shadow: 0 0 20px rgba(229, 188, 85, 0.2);
}

.timer-value.red {
  color: #d97465;
  text-shadow: 0 0 20px rgba(217, 116, 101, 0.2);
}

.timer-value.neutral {
  color: rgba(242, 239, 232, 0.5);
  text-shadow: 0 0 12px rgba(242, 239, 232, 0.06);
}

.timer-label {
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(242, 239, 232, 0.5);
  margin-top: 4px;
}

/* Timer Target Info */
.timer-target {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  color: rgba(242, 239, 232, 0.5);
  text-align: center;
  letter-spacing: 0.05em;
}

.timer-target span {
  color: #f2efe8;
}

/* ========================================
   BAG STATS — Scoreboard-v2 card style
   ======================================== */
.timer-stats {
  display: flex;
  gap: 8px;
  width: 100%;
}

.timer-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  background: #1c2220;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all 0.15s;
}

.timer-stat:hover {
  border-color: rgba(228, 170, 79, 0.3);
  background: rgba(255, 255, 255, 0.025);
}

.timer-stat-label {
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(242, 239, 232, 0.5);
  margin-bottom: 3px;
}

.timer-stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  color: #f2efe8;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 10px rgba(242, 239, 232, 0.06);
}

.timer-stat-value.positive {
  color: #5fbd84;
  text-shadow: 0 0 12px rgba(95, 189, 132, 0.12);
}

.timer-stat-value.negative {
  color: #d97465;
  text-shadow: 0 0 12px rgba(217, 116, 101, 0.12);
}

/* Legacy stat-value classes (kept for JS compat) */
.stat-value { /* alias for timer-stat-value */ }
.stat-value.on-track { color: #5fbd84; }
.stat-value.behind { color: #d97465; }
.stat-value.on-break { color: #e5bc55; }

/* ========================================
   BUTTON ROW — Scoreboard-v2 style
   ======================================== */
.timer-btn-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.manual-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: transparent;
  border: 1.5px solid var(--gold);
  border-radius: 10px;
  color: var(--gold);
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.manual-btn .icon { font-size: 18px; display: flex; }

.manual-btn:hover {
  background: rgba(245, 195, 109, 0.15);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(228, 170, 79, 0.15);
}

.manual-btn:active { transform: translateY(0); }

.manual-btn.btn-green { border-color: #5fbd84; color: #5fbd84; }
.manual-btn.btn-green:hover { background: rgba(95, 189, 132, 0.18); }
.manual-btn.btn-yellow { border-color: #e5bc55; color: #e5bc55; }
.manual-btn.btn-red { border-color: #d97465; color: #d97465; }
.manual-btn.btn-red:hover { background: rgba(217, 116, 101, 0.18); }
.manual-btn.btn-neutral { border-color: rgba(242, 239, 232, 0.22); color: rgba(242, 239, 232, 0.5); }

.manual-btn.loading { opacity: 0.6; pointer-events: none; }
.manual-btn.success { border-color: #5fbd84; color: #5fbd84; background: rgba(95, 189, 132, 0.18); }
.manual-btn.error { border-color: #d97465; color: #d97465; background: rgba(217, 116, 101, 0.18); }

/* ===================
   TIMELINE VIEW (legacy)
   =================== */
#timeline-view {
  padding-bottom: 0;
}

/* Responsive: Stack cards on smaller screens */
@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr auto;
    height: calc(100vh - 56px);
  }

  .card-hourly {
    grid-column: 1 / -1;
    max-height: none;
  }
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }

  .card-hourly {
    max-height: 60vh;
  }

  .scale-display {
    width: 130px;
    height: 130px;
  }

  .timer-ring-container {
    width: 150px;
    height: 150px;
  }

  .scale-value {
    font-size: 28px;
  }

  .timer-value {
    font-size: 36px;
  }

  .timer-stat-value {
    font-size: 15px;
  }

  .barcode-btn {
    min-height: 60px;
  }
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* Left padding clears the floating home button, which is position:fixed at
     left:12px with z-index:9999 and so paints over the header. At the previous
     12px the title rendered as "r Manager" — the button covered "Floo". */
  padding: 8px 12px 8px 56px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Small home icon - subtle dashboard link */
.home-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 16px;
  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.2s, color 0.2s;
}

.home-icon:hover {
  opacity: 1;
  color: var(--ro-green);
}

.app-header h1 {
  font-size: 18px;
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  position: relative; /* For dropdown positioning */
}

/* On small screens, wrap header items */
@media (max-width: 420px) {
  .app-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-right {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
  }

  .start-day-btn {
    padding: 6px 12px;
    font-size: 13px;
  }

  .start-time-badge {
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* Visible date display (clickable to open picker) */
.date-display {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 500;
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.date-display:hover {
  border-color: var(--ro-green);
  background: rgba(102, 137, 113, 0.1);
}

/* Hidden date picker (opened programmatically) */
.date-picker-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.lang-btn {
  padding: 8px 16px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: transparent;
  color: var(--gold);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  min-height: 44px;
  transition: all 0.2s;
}

.lang-btn:hover {
  background: var(--gold);
  color: var(--bg-dark);
}

/* Start Day Button & Badge */
.start-day-btn {
  padding: 8px 16px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green);
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  min-height: 44px;
  transition: all 0.2s;
}

.start-day-btn:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
}

.start-time-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(102, 137, 113, 0.2);
  border: 1px solid var(--green);
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--green-bright);
  min-height: 44px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.start-time-badge:hover {
  background: rgba(102, 137, 113, 0.3);
  border-color: var(--green-bright);
}

.start-time-badge:active {
  transform: scale(0.98);
}

.start-time-icon {
  font-size: 10px;
  color: var(--green);
}

/* Custom Time Picker Dropdown */
.time-picker-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 16px;
  min-width: 240px;
  z-index: 1000;
  animation: slideDown 0.2s ease-out;
}

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

.time-picker-header {
  font-family: 'DM Serif Display', serif;
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.time-picker-custom {
  display: flex;
  gap: 8px;
}

.custom-time-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  min-height: 44px;
}

.custom-time-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(102, 137, 113, 0.1);
}

.set-custom-time-btn {
  padding: 10px 20px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green);
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 44px;
}

.set-custom-time-btn:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
}

.set-custom-time-btn:active {
  transform: scale(0.98);
}

/* Update edit icon for dropdown indicator */
.edit-icon {
  font-size: 10px;
  color: var(--green);
  opacity: 0.7;
  margin-left: 2px;
  transition: transform 0.2s ease;
}

.start-time-badge:hover .edit-icon {
  opacity: 1;
  transform: translateY(1px);
}

/* Mobile responsive */
@media (max-width: 480px) {
  .time-picker-dropdown {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    right: auto;
    min-width: 280px;
    max-width: calc(100vw - 32px);
  }
}

/* Progress Summary */
.progress-summary {
  background: var(--bg-card);
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.progress-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.progress-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 600;
  color: var(--gold);
}

.progress-bar-container {
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: visible;
  margin-bottom: 8px;
  position: relative;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--green-bright));
  border-radius: 4px;
  transition: width 0.5s ease, box-shadow 0.3s ease;
  box-shadow: 0 0 12px rgba(102, 137, 113, 0.4);
}

/* Progress bar at/near target - brighter glow */
.progress-bar.on-target {
  box-shadow: 0 0 16px rgba(74, 222, 128, 0.5);
}

.progress-details {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  color: var(--text-secondary);
}

/* Timeline List */
.timeline-list {
  flex: 1;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.timeline-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s;
}

.timeline-slot:hover {
  background: rgba(102, 137, 113, 0.15);
  border-color: var(--green);
}

.timeline-slot.current {
  border-color: var(--gold);
  background: rgba(228, 170, 79, 0.1);
}

.timeline-slot.has-data .slot-status {
  color: var(--success);
}

.slot-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--text-primary);
  min-width: 100px;
}

.slot-lbs {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 600;
  color: var(--gold);
  flex: 1;
  text-align: right;
  margin-right: 12px;
}

.slot-lbs.empty {
  color: var(--text-secondary);
  font-weight: 400;
}

.slot-status {
  font-size: 16px;
  color: var(--text-secondary);
}

/* Today FAB */
.today-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 14px 24px;
  background: var(--gold);
  color: var(--bg-dark);
  border: none;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(228, 170, 79, 0.4);
  transition: all 0.2s;
  z-index: 50;
}

.today-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(228, 170, 79, 0.5);
}

/* ===================
   EDITOR VIEW
   =================== */

.editor-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: 80px; /* Space for footer */
}

/* Step Guide Banner */
.step-guide {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(102, 137, 113, 0.2), rgba(102, 137, 113, 0.1));
  border: 1px solid var(--green);
  border-radius: 10px;
  margin-bottom: 16px;
}

.step-guide.step-production {
  background: linear-gradient(135deg, rgba(228, 170, 79, 0.2), rgba(228, 170, 79, 0.1));
  border-color: var(--gold);
}

.step-guide.step-complete {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.2), rgba(74, 222, 128, 0.1));
  border-color: var(--success);
}

.step-guide.step-celebrate {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.3), rgba(102, 137, 113, 0.2));
  border-color: var(--success);
  animation: celebrate-pulse 1.5s ease-in-out 3;
}

@keyframes celebrate-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.step-guide.step-missed {
  background: linear-gradient(135deg, rgba(196, 92, 74, 0.2), rgba(196, 92, 74, 0.1));
  border-color: var(--danger);
}

.step-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--green);
  color: var(--bg-dark);
  border-radius: 50%;
  font-weight: 700;
  font-size: 20px;
  flex-shrink: 0;
}

.step-guide.step-production .step-icon {
  background: var(--gold);
}

.step-guide.step-complete .step-icon {
  background: var(--success);
  font-size: 18px;
}

.step-guide.step-celebrate .step-icon {
  background: var(--success);
  font-size: 20px;
}

.step-guide.step-missed .step-icon {
  background: var(--danger);
  font-size: 18px;
  font-weight: 800;
}

.step-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.step-title {
  font-weight: 600;
  font-size: 18px;
  color: var(--text-primary);
}

.step-hint {
  font-size: 15px;
  color: var(--text-secondary);
}

/* Section States */
.editor-section.needs-attention {
  animation: attention-pulse 2s ease-in-out infinite;
}

@keyframes attention-pulse {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 0 3px rgba(228, 170, 79, 0.3); }
}

.editor-section.completed {
  border-color: var(--success) !important;
  opacity: 0.85;
}

.editor-section.completed .section-label {
  color: var(--success);
}

/* Completed checkmark for sections */
.section-status {
  font-size: 18px;
  margin-left: 8px;
}

/* Editor Sections */
.editor-section {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
}

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

.section-header .section-label {
  margin-bottom: 0;
}

/* Copy crew button */
.copy-crew-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  min-height: 44px;
  background: rgba(228, 170, 79, 0.15);
  border: 1px solid var(--gold);
  border-radius: 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: auto;
}

.copy-crew-btn .copy-icon {
  font-size: 12px;
}

.copy-crew-btn:hover {
  background: rgba(228, 170, 79, 0.3);
}

.copy-crew-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.copy-crew-btn.copied {
  background: rgba(102, 137, 113, 0.2);
  border-color: var(--green);
  color: var(--green);
}

.section-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--green);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.subsection-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Modified Badge */
.modified-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--bg-dark);
  background: var(--gold);
  padding: 4px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Crew Section */
.crew-section {
  border-color: var(--green);
  border-width: 2px;
}

/* Production Section */
.production-section {
  border-color: var(--gold);
  border-width: 2px;
}

.production-section .section-label {
  color: var(--gold);
}

.production-section .production-grid {
  margin-bottom: 16px;
}

.production-section .production-grid:last-child {
  margin-bottom: 0;
}

/* Crew Grid */
.crew-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
  justify-items: center;
}

.crew-grid .crew-field {
  width: 100%;
  max-width: 120px;
}

/* Compact buttons in crew grid to fit on narrow screens */
.crew-grid .number-input {
  display: flex;
  justify-content: center;
}

.crew-grid .number-input button {
  width: 36px;
  min-width: 36px;
  padding: 0;
  min-height: 44px;
  font-size: 18px;
  flex-shrink: 0;
}

.crew-grid .number-input input {
  width: 40px;
  min-width: 40px;
  padding: 8px 4px;
  font-size: 18px;
  text-align: center;
}

/* QC row - prominent standalone field */
.qc-row {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-bottom: 16px;
  padding: 12px;
  background: rgba(228, 170, 79, 0.15);
  border: 2px solid var(--gold);
  border-radius: 10px;
  clear: both;
}

.qc-row .crew-field {
  min-width: 150px;
}

.qc-row .crew-field label {
  color: var(--gold);
  font-weight: 600;
  font-size: 16px;
}

.qc-row .number-input {
  border-color: var(--gold);
}

/* Line 2 Collapsible inside Crew Section */
.line2-collapsible {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.line2-collapsible .section-content {
  display: none;
  margin-top: 12px;
}

.line2-collapsible.expanded .section-content {
  display: block;
}

.subsection-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

.subsection-toggle h4 {
  margin: 0;
}

.line2-collapsible.expanded .subsection-label {
  color: var(--green);
}

.line2-collapsible .toggle-icon {
  font-size: 20px;
  color: var(--text-secondary);
  transition: transform 0.3s;
}

.line2-collapsible.expanded .toggle-icon {
  transform: rotate(45deg);
}

.crew-field label {
  display: block;
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-align: center;
}

.number-input {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-input);
}

.number-input button {
  width: 44px;
  min-height: 48px;
  background: rgba(255,255,255,0.05);
  border: none;
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
  transition: background 0.2s;
}

.number-input button:hover {
  background: rgba(255,255,255,0.1);
}

.number-input button:active {
  background: rgba(255,255,255,0.15);
}

.number-input input {
  flex: 1;
  min-width: 40px;
  padding: 10px 4px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  text-align: center;
}

.number-input input:focus {
  outline: none;
  background: rgba(102, 137, 113, 0.1);
}

/* Field Row */
.field-row {
  margin-bottom: 16px;
}

.field-row:last-child {
  margin-bottom: 0;
}

.field-row label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* Cultivar Select */
.cultivar-select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input) !important;
  color: var(--text-primary) !important;
  font-size: 18px;
  min-height: 52px;
  cursor: pointer;
}

.cultivar-select:focus {
  outline: none;
  border-color: var(--green);
}

/* Production Grid */
.production-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.production-field label {
  display: block;
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.lbs-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  min-height: 56px;
  text-align: center;
}

.lbs-input:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(228, 170, 79, 0.1);
}

/* QC Textarea */
.qc-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 16px;
  resize: vertical;
  min-height: 60px;
}

.qc-textarea:focus {
  outline: none;
  border-color: var(--green);
}

/* Line 2 Collapsible */
.editor-section.collapsible .section-content {
  display: none;
}

.editor-section.collapsible.expanded .section-content {
  display: block;
  margin-top: 16px;
}

.toggle-icon {
  font-size: 24px;
  color: var(--text-secondary);
  transition: transform 0.3s;
}

.editor-section.collapsible.expanded .toggle-icon {
  transform: rotate(45deg);
}

/* Hourly Target Display */
.target-section {
  margin-top: 16px;
}

.hourly-target-display {
  text-align: center;
  padding: 20px;
  background: rgba(102, 137, 113, 0.1);
  border-radius: 12px;
  border: 2px solid var(--ro-green);
}

.hourly-target-display .target-label {
  display: block;
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hourly-target-display .target-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 32px;
  font-weight: 600;
  color: var(--gold);
}

.cumulative-target-display {
  text-align: center;
  padding: 16px;
  margin-top: 12px;
  background: rgba(102, 137, 113, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(102, 137, 113, 0.3);
}

.cumulative-target-display .target-label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cumulative-target-display .target-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 500;
  color: rgba(213, 172, 91, 0.9);
}

/* Save Indicator */
.save-indicator {
  text-align: center;
  padding: 12px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.save-indicator.visible {
  opacity: 1;
}

.save-indicator .save-success {
  color: var(--success);
  display: none;
}

.save-indicator .save-error {
  color: var(--danger);
  display: none;
  font-weight: 600;
}

.save-indicator .retry-btn {
  display: none;
  padding: 8px 16px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.save-indicator .retry-btn:hover {
  background: #a84a3a;
}

.save-indicator.visible.success .save-success {
  display: block;
}

.save-indicator.visible.error .save-error,
.save-indicator.visible.error .retry-btn {
  display: block;
}

.save-indicator.visible.saving .save-success::after {
  content: '...';
  animation: saving-dots 1s infinite;
}

@keyframes saving-dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}


/* ===================
   LOADING OVERLAY
   =================== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===================
   RESPONSIVE
   =================== */
@media (min-width: 600px) {
  .timeline-list,
  .editor-content {
    max-width: 500px;
    margin: 0 auto;
  }

}

/* Remove number input spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* ===================
   ACCESSIBILITY
   =================== */

/* Visually hidden but accessible to screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Enhanced focus states for keyboard navigation */
.timeline-slot:focus {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  background: rgba(228, 170, 79, 0.15);
}

.timeline-slot:focus:not(:focus-visible) {
  outline: none;
}

.timeline-slot:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.number-input button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
  background: rgba(228, 170, 79, 0.3);
}

.cultivar-select:focus-visible,
.lbs-input:focus-visible,
.qc-textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Skip to main content link (hidden until focused) */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--gold);
  color: var(--bg-dark);
  padding: 8px 16px;
  z-index: 9999;
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
}

/* ===================
   TUTORIAL WALKTHROUGH
   =================== */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
}

.tutorial-overlay.active {
  display: block;
}

.tutorial-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

.tutorial-spotlight {
  position: absolute;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.85);
  transition: all 0.4s ease;
  pointer-events: none;
}

.tutorial-spotlight.active {
  background: transparent;
}

.tutorial-card {
  position: absolute;
  background: var(--bg-card);
  border: 2px solid var(--gold);
  border-radius: 16px;
  padding: 24px;
  max-width: 340px;
  width: calc(100% - 32px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: tutorial-fade-in 0.3s ease;
}

@keyframes tutorial-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.tutorial-step-indicator {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.tutorial-step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-color);
  transition: all 0.3s;
}

.tutorial-step-dot.active {
  background: var(--gold);
  transform: scale(1.2);
}

.tutorial-step-dot.completed {
  background: var(--success);
}

.tutorial-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 12px;
  text-align: center;
}

.tutorial-text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 20px;
  text-align: center;
}

/* Tutorial Language Choice */
.tutorial-lang-choice {
  margin-bottom: 20px;
  text-align: center;
}

.lang-choice-label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.lang-choice-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.lang-choice-btn {
  padding: 12px 24px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 48px;
}

.lang-choice-btn:hover {
  border-color: var(--gold);
  background: rgba(228, 170, 79, 0.1);
}

.lang-choice-btn.active {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--bg-dark);
}

.tutorial-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tutorial-nav {
  display: flex;
  gap: 8px;
}

.tutorial-btn {
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
}

.tutorial-btn-skip {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.tutorial-btn-skip:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.tutorial-btn-prev {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.tutorial-btn-prev:hover {
  background: rgba(255, 255, 255, 0.1);
}

.tutorial-btn-prev:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.tutorial-btn-next {
  background: var(--gold);
  border: none;
  color: var(--bg-dark);
  font-weight: 600;
}

.tutorial-btn-next:hover {
  background: var(--gold-dark);
}

/* ===================
   INLINE TOOLTIPS
   =================== */
.tooltip-hint {
  display: none;
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 500;
  animation: tooltip-bounce 0.4s ease;
  white-space: nowrap;
}

.tooltip-hint.visible {
  display: flex;
  align-items: center;
  gap: 8px;
}

@keyframes tooltip-bounce {
  0% { opacity: 0; transform: translateY(-10px); }
  50% { transform: translateY(2px); }
  100% { opacity: 1; transform: translateY(0); }
}

.tooltip-icon {
  font-size: 16px;
}

.tooltip-text {
  color: var(--text-primary);
}

.tooltip-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 0 0 0 8px;
  line-height: 1;
}

.tooltip-close:hover {
  color: var(--text-primary);
}

/* Tooltip arrow */
.tooltip-hint::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 20px;
  width: 12px;
  height: 12px;
  background: var(--bg-card);
  border-left: 1px solid var(--gold);
  border-top: 1px solid var(--gold);
  transform: rotate(45deg);
}

/* ===== 5KG BAG COMPLETE BUTTON ===== */
.bag-complete-btn {
  width: 100%;
  padding: 16px 20px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #1a6b3c, #22884d);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.bag-complete-btn:active {
  transform: scale(0.97);
  background: linear-gradient(135deg, #155a32, #1a6b3c);
}

/* Weight outside the expected window, or scale offline.
   ADVISORY ONLY — the button stays fully pressable (see hourly-entry/index.js).
   A dashed border says "the scale does not agree" without greying the button
   out, so a dead scale can never stop a bag being logged.
   Targets .manual-btn: that is the class the bag buttons actually carry
   (ids bag-complete-btn / bag-complete-btn-10lb) — the .bag-complete-btn
   rules in this file match nothing. */
.manual-btn[data-gated="true"]:not(:disabled) {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.6);
}

.bag-complete-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.bag-complete-btn.success {
  background: linear-gradient(135deg, #22884d, #2ea85e);
  border-color: #2ea85e;
}

.bag-btn-icon {
  font-size: 1.3rem;
}

.bag-btn-text {
  letter-spacing: 0.02em;
}

/* ===================
   REDUCED MOTION
   =================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   BAG MODE TOGGLE — manager-only; drives 5kg vs 10lb across stations
   ============================================================ */
.bag-mode-toggle {
  display: inline-flex;
  gap: 0;
  padding: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.12);
  margin: 8px 0;
}
.bag-mode-pill {
  padding: 8px 18px;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #5a5a5a;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.bag-mode-pill:hover {
  color: #1a1a1a;
}
.bag-mode-pill.active {
  background: var(--ro-green, #668971);
  color: #fff;
}
.bag-mode-pill:focus-visible {
  outline: 2px solid var(--ro-gold, #e4aa4f);
  outline-offset: 2px;
}

/* ============================================================
   DISABLED LOG BAG BUTTON — visual feedback when out of range
   or scale is offline. Hover the button for a tooltip explaining
   why it's disabled.
   ============================================================ */
.manual-btn:disabled,
.manual-btn[aria-disabled="true"] {
  opacity: 0.4;
  filter: grayscale(0.7);
  cursor: not-allowed;
  pointer-events: auto; /* keep tooltip working on hover */
  border-color: rgba(120, 120, 120, 0.3) !important;
  color: rgba(180, 180, 180, 0.7) !important;
  background: rgba(80, 80, 80, 0.1) !important;
  transform: none !important;
  box-shadow: none !important;
}
.manual-btn:disabled:hover,
.manual-btn[aria-disabled="true"]:hover {
  background: rgba(80, 80, 80, 0.1) !important;
  transform: none !important;
}

/* ── Production queue banner ──────────────────────────────────────────────
   What the board says is being trimmed, at the top of the editor. Read-only:
   no controls, no focusable children, nothing that writes to the form. */


/* ===================
   ORDER QUEUE TAB
   Page-local tokens only — hourly-entry.html does not load shared-base.css.
   =================== */

.queue-tab-body { display: flex; flex-direction: column; gap: 10px; }

.qt-order {
  padding: 8px;
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--green);
  border-radius: 8px;
  background: var(--bg-card);
}

.qt-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
/* Queue position. The board is ranked, and "which of these is first" is the
   question a lead asks before "how far along is it". */
.qt-rank {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-input);
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
}
.qt-who {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.qt-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-secondary);
}

/* One row per pass. Tops and smalls of a cultivar share a row because they
   share a lot — see the brief.
   Two columns: what it is on the left, numbers on the right; the bar and the
   date span both. */
.qt-pass {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1px 8px;
  padding: 5px 0;
  border-top: 1px solid var(--border-color);
}
.qt-order .qt-pass:first-of-type { border-top: 0; }

.qt-cv {
  grid-column: 1;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qt-form {
  grid-column: 1;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}
.qt-lbs {
  grid-column: 2;
  grid-row: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-primary);
  white-space: nowrap;
  text-align: right;
}
/* "23 lb left" / "done" — the actionable half of the pair above it. */
.qt-state {
  grid-column: 2;
  grid-row: 2;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
  text-align: right;
}
.qt-bar {
  grid-column: 1 / -1;
  height: 4px;
  margin-top: 4px;
  border-radius: 2px;
  background: var(--bg-input);
  overflow: hidden;
}
.qt-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--green-bright);
  transition: width 0.4s ease;
}
/* When this strain is expected to finish. Absent once it has. */
.qt-eta {
  grid-column: 1 / -1;
  margin-top: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-secondary);
}

/* The strain actually on the line, so the tab agrees with the banner. */
.qt-now {
  grid-column: 1;
  justify-self: start;
  padding: 0 5px;
  border-radius: 3px;
  background: var(--green-dark);
  color: var(--text-primary);
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.qt-pass.live .qt-cv { color: var(--green-bright); }

/* A finished strain is stated, not celebrated — it is context for what is left. */
.qt-pass.done .qt-fill { background: var(--text-secondary); }
.qt-pass.done .qt-cv { color: var(--text-secondary); }

.qt-order-eta {
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid var(--border-color);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-primary);
}

.qt-empty,
.qt-more {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  padding: 6px 0;
}


/* ===================
   QUEUE STRIP (header)
   Page-local tokens only — hourly-entry.html does not load shared-base.css.
   =================== */

.queue-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  /* Takes the empty middle of the header and yields it back when the header
     is tight, so it can never push the clock or the date off the strip. */
  flex: 1 1 auto;
  margin: 0 16px;
  overflow: hidden;
}
.queue-strip[hidden] { display: none; }

.qs-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.qs-current { flex: 0 1 auto; }
/* Next is the first thing to go when the header runs out of room — it is
   context, where the current strain is the answer to the question. */
.qs-next { flex: 0 1 auto; overflow: hidden; }

.qs-tag {
  flex: 0 0 auto;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.qs-strain {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Whose order, so two orders wanting the same cultivar are distinguishable.
   Quieter than the strain — it is the qualifier, not the answer. */
.qs-who {
  flex: 0 1 auto;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qs-lbs {
  flex: 0 0 auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
}
.qs-pct {
  flex: 0 0 auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--green-bright);
  white-space: nowrap;
}
.qs-sep { flex: 0 0 auto; color: var(--text-secondary); font-size: 12px; }
.qs-clear {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 12px;
  color: var(--text-secondary);
}

/* On a phone the header is already carrying a title, a clock, a language
   toggle and a date. Two strains do not fit; the current one still does. */
@media (max-width: 900px) {
  .queue-strip { margin: 0 8px; gap: 6px; }
  .qs-next, .qs-sep { display: none; }
  .qs-lbs { font-size: 11px; }
}
@media (max-width: 600px) {
  .queue-strip { display: none; }
}


/* Pounds done, editable per order line. Same affordance as the wholesale
   board's field: reads as text until touched. */
.qt-nums {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.qt-edit-row { display: inline-flex; align-items: baseline; gap: 4px; }
.qt-edit-form {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}
.qt-done-edit {
  width: 4.5ch;
  padding: 1px 4px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.qt-done-edit:hover { background: var(--bg-input); }
.qt-done-edit:focus {
  outline: none;
  background: var(--bg-input);
  box-shadow: 0 0 0 2px var(--green);
}
.qt-done-edit:disabled { opacity: 0.5; }
/* A dotted underline marks a figure a human set by hand rather than one the
   floor produced, so the two are never confused at a glance. */
.qt-done-edit.credited { text-decoration: underline dotted currentColor; text-underline-offset: 3px; }
.qt-of {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-primary);
  white-space: nowrap;
}
