
#config-banner {
  background: #FFF9C4; 
  border-bottom: 2px solid #FFF176;
  padding: 10px 20px; 
  font-size: 13px; 
  font-weight: 700;
  color: #7A6A00; 
  text-align: center; 
  display: none;
}
#config-banner.visible { 
  display: block; 
}
#config-banner code {
  background: rgba(0,0,0,0.08); 
  border-radius: 5px; 
  padding: 1px 6px; 
  font-family: monospace;
}


#app {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
  padding: 20px;
  box-sizing: border-box;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  flex: 1;
  min-height: 0;
  justify-content: center;
}

#header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.header-left { 
  display: flex; 
  align-items: center; 
  gap: 12px; 
}
.header-title { 
  font-size: 22px; 
  font-weight: 900; 
}
.header-date { 
  font-size: 14px; 
  font-weight: 600; 
  color: var(--text-soft); 
}

/* Centered Toggle Navigation Controls */
.header-center-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  /* Keep align-items: center to vertically center the buttons within this container */
  align-items: center; 
  
  /* NEW: Prevent it from growing horizontally and ensure its size is content-based */
  flex: 0 0 auto; 
  margin: 0 20px;
  
  /* Keep width: max-content to size based on content */
  width: max-content; 
  
  /* NEW: Add a max-width in a relative unit to prevent excessive horizontal expansion */
  /* ADJUST THIS VALUE: Fine-tune this 'rem' or 'vw' value based on your layout */
  max-width: 30rem; /* Example: 30rem or 40vw */
  
  /* NEW: Ensure this flex item aligns itself centrally within its parent (#header) */
  /* This prevents it from stretching vertically if the parent has extra space */
  align-self: center; 
}
/* Panel toggle button states */
.ctrl-toggle-btn {
  background: var(--blush);
  border: 2px solid var(--rose);
  border-radius: 12px;
  padding: 0.5em 1em;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  height: auto;
  box-sizing: border-box;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Active state - panel is visible */
.ctrl-toggle-btn.active {
  background: var(--rose);
  border-color: var(--rose-dark);
  color: var(--text);
}

/* Inactive state - panel is collapsed */
.ctrl-toggle-btn.inactive {
  background: var(--blush);
  border-color: var(--rose);
  color: var(--text-soft);
  opacity: 0.6;
}

.ctrl-toggle-btn:hover {
  transform: translateY(-1px);
}

.ctrl-toggle-btn:active {
  transform: translateY(1px);
}

.header-time { 
  font-size: 18px; 
  font-weight: 700; 
  color: var(--text-soft); 
}
.header-actions { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
}
.hdr-btn {
  background: var(--lilac); 
  border: none; 
  border-radius: 12px; 
  padding: 8px 14px;
  font-family: 'Nunito', sans-serif; 
  font-size: 13px; 
  font-weight: 700;
  color: var(--text); 
  cursor: pointer; 
  transition: all 0.2s; 
  white-space: nowrap;
}
.hdr-btn:hover { 
  background: #9B6BAE; 
  color: #ffffff;
  transform: scale(1.03); 
}
.sync-dot {
  width: 8px; 
  height: 8px; 
  border-radius: 50%; 
  display: inline-block;
  margin-right: 5px; 
  background: var(--mint-dark);
  transition: background 0.3s;
}
.sync-dot.syncing { 
  background: var(--butter-dark); 
  animation: pulse 1s ease-in-out infinite; 
}
.sync-dot.error { 
  background: var(--rose-dark); 
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }


.panel { 
  background: var(--white); 
  border-radius: var(--radius); 
  box-shadow: var(--shadow); 
  display: flex; 
  flex-direction: column; 
  overflow: hidden; 
  transition: all 0.3s ease;
  min-width: 0; 
}
.panel-header { 
  padding: 18px 22px 12px; 
  font-size: 20px; 
  font-weight: 900; 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  border-bottom: 2px dashed #F0E8F5; 
  flex-shrink: 0; 
}


.panel.collapsed {
  display: none;
}



.list-tabs { display: flex; gap: 8px; padding: 12px 22px 0; overflow-x: auto; scrollbar-width: none; flex-shrink: 0; align-items: center; }
.list-tabs::-webkit-scrollbar { display: none; }
.tab-btn { background: var(--blush); border: 2px solid transparent; border-radius: 20px; padding: 6px 14px; font-family: 'Nunito', sans-serif; font-size: 14px; font-weight: 700; color: var(--text-soft); cursor: pointer; white-space: nowrap; transition: all 0.2s; flex-shrink: 0; display: flex; align-items: center; gap: 5px; }
.tab-btn.active { background: var(--rose); color: var(--text); border-color: var(--rose-dark); }
.tab-btn:hover:not(.active) { background: var(--rose); color: var(--text); }
.tab-btn.add-list { background: transparent; border: 2px dashed var(--rose-dark); color: var(--rose-dark); }
.tab-btn.add-list:hover { background: var(--rose); }
.tab-del { background: none; border: none; font-size: 12px; cursor: pointer; opacity: 0.45; padding: 0 2px; line-height: 1; transition: opacity 0.15s; }
.tab-del:hover { opacity: 1; }


@media (max-width: 900px) {
  body {
    height: auto;
    overflow: auto; /* Allow scrolling down the page on mobile */
    user-select: auto; /* Better for mobile interactions */
    -webkit-user-select: auto;
  }

  #app {
    height: auto;
    grid-template-rows: auto auto;
    padding: 12px;
  }

  /* Stack header elements vertically instead of smashing them horizontally */
  #header {
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    text-align: center;
    align-items: center;
  }

  .header-left {
    flex-direction: column;
    gap: 4px;
  }

  .header-center-controls {
    margin: 4px 0;
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap; /* Let toggle buttons wrap if the phone screen is narrow */
  }

  .header-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Change grid layout from 3 columns to 1 stacked column */
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    height: auto;
  }

  /* Crucial: Set a concrete height limit for individual panels on mobile 
     so that the internal list scrollbars (.todo-body, .meal-body) still function perfectly! */
  .panel {
    height: 480px; 
    max-height: 75vh;
  }

  /* Fix meal card grids inside the panel to drop down cleanly if needed */
  .meal-body {
    grid-template-columns: 1fr; /* Single column for meals on small screens */
  }

  /* Adjust modals for mobile screen edges */
  .modal, .meal-detail, .emoji-picker {
    width: calc(100% - 24px);
    margin: 12px;
    padding: 20px;
  }
}

