:root {
  --blue-main: #2563eb;
  --blue-main-dark: #1d4ed8;
  --blue-main-light: #60a5fa;
  --blue-main-hover: #3b82f6;
  --blue-main-gradient: linear-gradient(135deg, #eff6ff, #dbeafe);
  --blue-main-gradient-hover: linear-gradient(135deg, #dbeafe, #bfdbfe);
  --blue-font: #1e3a5f;
  --blue-bg-light: #e0f2fe;
  --blue-bg-chat: #f8fbff;
}

body {
  font-family: 'Inter', 'Segoe UI', 'Arial', sans-serif;
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, #eff6ff 0%, #f8fafc 100%);
  color: var(--blue-font); /* Light default text */
  /* Remove flex centering from body, apply to wrapper */
  /* display: flex; */
  /* justify-content: center; */
  /* align-items: center; */
  /* min-height: 100vh; */
}

/* New App Wrapper */
.app-wrapper {
  display: flex;
  flex-direction: column; /* Stack settings bar and chat container vertically */
  height: 100vh;
  min-height: 100vh;
  width: 100%;
  /* Remove min-height if present, let .chat-container control height */
}

/* Remove sidebar styles */
.sidebar {
  display: none !important;
}

/* Settings bar at the top */
.settings-bar {
  display: flex;
  gap: 0.5em; /* Reduce gap between buttons */
  padding: 0.7em 1.2em 0.3em 1.2em; /* Reduce top/bottom padding */
  background: linear-gradient(90deg, #dbeafe 0%, #eff6ff 55%, #f8fafc 100%);
  border-bottom: 1px solid #bfdbfe;
  align-items: flex-start; /* Align buttons to the top */
  justify-content: flex-start;
  z-index: 10;
}

.settings-bar h1 {
  color: #0f172a;
  font-weight: 500;
  font-size: 1.5em;
  margin: 0 1.2em 0 0; /* Reduce right margin */
  text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
  flex-shrink: 0;
  line-height: 1;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
}

.settings-btn {
  font-family: inherit;
  padding: 0.5em 0.9em; /* Smaller buttons */
  border-radius: 8px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.92em;
  font-weight: 500;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 0.7em;
  transition: color 0.2s, background-color 0.2s, transform 0.1s;
}

.settings-btn:hover {
  color: #0f172a;
  background-color: rgba(37,99,235,0.08);
  transform: translateY(-2px);
}

.toolbar-spacer {
  flex: 1 1 auto;
}

.settings-btn-accent {
  background: rgba(37,99,235,0.08);
  border: 1px solid rgba(37,99,235,0.18);
}

.settings-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}


@media (max-width: 768px) {
  .settings-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.3em;
    padding: 0.5em 0.5em 0.2em 0.5em; /* Reduce padding on mobile */
  }
}

h1 {
  color: #ffffff; /* White heading */
  font-weight: 500;
  margin: 0;
  font-size: 1.8em;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.2); /* Subtle text shadow */
}

label {
  display: block;
  margin-bottom: 0.5em; /* Slightly more space */
  font-weight: 500;
  font-size: 0.9em;
  color: #b0b0b0; /* Lighter grey label */
}

/* Apply styles to select element as well */
input[type="text"], textarea, select {
  width: 100%;
  padding: 0.9em 1.1em; /* Slightly more padding */
  margin-top: 0;
  border-radius: 10px; /* Slightly more rounded */
  border: 1px solid #444; /* Darker border */
  font-size: 1em;
  box-sizing: border-box;
  background-color: #2a2a2a; /* Dark input background */
  color: #e0e0e0; /* Light input text */
  transition: border-color 0.2s ease, box-shadow 0.2s ease; /* Smooth transition */
  font-family: inherit; /* Ensure font consistency */
  appearance: none; /* Remove default system appearance */
  background-image: url('data:image/svg+xml;utf8,<svg fill="%23b0b0b0" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>'); /* Custom dropdown arrow */
  background-repeat: no-repeat;
  background-position: right 1.1em center;
  background-size: 1.2em;
  padding-right: 3em; /* Make space for the arrow */
  height: 3.5em; /* Explicit height for consistency */
  line-height: 1.5; /* Adjust line height */
}

/* Specific styles for date input */
input[type="date"].date-input {
  width: auto; /* Adjusted from 50% to auto or a fixed width if preferred */
  min-width: 150px; /* Ensure it has a minimum width */
  padding: 1em 1.2em; /* Increased padding */
  margin-top: 0;
  border-radius: 10px;
  border: 1px solid #444;
  font-size: 1em; /* Increased font size */
  box-sizing: border-box;
  background-color: #2a2a2a;
  color: #e0e0e0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
  height: 2.4em; /* Increased height */
  line-height: 1.5;
  color-scheme: dark; /* Helps with browser-native date picker theme */
}

input[type="date"].date-input::-webkit-calendar-picker-indicator {
  filter: invert(0.8); /* Make the calendar icon lighter on dark background */
}

/* New styles for the date and age display container */
.date-age-container {
  display: flex;
  align-items: center; /* Vertically align items */
  gap: 1em; /* Space between date input and age display */
}

.date-input-container {
  flex-shrink: 0; /* Prevent date input from shrinking too much */
}

.age-display {
  font-size: 0.9em;
  color: #c0c0c0; /* Light grey for age text */
  padding: 0.5em;
  background-color: #2a2a2a; /* Match input background */
  border-radius: 8px;
  border: 1px solid #444;
  white-space: nowrap; /* Prevent text from wrapping */
  flex-shrink: 0;
}

/* Style for disabled option */
select option[disabled] {
    color: #888;
}

/* Style for options */
select option {
    background-color: #2a2a2a;
    color: #e0e0e0;
}

textarea {
  resize: vertical;
  min-height: 45px; /* Slightly taller */
  line-height: 1.5; /* Better text spacing */
}

/* Apply focus styles to select */
input[type="text"]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--blue-main-light);
  box-shadow: 0 0 0 2px rgba(58, 123, 224, 0.18);
}

/* General button styling (can apply to reset/instructions/modal buttons) */
/* Keep this for modal buttons, but sidebar buttons are styled separately now */
button {
  font-family: inherit;
  padding: 0.5em 1em;
  border-radius: 8px;
  border: 1px solid #444;
  background-color: #2a2a2a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 500;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.loading {
  color: var(--theme-text-primary, #ffffff);
  font-style: italic;
  display: flex;
  align-items: center;
  animation: pulse 1.5s infinite;
}

/* New loading spinner animation */
.loading:before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border: 2px solid currentColor;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spinner 0.8s linear infinite;
}

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

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

table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 1em;
  border: 1px solid #444; /* Darker border */
  border-radius: 8px;
  overflow: hidden;
}

th, td {
  border: 1px solid #444; /* Darker border */
  padding: 0.8em 1em;
  text-align: left;
  font-size: 0.95em;
}

th {
  background: #2a2a2a; /* Dark header background */
  font-weight: 500;
  color: #e0e0e0; /* Light header text */
}

td {
  background: #1e1e1e; /* Slightly lighter dark for cells */
  color: #d0d0d0; /* Slightly dimmer text in cells */
}

.error {
  color: #ff8a80; /* Lighter red for errors */
  margin-top: 1em;
  font-weight: 500;
}

.chat-container {
  flex-grow: 1;
  background: #1e1e1f; /* Slightly adjusted chat area background */
  padding: 1em 1.2em 1em 1.2em; /* Reduce padding */
  border-radius: 0; /* Remove radius if it's full height */
  box-shadow: none; /* Remove shadow if sidebar has it */
  display: flex;
  flex-direction: column;
  height: calc(100vh - 54px); /* Subtract top bar height (adjust as needed) */
  box-sizing: border-box;
  position: relative; /* Needed for modal positioning context if not full screen */
  overflow: hidden; /* Prevent content overflow issues */
  width: 100%;
}

/* Main content layout */
.main-content {
  display: flex;
  flex-direction: row;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  width: 100%;
  position: relative;
  align-items: stretch;
}

.left-section {
  flex: 0 0 43%;
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: auto;
  overflow: hidden;
  background: rgba(255,255,255,0.78);
  border-right: 1px solid #dbeafe;
  padding: 1.2em 1.5em 1.2em 1.5em;
  justify-content: flex-start;
  position: relative;
}

.right-section {
  flex: 1 1 57%;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: auto;
  overflow: hidden;
  background: rgba(248,250,252,0.92);
  padding: 1.2em 1.5em 1.2em 1.5em;
  justify-content: flex-start;
  position: relative;
  color: #1f2937;
  border-left: 1px solid #dbeafe;
}

.section-title {
  font-size: 1.15em;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 1em 0;
  letter-spacing: 0.01em;
  padding-bottom: 0.2em;
  border-bottom: 1px solid #dbeafe;
}

.left-section .section-title {
  color: #0f172a;
  border-bottom: 1px solid #dbeafe;
}

.chat-actions-row {
  display: flex;
  justify-content: flex-end;
  position: absolute;
  top: 1.15em;
  right: 1.5em;
  margin: 0;
  z-index: 2;
}

.right-section .section-title {
  color: #ffffff;
  border-bottom: 1px solid #333;
  margin-right: 18rem;
}

/* Vaccine selection panel */
.vaccine-selection-panel {
  max-height: 400px;
  min-height: 200px;
  overflow-y: auto;
  overflow-x: hidden; /* Prevent horizontal scroll */
  padding: 0.5em;
  border: 1px solid #444;
  border-radius: 10px;
  background-color: #2a2a2a;
  width: 100%;
  box-sizing: border-box; /* Include padding in width calculation */
  flex: 1 1 auto;
  color: #e0e0e0;
}

.vaccine-selection-panel .vaccine-item {
  display: flex;
  align-items: center;
  justify-content: flex-start; /* Align items to the left instead of space-between */
  gap: 0.8em; /* Add consistent spacing between elements */
  margin-bottom: 0.7em;
  padding: 0.3em 0.5em;
  border-radius: 6px;
  transition: background-color 0.2s ease;
  width: 100%;
  box-sizing: border-box;
  flex-wrap: wrap; /* Allow wrapping if needed */
}

.vaccine-selection-panel .vaccine-item:last-child {
  margin-bottom: 0;
}

.vaccine-selection-panel .vaccine-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 1em;
}

.vaccine-selection-panel .dose-select {
  width: auto;
  min-width: 100px;
  max-width: 120px;
  height: 2.5em;
  padding: 0.3em 2em 0.3em 0.8em;
  margin-left: 0.5em;
  flex: 0 0 auto;
}

/* Add visual indication for items where a dose is selected */
.vaccine-selection-panel .vaccine-item.selected {
  background-color: rgba(58, 123, 224, 0.15);
  border: 1px solid rgba(58, 123, 224, 0.3);
}

.vaccine-selection-panel .all-up-to-date-option {
  border-bottom: 1px solid #444;
  margin-bottom: 1em;
  padding-bottom: 0.7em;
}

.vaccine-selection-panel .all-up-to-date-option label {
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin-bottom: 0;
  cursor: pointer;
  color: #e0e0e0;
}

.vaccine-selection-panel .all-up-to-date-option label input[type="checkbox"] {
  margin-right: 0 !important;
  flex: 0 0 auto;
}

/* Additional styles for vaccine item visibility */
.vaccine-selection-panel .vaccine-item,
.vaccine-selection-panel .vaccine-item label,
.vaccine-selection-panel .vaccine-item span,
.vaccine-selection-panel .vaccine-name {
  color: #e0e0e0 !important;
}

.vaccine-selection-panel input[type="checkbox"] {
  margin-right: 0.5em;
}

/* Ensure dose selects are visible */
.vaccine-selection-panel .dose-select {
  background-color: #333;
  color: #e0e0e0;
  border: 1px solid #555;
}

/* Force vaccine names to be visible */
.vaccine-selection-panel .vaccine-item .vaccine-name,
.vaccine-selection-panel .vaccine-item span.vaccine-name {
  color: #ffffff !important;
  font-weight: 500;
  background: none !important;
}

/* Make sure commercial names are visible too */
.vaccine-selection-panel .commercial-names-list .commercial-name {
  color: #b0b0b0 !important;
}

/* Ultimate override for vaccine panel text visibility */
#vaccine-selection-panel * {
  color: #e0e0e0 !important;
}

#vaccine-selection-panel .vaccine-name {
  color: #ffffff !important;
  font-size: 14px !important;
  display: inline-block !important;
  min-width: 100px !important;
}

#vaccine-selection-panel .all-up-to-date-option label {
  color: #e0e0e0 !important;
  font-size: 14px !important;
}

.header {
  display: flex;
  /* Adjust alignment if only title remains */
  justify-content: flex-start; /* Or center */
  align-items: center;
  margin-bottom: 1em; /* Keep this */
  padding-bottom: 1em; /* Keep this */
  border-bottom: 1px solid #383838; /* Slightly lighter border */
  flex-shrink: 0; /* Prevent header from shrinking */
}

/* Remove header-buttons styles */
/* .header-buttons { ... } */

.description {
  font-size: 0.95em;
  color: #a0a0a0; /* Lighter secondary text */
  margin-bottom: 1.5em;
  flex-shrink: 0; /* Prevent description from shrinking */
}

.child-info-form {
  flex-direction: column;
  gap: 1em;
  margin-bottom: 1.5em;
  align-items: stretch;
}

#initial-form {
  display: flex;
  flex-direction: column;
  gap: 1.2em;
  flex: 1 1 auto;
}

#initial-send-btn {
  align-self: flex-end;
  margin-top: 1em;
  display: flex;
  align-items: center;
  gap: 0.5em;
  background: linear-gradient(135deg, #3ecf8e, #2eb872);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1em;
  font-weight: 500;
  padding: 0;
  box-shadow: 0 1px 3px rgba(46, 184, 114, 0.15);
  transition: background 0.2s, transform 0.1s;
  cursor: pointer;
  justify-content: center;
}

#initial-send-btn:hover {
  background: linear-gradient(135deg, #43e697, #38c47c);
  color: #fff;
  transform: translateY(-2px) scale(1.03);
}

#initial-send-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.form-group {
  flex: 1;
  min-width: 150px;
  display: flex;
  flex-direction: column;
  margin-bottom: 0.5em;
  width: 100%;
}

.age-group {
  width: 100%;
}

.date-age-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1em;
}

.vaccine-selection-panel .vaccine-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.7em;
  padding: 0.3em 0.5em;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.vaccine-selection-panel .vaccine-item:last-child {
  margin-bottom: 0;
}

.vaccine-selection-panel .vaccine-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 1em;
}

.vaccine-selection-panel .dose-select {
  width: auto;
  min-width: 100px;
  max-width: 120px;
  height: 2.5em;
  padding: 0.3em 2em 0.3em 0.8em;
  margin-left: 0.5em;
  flex: 0 0 auto;
}

.vaccine-selection-panel .vaccine-item.selected {
  background-color: rgba(58, 123, 224, 0.15);
  border: 1px solid rgba(58, 123, 224, 0.3);
}

.vaccine-selection-panel .all-up-to-date-option {
  border-bottom: 1px solid #444;
  margin-bottom: 1em;
}

/* Commercial vaccine display styles */
.vaccine-item.commercial-mode .vaccine-name {
  font-size: 0.85em;
  font-style: italic;
  font-weight: 500;
  margin-bottom: 0.3em;
}

.vaccine-item .commercial-names-list {
  display: none;
  margin-top: 0.3em;
  padding-left: 1em;
  font-size: 0.8em;
  color: #b0b0b0;
  border-left: 2px solid #444;
  padding-left: 0.8em;
  margin-left: 0.2em;
}

.vaccine-item.commercial-mode .commercial-names-list {
  display: block;
}

.commercial-names-list .commercial-name {
  display: block;
  margin-bottom: 0.2em;
}

.commercial-names-list .commercial-name:before {
  content: "• ";
  color: #3c6ed1;
}

.vaccine-item.commercial-mode {
  padding: 0.8em 0;
  border-left: 3px solid #3c6ed1;
  padding-left: 0.8em;
  margin-left: -0.8em;
  background-color: rgba(60, 110, 209, 0.05);
}

.vaccine-item.commercial-mode.selected {
  background-color: rgba(60, 110, 209, 0.1);
}

/* Wizard Styles */
.wizard-container {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: none;
  background: transparent;
  box-shadow: none;
  border: none;
}

.wizard-header {
  flex-shrink: 0;
  margin-bottom: 0.9em;
}

.wizard-title {
  font-size: 1.15em;
  font-weight: 600;
  color: #ffffff;
  margin: 0 0 1em 0;
  text-align: left;
  letter-spacing: 0.01em;
  padding-bottom: 0.2em;
  border-bottom: 1px solid #23232a;
}

.wizard-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.step-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5em;
  min-width: 80px;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #3a3a3a;
  color: #b0b0b0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  font-size: 0.9em;
  transition: all 0.3s ease;
}

.step-indicator.active .step-number {
  background-color: var(--blue-main);
  color: white;
}

.step-indicator.completed .step-number {
  background-color: #2eb872;
  color: white;
}

.step-label {
  font-size: 0.8em;
  text-align: center;
  color: #b0b0b0;
  font-weight: 400;
}

.step-indicator.active .step-label {
  color: var(--blue-main);
  font-weight: 500;
}

.step-indicator.completed .step-label {
  color: #2eb872;
  font-weight: 500;
}

.step-connector {
  flex: 1;
  height: 2px;
  background-color: #ddd;
  margin: 0 1em;
  position: relative;
  top: -8px;
}

.step-connector.completed {
  background-color: #2eb872;
}

.wizard-form {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.wizard-step {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  width: 100%;
  height: auto;
}

.wizard-step.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  height: auto;
}

.step-content {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0.75em 0;
  padding-right: 0.35em;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
  overscroll-behavior: contain;
  scroll-padding-bottom: 1rem;
  overflow-y: auto;
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: column;
  padding-bottom: 1.1em;
}

.step-content::-webkit-scrollbar,
.vaccine-selection-panel::-webkit-scrollbar,
#medical-conditions-container::-webkit-scrollbar,
#previous-vaccines-list::-webkit-scrollbar,
.chat-history::-webkit-scrollbar,
.file-list-container::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.step-content::-webkit-scrollbar-track,
.vaccine-selection-panel::-webkit-scrollbar-track,
#medical-conditions-container::-webkit-scrollbar-track,
#previous-vaccines-list::-webkit-scrollbar-track,
.chat-history::-webkit-scrollbar-track,
.file-list-container::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 999px;
}

.step-content::-webkit-scrollbar-thumb,
.vaccine-selection-panel::-webkit-scrollbar-thumb,
#medical-conditions-container::-webkit-scrollbar-thumb,
#previous-vaccines-list::-webkit-scrollbar-thumb,
.chat-history::-webkit-scrollbar-thumb,
.file-list-container::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.38);
  border-radius: 999px;
  border: 1px solid transparent;
  background-clip: padding-box;
}

.step-content::-webkit-scrollbar-thumb:hover,
.vaccine-selection-panel::-webkit-scrollbar-thumb:hover,
#medical-conditions-container::-webkit-scrollbar-thumb:hover,
#previous-vaccines-list::-webkit-scrollbar-thumb:hover,
.chat-history::-webkit-scrollbar-thumb:hover,
.file-list-container::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.58);
  background-clip: padding-box;
}

.step-title {
  font-size: 1.3em;
  font-weight: 500;
  color: var(--blue-main);
  margin-bottom: 0.5em;
  width: 100%;
}

.step-description {
  color: #666;
  margin-bottom: 1.5em;
  font-size: 0.95em;
  line-height: 1.4;
  width: 100%;
}

.selected-vaccines-summary {
  background-color: rgba(58, 123, 224, 0.05);
  border-left: 3px solid var(--blue-main);
  padding: 1em;
  margin-bottom: 1.5em;
  border-radius: 0 6px 6px 0;
  width: 100%;
  box-sizing: border-box;
}

.selected-vaccines-summary h4 {
  margin: 0 0 0.8em 0;
  color: var(--blue-main);
  font-size: 1em;
  font-weight: 500;
}

.vaccine-selection-section {
  margin-top: 1em;
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.review-section {
  background-color: #2a2a2a;
  border-radius: 8px;
  padding: 1.5em;
  border: 1px solid #444;
  width: 100%;
  flex: 1 1 auto;
  box-sizing: border-box;
}

.review-item {
  margin-bottom: 1.5em;
  width: 100%;
}

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

.review-item h4 {
  margin: 0 0 0.5em 0;
  color: var(--blue-main);
  font-size: 1em;
  font-weight: 500;
  width: 100%;
}

.review-value {
  color: #e0e0e0;
  padding: 0.5em;
  background-color: #1a1a1a;
  border-radius: 4px;
  border: 1px solid #444;
  min-height: 1.2em;
  width: 100%;
  box-sizing: border-box;
}

.wizard-navigation {
  order: -1;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.2em;
  padding: 0;
  min-height: auto;
  border: none;
  position: relative;
  z-index: 1;
  margin: 0 0 0.85em 0;
  border-radius: 0;
  background-color: transparent;
  box-shadow: none;
  overflow: visible;
}

.wizard-btn {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.58em 1.15em;
  border: 1px solid #444;
  border-radius: 999px;
  font-size: 0.82em;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  min-width: 118px;
  justify-content: center;
  line-height: 1;
  overflow: visible;
}

.wizard-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.wizard-btn-primary {
  background-color: rgba(58, 123, 224, 0.12);
  color: #dbeafe;
  border-color: rgba(96, 165, 250, 0.35);
}

.wizard-btn-primary:hover:not(:disabled) {
  background-color: rgba(58, 123, 224, 0.2);
}

.wizard-btn-secondary {
  background-color: transparent;
  color: #cbd5e1;
  border: 1px solid #444;
}

.wizard-btn-secondary:hover:not(:disabled) {
  background-color: rgba(255,255,255,0.05);
  color: #ffffff;
}

.wizard-btn-success {
  background: linear-gradient(135deg, #3ecf8e, #2eb872);
  color: white;
}

.wizard-btn-success:hover:not(:disabled) {
  background: linear-gradient(135deg, #43e697, #38c47c);
}

.wizard-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Responsive wizard styles */
@media (max-width: 768px) {
  .wizard-progress {
    padding: 0 0.5em;
  }
  
  .step-indicator {
    min-width: 60px;
  }
  
  .step-number {
    width: 28px;
    height: 28px;
    font-size: 0.8em;
  }
  
  .step-label {
    font-size: 0.7em;
  }
  
  .step-connector {
    margin: 0 0.5em;
  }
  
  .wizard-btn {
    padding: 0.6em 1em;
    font-size: 0.8em;
    min-width: 108px;
  }
  
  .wizard-navigation {
    justify-content: center;
    flex-direction: row;
    gap: 0.75em;
  }
  
  .wizard-navigation .wizard-btn {
    width: auto;
  }
}

/* Responsive layout for mobile devices */
@media (max-width: 768px) {
  .main-content {
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
  }
  
  .left-section {
    flex: none;
    width: 100%;
    min-width: auto;
    max-width: none;
    height: auto;
    min-height: 50vh;
  }
  
  .right-section {
    flex: none;
    width: 100%;
    height: auto;
    min-height: 50vh;
  }

  .chat-actions-row {
    position: static;
    margin: 0 0 0.65em 0;
  }

  .right-section .section-title {
    margin-right: 0;
  }
}

/* Additional wizard full-width styles */
.wizard-step .form-group {
  width: 100%;
  box-sizing: border-box;
}

.wizard-step input,
.wizard-step select,
.wizard-step textarea {
  width: 100%;
  box-sizing: border-box;
}

.date-input-container {
  width: 100%;
}

.date-input {
  width: 100%;
  box-sizing: border-box;
}

.age-display {
  width: 100%;
  box-sizing: border-box;
  padding: 0.75em 0.9em;
  background-color: #2a2a2a;
  color: #e0e0e0;
  border: 1px solid #444;
  border-radius: 8px;
  margin-top: 0.5em;
}

.vaccine-selection-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1em;
}

.vaccine-selection-header > label {
  color: var(--theme-text-primary, #0f172a) !important;
}

.vaccine-display-toggle {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

/* Use media query for larger screens */
@media (min-width: 768px) { /* Adjusted breakpoint for better layout */
  .child-info-form {
    flex-direction: row; /* Side-by-side on larger screens */
    gap: 1.5em;
    align-items: flex-end; /* Align items to the bottom */
  }
  .age-group {
      flex: 1 1 30%; /* Adjust flex basis for age */
  }
  .vaccine-group {
      flex: 1 1 70%; /* Adjust flex basis for vaccines */
      /* Remove default flex alignment if needed */
      /* align-self: auto; */
  }
}

.form-group {
  flex: 1;
  /* Add min-width for better wrapping behavior if needed */
  min-width: 150px;
  display: flex; /* Use flexbox for label + input alignment */
  flex-direction: column; /* Stack label above input */
  margin-bottom: 0.5em; /* Reduce bottom margin */
}

.chat-history {
  flex: 1 1 auto; /* Keep this */
  overflow-y: auto;
  margin-bottom: 0.85em;
  padding-right: 10px;
  /* Remove height adjustments if flex handles it */
}

.chat-message {
  margin-bottom: 1.5em;
  display: flex;
}

.chat-message.user { /* Ensure user messages align to the right */
  justify-content: flex-end;
}

.chat-message.assistant { /* Ensure assistant messages align to the left */
  justify-content: flex-start;
}

/* Chat bubble general styles - keep for user messages only */
.chat-bubble {
  max-width: 80%;
  padding: 0.8em 1.2em;
  border-radius: 18px;
  line-height: 1.5;
  word-wrap: break-word;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15); /* Add subtle shadow to bubbles */
}

/* User chat bubble (keep the bubble style) */
.chat-message.user .chat-bubble {
  background: linear-gradient(135deg, var(--blue-main), var(--blue-main-dark));
  color: #e3f2fd; /* Light blue text */
  border-bottom-right-radius: 4px; /* Tail on the right */
}

/* Assistant message - make text white for better contrast */
.chat-message.assistant .chat-bubble {
  background: #2a2a2a !important;
  color: #e0e0e0;
  border-bottom-left-radius: 0;
  box-shadow: none;
  padding: 1em;
  border: 1px solid #333;
  border-radius: 8px;
  max-width: 95%; /* Allow more width for assistant messages */
}

/* Style for the plan-answer is already set to have no background, so we can keep it as is */
.chat-message.assistant.plan-answer .chat-bubble {
  background: #2a2a2a !important;
  border-bottom-left-radius: 8px;
  box-shadow: none;
  padding: 1em;
  border: 1px solid #333;
}

/* Remove background from the parent message div as well */
.chat-message.assistant {
  background: none !important;
}

/* Markdown elements in assistant messages - adjust strong color if needed */
.chat-message.assistant .chat-bubble p { margin: 0 0 0.8em 0; line-height: 1.5; }
.chat-message.assistant .chat-bubble p:last-child { margin-bottom: 0; }
.chat-message.assistant .chat-bubble ul, 
.chat-message.assistant .chat-bubble ol { margin: 0.8em 0 0.8em 1.5em; padding-left: 0.5em; }
.chat-message.assistant .chat-bubble li { margin-bottom: 0.4em; line-height: 1.5; }
.chat-message.assistant .chat-bubble strong { font-weight: 500; color: #ffffff; }

/* Tables need borders even without bubble background */
.chat-message.assistant .chat-bubble table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  border: 1px solid #444;
  border-radius: 4px;
  overflow: hidden;
  background-color: rgba(30, 30, 35, 0.3); /* Very subtle background for tables */
}

.chat-message.assistant .chat-bubble th {
  background-color: #444;
  color: #f0f0f0;
  font-weight: 600;
  border: 1px solid #555;
  padding: 0.7em 0.8em;
}

.chat-message.assistant .chat-bubble td {
  background-color: #333;
  color: #e0e0e0;
  border: 1px solid #555;
  padding: 0.7em 0.8em;
}

/* Markdown elements in dark theme */
.chat-bubble p { margin: 0 0 0.8em 0; line-height: 1.5; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble ul, .chat-bubble ol { margin: 0.8em 0 0.8em 1.5em; padding-left: 0.5em; }
.chat-bubble li { margin-bottom: 0.4em; line-height: 1.5; }
.chat-bubble strong { font-weight: 500; color: #ffffff; } /* Brighter bold */
.chat-bubble code {
  background-color: #444; /* Darker code background */
  color: #c5c8c6; /* Light code text */
  padding: 0.2em 0.5em;
  border-radius: 4px;
  font-size: 0.9em;
}
.chat-bubble pre {
  background-color: #2a2a2a; /* Dark pre background */
  color: #c5c8c6; /* Light pre text */
  padding: 1em;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.9em;
  border: 1px solid #444;
}
.chat-bubble pre code {
  background-color: transparent;
  padding: 0;
  border: none;
}
.chat-bubble table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  border: 1px solid #444;
  border-radius: 4px;
  overflow: hidden;
}
.chat-bubble th, .chat-bubble td {
  border: 1px solid #555;
  padding: 0.7em 0.8em;
  text-align: left;
  font-size: 0.93em;
  line-height: 1.4;
}
.chat-bubble th {
  background-color: #444;
  color: #f0f0f0;
  font-weight: 600;
}
.chat-bubble td {
  background-color: #333;
  color: #e0e0e0;
}
.chat-bubble h1, .chat-bubble h2, .chat-bubble h3, 
.chat-bubble h4, .chat-bubble h5, .chat-bubble h6 {
  margin: 1.2em 0 0.7em 0;
  line-height: 1.3;
}
.chat-bubble h1:first-child, .chat-bubble h2:first-child, 
.chat-bubble h3:first-child, .chat-bubble h4:first-child {
  margin-top: 0.4em;
}

.chat-input-row {
  display: flex;
  gap: 0.8em;
  align-items: center;
  padding: 0.6em;
  min-height: 58px;
  border: 1px solid #333;
  border-radius: 28px;
  background-color: #2a2a2a;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3);
  flex-shrink: 0;
}

.chat-input { /* Input field within the row */
  flex: 1 1 auto;
  padding: 0.8em 1em;
  border-radius: 0;
  border: none;
  background-color: transparent;
  font-size: 1em;
  margin: 0;
  outline: none;
  color: #e0e0e0;
}

.chat-input::placeholder { /* Style placeholder */
    color: #888;
}

.chat-send-btn {
  background: linear-gradient(135deg, #6a95ff, #6289ff); /* Gradient for send button */
  color: #121212; /* Dark icon for contrast */
  border: none;
  border-radius: 50%;
  padding: 0;
  width: 44px; /* Slightly larger */
  height: 44px; /* Slightly larger */
  font-size: 1em;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  margin: 0;
  transition: background-color 0.2s ease, transform 0.1s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.chat-send-btn:hover {
  background: linear-gradient(135deg, #7ca5ff, #7095ff); /* Brighter gradient on hover */
  transform: scale(1.05); /* Slight scale effect */
}

.chat-send-btn:disabled {
  background: #444; /* Dark grey disabled */
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.chat-send-btn svg {
  fill: #1e1e1e; /* Dark icon */
  width: 22px; /* Adjust icon size */
  height: 22px;
}

.chat-send-btn:disabled svg {
  fill: #888; /* Dimmer icon when disabled */
}

/* Remove specific styles for buttons now in sidebar */
/* .reset-btn { ... } */
/* .instructions-btn { ... } */
/* .files-btn { ... } */

/* Modal Styles */
.modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1000; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
  padding-top: 20px; /* Location of the box - reduced for higher positioning */
}

.modal-content {
  background-color: #2e2e30; /* Slightly adjusted modal background */
  color: #e0e0e0;
  margin: 2% auto; /* 2% from the top (reduced from 5%) and centered */
  padding: 25px;
  border: 1px solid #5a5a5a; /* Slightly lighter border */
  border-radius: 12px;
  width: 80%; /* Could be more or less, depending on screen size */
  max-width: 600px; /* Maximum width */
  position: relative;
  box-shadow: 0 8px 25px rgba(0,0,0,0.5); /* Enhanced modal shadow */
  display: flex; /* Use flexbox for layout */
  flex-direction: column; /* Stack content vertically */
}

.modal-content.large { /* Style for wider modals */
    max-width: 800px;
    width: 90%;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8em;
  padding-bottom: 0.8em;
  border-bottom: 1px solid #444;
}

.modal-close {
  color: #aaa;
  position: absolute;
  top: 10px;
  right: 20px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.modal-close:hover,
.modal-close:focus {
  color: #fff;
  text-decoration: none;
}

.modal-close,
.modal-close-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 999px;
  border: 1px solid #555;
  background: #2a2a2a;
  color: #d1d5db;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.modal-close {
  font-weight: 600;
}

.modal-close:hover,
.modal-close:focus,
.modal-close-btn:hover,
.modal-close-btn:focus {
  background: #3a3a3a;
  color: #ffffff;
  border-color: #6b7280;
  text-decoration: none;
  outline: none;
}

.modal h2 {
  margin-top: 0;
  color: #ffffff;
  border-bottom: 1px solid #444;
  padding-bottom: 0.5em;
  margin-bottom: 1em;
}

.modal p {
  color: #b0b0b0;
  font-size: 0.95em;
  margin-bottom: 1em;
}

.modal textarea { /* Style textarea within modal */
  width: 100%;
  padding: 0.8em 1em;
  margin-bottom: 1.5em;
  border-radius: 8px;
  border: 1px solid #444;
  background-color: #1e1e1e; /* Slightly darker than modal bg */
  color: #e0e0e0;
  font-size: 0.95em;
  min-height: 150px;
  box-sizing: border-box;
}

.modal textarea:focus {
  border-color: #6289ff;
  box-shadow: 0 0 0 2px rgba(98, 137, 255, 0.3);
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 1em;
  margin-top: 1em;
}

.modal-save-btn {
  background-color: var(--blue-main); /* Blue save button */
  color: #121212;
  border-color: var(--blue-main-dark);
}

.modal-save-btn:hover {
  background-color: var(--blue-main-hover);
  border-color: var(--blue-main-light);
}

.modal-cancel-btn {
  background-color: #444; /* Grey cancel button */
  color: #e0e0e0;
  border-color: #555;
}

.modal-cancel-btn:hover {
  background-color: #555;
  border-color: #666;
}

.modal-status {
    margin-top: 1em;
    font-size: 0.9em;
    min-height: 1.2em; /* Reserve space */
    text-align: right;
    color: #8ab4f8; /* Default status color */
}

.modal-status.error {
    color: #ff8a80; /* Error status color */
}

/* Files Modal Specific Styles */
.file-list-container {
    margin-bottom: 1.5em;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 1em;
    background-color: #1e1e1e; /* Slightly darker background for list area */
    max-height: 300px; /* Limit height and make scrollable */
    overflow-y: auto;
}

.file-list-container h3 {
    margin-top: 0;
    margin-bottom: 0.8em;
    color: #e0e0e0;
    font-size: 1.1em;
}

#file-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#file-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6em 0.8em;
    border-bottom: 1px solid #333;
    font-size: 0.95em;
}

#file-list li:last-child {
    border-bottom: none;
}

#file-list span { /* Filename */
    flex-grow: 1;
    margin-right: 1em;
    word-break: break-all; /* Prevent long filenames from overflowing */
}

#file-list .file-actions button {
    margin-left: 0.5em;
    padding: 0.3em 0.8em;
    font-size: 0.85em;
}

.file-actions .view-edit-btn {
    background-color: #4a4a4a;
    color: #e0e0e0;
    border-color: #555;
}
.file-actions .view-edit-btn:hover {
    background-color: #5a5a5a;
}

.file-actions .delete-btn {
    background-color: #7d3c3c; /* Dark red */
    color: #f0d0d0;
    border-color: #8d4c4c;
}
.file-actions .delete-btn:hover {
    background-color: #9d4c4c;
}

.upload-section {
    margin-top: 1em;
    padding-top: 1em;
    border-top: 1px solid #333;
}

.upload-section h3 {
    margin-top: 0;
    margin-bottom: 0.8em;
    color: #e0e0e0;
    font-size: 1.1em;
}

#file-upload-input {
    display: block;
    margin-bottom: 1em;
    color: #b0b0b0; /* Style file input text */
}

/* Style file input button */
#file-upload-input::file-selector-button {
    font-family: inherit;
    padding: 0.5em 1em;
    border-radius: 8px;
    border: 1px solid #444;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    background: #303134;
    color: #bdc1c6;
    margin-right: 1em;
}

#file-upload-input::file-selector-button:hover {
    background: #3c4043;
    border-color: #555;
}

.modal-action-btn { /* General style for action buttons like Upload */
    background-color: var(--blue-main);
    color: #121212;
    border-color: var(--blue-main-dark);
}
.modal-action-btn:hover {
    background-color: var(--blue-main-hover);
    border-color: var(--blue-main-light);
}

/* File Editor Modal Styles */
#file-editor-title {
    margin-top: 0;
    color: #ffffff;
    border-bottom: 1px solid #444;
    padding-bottom: 0.5em;
    margin-bottom: 1em;
}

#file-editor-textarea {
    width: 100%;
    padding: 0.8em 1em;
    margin-bottom: 1.5em;
    border-radius: 8px;
    border: 1px solid #444;
    background-color: #1e1e1e;
    color: #e0e0e0;
    font-size: 0.95em;
    min-height: 300px; /* Taller editor */
    box-sizing: border-box;
    font-family: monospace; /* Use monospace for editing */
}

#file-editor-textarea:focus {
    border-color: #6289ff;
    box-shadow: 0 0 0 2px rgba(98, 137, 255, 0.3);
}

/* Ensure button base styles are defined if needed elsewhere */
button {
  /* Basic button reset if needed */
  font-family: inherit;
}


/* New styles for age selection */
.age-group label {
  margin-bottom: 0.5em; /* Consistent spacing */
}

.age-selects {
  display: flex;
  gap: 0.8em; /* Space between year and month dropdowns */
}

.age-selects select {
  flex: 1; /* Make dropdowns share space */
  min-width: 80px; /* Ensure dropdowns don't get too small */
}

/* Adjust padding for select with arrow */
select {
  /* ... existing select styles ... */
  padding: 0.9em 3em 0.9em 1.1em; /* Ensure right padding accommodates arrow */
}

/* New styles for vaccine selection */
.vaccine-group { /* Adjust vaccine group layout */
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

.vaccine-group label {
  margin-bottom: 0.3em;
}

#previous-vaccines-list {
  display: flex;
  flex-direction: column;
  gap: 0.8em;
  margin-bottom: 0; /* Ensure space between list and button */
  width: 100%;
  min-height: 60px;
  padding: 0.75em;
  border: 1px solid #3f3f46;
  border-radius: 6px;
  background-color: #1f1f23;
  box-sizing: border-box;
}

#previous-vaccines-list .no-selection {
  color: #b0b0b0;
  font-style: italic;
  text-align: center;
  padding: 1em;
}

.vaccine-entry {
  display: flex;
  gap: 0.5em;
  align-items: center;
  padding: 0.5em;
  background-color: rgba(58, 123, 224, 0.1);
  border-radius: 4px;
  margin-bottom: 0.5em;
  color: #e0e0e0;
}

.vaccine-entry {
  display: flex;
  gap: 0.5em;
  align-items: center; /* Vertically center items in the row */
  padding: 0.2em 0.1em;
  font-size: 0.97em;
}

.vaccine-entry select {
  flex: 1; /* Allow dropdowns to grow */
  height: 3.5em; /* Ensure consistent height */
}

.vaccine-entry .vaccine-select {
  min-width: 200px; /* Give more space to vaccine name */
}

.vaccine-entry .dose-select {
  min-width: 80px;
}

.remove-vaccine-btn {
  background-color: #7d3c3c; /* Dark red */
  color: #f0d0d0;
  border-color: #8d4c4c;
  padding: 0.4em 0.8em; /* Slightly smaller padding */
  font-size: 0.85em;
  flex-shrink: 0; /* Prevent button from shrinking */
}
.remove-vaccine-btn:hover {
    background-color: #9d4c4c;
}

.add-btn { /* Style for Add Vaccine button (now opens modal) */
  /* Match select styles */
  background-color: #2a2a2a; /* Match select background */
  color: #e0e0e0; /* Match select text color */
  border: 1px solid #444; /* Match select border */
  border-radius: 10px; /* Match select border-radius */
  padding: 0 0.9em; /* Match horizontal padding of select */
  font-size: 0.97em; /* Match select font-size */
  cursor: pointer;
  font-weight: 500; /* Keep button font-weight */
  transition: background-color 0.2s ease, border-color 0.2s ease;
  display: inline-block; /* Make it fit content width */
  height: 2.6em; /* Match height of selects */
  line-height: 2.6em; /* Vertically center text using line-height */
  text-align: center; /* Center text horizontally */
  margin-top: 0; /* Keep or adjust as needed */
  /* Remove align-self: flex-start; */
  white-space: nowrap; /* Prevent text wrapping */
}

.add-btn:hover {
  background: #3c4043; /* Slightly lighter grey on hover */
  border-color: #555; /* Slightly lighter border on hover */
  color: #ffffff; /* Slightly brighter text on hover */
}

/* Add Vaccine Modal Styles */
#add-vaccine-modal .modal-content {
    max-width: 500px; /* Adjust width as needed */
}

.add-vaccine-form {
    display: flex;
    flex-direction: column;
    gap: 1em;
    margin-bottom: 1.5em;
}

.add-vaccine-form .form-group {
    flex: 1;
    min-width: 0; /* Override previous min-width if needed */
}

/* New styles for medical conditions container */
#medical-conditions-container {
  max-height: 250px;
  min-height: 150px;
  overflow-y: auto;
  padding: 0.75em;
  border: 1px solid #3f3f46;
  border-radius: 8px;
  background-color: #1f1f23;
  margin-top: 0.3em; /* Align with other inputs */
  display: block; /* Changed from flex to block for proper vertical stacking */
  width: 100%;
  flex: 1 1 auto;
  box-sizing: border-box;
}

#medical-conditions-container label {
  display: flex; /* I want the to be inline */
  justify-content: space-between; /* Space between checkbox and label */
  width: 100%; /* Full width for label */
  padding: 0.5em 0.8em; /* Padding for each item */
  align-items: center;
  margin-bottom: 0.6em; /* Space between items */
  font-size: 0.95em;
  color: #e0e0e0; /* Light text */
  cursor: pointer;
}

#medical-conditions-container input[type="checkbox"] {
  margin-right: 0.7em;
  /* Optional: Style checkbox appearance if desired, though browser defaults are often fine */
  width: 16px;
  height: 16px;
  accent-color: var(--blue-main); /* Color the checkbox when checked */
}
/* New styles for vaccine display toggle */
.vaccine-selection-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1em;
}

.vaccine-display-toggle {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #444;
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #e0e0e0;
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #3c6ed1;
}

input:focus + .slider {
  box-shadow: 0 0 1px #3c6ed1;
}

input:checked + .slider:before {
  -webkit-transform: translateX(26px);
  -ms-transform: translateX(26px);
  transform: translateX(26px);
}

.toggle-label {
  font-size: 0.9em;
  color: #e0e0e0;
  font-weight: 500;
}

/* New styles for commercial vaccine names display */
.vaccine-item.commercial-mode .vaccine-name {
  font-size: 0.85em;
  font-style: italic;
}

.vaccine-item .commercial-names-list {
  display: none;
  margin-top: 0.3em;
  padding-left: 1em;
  font-size: 0.8em;
  color: #b0b0b0;
}

.vaccine-item.commercial-mode .commercial-names-list {
  display: block;
}

.commercial-names-list .commercial-name {
  display: block;
  margin-bottom: 0.2em;
}

.commercial-names-list .commercial-name:before {
  content: "• ";
  color: #3c6ed1;
}

/* Additional styles for better commercial names visibility */
.vaccine-item.commercial-mode .vaccine-name {
  font-weight: 500;
  margin-bottom: 0.3em;
}

.vaccine-item.commercial-mode {
  padding: 0.8em 0;
  border-left: 3px solid #3c6ed1;
  padding-left: 0.8em;
  margin-left: -0.8em;
  background-color: rgba(60, 110, 209, 0.05);
}

.commercial-names-list {
  border-left: 2px solid #444;
  padding-left: 0.8em;
  margin-left: 0.2em;
}

.vaccine-item.commercial-mode.selected {
  background-color: rgba(60, 110, 209, 0.1);
  border-left-color: #5a8bff;
}

/* Safari-specific fixes */
@supports (-webkit-appearance: none) {
  .vaccine-selection-panel .vaccine-item {
    display: flex !important;
    -webkit-flex-direction: row !important;
    flex-direction: row !important;
    -webkit-align-items: center !important;
    align-items: center !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  .vaccine-selection-panel .vaccine-name {
    display: inline-block !important;
    visibility: visible !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
  }
  
  /* Force Safari to show form elements */
  .vaccine-selection-panel input[type="checkbox"] {
    display: inline-block !important;
    -webkit-appearance: checkbox !important;
    appearance: checkbox !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  .vaccine-selection-panel select {
    display: inline-block !important;
    -webkit-appearance: menulist !important;
    appearance: menulist !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}

/* Fix horizontal overflow in vaccine selection */
.vaccine-selection-panel .vaccine-item {
  justify-content: flex-start !important;
  gap: 0.8em !important;
  flex-wrap: nowrap !important; /* Keep everything on one line */
  width: 100% !important;
  box-sizing: border-box !important;
  align-items: center !important; /* Ensure vertical alignment */
}

.vaccine-selection-panel .vaccine-name {
  flex: 1 1 auto !important;
  white-space: nowrap !important; /* Keep name on one line */
  word-wrap: normal !important;
  max-width: none !important; /* Remove width restriction */
  overflow: hidden !important;
  text-overflow: ellipsis !important; /* Show ... if text is too long */
  padding-right: 0.5em !important;
}

.vaccine-selection-panel .dose-select {
  flex: 0 0 auto !important;
  max-width: 120px !important;
  min-width: 80px !important;
}

.vaccine-selection-panel input[type="checkbox"] {
  flex: 0 0 auto !important;
  margin: 0 !important;
  width: auto !important;
  height: auto !important;
}

/* Ensure commercial names don't break the layout */
.vaccine-selection-panel .commercial-names-list {
  display: none !important; /* Hide by default to keep single line */
}

.vaccine-selection-panel .vaccine-item.commercial-mode .commercial-names-list {
  display: block !important;
  flex: 0 0 auto !important;
  max-width: 200px !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
}

/* === THINKING STEPS PROCESSING WIDGET === */
.thinking-steps {
  background: var(--blue-bg-chat);
  border: 1px solid #444;
  border-radius: 12px;
  padding: 1rem;
  margin: 1rem 0;
  max-width: 500px;
}

.thinking-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--blue-main);
  margin-bottom: 1rem;
  font-size: 1rem;
}

.thinking-title svg {
  color: var(--blue-main);
  animation: pulse 2s infinite;
}

.thinking-steps-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.thinking-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  opacity: 0.5;
  transition: all 0.3s ease;
}

.thinking-step.active {
  opacity: 1;
  color: var(--blue-main);
}

.thinking-step.completed {
  opacity: 0.8;
  color: #4CAF50;
}

.step-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex: 0 0 auto;
}

.step-circle {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #555;
  border: 2px solid #555;
  transition: all 0.3s ease;
}

.thinking-step.active .step-circle {
  background: var(--blue-main);
  border-color: var(--blue-main);
  animation: pulse 2s infinite;
}

.thinking-step.completed .step-circle {
  background: #4CAF50;
  border-color: #4CAF50;
}

.step-line {
  width: 2px;
  height: 20px;
  background: #444;
  margin-top: 4px;
  transition: all 0.3s ease;
}

.thinking-step.completed .step-line {
  background: #4CAF50;
}

.step-content {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Animations */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

/* Hide the last step line */
.thinking-step:last-child .step-line {
  display: none;
}

/* PDF Links Styling */
.chat-bubble a[href$=".pdf"],
.chat-bubble a[href*="/vaccine-pdfs/"] {
  color: #6eaaff;
  text-decoration: none;
  font-weight: 500;
  padding: 0;
  border-radius: 0;
  background: transparent;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chat-bubble a[href$=".pdf"]:hover,
.chat-bubble a[href*="/vaccine-pdfs/"]:hover {
  color: #8fc5ff;
  text-decoration: underline;
}

.chat-bubble a[href$=".pdf"]:active,
.chat-bubble a[href*="/vaccine-pdfs/"]:active {
  transform: translateY(0);
}

/* PDF Section Styling */
.chat-bubble h2:has(+ ul a[href$=".pdf"]),
.chat-bubble h3:has(+ ul a[href$=".pdf"]),
.chat-bubble h2:contains("📚"),
.chat-bubble h3:contains("📚") {
  color: #6eaaff;
  border-bottom: 2px solid rgba(58, 123, 224, 0.3);
  padding-bottom: 8px;
  margin-top: 24px;
}

.chat-bubble ul:has(a[href$=".pdf"]) {
  list-style: none;
  padding-left: 0;
  margin-top: 12px;
}

.chat-bubble ul:has(a[href$=".pdf"]) li {
  margin: 8px 0;
  padding: 8px 12px;
  background: transparent;
  border-radius: 6px;
  transition: border-color 0.2s ease;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.chat-bubble ul:has(a[href$=".pdf"]) li:hover {
  background: transparent;
  border-color: rgba(148, 163, 184, 0.32);
}

/* PDF Modal Styling */
#pdf-modal .modal-content {
  width: 90%;
  max-width: 1200px;
  height: 90vh;
  max-height: 90vh;
}

.pdf-modal-content {
  display: flex;
  flex-direction: column;
}

.pdf-viewer-container {
  flex: 1;
  overflow: hidden;
  margin: 16px 0;
}

#pdf-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(138, 180, 248, 0.2);
}

#pdf-modal .modal-header h3 {
  margin: 0;
  color: #8ab4f8;
  font-size: 1.3em;
}

#pdf-modal .modal-buttons {
  margin-top: 0;
  padding-top: 12px;
  border-top: 1px solid rgba(138, 180, 248, 0.2);
}

/* Image Modal Styling (Vaccination Table) */
#img-modal .modal-content {
  width: 95%;
  max-width: 1400px;
  height: 90vh;
  max-height: 90vh;
}

.img-modal-content {
  display: flex;
  flex-direction: column;
}

.img-viewer-container {
  flex: 1;
  overflow: auto;
  margin: 16px 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

#img-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(138, 180, 248, 0.2);
}

#img-modal .modal-header h3 {
  margin: 0;
  color: #8ab4f8;
  font-size: 1.3em;
}

#img-modal .modal-buttons {
  margin-top: 0;
  padding-top: 12px;
  border-top: 1px solid rgba(138, 180, 248, 0.2);
}

/* Final vaccine row layout cleanup */
.vaccine-selection-panel .vaccine-item:not(.all-up-to-date-option) {
  display: grid !important;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  column-gap: 0.85em !important;
  row-gap: 0.2em !important;
  align-items: start !important;
  padding: 0.65em 0.75em !important;
  margin-bottom: 0.5em !important;
  border-radius: 10px;
}

.vaccine-selection-panel .vaccine-checkbox,
.vaccine-selection-panel .vaccine-item input[type="checkbox"]:not(#all-up-to-date-checkbox) {
  margin: 0 !important;
  width: 18px !important;
  height: 18px !important;
  align-self: start;
  margin-top: 0.15em !important;
  flex: none !important;
}

.vaccine-selection-panel .vaccine-text-group {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2em;
}

.vaccine-selection-panel .vaccine-name,
.vaccine-selection-panel .vaccine-item .vaccine-name,
.vaccine-selection-panel .vaccine-text-group .vaccine-name {
  display: block !important;
  min-width: 0 !important;
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.35;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  font-size: 0.96rem !important;
  font-weight: 600;
}

.vaccine-selection-panel .commercial-names-list,
.vaccine-selection-panel .vaccine-item.commercial-mode .commercial-names-list {
  display: none !important;
  width: 100%;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  font-size: 0.84rem;
  line-height: 1.35;
}

.vaccine-selection-panel .vaccine-item.commercial-mode .commercial-names-list {
  display: flex !important;
  flex-direction: column;
  gap: 0.1em;
}

.vaccine-selection-panel .commercial-names-list .commercial-name {
  display: block;
  margin: 0;
  padding: 0;
}

.vaccine-selection-panel .commercial-names-list .commercial-name:before {
  content: "- ";
}

.vaccine-selection-panel .dose-select {
  align-self: center !important;
  justify-self: end;
  margin-left: 0 !important;
  min-width: 96px !important;
  max-width: 118px !important;
}

.vaccine-selection-panel .vaccine-item.commercial-mode {
  padding-left: 0.75em !important;
  margin-left: 0 !important;
  border-left: none !important;
}

@supports (-webkit-appearance: none) {
  .vaccine-selection-panel .vaccine-name,
  .vaccine-selection-panel .vaccine-item .vaccine-name,
  .vaccine-selection-panel .commercial-names-list,
  .vaccine-selection-panel .commercial-names-list .commercial-name {
    -webkit-text-fill-color: currentColor !important;
  }
}

/* =========================
   Global Theme System
   ========================= */

body[data-theme="dark"] {
  --theme-bg-page: #0f172a;
  --theme-bg-page-alt: #111827;
  --theme-bg-surface: #111b2f;
  --theme-bg-panel: #1f2937;
  --theme-bg-panel-soft: #253246;
  --theme-bg-input: #111827;
  --theme-bg-bubble-user: linear-gradient(135deg, #2563eb, #1d4ed8);
  --theme-bg-bubble-assistant: #1f2937;
  --theme-bg-modal-overlay: rgba(2, 6, 23, 0.72);
  --theme-text-primary: #e2e8f0;
  --theme-text-secondary: #cbd5e1;
  --theme-text-muted: #94a3b8;
  --theme-border: #334155;
  --theme-border-strong: #475569;
  --theme-accent: #60a5fa;
  --theme-accent-strong: #3b82f6;
  --theme-accent-soft: rgba(59, 130, 246, 0.18);
  --theme-success: #22c55e;
  --theme-danger: #f87171;
  --theme-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
}

body[data-theme="light"] {
  --theme-bg-page: #f8fafc;
  --theme-bg-page-alt: #eef2ff;
  --theme-bg-surface: #ffffff;
  --theme-bg-panel: #ffffff;
  --theme-bg-panel-soft: #f8fafc;
  --theme-bg-input: #ffffff;
  --theme-bg-bubble-user: linear-gradient(135deg, #2563eb, #1d4ed8);
  --theme-bg-bubble-assistant: #f8fafc;
  --theme-bg-modal-overlay: rgba(15, 23, 42, 0.45);
  --theme-text-primary: #0f172a;
  --theme-text-secondary: #1e293b;
  --theme-text-muted: #64748b;
  --theme-border: #cbd5e1;
  --theme-border-strong: #94a3b8;
  --theme-accent: #1d4ed8;
  --theme-accent-strong: #2563eb;
  --theme-accent-soft: rgba(37, 99, 235, 0.1);
  --theme-success: #16a34a;
  --theme-danger: #dc2626;
  --theme-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

body[data-theme] {
  color: var(--theme-text-primary) !important;
  background: linear-gradient(160deg, var(--theme-bg-page), var(--theme-bg-page-alt)) !important;
}

body[data-theme] .settings-bar,
body[data-theme] .left-section,
body[data-theme] .right-section,
body[data-theme] .chat-input-row,
body[data-theme] .modal-content {
  background: var(--theme-bg-panel) !important;
  color: var(--theme-text-primary) !important;
  border-color: var(--theme-border) !important;
  box-shadow: var(--theme-shadow);
}

body[data-theme] .file-list-container,
body[data-theme] .review-section,
body[data-theme] .vaccine-selection-panel,
body[data-theme] .thinking-steps,
body[data-theme] #previous-vaccines-list,
body[data-theme] #medical-conditions-container,
body[data-theme] .review-value,
body[data-theme] .selected-vaccines-summary {
  box-shadow: none !important;
}

body[data-theme] .settings-bar {
  background: linear-gradient(90deg, var(--theme-bg-panel), var(--theme-bg-panel-soft)) !important;
}

body[data-theme] .app-wrapper,
body[data-theme] .main-content {
  background: var(--theme-bg-panel) !important;
}

body[data-theme] .wizard-container {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
}

body[data-theme] .section-title,
body[data-theme] .wizard-title,
body[data-theme] .step-title,
body[data-theme] h1,
body[data-theme] h2,
body[data-theme] h3,
body[data-theme] h4,
body[data-theme] label,
body[data-theme] .step-label,
body[data-theme] .toggle-label,
body[data-theme] .review-item h4,
body[data-theme] .selected-vaccines-summary h4 {
  color: var(--theme-text-primary) !important;
}

body[data-theme] .vaccine-selection-header > label,
body[data-theme] .vaccine-selection-header label:first-child {
  color: var(--theme-text-primary) !important;
  opacity: 1 !important;
  visibility: visible !important;
}

body[data-theme] .description,
body[data-theme] .step-description,
body[data-theme] .modal p,
body[data-theme] .no-selection,
body[data-theme] .modal-status,
body[data-theme] .age-display,
body[data-theme] .review-value,
body[data-theme] #previous-vaccines-list,
body[data-theme] #medical-conditions-container label {
  color: var(--theme-text-secondary) !important;
}

body[data-theme] #previous-vaccines-list .no-selection,
body[data-theme] #previous-vaccines-list .vaccine-entry {
  color: var(--theme-text-primary) !important;
}

body[data-theme] .age-display {
  background: var(--theme-bg-input) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text-primary) !important;
}

body[data-theme] .review-section,
body[data-theme] .thinking-steps {
  background: var(--theme-bg-panel-soft) !important;
  border: 1px solid var(--theme-border) !important;
  color: var(--theme-text-primary) !important;
}

body[data-theme] .review-value {
  background: var(--theme-bg-input) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text-primary) !important;
}

body[data-theme] .thinking-title,
body[data-theme] .thinking-title svg,
body[data-theme] .thinking-step,
body[data-theme] .step-content {
  color: var(--theme-text-secondary) !important;
}

body[data-theme] .thinking-step.active {
  color: var(--theme-accent) !important;
}

body[data-theme] .thinking-step.completed {
  color: var(--theme-success) !important;
}

body[data-theme] input[type="text"],
body[data-theme] input[type="date"],
body[data-theme] textarea,
body[data-theme] select,
body[data-theme] .chat-input,
body[data-theme] .modal textarea,
body[data-theme] #file-editor-textarea {
  background: var(--theme-bg-input) !important;
  color: var(--theme-text-primary) !important;
  border-color: var(--theme-border) !important;
}

body[data-theme] input::placeholder,
body[data-theme] textarea::placeholder,
body[data-theme] .chat-input::placeholder {
  color: var(--theme-text-muted) !important;
}

body[data-theme] input:focus,
body[data-theme] textarea:focus,
body[data-theme] select:focus,
body[data-theme] .chat-input:focus {
  border-color: var(--theme-accent) !important;
  box-shadow: 0 0 0 2px var(--theme-accent-soft) !important;
}

body[data-theme] button,
body[data-theme] .settings-btn,
body[data-theme] .wizard-btn,
body[data-theme] .modal-action-btn,
body[data-theme] .modal-save-btn,
body[data-theme] .modal-cancel-btn,
body[data-theme] .file-actions .view-edit-btn,
body[data-theme] .file-actions .delete-btn,
body[data-theme] .chat-send-btn,
body[data-theme] #initial-send-btn {
  color: var(--theme-text-primary) !important;
  border-color: var(--theme-border) !important;
}

body[data-theme] .settings-btn:hover,
body[data-theme] .wizard-btn-primary,
body[data-theme] .modal-save-btn,
body[data-theme] .modal-action-btn {
  background: var(--theme-accent-soft) !important;
  color: var(--theme-text-primary) !important;
}

body[data-theme] .settings-btn-accent,
body[data-theme] .wizard-btn-secondary,
body[data-theme] .modal-cancel-btn,
body[data-theme] .file-actions .view-edit-btn {
  background: var(--theme-bg-panel-soft) !important;
}

body[data-theme] .wizard-navigation,
body[data-theme] .chat-input-row {
  background: var(--theme-bg-panel-soft) !important;
  border-color: var(--theme-border) !important;
  box-shadow: none !important;
}

body[data-theme] .step-content::-webkit-scrollbar-track,
body[data-theme] .vaccine-selection-panel::-webkit-scrollbar-track,
body[data-theme] #medical-conditions-container::-webkit-scrollbar-track,
body[data-theme] #previous-vaccines-list::-webkit-scrollbar-track,
body[data-theme] .chat-history::-webkit-scrollbar-track,
body[data-theme] .file-list-container::-webkit-scrollbar-track {
  background: transparent !important;
}

body[data-theme] .step-content::-webkit-scrollbar-thumb,
body[data-theme] .vaccine-selection-panel::-webkit-scrollbar-thumb,
body[data-theme] #medical-conditions-container::-webkit-scrollbar-thumb,
body[data-theme] #previous-vaccines-list::-webkit-scrollbar-thumb,
body[data-theme] .chat-history::-webkit-scrollbar-thumb,
body[data-theme] .file-list-container::-webkit-scrollbar-thumb {
  background: var(--theme-border-strong) !important;
  border: 1px solid transparent;
  background-clip: padding-box;
}

body[data-theme] .step-content,
body[data-theme] .vaccine-selection-panel,
body[data-theme] #medical-conditions-container,
body[data-theme] #previous-vaccines-list,
body[data-theme] .chat-history,
body[data-theme] .file-list-container {
  scrollbar-width: thin;
  scrollbar-color: var(--theme-border-strong) transparent;
}

body[data-theme] .wizard-navigation {
  background: transparent !important;
  border-color: transparent !important;
  border-radius: 0;
  padding: 0 !important;
}

body[data-theme] .wizard-btn {
  background: transparent !important;
  color: var(--theme-text-secondary) !important;
  border-color: var(--theme-border) !important;
}

body[data-theme] .wizard-btn-primary {
  background: var(--theme-accent-soft) !important;
  color: var(--theme-text-primary) !important;
  border-color: color-mix(in srgb, var(--theme-accent) 35%, var(--theme-border)) !important;
}

body[data-theme] .wizard-btn-secondary:hover:not(:disabled),
body[data-theme] .wizard-btn-primary:hover:not(:disabled),
body[data-theme] .wizard-btn-success:hover:not(:disabled) {
  background: var(--theme-accent-soft) !important;
  color: var(--theme-text-primary) !important;
}

body[data-theme] .file-actions .delete-btn {
  background: rgba(239, 68, 68, 0.18) !important;
  color: var(--theme-danger) !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
}

body[data-theme] .chat-message.user .chat-bubble {
  background: var(--theme-bg-bubble-user) !important;
  color: #ffffff !important;
}

body[data-theme] .chat-message.assistant .chat-bubble,
body[data-theme] .chat-message.assistant.plan-answer .chat-bubble {
  background: var(--theme-bg-bubble-assistant) !important;
  color: var(--theme-text-primary) !important;
  border-color: var(--theme-border) !important;
}

body[data-theme] .chat-bubble strong,
body[data-theme] .chat-message.assistant .chat-bubble strong {
  color: var(--theme-text-primary) !important;
}

body[data-theme] .chat-bubble th,
body[data-theme] .chat-message.assistant .chat-bubble th {
  background: var(--theme-bg-panel-soft) !important;
  color: var(--theme-text-primary) !important;
  border-color: var(--theme-border-strong) !important;
}

body[data-theme] .chat-bubble td,
body[data-theme] .chat-message.assistant .chat-bubble td,
body[data-theme] .chat-bubble table,
body[data-theme] .chat-message.assistant .chat-bubble table {
  background: var(--theme-bg-panel) !important;
  color: var(--theme-text-secondary) !important;
  border-color: var(--theme-border) !important;
}

body[data-theme] .modal {
  background-color: var(--theme-bg-modal-overlay) !important;
}

body[data-theme] .modal-header {
  border-bottom-color: var(--theme-border) !important;
}

body[data-theme] .modal-close,
body[data-theme] .modal-close-btn {
  background: var(--theme-bg-panel-soft) !important;
  color: var(--theme-text-primary) !important;
  border-color: var(--theme-border) !important;
}

body[data-theme] .modal-close:hover,
body[data-theme] .modal-close:focus,
body[data-theme] .modal-close-btn:hover,
body[data-theme] .modal-close-btn:focus {
  background: var(--theme-accent-soft) !important;
  color: var(--theme-text-primary) !important;
  border-color: var(--theme-accent) !important;
}

body[data-theme] .vaccine-item.selected,
body[data-theme] .vaccine-selection-panel .vaccine-item.selected,
body[data-theme] .selected-vaccines-summary,
body[data-theme] .vaccine-entry {
  background: var(--theme-accent-soft) !important;
  border-color: var(--theme-accent) !important;
}

body[data-theme] .vaccine-entry {
  border: 1px solid var(--theme-border) !important;
}

body[data-theme] .step-indicator.active .step-number,
body[data-theme] .thinking-step.active .step-circle,
body[data-theme] .slider,
body[data-theme] input:checked + .slider {
  background-color: var(--theme-accent-strong) !important;
  border-color: var(--theme-accent-strong) !important;
}

body[data-theme] .step-indicator.completed .step-number,
body[data-theme] .step-connector.completed,
body[data-theme] .thinking-step.completed .step-circle,
body[data-theme] .thinking-step.completed .step-line {
  background-color: var(--theme-success) !important;
  border-color: var(--theme-success) !important;
}

body[data-theme] .step-number,
body[data-theme] .step-connector,
body[data-theme] .step-circle,
body[data-theme] .step-line,
body[data-theme] .slider,
body[data-theme] .commercial-names-list {
  border-color: var(--theme-border) !important;
  background-color: var(--theme-bg-panel-soft) !important;
}

body[data-theme="dark"] .review-section,
body[data-theme="dark"] .thinking-steps {
  background: #162033 !important;
  border-color: #334155 !important;
}

body[data-theme="dark"] .review-value {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

body[data-theme="dark"] .thinking-title,
body[data-theme="dark"] .thinking-title svg {
  color: #93c5fd !important;
}

body[data-theme="dark"] .thinking-step {
  color: #94a3b8 !important;
}

body[data-theme="dark"] .thinking-step.active {
  color: #60a5fa !important;
}

body[data-theme="dark"] .thinking-step.completed {
  color: #4ade80 !important;
}

body[data-theme="dark"] .step-circle,
body[data-theme="dark"] .step-line {
  background-color: #475569 !important;
  border-color: #475569 !important;
}

body[data-theme] .selected-vaccines-summary {
  background: transparent !important;
  border: 1px solid var(--theme-border) !important;
  border-left-width: 4px !important;
}

.theme-control {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-left: 0.4em;
  padding: 0.25em 0.6em;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.theme-control label {
  margin: 0;
  font-size: 0.82em;
  font-weight: 600;
  color: inherit;
}

.theme-select {
  min-width: 110px;
  height: 2em;
  margin: 0;
  padding: 0.2em 1.8em 0.2em 0.55em;
  border-radius: 8px;
  font-size: 0.82em;
  font-weight: 500;
  border: 1px solid currentColor;
  background-size: 1em;
  background-position: right 0.5em center;
}

@media (max-width: 980px) {
  .theme-control {
    margin-left: 0;
    margin-top: 0.25em;
  }
}

/* Light theme hard-fix layer for legacy dark literals */
body[data-theme="light"] input[type="date"].date-input {
  color-scheme: light !important;
}

body[data-theme="light"] input[type="date"].date-input::-webkit-calendar-picker-indicator {
  filter: none !important;
}

body[data-theme="light"] select option {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

body[data-theme="light"] #previous-vaccines-list,
body[data-theme="light"] #medical-conditions-container,
body[data-theme="light"] .review-section,
body[data-theme="light"] .review-value,
body[data-theme="light"] .age-display,
body[data-theme="light"] .file-list-container,
body[data-theme="light"] .upload-section,
body[data-theme="light"] .chat-input-row {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

body[data-theme="light"] #file-list li,
body[data-theme="light"] .upload-section,
body[data-theme="light"] .wizard-navigation,
body[data-theme="light"] .vaccine-selection-panel .all-up-to-date-option,
body[data-theme="light"] .modal h2,
body[data-theme="light"] #file-editor-title {
  border-color: #cbd5e1 !important;
}

body[data-theme="light"] .modal-content,
body[data-theme="light"] .modal textarea,
body[data-theme="light"] #file-editor-textarea,
body[data-theme="light"] .chat-message.assistant .chat-bubble,
body[data-theme="light"] .chat-message.assistant.plan-answer .chat-bubble {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

body[data-theme="light"] .chat-bubble td,
body[data-theme="light"] .chat-message.assistant .chat-bubble td,
body[data-theme="light"] .chat-bubble table,
body[data-theme="light"] .chat-message.assistant .chat-bubble table {
  background-color: #ffffff !important;
  color: #1e293b !important;
  border-color: #cbd5e1 !important;
}

body[data-theme="light"] .chat-bubble th,
body[data-theme="light"] .chat-message.assistant .chat-bubble th {
  background-color: #eff6ff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

body[data-theme="light"] .chat-bubble code,
body[data-theme="light"] .chat-bubble pre,
body[data-theme="light"] .chat-bubble pre code {
  background-color: #f8fafc !important;
  color: #1e293b !important;
  border-color: #cbd5e1 !important;
}

body[data-theme="light"] #vaccine-selection-panel,
body[data-theme="light"] .vaccine-selection-panel {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
}

body[data-theme="light"] #vaccine-selection-panel *,
body[data-theme="light"] .vaccine-selection-panel .vaccine-item,
body[data-theme="light"] .vaccine-selection-panel .vaccine-item label,
body[data-theme="light"] .vaccine-selection-panel .vaccine-item span,
body[data-theme="light"] .vaccine-selection-panel .vaccine-name,
body[data-theme="light"] .vaccine-selection-panel .vaccine-item .vaccine-name,
body[data-theme="light"] .vaccine-selection-panel .commercial-names-list,
body[data-theme="light"] .commercial-names-list .commercial-name,
body[data-theme="light"] .toggle-label,
body[data-theme="light"] #medical-conditions-container label {
  color: #0f172a !important;
}

body[data-theme="light"] .vaccine-selection-panel .vaccine-name,
body[data-theme="light"] .vaccine-selection-panel .vaccine-item .vaccine-name,
body[data-theme="light"] .commercial-names-list,
body[data-theme="light"] .commercial-names-list .commercial-name,
body[data-theme="light"] .commercial-names-list .commercial-name:before {
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
}

body[data-theme="light"] .vaccine-selection-header > label,
body[data-theme="light"] .vaccine-selection-header label:first-child {
  color: #0f172a !important;
}

body[data-theme="light"] .vaccine-selection-panel .dose-select,
body[data-theme="light"] .vaccine-selection-panel select,
body[data-theme="light"] .vaccine-entry select,
body[data-theme="light"] .theme-select {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

body[data-theme="light"] .vaccine-item.commercial-mode,
body[data-theme="light"] .vaccine-item.commercial-mode.selected,
body[data-theme="light"] .vaccine-entry,
body[data-theme="light"] .selected-vaccines-summary,
body[data-theme="light"] .vaccine-selection-panel .vaccine-item.selected {
  background: rgba(37, 99, 235, 0.08) !important;
  border-color: rgba(37, 99, 235, 0.22) !important;
}

body[data-theme="light"] #previous-vaccines-list .vaccine-entry,
body[data-theme="light"] #previous-vaccines-list .no-selection {
  color: #0f172a !important;
}

body[data-theme="light"] .slider {
  background-color: #cbd5e1 !important;
}

body[data-theme="light"] .step-circle,
body[data-theme="light"] .step-line,
body[data-theme="light"] .step-number {
  background-color: #dbeafe !important;
  border-color: #93c5fd !important;
  color: #1e3a8a !important;
}

body[data-theme="light"] .chat-send-btn svg,
body[data-theme="light"] .chat-send-btn:disabled svg {
  fill: #ffffff !important;
}

body[data-theme="light"] .modal-close,
body[data-theme="light"] .modal-close-btn {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

body[data-theme="light"] .modal-close:hover,
body[data-theme="light"] .modal-close:focus,
body[data-theme="light"] .modal-close-btn:hover,
body[data-theme="light"] .modal-close-btn:focus {
  background-color: #eff6ff !important;
  color: #0f172a !important;
  border-color: #93c5fd !important;
}

/* ===== Login Overlay ===== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d1117;
}

.login-box {
  background: #1e2433;
  border: 1px solid #2e3650;
  border-radius: 16px;
  padding: 2.5rem 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.login-logo {
  text-align: center;
  margin-bottom: 1.8rem;
}

.login-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  margin-bottom: 0.6rem;
}

.login-title {
  font-size: 1.7rem;
  font-weight: 700;
  color: #e8eaf6;
  margin: 0 0 0.2rem;
  letter-spacing: 0.5px;
}

.login-subtitle {
  font-size: 0.82rem;
  color: #8ab4f8;
  margin: 0;
}

.login-field {
  margin-bottom: 1rem;
}

.login-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: #9ca3af;
  margin-bottom: 0.35rem;
  letter-spacing: 0.3px;
}

.login-field input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 8px;
  color: #e8eaf6;
  font-size: 0.95rem;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.login-field input:focus {
  border-color: #4f82e8;
  box-shadow: 0 0 0 2px rgba(79,130,232,0.2);
}

.login-error {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.4);
  border-radius: 7px;
  color: #f87171;
  font-size: 0.82rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.9rem;
  text-align: center;
}

.login-btn {
  width: 100%;
  padding: 0.7rem;
  margin-top: 0.4rem;
  background: #4f82e8;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.15s, opacity 0.15s;
}

.login-btn:hover { background: #3b6fd4; }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Logout button in settings bar */
.settings-btn-logout {
  color: #f87171 !important;
  border-color: rgba(248,113,113,0.3) !important;
}
.settings-btn-logout:hover {
  background: rgba(248,113,113,0.12) !important;
  border-color: rgba(248,113,113,0.6) !important;
}

/* Light theme login */
body[data-theme="light"] .login-overlay { background: #f0f4f8; }
body[data-theme="light"] .login-box { background: #fff; border-color: #d1d9e6; box-shadow: 0 4px 24px rgba(0,0,0,0.1); }
body[data-theme="light"] .login-title { color: #1e293b; }
body[data-theme="light"] .login-field label { color: #64748b; }
body[data-theme="light"] .login-field input { background: #f8fafc; border-color: #cbd5e1; color: #1e293b; }
body[data-theme="light"] .login-field input:focus { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.15); }

/* ============================================================
   Dropdown Menu
   ============================================================ */
.menu-dropdown-wrapper {
  position: relative;
}
.menu-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
}
.menu-chevron {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
[aria-expanded="true"] .menu-chevron {
  transform: rotate(180deg);
}
.menu-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  max-width: 280px;
  width: max-content;
  background: #1e2433;
  border: 1px solid #2e3650;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  z-index: 2000;
  padding: 6px 0;
  overflow: hidden;
}
.menu-dropdown.open {
  display: block;
}
.menu-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 8px 14px 4px;
  pointer-events: none;
}
.menu-divider {
  height: 1px;
  background: #2e3650;
  margin: 4px 0;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  background: none;
  border: none;
  color: #c9d1d9;
  font-size: 0.88rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.menu-item:hover {
  background: rgba(255,255,255,0.07);
  color: #e8eaf6;
}
.menu-item svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  flex-shrink: 0;
  opacity: 0.8;
}
.menu-item-theme {
  cursor: default;
  white-space: normal;
  min-width: 0;
}
.menu-item-theme:hover {
  background: none;
}
.menu-item-theme > span {
  flex-shrink: 0;
}
.theme-select-inline {
  background: #111827;
  border: 1px solid #374151;
  border-radius: 6px;
  color: #c9d1d9;
  font-size: 0.82rem;
  padding: 3px 6px;
  cursor: pointer;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.theme-select-inline:focus {
  outline: 1px solid #4f82e8;
}
.menu-item-logout {
  color: #f87171;
}
.menu-item-logout:hover {
  background: rgba(248,113,113,0.1);
  color: #fca5a5;
}
/* Light theme dropdown */
body[data-theme="light"] .menu-dropdown {
  background: #fff;
  border-color: #d1d9e6;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}
body[data-theme="light"] .menu-item {
  color: #374151;
}
body[data-theme="light"] .menu-item:hover {
  background: #f3f4f6;
  color: #111827;
}
body[data-theme="light"] .menu-section-label {
  color: #9ca3af;
}
body[data-theme="light"] .menu-divider {
  background: #e5e7eb;
}
body[data-theme="light"] .theme-select-inline {
  background: #f9fafb;
  border-color: #d1d5db;
  color: #374151;
}
body[data-theme="light"] .menu-item-logout {
  color: #dc2626;
}
body[data-theme="light"] .menu-item-logout:hover {
  background: rgba(220,38,38,0.08);
}

/* ============================================================
   History Modal
   ============================================================ */
#history-modal .modal-content {
  max-width: 600px;
  width: 92%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
#history-list-container {
  overflow-y: auto;
  flex: 1;
}
.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  border-bottom: 1px solid #2e3650;
  gap: 10px;
  transition: background 0.1s;
}
.history-item:last-child {
  border-bottom: none;
}
.history-item:hover {
  background: rgba(255,255,255,0.04);
}
.history-item-info {
  flex: 1;
  min-width: 0;
}
.history-item-title {
  display: block;
  font-size: 0.88rem;
  color: #c9d1d9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item-date {
  display: block;
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 2px;
}
.history-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.history-load-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #4f82e8;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.12s;
}
.history-load-btn:hover {
  background: #3b6fd4;
}
.history-load-btn svg { fill: #fff; }
.history-delete-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  color: #f87171;
  border: 1px solid rgba(248,113,113,0.35);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.history-delete-btn:hover {
  background: rgba(248,113,113,0.12);
  border-color: rgba(248,113,113,0.6);
}
.history-delete-btn svg { fill: #f87171; }
.history-empty-msg {
  color: #6b7280;
  text-align: center;
  padding: 2.5rem 0;
  font-size: 0.9rem;
}
/* Light theme history */
body[data-theme="light"] .history-item { border-color: #e5e7eb; }
body[data-theme="light"] .history-item:hover { background: #f9fafb; }
body[data-theme="light"] .history-item-title { color: #374151; }
body[data-theme="light"] .history-item-date { color: #9ca3af; }
body[data-theme="light"] .history-delete-btn { color: #dc2626; border-color: rgba(220,38,38,0.3); }
body[data-theme="light"] .history-delete-btn:hover { background: rgba(220,38,38,0.07); }
body[data-theme="light"] .history-delete-btn svg { fill: #dc2626; }
