:root {
  /* Colors */
  --color-bg: #f4f7fa;
  --color-white: #ffffff;
  --color-text: #2c3e50;
  --color-border: #d0d7de;
  --color-accent: #1d72b8;
  --color-accent-dark: #155a8a;
  --color-hover: #eef4fb;
  --color-shadow: rgba(0, 0, 0, 0.08);
  --color-toast-bg: var(--color-accent-dark);

  /* Typography */
  --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --font-size-base: 1rem;
  --font-size-heading: 1.5rem;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 30px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 12px;

  /* Shadows */
  --shadow-light: 0 2px 6px var(--color-shadow);
  --shadow-medium: 0 4px 12px var(--color-shadow);
}

/* ────────────── Global & Base ────────────── */
body {
  font-family: var(--font-main);
  background: var(--color-bg);
  color: var(--color-text);
  margin: 0;
  padding: var(--space-md);
}

input[type="text"],
input[type="date"] {
  width: 300px;
  max-width: 100%;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-base);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-sizing: border-box;
}

input[type="file"] {
  display: none;
  margin-top: var(--space-sm);
}

/* ────────────── Main Layout ────────────── */
.main-wrapper {
  max-width: 900px;
  margin: 0 auto;
  background: var(--color-white);
  padding: var(--space-lg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-medium);
}

/* ────────────── Headings ────────────── */
h2 {
  margin-top: var(--space-lg);
  color: var(--color-accent-dark);
  font-size: var(--font-size-heading);
  border-left: 6px solid var(--color-accent);
  padding-left: var(--space-sm);
}

#elevationSection h2 {
  margin-top: 0;
  color: #333;
}

/* ────────────── Form Styles ────────────── */
#estimateForm {
  width: 100%;
  max-width: 700px;
  border-collapse: collapse;
}

/* ────────────── Tables ────────────── */
table {
  width: 100%;
  margin-top: var(--space-sm);
  border-collapse: collapse;
}

td {
  padding: var(--space-sm) var(--space-xs);
  vertical-align: middle;
}

td:first-child {
  font-weight: bold;
  white-space: nowrap;
  width: 1%;
}

#mergedTableContainer table {
  text-align: center;
  border-collapse: collapse;
}

#mergedTableContainer th,
#mergedTableContainer td,
#mergedTableWrapper th,
#mergedTableWrapper td {
  border: 1px solid var(--color-border);
  padding: var(--space-sm);
  text-align: center;
}

#mergedTableWrapper {
  display: none;
  padding: 0;
  margin-top: var(--space-md);
  border: none;
  transition: border 0.3s ease, box-shadow 0.3s ease;
}

#mergedTableWrapper.has-data {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  background: var(--color-white);
  box-shadow: var(--shadow-light);
}

/* ────────────── File Drop Zone ────────────── */
#drop-zone {
  border: 2px dashed var(--color-accent);
  padding: var(--space-lg);
  text-align: center;
  border-radius: var(--radius-lg);
  background: var(--color-white);
  transition: background-color 0.3s;
}

.click-browse {
  color: var(--color-accent);
  cursor: pointer;
  text-decoration: underline;
}

#file-name {
  margin-top: var(--space-sm);
  font-style: italic;
}

/* ────────────── Dropdowns ────────────── */
#builderDropdown,
#estimatorDropdown {
  border: 1px solid var(--color-border);
  background: var(--color-white);
  max-height: 150px;
  overflow-y: auto;
  position: absolute;
  z-index: 10;
  width: 100%;
  display: none;
  border-radius: var(--radius-sm);
}

/* ────────────── Loading Overlay ────────────── */
#loadingOverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

#loadingMessage {
  color: var(--color-white);
  font-size: 1.2rem;
  margin-bottom: var(--space-md);
}

.loader {
  border: 6px solid #f3f3f3;
  border-top: 6px solid var(--color-accent);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ────────────── Toast Notification ────────────── */
#toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 10px 20px;
  border-radius: 6px;
  z-index: 9999;
  font-size: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

/* ────────────── Buttons ────────────── */
#folderButtons button {
  margin: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background-color: var(--color-accent);
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-white);
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s;
}

#folderButtons button:hover {
  background-color: var(--color-accent-dark);
}

/* ────────────── Elevation Section ────────────── */
#elevationSection {
  display: none;
  margin-top: var(--space-lg);
  padding: var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-white);
  box-shadow: var(--shadow-light);
  transition: all 0.3s ease;
}

#elevationSection hr {
  margin-top: var(--space-md);
  border: none;
  border-top: 1px solid #ddd;
}
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 30px;
}

.form-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.form-section label {
  display: flex;
  flex-direction: column;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
}

input[type="text"],
input[type="date"]{
  padding: 8px;
  font-size: 14px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  width: 100%;
  box-sizing: border-box;
}
.form-section label {
  display: flex;
  flex-direction: column;
  font-weight: 500;
  font-size: 14px;
  gap: 4px;
}

#branchSelect {
    width: fit-content;
    padding: 8px;
    font-size: 16px;
    box-sizing: border-box;
    border-radius: 6px;
    border: 1px solid #ccc;
  }

#toast {
    border: 2px dashed lime !important;
}

  /* 🌙 Folder checkbox container background */
.folder-checkbox {
  accent-color: #4caf50;
  border-radius: 4px;
}

/* 🌙 Dark mode override */
body.dark .folder-checkbox {
  background-color: #333;
  accent-color: #4caf50;
}

/* Optional label styling for folder checkboxes */
#folderCheckboxRow label {
  background-color: #f0f0f0;
}

body.dark #folderCheckboxRow label {
  background-color: #222;
  color: #fff;
}

/* 🚫 Reset form checkboxes (avoid dark background in form) */
form input[type="checkbox"],
#laborRatesForm input[type="checkbox"] {
  background-color: transparent !important;
  accent-color: initial !important;
}
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: white;
  border: 1px solid #ccc;
  max-height: 150px;
  overflow-y: auto;
  z-index: 10;
}

.autocomplete-item {
  padding: 6px 10px;
  cursor: pointer;
}

.autocomplete-item.active {
  background-color: #181717;
  color: wheat;
}

.autocomplete-item.no-results {
  color: #888;
  cursor: default;
}
