/* ============================================================
   [1] DESIGN SYSTEM & VARIABLES
   ============================================================ */
:root {
  --primary: #1a73e8;
  --primary-hover: #1765cc;
  --secondary: #5f6368;
  --danger: #d93025;
  --success: #1e8e3e;
  --warning: #f9ab00;

  --bg-page: #f8f9fa;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;

  --border-color: #dadce0;
  --border-radius: 8px;

  --text-main: #202124;
  --text-secondary: #5f6368;
  --text-light: #70757a;

  --shadow-sm: 0 1px 2px 0 rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 11px 15px -7px rgba(0, 0, 0, 0.2), 0 24px 38px 3px rgba(0, 0, 0, 0.14), 0 9px 46px 8px rgba(0, 0, 0, 0.12);

  --font-family: 'Google Sans', Roboto, sans-serif;
}

/* ============================================================
   [2] RESET & BASE
   ============================================================ */
* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  height: 100vh;
  display: flex;
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  overflow: hidden;
}

h2,
h3 {
  margin: 0 0 16px 0;
  font-weight: 500;
}

button {
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.2s ease;
}

input {
  font-family: var(--font-family);
}

/* ============================================================
   [3] SIDEBAR (QUEUE)
   ============================================================ */
.sidebar {
  width: 320px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 0;
  z-index: 10;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px 0 20px;
}

.sidebar h2 {
  padding: 10px 0;
  margin: 0;
  font-size: 18px;
  color: var(--text-main);
}

.queue-title {
  padding: 0 20px 10px 20px;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
}

.operator-badge {
  background: #f1f3f4;
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 11px;
  border: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  transition: all 0.2s;
}

.operator-badge:hover {
  background: #e8eaed;
  border-color: #c3c7cd;
}

.operator-badge::before {
  content: '👤';
  margin-right: 4px;
  font-size: 10px;
}

.btn-icon {
  padding: 4px 8px;
  height: 28px;
  font-size: 11px;
  background: #f8f9fa;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

#queueList {
  flex: 1;
  overflow-y: auto;
  padding: 10px 16px;
}

.queue-group {
  margin-bottom: 16px;
}

.queue-group-header {
  padding: 10px 12px;
  background: #f1f3f4;
  font-weight: 600;
  font-size: 14px;
  border-radius: 6px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary);
}

.queue-group-header:hover {
  background: #e8eaed;
}

.queue-group-header::after {
  content: '▾';
  font-size: 12px;
  transition: transform 0.2s;
}

.queue-group.collapsed .queue-group-header::after {
  transform: rotate(-90deg);
}

.queue-group-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* Increased from 6px */
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.queue-group.collapsed .queue-group-content {
  max-height: 0 !important;
}

.queue-item {
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.queue-item:hover {
  border-color: var(--primary);
  background: #f8faff;
}

.queue-item.selected {
  border-color: var(--primary);
  background: #e8f0fe;
  box-shadow: inset 0 0 0 1px var(--primary);
  /* Inset shadow to avoid overlap */
  z-index: 1;
  /* Slight lift to avoid clipping */
}

.queue-item.status-tare {
  background-color: #e8f0fe;
}

.queue-item.status-weighed {
  background-color: #e6f4ea;
}

/* ============================================================
   [4] MAIN CONTENT
   ============================================================ */
.main-content {
  flex: 1;
  padding: 12px 24px 24px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* TOP BUTTONS BAR */
.top-buttons {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.btn,
.top-button {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-main);
  font-weight: 500;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
}

.btn:hover,
.top-button:hover {
  background: #f1f3f4;
  border-color: #c3c7cd;
}

.btn-primary,
#syncBtn {
  background: var(--primary);
  color: #ffffff;
  border: none;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover,
#syncBtn:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3);
}

/* TTN Date Panel */
.ttn-date-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #ffffff;
  padding: 0 4px 0 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  height: 38px;
  /* Same as .btn */
}

.ttn-date-input {
  border: none;
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--text-main);
  outline: none;
  background: transparent;
  height: 100%;
}

.btn.small {
  height: 30px !important;
  padding: 0 12px !important;
  font-size: 12px;
  line-height: 1;
}

#fillTtnDateButton {
  margin-left: auto;
  border: none;
  background: #f1f3f4;
  color: var(--primary);
  font-weight: 600;
}

#fillTtnDateButton:hover {
  background: var(--primary);
  color: #ffffff;
}

/* Tools Menu Popover */
.tools-menu-wrapper {
  position: relative;
}

.tools-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 16px;
  display: none;
  flex-direction: column;
  gap: 12px;
  z-index: 100;
}

.tools-menu.open {
  display: flex;
}

.tools-menu-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.tools-menu-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* Slightly tighter internal gap */
}

.tools-menu-row label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-light);
  /* Better consistency with other labels */
  letter-spacing: 0.4px;
}

.tools-menu-row input {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  height: 36px;
  background: var(--bg-page);
}

.tools-menu-row button {
  width: 100%;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  transition: all 0.2s;
}

.tools-menu-row button:hover {
  background: #f1f3f4;
  border-color: #c3c7cd;
}

.tools-menu-separator {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

.tools-menu-separator {
  height: 1px;
  background: #f1f3f4;
  margin: 4px 0;
}

/* Progress bar inside sync button */
#syncBtn {
  position: relative;
  overflow: hidden;
  min-width: 180px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

#syncBtn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--progress, 0%);
  background: rgba(255, 255, 255, 0.25);
  z-index: 1;
  transition: width 0.3s ease-out;
}

#syncBtn span {
  position: relative;
  z-index: 2;
  width: 100%;
  display: block;
}

/* ============================================================
   [5] FORMS & CARDS
   ============================================================ */
.card,
.details-panel,
.weight-summary-panel,
.weight-form {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 12px 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  position: relative; /* For absolute positioning of inner elements */
}

.selected-auto-header {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

#selectedAutoDisplay {
  font-size: 16px;
  /* Reduced from 18px */
  font-weight: 700;
  text-align: center;
  color: var(--text-main);
}

.inputs-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.autocomplete-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.autocomplete-container label,
.seals-input label,
.seals-right-field label,
.vs-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.autocomplete-container input,
.seals-input input,
.seals-right-field input,
.vs-field input {
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 15px;
  transition: border-color 0.2s;
}

.autocomplete-container input:focus,
.vs-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

/* SEALS & EXTRA (Split Layout) */
.seals-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  background: var(--bg-card);
  padding: 11px 20px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

.seals-group-left,
.seals-group-right {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  /* Small distance as requested */
}

.seals-input-field {
  width: 140px;
  /* Narrower seals field */
}

.temp-field,
.density-field {
  width: 90px;
}

/* Compact Buttons */
.compact-btn {
  padding: 0 12px !important;
  height: 36px !important;
  min-width: 60px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: normal;
}

.field-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-container label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-light);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.field-container input {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
}

#saveSealsButton {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
}

/* ============================================================
   [6] WEIGHT DISPLAY & FORMS
   ============================================================ */
.details-panel {
  width: 100%;
  margin-top: 0;
  margin-left: 0;
  margin-right: auto;
}

.weight-summary-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 600px;
  margin-left: 0;
  padding: 12px 16px;
}

.weight-summary-row {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap; /* Allow wrapping on very narrow screens */
  gap: 16px; /* Reduced gap */
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f3f4;
}

.weight-summary-row:last-child {
  border-bottom: none;
}

.weight-left,
.weight-right {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex: 1;
  min-width: 180px; /* Reduced from 250px for better fit */
}

.weight-label {
  font-size: 16px;
  color: var(--text-secondary);
  width: 140px;
}

.weight-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.weight-time {
  font-size: 16px;
  color: var(--text-light);
}

.weight-summary-params {
  display: none; /* Removed absolute version */
}

.params-row {
  border-bottom: none !important;
  padding-bottom: 0 !important;
  margin-top: -4px;
}

.small-label {
  font-size: 14px !important;
  color: var(--text-light) !important;
  width: 140px;
}

/* Weight Form & Input Clear */
.weight-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  /* Anchor for advice popup */
}

/* ядок ага (кг) + підказка лити/олити */
.weight-label-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.weight-label-row label {
  font-size: 13px;
  font-weight: 600;
  color: #5f6368;
  white-space: nowrap;
}

.volume-advice-popup {
  display: none;
  font-size: 13px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  line-height: 1.6;
}

.volume-advice-popup.advice-warn {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
}

.volume-advice-popup.advice-ok {
  background: #d1e7dd;
  color: #0f5132;
  border: 1px solid #198754;
}

.input-clear-wrapper {
  position: relative;
  width: 100%;
}

.input-clear-wrapper input {
  width: 100%;
  padding: 11px 40px 11px 16px;
  font-size: 20px;
  font-weight: 600;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #fcfcfc;
}

.clear-input {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--text-light);
  font-size: 18px;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.clear-input:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
}

.button-group {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.button-group button {
  flex: 1;
  height: 64px;
  /* 2x taller than standard ~32-38px */
  font-weight: 700;
  font-size: 18px;
  /* Larger font */
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
  transition: transform 0.1s active, opacity 0.2s;
}

.button-group button:active {
  transform: scale(0.98);
}

#tareButton {
  background-color: #aecbfa !important;
  /* Light Blue */
  color: #174ea6 !important;
  /* Dark Blue text for contrast */
}

#grossButton {
  background-color: #a8dab5 !important;
  /* Light Green */
  color: #0d652d !important;
  /* Dark Green text for contrast */
}

#distributeButton {
  background-color: #ffcc80 !important;
  /* Light Orange */
  color: #af5d00 !important;
  /* Dark Orange/Brown text for contrast */
}

#tareButton:disabled,
#grossButton:disabled,
#distributeButton:disabled {
  background-color: #e8eaed !important;
  color: #9aa0a6 !important;
  opacity: 0.6;
  cursor: not-allowed;
}

/* ============================================================
   [7] MINI MODAL (The Core)
   ============================================================ */
.mini-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.mini-modal {
  width: 90vw;
  max-width: 850px;
  height: auto;
  max-height: 85vh;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
}

.mini-modal.small {
  max-width: 400px;
  width: 95%;
}

.mini-modal-header {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: #ffffff;
}

.mini-modal-title {
  font-size: 20px;
  font-weight: 500;
  color: var(--text-main);
}

.mini-modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-modal-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
}

.mini-modal-body {
  flex: 1;
  overflow-y: auto;
  background: #ffffff;
}

.mini-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #f8f9fa;
}

/* ============================================================
   [8] SETTINGS UI (Clean Layout)
   ============================================================ */
.vs-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.vs-header-summary {
  padding: 24px;
  background: #f8f9fa;
  border-bottom: 1px solid var(--border-color);
}

.vs-title {
  font-size: 24px;
  font-weight: 500;
  margin: 0;
}

.vs-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.vs-tabs {
  display: flex;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
  gap: 4px;
}

.vs-tab {
  padding: 16px 20px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}

.vs-tab:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.03);
}

.vs-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.vs-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.vs-section {
  max-width: 800px;
  margin: 0 auto;
}

.vs-actions-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}

/* Cards List */
.vs-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: box-shadow 0.2s;
}

.vs-card:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.vs-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vs-card-name {
  font-size: 16px;
  font-weight: 500;
  padding-left: 0;
}

.vs-card-meta {
  font-size: 13px;
  color: var(--text-secondary);
}

.vs-card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  /* Small gaps between buttons */
  margin-left: auto;
  /* Push to the right */
  padding-right: 12px;
  /* Small offset from the edge */
}

/* ============================================================
   [9] UI KIT: FORMS & BUTTONS
   ============================================================ */
.vs-form {
  max-width: 480px;
  margin: 40px auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.vs-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vs-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.vs-field input {
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 15px;
}

.vs-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
}

.vs-btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border-color);
  background: #ffffff;
}

.vs-btn-primary {
  background: var(--primary);
  color: #ffffff;
  border: none;
}

.vs-btn-ghost {
  border: none;
  background: transparent;
  color: var(--primary);
}

.vs-btn-danger {
  color: var(--danger);
}

.vs-btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border-radius: 50%;
}

.vs-btn-icon:hover {
  background: rgba(0, 0, 0, 0.05);
}

.vs-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.vs-link:hover {
  text-decoration: underline;
}

/* ============================================================
   [10] HELPER CLASSES
   ============================================================ */
.hidden {
  display: none !important;
}

.suggestions-box {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-shadow: var(--shadow-md);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
}

.suggestions-box div {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
}

.suggestions-box div:hover {
  background: #f1f3f4;
}

#message {
  position: fixed;
  bottom: 32px;
  /* Centering relative to main content (window width - sidebar width of 320px) */
  left: calc(320px + (100% - 320px) / 2);
  transform: translateX(-50%);
  padding: 14px 36px;
  border-radius: 8px;
  /* More modern rectangular look */
  background: #323336;
  color: #ffffff !important;
  /* Force white text */
  font-size: 15px;
  z-index: 2000;
  box-shadow: var(--shadow-lg);
  display: none;
  min-width: 450px;
  /* 50% wider */
  max-width: 700px;
  text-align: center;
}

#message.msg-ok {
  background: var(--success);
}

#message.msg-err {
  background: var(--danger);
}

#message.msg-warn {
  background: #f9ab00;
  color: #ffffff !important;
}


/* ============================================================
   [12] CONFIRM MODAL (Simple UI)
   ============================================================ */
.confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.confirm-modal {
  background: #ffffff;
  padding: 32px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.confirm-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-main);
}

.confirm-message {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

/* ============================================================
   [13] EXTRA DASHBOARD TWEAKS
   ============================================================ */
.seals-input label,
.seals-right-field label {
  display: block;
  margin-bottom: 8px;
}

.seals-input input,
.seals-right-field input {
  width: 100%;
}

.seals-buttons {
  margin-top: 12px;
}

.top-buttons .top-button.small {
  padding: 4px 12px;
  font-size: 12px;
  height: 32px;
}

/* Ensure autocomplete doesn't break layout */
.autocomplete-container {
  position: relative;
}

/* Sidebar Robustness */
#queueList::-webkit-scrollbar {
  width: 6px;
}

#queueList::-webkit-scrollbar-thumb {
  background: #dadce0;
  border-radius: 3px;
}

#queueList::-webkit-scrollbar-track {
  background: transparent;
}

/* ============================================================
   [11] REPORTS SPECIFIC
   ============================================================ */
.report-section {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  background: #ffffff;
  margin-bottom: 24px;
}

.report-section h3 {
  font-size: 16px;
  color: var(--primary);
  border-bottom: 1px solid #f1f3f4;
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
}

.report-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.report-item .label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-light);
  font-weight: 600;
}

.report-item .value {
  font-size: 16px;
  font-weight: 500;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
}

.report-table th {
  text-align: left;
  padding: 12px;
  background: #f8f9fa;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.report-table td {
  padding: 12px;
  border-bottom: 1px solid #f1f3f4;
  font-size: 14px;
}

.report-table tr:hover td {
  background: #fcfcfc;
}

.num {
  text-align: right;
  font-family: 'Roboto Mono', monospace;
}

/* ============================================================
   [12] OPERATOR SELECTOR & SETTINGS
   ============================================================ */
.operator-list {
  display: flex;
  flex-direction: column;
  padding: 8px;
}

.operator-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  gap: 12px;
}

.operator-item:hover {
  background: #f8f9fa;
}

.operator-item.active {
  background: #f1f3f4;
}

.operator-name-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}

.operator-item.active .operator-name-wrapper {
  font-weight: 600;
  color: var(--primary);
}

.operator-item.active .operator-name-wrapper::after {
  content: '✓';
  font-size: 12px;
}

.btn-settings-op {
  padding: 6px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-settings-op:hover {
  background: #e8eaed;
  color: var(--text-main);
}

.add-operator-row {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 8px;
  background: #fcfcfc;
}

.add-operator-row input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
}

/* Settings Form Styles */
.op-settings-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.op-settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.op-settings-field label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-light);
  letter-spacing: 0.5px;
}

.op-settings-field input {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
}

.op-settings-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.btn-delete-op {
  color: var(--danger);
  background: transparent;
  border: none;
  font-size: 13px;
  font-weight: 500;
  padding: 8px;
}

.btn-delete-op:hover {
  text-decoration: underline;
}

/* ===== MODERN LIGHT MODAL THEME ===== */
.mini-modal.vs-modal-light {
  background: #ffffff;
  color: #1f2937;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  max-width: 95vw;
}

.mini-modal.vs-modal-light .mini-modal-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  color: #111827;
}

.mini-modal.vs-modal-light .mini-modal-title {
  color: #111827;
  font-weight: 700;
}

.mini-modal.vs-modal-light .mini-modal-close {
  color: #6b7280;
}

.mini-modal.vs-modal-light .mini-modal-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #111827;
}

.mini-modal.vs-modal-light .mini-modal-body {
  background: #fdfdfd;
  padding: 24px;
}

.mini-modal.vs-modal-light .mini-modal-footer {
  background: #ffffff;
  border-top: 1px solid var(--border-color);
}

/* Specific overrides for Wagons UI in Light Theme */
.vs-modal-light .vs-wagons-form-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.vs-modal-light .vs-section-title {
  color: #1e293b;
  opacity: 1;
}

.vs-modal-light .vs-field-group label {
  color: #64748b;
}

.vs-modal-light .vs-field-group input {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #1e293b;
}

.vs-modal-light .vs-field-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

.vs-modal-light .vs-table-wrapper {
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

.vs-modal-light .vs-wagons-table thead th {
  background: #f1f5f9;
  color: #475569;
  border-bottom: 2px solid #e2e8f0;
}

.vs-modal-light .vs-wagons-table tbody td {
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

.vs-modal-light .vs-wagons-table tbody tr:hover {
  background: #f8fafc;
}

.vs-modal-light .vs-wagons-total {
  color: #1e293b;
}

.vs-modal-light .vs-btn-secondary {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

/* ===== MODERN DARK MODAL THEME ===== */
.mini-modal.vs-modal-dark {
  background: #1a1b1e;
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.mini-modal.vs-modal-dark .mini-modal-header {
  background: #1a1b1e;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #fff;
}

.mini-modal.vs-modal-dark .mini-modal-title {
  color: #fff;
  font-weight: 700;
}

.mini-modal.vs-modal-dark .mini-modal-close {
  color: #9ca3af;
}

.mini-modal.vs-modal-dark .mini-modal-close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.mini-modal.vs-modal-dark .mini-modal-body {
  background: #111214;
  padding: 24px;
}

.mini-modal.vs-modal-dark .mini-modal-footer {
  background: #1a1b1e;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ===== vs-btn synonims for Styles.css (Terminal) ===== */
.vs-btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.vs-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ===== WAGONS MANAGEMENT UI (Copied from Dispatcher) ===== */
.vs-wagons-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.vs-wagons-form-box {
  background: rgba(255, 255, 255, 0.03);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.vs-section-title {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  opacity: 0.9;
}

.vs-wagons-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1.2fr 1fr auto;
  gap: 20px;
  align-items: flex-end;
}

.vs-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vs-field-group label {
  font-size: 0.75rem;
  color: #9ca3af;
  font-weight: 500;
}

.vs-field-group input {
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.vs-field-group input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.vs-wagons-list-box {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.vs-table-wrapper {
  max-height: 350px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.01);
}

.vs-wagons-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.vs-wagons-table thead th {
  position: sticky;
  top: 0;
  background: #1a1b1e;
  padding: 12px 15px;
  text-align: left;
  font-weight: 600;
  color: #9ca3af;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  z-index: 10;
}

.vs-wagons-table tbody td {
  padding: 12px 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: #e5e7eb;
}

.vs-wagons-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.vs-wagons-table th.col-date {
  width: 140px;
}

.vs-wagons-table th.col-num {
  width: 50px;
}

.vs-wagons-table th.col-actions {
  width: 80px;
  text-align: center;
}

.vs-wagons-table th.col-weight {
  text-align: right;
  width: 120px;
}

.vs-wagons-table td.col-weight {
  text-align: right;
  font-weight: 600;
  color: #10b981;
}

.vs-wagons-table td.col-date {
  white-space: nowrap;
  color: #64748b;
  font-size: 0.85rem;
}

.vs-wagons-total {
  text-align: right;
  font-weight: 600;
  font-size: 1.1rem;
  color: #fff;
  padding: 5px 10px;
}

#w-total-weight {
  color: #10b981;
}

.vs-modal-footer {
  margin-top: 10px;
  display: flex;
  justify-content: flex-start;
}
/* ============================================================ */
/* [12] RESPONSIVE & LAYOUT OPTIMIZATION                     */
/* ============================================================ */

@media (max-width: 1100px) {
  .weight-summary-panel {
    width: 100% !important;
    max-width: 600px !important;
  }
}

@media (max-width: 850px) {
  .inputs-row {
    grid-template-columns: 1fr !important;
  }
  .weight-summary-row {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
}

/* --- ������� ���� --- */
.reports-table th { position: sticky; top: 0; background: #1e293b; z-index: 10; shadow: 0 2px 4px rgba(0,0,0,0.3); }
.reports-table tr:nth-child(even) { background: rgba(255,255,255,0.02); }
.reports-table td { border-color: #334155; }
.reports-filters select, .reports-filters input { transition: all 0.2s; }
.reports-filters select:hover, .reports-filters input:hover { border-color: #4b5563; }
.reports-filters select:focus, .reports-filters input:focus { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); }


/* Forced Width for Internal Reports */
.mini-modal.vs-modal-light { width: 95vw !important; max-width: 98vw !important; }

