/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: Arial, sans-serif;
  background: #f5f5f5;
  width: 100%;
  min-height: 100vh;
}

/* Header: Slim, turquoise, left-aligned title, right-aligned toggles */
header {
  background: #40E0D0; /* Turquoise */
  color: #fff;
  padding: 0.5rem 1%;
  text-align: left;
  position: relative;
  width: 100%;
}

header h1 {
  font-size: 1.4rem;
  font-weight: bold;
  display: inline-block;
}

#hideToggles {
  position: absolute;
  top: 0.5rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
}

.hide-toggle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: #444;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex;          /* Add flexbox */
  align-items: center;    /* Center vertically */
  justify-content: center; /* Center horizontally */
  transition: background-color 0.2s;
}

/* Fix Hide Toggles: Indicate state visually */
.hide-toggle[title$="Hide"] {
  background-color: #444; /* Visible state */
}

.hide-toggle[title$="Show"] {
  background-color: #888; /* Hidden state */
}

.hide-toggle:hover {
  background-color: #222;
}


/* Fluid Containers */
#topUI {
  padding: 1rem 2%;
  width: 100%;
  background: #fafafa;
  border-bottom: 1px solid #ccc;
}

.grid-stack {
  background: #fafafa;
  width: 100%;
  min-height: 60vh;
  margin: 1rem auto;
}

/* Sections */
#dashboardSection,
#reportBuilderSection,
#profileSection,
#adminSection {
  margin: 1rem 2%;
  padding: 1rem 2%;
  background: #fdfdfd;
  border: 1px solid #ccc;
  width: 95%;
  max-width: 2400px;
  box-sizing: border-box;
}

#dashboardContent,
#reportBuilderContent {
  margin-top: 1rem;
  width: 100%;
}

/* Buttons & Inputs */
button,
input[type="file"],
select {
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fdfdfd;
  transition: background 0.2s;
}

button:hover {
  background: #e0e0e0;
}

.modern-btn {
  background: #007bff;
  color: #fff;
  border: none;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.modern-btn:hover {
  background: #0056b3;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Specific Buttons */
#add-widget,
#remove-last {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  margin: 5px;
  cursor: pointer;
  text-indent: -9999px;
  position: relative;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3), 0 3px 5px rgba(0, 0, 0, 0.2);
}

#add-widget {
  background: linear-gradient(#2ecc71, #27ae60);
}

#add-widget::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  background: url("data:image/svg+xml;utf8,<svg width='64' height='64' viewBox='0 0 64 64' xmlns='http://www.w3.org/2000/svg'><line x1='16' y1='32' x2='48' y2='32' stroke='%23ffffff' stroke-width='8' stroke-linecap='round'/><line x1='32' y1='16' x2='32' y2='48' stroke='%23ffffff' stroke-width='8' stroke-linecap='round'/></svg>") no-repeat center/contain;
}

#remove-last {
  background: linear-gradient(#e74c3c, #c0392b);
}

#remove-last::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  background: url("data:image/svg+xml;utf8,<svg width='64' height='64' viewBox='0 0 64 64' xmlns='http://www.w3.org/2000/svg'><path d='M20 14h24l-2 6h-20l-2-6z' fill='%23ffffff'/><path d='M18 20v26c0 2.2 1.8 4 4 4h20c2.2 0 4-1.8 4-4V20H18z' fill='%23ffffff'/></svg>") no-repeat center/contain;
}

/* Status Icons */
.status-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  vertical-align: middle;
  margin-left: 5px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.status-icon.check {
  background-image: url('data:image/svg+xml;utf8,<svg fill="%2390EE90" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M173.898 439.404l-166.4-166.4c-9.373-9.373-9.373-24.568 0-33.941l33.941-33.941c9.373-9.373 24.568-9.373 33.941 0L192 284.118l243.199-243.2c9.373-9.373 24.568-9.373 33.941 0l33.941 33.941c9.373 9.373 9.373 24.568 0 33.941l-310.08 310.08c-9.372 9.372-24.568 9.372-33.94-.001z"/></svg>');
}

.status-icon.x {
  background-image: url('data:image/svg+xml;utf8,<svg fill="%23ff4444" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M231.7 256l145.4-145.4c12.5-12.5 12.5-32.8 0-45.3l-22.6-22.6c-12.5-12.5-32.8-12.5 0-45.3L256 231.7l-145.4-145.4c-12.5-12.5-32.8-12.5-45.3 0l-22.6 22.6c-12.5 12.5-12.5 32.8 0 45.3L231.7 256z"/></svg>');
}

.status-icon.loading {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" fill="none" stroke="#888" stroke-width="2"><animate attributeName="stroke-dasharray" from="0 31.4" to="31.4 0" dur="1s" repeatCount="indefinite"/></circle></svg>');
}

/* GridStack Item Content */
.grid-stack-item-content {
  background: #18bc9c;
  border: 1px solid #16a085;
  border-radius: 4px;
  padding: 1rem;
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

/* Corner Grabber Positioning */
.ui-resizable-se {
  bottom: 0 !important;
  right: 0 !important;
  width: 15px;
  height: 15px;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 6 6"><path d="M6 6H0V4h2v-2H4v-2h2z" fill="#666"/></svg>') no-repeat center;
  cursor: se-resize;
}

/* Widget Toolbar Controls */
.widget-toolbar-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.widget-toolbar-controls button {
  background-color: #007bff; /* Darker for readability */
  color: #fff;
  border: 1px solid #0056b3;
  border-radius: 40px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
}

.widget-toolbar-controls button:hover {
  background-color: #0056b3;
}

/* Hide Toggles for Widgets */
.widget-hide-toggle,
.toolbars-toggle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: #444;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 24px;
  text-align: center;
  transition: background-color 0.2s;
}

.widget-hide-toggle:hover,
.toolbars-toggle:hover {
  background: #222;
}

.lock-toggle {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #666;
  color: #fff;
  border: none;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  z-index: 10;
  transition: background-color 0.2s;
}

.lock-toggle:hover {
  background: #444;
}

/* Module Name Input */
.module-name-input {
  width: 100%;
  font-size: 1rem;
  font-weight: bold;
  border: none;
  background: transparent;
  outline: none;
  color: #000;
}

.module-name-input::placeholder {
  color: #aaa;
}

/* Widget Table */
.widget-table {
  border-collapse: collapse;
  width: 100%;
  table-layout: auto;
  white-space: nowrap;
}

.widget-table th,
.widget-table td {
  border: 1px solid #ccc;
  padding: 0.4rem 0.6rem;
  min-width: 80px;
  font-size: 0.9rem;
}

.widget-table td.selected {
  outline: 2px solid #fffbcc;
  background-color: #f0f0f0;
}

.widget-table td.editing {
  outline: 2px solid #18bc9c;
  background-color: #f0f8f8;
}

.grid-numbers th,
.grid-numbers td {
  border: 1px solid #ccc;
}

.grid-numbers .row-number {
  display: table-cell;
}

.grid-no-numbers th,
.grid-no-numbers td,
.no-grid-numbers th,
.no-grid-numbers td,
.no-grid th,
.no-grid td {
  border: 1px solid #ccc;
}

.row-number-header {
  width: 30px;
  background: #f0f0f0;
  text-align: center;
}

.row-number {
  width: 30px;
  font-size: 12px;
  color: #666;
  text-align: center;
  cursor: pointer;
  display: table-cell;
}

.widget-table td.edited::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-top: 10px solid red;
  border-left: 10px solid transparent;
}

/* Widget Table Body */
.widget-table-body {
  position: relative;
  overflow: auto;
  width: 100%;
  height: calc(100% - 4rem);
  border: 1px solid #ccc;
  touch-action: pan-x pan-y;
  overflow: visible;
}

.widget-spacer {
  height: 1px; /* Dynamically sized by JS */
}

/* Table Toolbar */
.widget-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 5px;
  background: #f8f8f8;
  border-bottom: 1px solid #ccc;
  position: relative;
}

/* Issue 3: Darker buttons for readability */
.widget-table-toolbar button {
  background-color: #007bff;
  color: #fff;
  border: 1px solid #0056b3;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 13px;
  transition: background-color 0.2s;
}

.widget-table-toolbar button:hover {
  background-color: #0056b3;
}

/* Issue 9: Style Lock Sales Order Button */
.lockSalesOrderBtn {
  background: #ff9800;
  color: #fff;
}

.lockSalesOrderBtn:hover {
  background: #f57c00;
}

/* Issue 10: Style Status Dropdown */
.status-select {
  padding: 2px;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 100%;
  font-size: 0.9rem;
  background: #fff;
}

.search-label {
  margin-left: 15px;
}

/* Issue 4: Enhanced Export Popup Styling */
.export-options {
  position: absolute;
  top: 0;
  right: 0;
  background: #007bff;
  color: #fff;
  border: 1px solid #0056b3;
  padding: 10px;
  z-index: 10;
  font-size: 16px;
  font-weight: bold;
  border-radius: 4px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.export-options button {
  background: #fff;
  color: #007bff;
  border: 1px solid #0056b3;
  padding: 6px 12px;
  margin: 5px;
  font-weight: bold;
  transition: background-color 0.2s, color 0.2s;
}

.export-options button:hover {
  background: #0056b3;
  color: #fff;
}

.new-column-input,
.existing-column-select {
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid #d0d0d0;
  border-radius: 20px;
  background: #f0f0f0;
  color: #333;
  margin: 2px;
  width: 150px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.new-column-input:focus,
.existing-column-select:focus {
  outline: none;
  border-color: #18bc9c;
  box-shadow: 0 0 3px rgba(24, 188, 156, 0.5);
}

/* Value Module */
.valueDisplay {
  margin-top: 0.5rem;
  padding: 10px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: #f8f8f8;
  text-align: center;
  width: 100%;
}

.value-header {
  font-size: 16px;
  font-weight: bold;
  color: #555;
  margin-bottom: 5px;
}

.value-content {
  font-size: 24px;
  font-weight: bold;
  word-break: break-word;
}

.value-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 5px;
  background: #f8f8f8;
  border-bottom: 1px solid #ccc;
}

.value-toolbar button {
  background-color: #007bff;
  color: #fff;
  border: 1px solid #0056b3;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 13px;
  transition: background-color 0.2s;
}

.value-toolbar button:hover {
  background-color: #0056b3;
}

.note-container {
  margin-top: 10px;
  text-align: center;
  width: 100%;
}

.note-display {
  margin-top: 10px;
  font-size: 24px;
  font-weight: bold;
  color: #000000;
  background-color: #ffffff;
  text-align: center;
  padding: 10px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  width: 100%;
}

.note-text {
  width: 100%;
  height: 150px;
  padding: 5px;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
}

/* Graph Module */
.graph-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 5px;
  background: #f8f8f8;
  border-bottom: 1px solid #ccc;
}

.checkbox-item {
  display: block;
  margin: 5px 0;
}

.graph-canvas {
  width: 100%;
  height: 300px !important;
  max-height: 300px;
}

/* Map Module */
.map-config {
  padding: 5px;
}

.map-config select {
  font-size: 0.8rem;
  margin: 2px;
  padding: 2px 4px;
}

.map-config button.map-compute-btn {
  font-size: 0.8rem;
  padding: 4px 6px;
  margin: 5px 0;
}

.search-dropdown {
  width: 120px;
  padding: 4px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Filter/Sort Menu Visibility */
.dropdown-menu {
  position: absolute;
  background: #fff;
  border: 1px solid #ccc;
  padding: 5px;
  z-index: 10001;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  max-height: 200px;
  overflow-y: auto;
}

.dropdown-menu .menu-btn {
  padding: 5px;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
}

.dropdown-menu .menu-btn:hover {
  background: #eee;
}

.map-visual {
  height: 150px;
  width: 100%;
  margin-top: 10px;
}

/* Other Dropdowns and Popups */
.dropdown-options,
.context-menu,
#cutContextMenu {
  position: fixed;
  background: #fff;
  border: 1px solid #ccc;
  padding: 5px;
  z-index: 9999;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  max-height: 200px;
  overflow-y: auto;
}

.dropdown-item,
.context-menu .menu-btn,
#cutContextMenu button {
  padding: 5px;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover,
.context-menu .menu-btn:hover,
#cutContextMenu button:hover {
  background: #eee;
}

.filter-popup {
  position: absolute;
  background: #fff;
  padding: 15px;
  border: 1px solid #ccc;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
  max-width: 90%;
  overflow-y: auto;
}

.filter-options-scroll {
  max-height: 200px;
  overflow-y: auto;
  margin: 10px 0;
}

.popup {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: #fafafa;
  border: 1px solid #ccc;
  padding: 1rem;
  z-index: 9999;
  max-width: 90%;
}

/* Pivot Table */
.pivot-output-container {
  width: 100%;
  max-height: 400px;
  overflow: auto;
}

.pivot-table-output,
.pivot-table {
  width: 100%;
  height: auto;
}

.pivot-table {
  border-collapse: collapse;
  table-layout: auto;
}

.pivot-table th,
.pivot-table td {
  border: 1px solid #ccc;
  padding: 0.4rem 0.6rem;
  min-width: 80px;
  font-size: 0.9rem;
  text-align: right;
}

.pivot-table th {
  background: #f0f0f0;
  font-weight: bold;
  text-align: left;
}

.pivot-chart-output {
  width: 100%;
  height: 300px !important;
  max-height: 300px;
}

/* Report Builder */
#reportColumnList {
  margin-bottom: 1rem;
}

.columnItemRow {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 5px 0;
}

.columnItemRow select,
.column-select {
  padding: 0.3rem;
  min-width: 120px;
}

.columnItemRow button.removeColumnItem {
  background: #ff4444;
  color: #fff;
  border: none;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
}

#reportRowSelection {
  margin-bottom: 1rem;
  width: 50%;
  max-width: 300px;
}

#reportTableContainer {
  max-width: 100%;
  overflow-x: auto;
  background: #fff;
  border: 1px solid #ccc;
  padding: 10px;
  box-sizing: border-box;
}

#reportTableContainer table {
  border-collapse: collapse;
  width: 100%;
  white-space: nowrap;
}

#reportTableContainer th,
#reportTableContainer td {
  border: 1px solid #ccc;
  padding: 0.4rem;
  font-size: 0.9rem;
}

/* Dashboard Controls */
#dashboardControls label {
  font-size: 0.95rem;
  margin-right: 1rem;
}

#orderNumberColumn,
#statusFilter,
#dashboardRowSelection,
#dashboardSearch {
  padding: 0.3rem;
  font-size: 0.9rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  min-width: 150px;
  margin-left: 0.5rem;
}

#dashboardFormattingToolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0.5rem;
  background: #f8f8f8;
  border-bottom: 1px solid #ccc;
  margin-bottom: 1rem;
}

#dashboardFormattingToolbar select,
#dashboardFormattingToolbar button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, box-shadow 0.2s;
}

#dashboardFormattingToolbar select:hover,
#dashboardFormattingToolbar button:hover {
  background: #e0e0e0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#dashboardFormattingToolbar select {
  font-size: 12px;
  padding: 0 4px;
}

#dashboardFormattingToolbar button svg {
  width: 16px;
  height: 16px;
  fill: #333;
}

.color-picker-hidden {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

#dashboardExportToolbar {
  margin-bottom: 1rem;
  display: flex;
  gap: 0.5rem;
}

/* Dashboard Table */
#dashboardTable {
  border-collapse: collapse;
  width: 100%;
  white-space: nowrap;
  table-layout: auto;
  color: #666 !important;
}

#dashboardTableContainer {
  max-height: 400px;
  overflow-y: auto;
  overflow-x: auto;
  width: 100%;
}



#dashboardTable th {
  background: #f0f0f0;
  font-weight: bold;
  padding: 0.2rem 0.6rem;
}

#dashboardTable .filter-sort-btn {
  margin-left: 0.5rem;
  padding: 0.2rem 0.4rem;
  font-size: 0.8rem;
  color: #666 !important;
}

#dashboardTable select {
  width: 150px;
  padding: 0.2rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  color: #666 !important;
}




/* Column Selection */
#columnSelectionArea {
  margin-top: 1rem;
}

#dashboardColumnList {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  color: #666 !important;
}

.column-item {
  display: flex;
  align-items: center;
  background: #f0f0f0;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
}

.remove-column-btn {
  margin-left: 0.5rem;
  background: #ff4444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  cursor: pointer;
  font-size: 12px;
  display: flex;          /* Add flexbox */
  align-items: center;    /* Center vertically */
  justify-content: center; /* Center horizontally */
  transition: background-color 0.2s;
}

.remove-column-btn:hover {
  background: #cc0000;
}

/* Profile and Admin Sections */
#profileSection label,
#adminSection label {
  display: block;
  margin: 0.5rem 0;
}

#profileSection input,
#adminSection input,
#adminSection select {
  width: 100%;
  max-width: 300px;
  padding: 0.3rem;
  margin-top: 0.2rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

#userTable {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

#userTable th,
#userTable td {
  border: 1px solid #ccc;
  padding: 0.5rem;
  text-align: left;
}

#userTable th {
  background: #f0f0f0;
  font-weight: bold;
}

#userTable td button {
  padding: 0.3rem 0.6rem;
  background: #ff4444;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#userTable td button:hover {
  background: #cc0000;
}

/* Tabs */
.tab-bar {
  display: flex;
  gap: 5px;
  padding: 10px;
  background: #f0f0f0;
  overflow-x: auto;
  width: 100%;
}

.tab-btn {
  padding: 5px 10px;
  border: 1px solid #ccc;
  background: #e0e0e0;
  cursor: pointer;
  white-space: nowrap;
}

.tab-btn.active {
  background: #007bff;
  color: white;
}

.tab-content {
  padding: 10px;
  width: 100%;
}

.tab-panel {
  display: none;
}

.tab-panel .modern-btn {
  color: #fff;
}

.tab-panel.active {
  display: block;
}

.fields {
  margin-top: 10px;
  width: 100%;
}

.field {
  display: block;
  margin: 10px 0;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 100%;
}

.calc-result-output {
  margin-top: 10px;
  font-size: 1.5em;
  font-weight: bold;
  width: 100%;
}

.remove-variable-btn {
  background: #ff4444;
}

.duplicate-field-btn,
.duplicate-variable-btn {
  background: #17a2b8;
}

.add-all-columns-btn,
.add-row-btn {
  background: #28a745;
}

.remove-all-columns-btn {
  background: #ff4444;
}

.suggestion-box {
  position: absolute;
  background: #fff;
  border: 1px solid #ccc;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  max-height: 150px;
  overflow-y: auto;
  z-index: 1000;
  width: inherit;
  top: 100%;
  color: #333;
}

.editable-cell {
  position: relative;
}

.suggestion-item {
  padding: 5px;
  cursor: pointer;
}

.suggestion-item:hover {
  background-color: #e0e0e0;
}

/* Dark Theme */
.dark-theme {
  background: #333;
  color: #fff;
}

.dark-theme #topbar {
  background: #1a8c7a;
}

.dark-theme .grid-stack-item-content {
  background: #1a8c7a;
  border-color: #146c5a;
}

.dark-theme #dashboardTable th {
  background: #444;
}


/* Media Queries for Mobile */
@media (max-width: 768px) {
  header {
    padding: 0.5rem 2%;
  }

  header h1 {
    font-size: 1.2rem;
  }

  #topUI,
  #dashboardSection,
  #reportBuilderSection,
  #profileSection,
  #adminSection {
    padding: 0.5rem 2%;
    margin: 0.5rem 1%;
    width: 98%;
  }

  .tab-bar {
    padding: 5px;
  }

  .tab-btn {
    padding: 4px 8px;
    font-size: 0.9rem;
  }

  .widget-table th,
  .widget-table td {
    padding: 0.3rem 0.5rem;
    min-width: 60px;
    font-size: 0.85rem;
  }



/* NEW */
#dashboardTable th,
#dashboardTable td {
  height: 30px;
  max-height: 30px;         /* Enforces strict upper limit */
  line-height: 30px;        /* Centers text vertically */
  padding: 0 0.6rem;        /* Consistent padding */
  border: 1px solid #ccc;   /* Consistent border */
  overflow: hidden;         /* Clips excess content */
  white-space: nowrap;      /* Prevents text wrapping */
  text-overflow: ellipsis;  /* Adds ellipsis for clipped text */
}

/* NEW */
  button,
  input[type="file"],
  select {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }

  .modern-btn {
    padding: 4px 8px;
    font-size: 12px;
    color: #fff !important; /* Ensure readability on mobile */
  }

  #orderNumberColumn,
  #statusFilter,
  #dashboardRowSelection,
  #dashboardSearch {
    min-width: 120px;
  }
}

.tab-controls {
  display: flex;
  gap: 5px;
  margin-bottom: 10px;
}

.remove-tab-btn {
  background: #ff4444;
  color: #fff;
  border: none;
  padding: 5px 10px;
  cursor: pointer;
  border-radius: 20px;
}

.remove-tab-btn:hover {
  background: #cc0000;
}

.modern-btn.filter-sort-btn {
  background: #e0e0e0;
  color: #333 !important;
}

#dashboardTableContainer .modern-btn.filter-sort-btn {
  color: #000 !important;
}

#syncDataBtn {
  padding: 8px 16px;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#syncDataBtn:hover {
  background-color: #45a049;
}

/* Additional Styles */
.field-popup, .filter-popup {
  position: fixed;
  background: #4e8c97;
  padding: 15px;
  border: 1px solid #ccc;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field {
  margin: 10px 0;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.field h4 {
  margin: 0 0 5px 0;
}

.remove-field-btn {
  float: right;
  background: #ff4444;
}

.column-field .field-content, .calculate-field .field-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.column-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.column-input-container {
  display: inline-block;
}

.column-table {
  width: 100%;
  margin-top: 10px;
  position: relative;
}

.row-range-input {
  padding: 5px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.filterable-header {
  position: relative;
  cursor: pointer;
}

.filterable-header:hover {
  background: #e0e0e0;
}

.filter-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border: 1px solid #ccc;
  padding: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  display: none;
  max-height: 200px;
  overflow-y: auto;
}

.filter-options {
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.submit-column-btn {
  background: #28a745;
  margin-left: 5px;
}

.calc-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.calc-number {
  font-weight: bold;
  min-width: 20px;
}

.calc-column, .calc-method {
  padding: 5px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.filter-btn {
  background: #ffc107;
}

.calc-result strong {
  font-size: 1.2em;
}

/* Row Layout for DB Management */
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

/* Store Data Table Styles */
#storeDataTableContainer {
  max-height: 400px;
  overflow-y: auto;
  overflow-x: auto;
  width: 100%;
}

#storeDataTable {
  border-collapse: collapse;
  width: 100%;
  white-space: nowrap;
  table-layout: auto;
}

#storeDataTable th,
#storeDataTable td {
  border: 1px solid #ccc;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  text-align: left;
}

#storeDataTable th {
  background: #f0f0f0;
  font-weight: bold;
}

/* Hidden Class - Ensure it works for toggles */
.hidden {
  display: none !important; /* Increased specificity for toggle reliability */
}


/* NEW */

/* Base table styling */
#dashboardTable {
  border-collapse: collapse;
  width: 100%;
  white-space: nowrap;
  table-layout: auto;
  color: #666 !important;
}

#dashboardTable th,
#dashboardTable td {
  height: 30px;
  max-height: 30px;         /* Strict height enforcement */
  line-height: 30px;        /* Vertical centering */
  padding: 0 0.6rem;        /* Consistent padding */
  border: 1px solid #ccc;   /* Consistent border */
  overflow: hidden;         /* Clip excess content */
  white-space: nowrap;      /* Prevent wrapping */
  text-overflow: ellipsis;  /* Indicate clipped content */
  font-size: 0.9rem;        /* From first instance, if desired */
  text-align: left;         /* From first instance, if desired */
}

#dashboardTable th {
  background: #f0f0f0;
  font-weight: bold;
  padding: 0.2rem 0.6rem;   /* Matches existing th override */
}

/* Editable cells */
#dashboardTable td[contenteditable="true"] {
  border: 1px dashed #ccc;
  padding: 0.2rem;
  max-height: 30px;         /* Prevent expansion */
  overflow: hidden;         /* Clip excess content */
}

#dashboardTable td[contenteditable="true"]:focus {
  outline: 1px solid #18bc9c;
  background: #f0f8ff;
}

/* Selected cells */
#dashboardTable td.selected {
  outline: 2px solid #fffbcc;
  background-color: #f0f0f0;
}

/* Dark theme */
.dark-theme #dashboardTable td {
  border-color: #555;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  #dashboardTable th,
  #dashboardTable td {
    padding: 0.3rem 0.5rem;
    font-size: 0.85rem;
    max-height: 30px;       /* Maintain height consistency */
  }
}

/* NEW*/
/* NEW*/
/* NEW*/

/* Fix 1: Load Profile Dropdown */
#loadProfileInputContainer { /* Assuming the input has a parent div with this ID */
  position: relative;
}

.dropdown-options {
  position: absolute;
  background: #a1d3eb;
  border: 1px solid #ccc;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  max-height: 200px;
  overflow-y: auto;
  z-index: 9999;
}

/* Fix 3: Dashboard Resize Handle */
#dashboardTableContainer {
  position: relative;
  overflow-y: auto;
  overflow-x: auto;
  width: 100%;
  height: 400px; /* Initial height, overridden by JS */
}

.resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 15px;
  height: 15px;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 6 6"><path d="M6 6H0V4h2v-2H4v-2h2z" fill="#666"/></svg>') no-repeat center;
  cursor: se-resize;
  z-index: 10;
}

/* Styles the ship point input field */
.map-shippoint-input {
  margin-left: 10px;
}

/* Styles the suggestions dropdown container */
.shippoint-suggestions {
  position: absolute;
  background-color: white;
  border: 1px solid #ccc;
  max-height: 150px;
  overflow-y: auto;
  z-index: 1000;
}

/* Styles individual suggestion items within the dropdown */
.suggestion-item {
  padding: 5px;
  cursor: pointer;
}

/* Adds hover effect to suggestion items */
.suggestion-item:hover {
  background-color: #f0f0f0;
}