/* --- ProBrewer: gentle entry screen (non-breaking, additive) --- */
.pb-entry {
  margin: 18px auto 6px;
  max-width: 520px;
  padding: 0 6px 10px;
}
.pb-entry h2{
  margin: 10px 0 14px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  color: #2f2f2f;
  opacity: 0.9;
}
.pb-entry-grid{
  display: grid;
  gap: 12px;
}
/* Make entry page cards similar */
.pb-entry-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border-radius: 16px;
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 8px 20px rgba(0,0,0,0.05);
  cursor: pointer;
  text-align: left;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.pb-entry-card:hover {
  border-color: rgba(122, 20, 67, 0.2);
  box-shadow: 0 12px 28px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.pb-entry-card:active {
  transform: translateY(0);
}
.pb-entry-ic{
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(128, 16, 64, 0.08);
}
.pb-entry-ic svg{
  width: 28px;
  height: 28px;
}
.pb-entry-title{
  font-size: 16px;
  font-weight: 800;
  color: #7a1443; /* wine */
  margin: 0 0 2px;
}
.pb-entry-sub{
  font-size: 12.5px;
  margin: 0;
  color: rgba(0,0,0,0.62);
  line-height: 1.25;
}
.pb-entry-foot{
  display:flex;
  justify-content:center;
  margin-top: 10px;
}
.pb-entry-skip{
  border: 0;
  background: transparent;
  color: rgba(0,0,0,0.55);
  font-size: 12.5px;
  cursor: pointer;
  padding: 6px 10px;
}
.pb-entry-skip:hover{ text-decoration: underline; }

/* When entry mode is active, hide the busy UI below the entry panel */
body.pb-entry-mode #pbLegacyContent{ display:none; }
body.pb-entry-mode #pbEntryPanel{ display:block; }
body:not(.pb-entry-mode) #pbEntryPanel{ display:none; }

@media (max-width: 420px){
  .pb-entry-card{ grid-template-columns: 52px 1fr; }
  .pb-entry-ic{ width:52px; height:52px; }
}

/* ---- Entry routing modes (no refactor) ---- */
body.pb-mode-manage #pbBeverageGroup,
body.pb-mode-manage #pbMeasurementGroup {
  display: none !important;
}

/* In create mode, keep the batch manager panel hidden */
body.pb-mode-create #cloudManagementSection {
  display: none !important;
}

/* ---- ProBrewer routing modes ---- */
body.pb-mode-manage #pbBeverageGroup,
body.pb-mode-manage #pbMeasurementGroup { display: none !important; }

body.pb-mode-manage .micro-group.batch-actions { display: block !important; }

/* Entry screen only shows while pb-entry-mode is active */
#pbEntry { display: none; }
body.pb-entry-mode #pbEntry { display: block; }

#pbHomeBtn.pb-home-btn{
  position: fixed !important;
  top: 30px !important;
  left: 12px !important;
  z-index: 10050 !important;

  width: auto !important;
  max-width: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;

  padding: 9px 12px !important;
  border: 0 !important;
  border-radius: 999px !important;

  background: var(--accent) !important;
  color: #fff !important;

  font-weight: 700 !important;
  font-size: 13px !important;
  line-height: 1 !important;

  box-shadow: 0 8px 18px rgba(0,0,0,.16) !important;
  cursor: pointer !important;
}

#pbHomeBtn .pb-home-text{ opacity: .95; }
#pbHomeBtn .pb-home-ico{ font-size: 16px; line-height: 1; margin-top: -1px; }

@media (max-width: 380px){
  #pbHomeBtn .pb-home-text{ display:none; }
  #pbHomeBtn.pb-home-btn{ padding: 9px 10px !important; }
}

/* Home button should NOT appear on the entry screen */
body.pb-entry-mode #pbHomeBtn { display: none !important; }


.pb-home-ico{
  font-size: 16px;
  line-height: 1;
  margin-top: -1px;
}

.pb-home-text{
  opacity: .95;
}

/* On very small screens, hide the text and keep just the icon */
@media (max-width: 380px){
  .pb-home-text{ display:none; }
  .pb-home-btn{ padding: 9px 10px; }
}

body{ padding-top: 44px; }


/* In "Select a batch" mode, hide only Save + Smart Sulfite */
body.pb-mode-manage #saveBtn,
body.pb-mode-manage #smartSulfiteBtn{
  display: none !important;
}

/* Keep the manager dropdown button visible */
body.pb-mode-manage #mainBatchActionBtn{
  display: flex !important;
}

#mainBatchActionBtn{
  width: 100%;
  justify-content: center;
  margin-top: 10px;
}

/* Create: pre-apply => only Beverage + Measurement */
body.pb-mode-create.pb-create-preapply #results,
body.pb-mode-create.pb-create-preapply .micro-group.batch-actions{
  display: none !important;
}

/* Create: post-apply => show Results + Batch Mgmt */
body.pb-mode-create.pb-create-postapply #results,
body.pb-mode-create.pb-create-postapply .micro-group.batch-actions{
  display: block !important;
}

/* In create post-apply, show only the 4 main batch buttons */
body.pb-mode-create.pb-create-postapply #saveBtn,
body.pb-mode-create.pb-create-postapply #smartSulfiteBtn,
body.pb-mode-create.pb-create-postapply #loadBatchesBtn,
body.pb-mode-create.pb-create-postapply #settingsBtn{
  display: inline-flex !important;
}
body.pb-mode-create.pb-create-postapply #loginBtn,
body.pb-mode-create.pb-create-postapply #registerBtn,
body.pb-mode-create.pb-create-postapply #cancelAuthBtn,
body.pb-mode-create.pb-create-postapply #mainBatchActionBtn,
body.pb-mode-create.pb-create-postapply #closeBatchManagerBtn{
  display: none !important;
}
body.pb-mode-create.pb-create-postapply .micro-group.batch-actions .dropdown-item{
  display: none !important;
}



/* ===== ProBrewer: Tools mode (site-native, inside legacy card) ===== */
body.pb-mode-tools #pbToolsSection{ display:block !important; }
body.pb-mode-tools #pbBeverageGroup,
body.pb-mode-tools #pbMeasurementGroup,
body.pb-mode-tools #results,
body.pb-mode-tools .micro-group.batch-actions,
body.pb-mode-tools #cloudManagementSection{
  display:none !important;
}

/* ===== Standalone Tools Card Styling ===== */
.pb-standalone-section {
  margin: 20px auto;
  max-width: 500px;
  width: 100%;
}

.pb-standalone-card {
  background: white !important;
  border-radius: 16px !important;
  box-shadow: 0 10px 24px rgba(0,0,0,0.06) !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
  padding: 20px !important;
  margin: 0 !important;
}

.pb-standalone-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  padding-bottom: 12px;
}

.pb-standalone-title {
  font-weight: 800 !important;
  font-size: 20px !important;
  color: #2c5530 !important;
  margin: 0 !important;
}

.pb-standalone-subtitle {
  font-size: 13px !important;
  opacity: 0.75 !important;
  color: #666 !important;
  margin: 0 !important;
}

.pb-standalone-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  margin: 0 !important;
  padding: 0 !important;
}

.pb-standalone-item {
  display: flex !important;
  align-items: center !important;
  padding: 16px !important;
  border: 1px solid rgba(0,0,0,0.1) !important;
  border-radius: 12px !important;
  background: rgba(255,255,255,0.9) !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  text-align: left !important;
  width: 100% !important;
  margin: 0 !important;
}

.pb-standalone-item:hover {
  background: rgba(122, 20, 67, 0.05) !important;
  border-color: rgba(122, 20, 67, 0.3) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.pb-standalone-item:active {
  transform: translateY(0);
  background: rgba(122, 20, 67, 0.1) !important;
}

.pb-standalone-ico {
  font-size: 22px !important;
  margin-right: 14px !important;
  min-width: 30px !important;
  text-align: center !important;
}

.pb-standalone-label {
  white-space: normal !important;
  word-break: break-word !important;
  max-width: 100% !important;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
  .pb-standalone-section {
    margin: 15px 12px;
    max-width: none;
  }
  
  .pb-standalone-card {
    padding: 16px !important;
    border-radius: 12px !important;
  }
  
  .pb-standalone-item {
    padding: 14px !important;
    border-radius: 10px !important;
  }
  
  .pb-standalone-ico {
    font-size: 20px !important;
    margin-right: 12px !important;
    min-width: 26px !important;
  }
  
  .pb-standalone-label {
    font-size: 15px !important;
  }
}

@media (max-width: 380px) {
  .pb-standalone-item {
    padding: 12px !important;
  }
  
  .pb-standalone-ico {
    font-size: 18px !important;
    margin-right: 10px !important;
  }
  
  .pb-standalone-label {
    font-size: 14px !important;
  }
}

/* ===== COMPACT Standalone Tools ===== */
#pbStandaloneToolsSection.pb-standalone-section {
  margin: 15px auto !important;
  max-width: 420px !important; /* Smaller width */
  width: 100% !important;
}

#pbStandaloneToolsSection .card {
  padding: 16px !important; /* Less padding */
  border-radius: 14px !important;
  max-height: 80vh !important; /* Limit height */
  overflow-y: auto !important; /* Scroll if needed */
}

/* Compact header */
#pbStandaloneToolsMount .pb-standalone-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  margin-bottom: 16px !important;
  padding-bottom: 10px !important;
  border-bottom: 1px solid rgba(0,0,0,0.08) !important;
}

#pbStandaloneToolsMount .pb-standalone-title {
  font-weight: 700 !important;
  font-size: 18px !important; /* Smaller font */
  color: #2c5530 !important;
  margin: 0 !important;
}

#pbStandaloneToolsMount .pb-standalone-subtitle {
  font-size: 12px !important; /* Smaller */
  opacity: 0.75 !important;
  color: #666 !important;
  margin: 0 !important;
}

/* Compact list */
#pbStandaloneToolsMount .pb-standalone-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important; /* Tighter spacing */
  margin: 0 !important;
  padding: 0 !important;
}

/* Compact items */
#pbStandaloneToolsMount .pb-standalone-item {
  display: flex !important;
  align-items: center !important;
  padding: 12px 14px !important; /* Less padding */
  border: 1px solid rgba(0,0,0,0.1) !important;
  border-radius: 10px !important;
  background: rgba(255,255,255,0.95) !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  text-align: left !important;
  width: 100% !important;
  margin: 0 !important;
}

#pbStandaloneToolsMount .pb-standalone-ico {
  font-size: 20px !important; /* Smaller icons */
  margin-right: 12px !important;
  min-width: 26px !important;
  text-align: center !important;
}

#pbStandaloneToolsMount .pb-standalone-label {
  font-size: 15px !important; /* Smaller text */
  font-weight: 600 !important;
  color: #333 !important;
  flex: 1 !important;
}

/* Mobile: even more compact */
@media (max-width: 480px) {
  #pbStandaloneToolsSection.pb-standalone-section {
    margin: 12px !important;
    max-width: none !important;
  }
  
  #pbStandaloneToolsSection .card {
    padding: 14px !important;
    border-radius: 12px !important;
  }
  
  #pbStandaloneToolsMount .pb-standalone-header {
    margin-bottom: 14px !important;
    padding-bottom: 8px !important;
  }
  
  #pbStandaloneToolsMount .pb-standalone-title {
    font-size: 17px !important;
  }
  
  #pbStandaloneToolsMount .pb-standalone-subtitle {
    font-size: 11px !important;
  }
  
  #pbStandaloneToolsMount .pb-standalone-list {
    gap: 6px !important;
  }
  
  #pbStandaloneToolsMount .pb-standalone-item {
    padding: 10px 12px !important;
    border-radius: 8px !important;
  }
  
  #pbStandaloneToolsMount .pb-standalone-ico {
    font-size: 18px !important;
    margin-right: 10px !important;
    min-width: 24px !important;
  }
  
  #pbStandaloneToolsMount .pb-standalone-label {
    font-size: 14px !important;
  }
}

/* Small phones */
@media (max-width: 360px) {
  #pbStandaloneToolsMount .pb-standalone-item {
    padding: 8px 10px !important;
  }
  
  #pbStandaloneToolsMount .pb-standalone-ico {
    font-size: 16px !important;
    margin-right: 8px !important;
  }
  
  #pbStandaloneToolsMount .pb-standalone-label {
    font-size: 13px !important;
  }
}

/* ===== CRITICAL FIXES FOR BUTTONS ===== */
/* 1. When in manage mode, HIDE beverage/measurement, SHOW batch manager */
body.pb-mode-manage #pbBeverageGroup,
body.pb-mode-manage #pbMeasurementGroup,
body.pb-mode-manage #results,
body.pb-mode-manage #pbToolsSection {
  display: none !important;
}

body.pb-mode-manage #cloudManagementSection {
  display: block !important;
}

body.pb-standalone-tools #pbStandaloneToolsSection {
  display: block !important;
}

body.pb-standalone-tools #pbEntry,
body.pb-standalone-tools #pbLegacyContent {
  display: none !important;
}

/* WIDTH FIXES ONLY */
#pbStandaloneToolsSection {
  max-width: 380px !important;
  margin: 15px auto !important;
  width: 100% !important;
}

#pbStandaloneToolsSection .card {
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.pb-standalone-item {
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.pb-standalone-label {
  white-space: normal !important;
  word-wrap: break-word !important;
}

/* 4. Entry mode styling */
body.pb-entry-mode #pbEntry {
  display: block !important;
}

body.pb-entry-mode #pbLegacyContent,
body.pb-entry-mode #pbStandaloneToolsSection {
  display: none !important;
}

/* 5. Create mode styling */
body.pb-mode-create #pbLegacyContent {
  display: block !important;
}

body.pb-mode-create #pbEntry,
body.pb-mode-create #pbStandaloneToolsSection {
  display: none !important;
}

/* Brix Correction Modal Styles */
#brixCorrectionModal .modal-content {
  max-width: 450px !important;
}

.converter-section {
  background: #f8f8f8;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 15px;
}

.converter-section h4 {
  margin-top: 0;
  margin-bottom: 15px;
  color: #7a1443;
  font-size: 16px;
}

.converter-section .row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 10px;
}

.converter-section .row label {
  flex: 1;
  margin: 0;
}

.converter-section button {
  padding: 8px 15px;
  background: #7a1443;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.converter-section button:hover {
  background: #5a0e31;
}

.results-section {
  background: #eef7ee;
  border: 1px solid #c1e0c1;
  padding: 15px;
  border-radius: 8px;
}

.results-section h4 {
  margin-top: 0;
  color: #2c5530;
}

.btn-row {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.btn-row button {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.btn-row button:first-child {
  background: #666;
  color: white;
}

.btn-row button:last-child {
  background: #ddd;
  color: #333;
}

/* ===== FIX FOR CREATE MODE BUTTON VISIBILITY ===== */
/* Ensure Save and Smart Sulfite buttons are visible in create mode */
body.pb-mode-create #saveBtn,
body.pb-mode-create #smartSulfiteBtn {
  display: inline-flex !important;
}

/* Show batch actions section in create mode */
body.pb-mode-create .micro-group.batch-actions {
  display: block !important;
}

/* Show the results section after apply in create mode */
body.pb-mode-create.pb-create-postapply #results {
  display: block !important;
}

/* Make sure all primary buttons are visible in create mode */
body.pb-mode-create .batch-primary-actions {
  display: flex !important;
}

/* In create post-apply mode, hide the batch action dropdown button */
body.pb-mode-create.pb-create-postapply #mainBatchActionBtn {
  display: none !important;
}

/* Hide Batches and Settings buttons in create mode */
body.pb-mode-create.pb-create-postapply #loadBatchesBtn,
body.pb-mode-create.pb-create-postapply #settingsBtn {
  display: none !important;
}




/* ===== Entry Screen: Help FAB + Logo polish (additive) ===== */
/* Slightly smaller logo box so it doesn't dominate */
.card .top-label .logo-box{
  width: 52px !important;
  height: 52px !important;
  padding: 6px !important;
  border-radius: 16px !important;
}
.card .top-label .logo-box img{
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}

/* Help button: match the yellow "?" style and keep it visible on entry */
#helpToggle.help-fab{
  position: fixed !important;
  top: 28px !important;
  right: 12px !important;
  z-index: 10060 !important;

  width: 44px !important;
  height: 44px !important;
  border-radius: 999px !important;

  background: #f4c542 !important; /* warm yellow */
  color: #2b2b2b !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  font-weight: 900 !important;
  font-size: 18px !important;
  line-height: 1 !important;

  box-shadow: 0 10px 20px rgba(0,0,0,.18) !important;
  border: 1px solid rgba(0,0,0,.08) !important;
  cursor: pointer !important;
}

#helpToggle.help-fab:active{
  transform: translateY(1px);
}

/* Ensure help overlay/panel can appear above entry cards */
#helpOverlay{ z-index: 10070 !important; }
#helpPanel{ z-index: 10080 !important; }

/* --- Entry card polish: contrast + hierarchy (instrument-grade, non-cartoon) --- */

/* Ensure our entry cards have a crisp, clickable affordance even if base styles change */
.pb-entry-card{
  position: relative;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(0,0,0,0.10);
  box-shadow: 0 10px 22px rgba(0,0,0,0.06);
  text-align: left;
}

/* Slightly stronger, calmer hover (desktop) */
.pb-entry-card:hover{
  border-color: rgba(122, 20, 67, 0.22);
  box-shadow: 0 14px 30px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

/* Keyboard accessibility */
.pb-entry-card:focus-visible{
  outline: 3px solid rgba(255, 203, 0, 0.55);
  outline-offset: 2px;
}

/* Icon block: increase contrast without getting loud */
.pb-entry-ic{
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(122, 20, 67, 0.10);
  color: rgba(122, 20, 67, 0.78);
}

.pb-entry-ic svg{
  width: 28px;
  height: 28px;
}

/* Titles/subtitles: slightly clearer hierarchy */
.pb-entry-title{
  margin: 0 0 2px;
  line-height: 1.15;
}

.pb-entry-sub{
  color: rgba(0,0,0,0.66);
}

/* Primary emphasis: Create New Batch */
#pbGoCreate{
  border-color: rgba(122, 20, 67, 0.26);
  background: linear-gradient(180deg, rgba(122, 20, 67, 0.06), rgba(255,255,255,0.94));
  box-shadow: 0 12px 26px rgba(0,0,0,0.07);
}

#pbGoCreate::before{ display:none; }

#pbGoCreate .pb-entry-ic{
  background: rgba(122, 20, 67, 0.14);
  color: rgba(122, 20, 67, 0.92);
}

/* Mobile tuning */
@media (max-width: 420px){
  .pb-entry-card{ grid-template-columns: 58px 1fr; padding: 16px; }
  .pb-entry-ic{ width: 52px; height: 52px; }
  #pbGoCreate::before{ left: 8px; }
}
