@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
#grid .progress-wrap { display: inline-flex; align-items: center; gap: 8px; width: 100%; }
#grid .progress-wrap .progress { flex: 1 1 auto; }
#grid .progress.progress-compact { height: 6px; background: rgba(255,255,255,0.25) !important; border: 1px solid rgba(255,255,255,0.35) !important; border-radius: 9999px; overflow: hidden; }
#grid .progress.progress-compact > div { height: 100%; background: #ffffff !important; }
#grid .progress-wrap .count-chip { flex: 0 0 auto; display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 9999px; font-size: 12px; line-height: 1; background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.35); color: #fff; }
html, body {
  background-color: var(--qa-primary);
  transition: background-color 0.3s ease;
}
input[type="text"],
input[type="search"],
input[type="email"],
input[type="number"],
input[type="password"],
textarea {
  background-color: var(--qa-primary);
  color: var(--qa-text);
}
select {
  display: inline-block;
  width: 220px;
  min-height: 38px;
  padding: 8px 12px;
  margin: 5px 0;
  border: 2px solid var(--qa-border);
  border-radius: 6px;
  box-sizing: border-box;
  background: var(--qa-primary);
  color: var(--qa-text);
  font-size: 13px;
  line-height: 1.5;
  transition: all 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}
select:hover {
  background: rgba(1,167,255,0.025);
  border-color: rgba(1,167,255,0.35);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(1,167,255,0.10);
}
select:focus {
  border-color: var(--qa-brand);
  outline: none;
  box-shadow: 0 0 0 3px rgba(1, 167, 255, 0.1);
}
select option,
option {
  background-color: var(--qa-primary);
  color: var(--qa-text);
}
body {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column; 
    height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    font-size: 12px;
    line-height: 1.6;
  background-color: var(--qa-primary);
  color: var(--qa-text);
}
a:link { color: var(--qa-link-color); }
a:visited { color: var(--qa-link-color); }
a:hover,
a:focus { color: var(--qa-link-color); text-decoration: underline; }
a.btn, a.btn:hover, a.btn:focus, a.btn:active,
a.btn-modern, a.btn-modern:hover, a.btn-modern:focus, a.btn-modern:active { text-decoration: none !important; }
/* Active/clicked state */
a:active { color: #000; }
.center-container { flex: 1; text-align: center; margin: 0 10px; }
.main-area { display: flex; flex: 1; overflow: hidden; }
.content { flex: 1; display: block; padding: 20px; box-sizing: border-box; overflow-y: auto; }
.container { margin: 0 auto; }
#status-bar { background-color: var(--banner-color, orange); font-size: 10px; color: white; padding: 4px; text-align: center; width: 100%; margin: 0 auto; top: 0; left: 0; }
h1 { color: var(--qa-heading); text-align: center; padding: 20px 0; font-size: 16px; }
h2 { color: var(--qa-heading); text-align: center; padding: 20px 0; font-size: 14px; }
.navigation { font-size: 14px; }
.navigation_login { font-size: 14px; padding-left: 20px; }
.navigation_login_text { font-size: 14px; color: blue; }
.navigation_login_header { font-size: 14px; font-weight: bold; padding-left: 10px; }
.item { border: 2px solid var(--qa-border); border-radius: 10px; padding: 16px; margin-bottom: 16px; background: var(--qa-primary); transition: all 0.2s ease; position: relative; }
.item:hover { border-color: var(--qa-brand); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12); }
.item.focused { border-color: var(--qa-brand); box-shadow: 0 0 0 3px rgba(1, 167, 255, 0.2); }
.item.verified { background: rgba(40, 167, 69, 0.05); border-color: #28a745; }
.item.has-error { border-color: #dc3545; background: rgba(220, 53, 69, 0.05); }
html:not(.dark-mode) .item:not(.verified):not(.has-error) { background: var(--qa-secondary); }
.item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.item-line-number { font-size: 12px; font-weight: bold; color: var(--qa-brand); background: var(--qa-secondary); padding: 4px 10px; border-radius: 4px; }
.item-actions { display: flex; gap: 6px; }
.item-action-btn { background: var(--qa-secondary); border: none; padding: 6px 8px; border-radius: 6px; cursor: pointer; color: var(--qa-brand); transition: all 0.2s ease; font-size: 14px; }
.item-action-btn:hover { background: var(--qa-brand); color: #fff; }
.description { font-size: 15px; font-weight: 500; color: var(--qa-text); margin-bottom: 8px; line-height: 1.5; }
input[type="submit"] { background-color: #0056b3; font-size: 11px; color: white; cursor: pointer; border: none; padding: 8px 20px; border-radius: 4px; transition: background-color 0.3s; }
input[type="number"] { display: inline-block; padding: 8px; margin: 5px 0; border: 1px solid #ddd; border-radius: 4px; }
input[type="date"] { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; }
input[type="submit"]:hover { background-color: #003d80; }
select, input[type="text"], button { display: inline-block; padding: 8px; margin: 5px 0; border: 1px solid #ddd; border-radius: 4px; }
button { background-color: var(--qa-brand); white-space: nowrap; font-size: 12px; color: #fff; cursor: pointer; border: none; transition: background-color 0.3s; }
/* Reusable anchor-as-button styles */
a.btn-link,
button.btn-link { display:inline-block; background-color: var(--qa-brand); color: #fff !important; text-decoration:none; padding:8px 12px; border-radius:4px; font-size:12px; line-height:1.2; border:1px solid var(--qa-brand); cursor:pointer; transition: background-color .25s; }
a.btn-link:hover,
button.btn-link:hover { background-color:#004494; text-decoration:none; }
a.btn-link:active { background-color:#003d80; }
a.btn-link:focus { outline:2px solid #003d80; outline-offset:2px; }
/* Small variant */
a.btn-link.small, button.btn-link.small { padding:4px 8px; font-size:11px; }
button:hover { background-color: var(--qa-brand-alt); }
button:disabled { background-color: #bbb; color: black; cursor: not-allowed; }
.button-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.button-group button { padding: 8px 16px; border: 2px solid var(--tertiary-color); border-radius: 20px; background-color: var(--bg-color); color: var(--text-color); cursor: pointer; font-size: 13px; font-weight: 500; transition: all 0.2s ease; white-space: nowrap; }
.button-group button:hover { border-color: var(--primary-color); background: var(--secondary-color); }
.button-group button.selected { background-color: var(--primary-color); color: white; border-color: var(--primary-color); }
/* Selection buttons inside toolbar action groups */
.button-group.toolbar-actions .action { padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(0, 95, 153, 0.40); background: #ffffff; color: var(--qa-heading); font-size: 13px; gap: 6px; }
.button-group.toolbar-actions .action:hover,
.button-group.toolbar-actions .action:focus-visible { background: rgba(1,167,255,0.06); border-color: var(--qa-brand); box-shadow: 0 2px 10px rgba(0,0,0,0.10), 0 0 0 1px var(--qa-brand); outline: none; }
.button-group.toolbar-actions .action.selected { background: var(--qa-brand); color: #fff; border-color: var(--qa-brand); box-shadow: 0 2px 8px rgba(1,167,255,0.25); }
.button-group.toolbar-actions .action.remove { border-color: rgba(0, 95, 153, 0.40); color: var(--qa-heading); background: #fff; }
.button-group.toolbar-actions .action.remove.selected { background: var(--qa-brand); color: #fff; border-color: var(--qa-brand); box-shadow: 0 2px 8px rgba(1,167,255,0.25); }
.button-group.toolbar-actions .clear-selection-btn.action { border-color: #6c757d; color: #6c757d; }
.button-group.toolbar-actions .clear-selection-btn.action:hover { background: #6c757d; color: #fff; border-color: #6c757d; }
.button-group.toolbar-actions .clear-selection-btn.action { margin-left: auto; }
.copy-button,
.search-button { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; margin-left: 6px; background: transparent; color: var(--qa-heading); border: 1px solid var(--qa-border); border-radius: 6px; font-size: 14px; cursor: pointer; transition: box-shadow .15s ease, border-color .15s ease, background-color .15s ease; }
.copy-button:hover,
.search-button:hover,
.copy-button:focus-visible,
.search-button:focus-visible { background: rgba(1,167,255,0.06); border-color: var(--qa-brand); box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 0 0 1px var(--qa-brand); outline: none; }
.copy-button.copied { background: var(--qa-brand); color: #fff; border-color: var(--qa-brand); box-shadow: 0 2px 8px rgba(1,167,255,0.25); }
/* Add extra spacing after any copy icon within the item details row */
.item-details .copy-button { margin-right: 12px; }
/* Default: hide mobile-specific details row */
.item-details-mobile { display: none; }
.button-group .comment-container { flex: 1 1 100%; width: 100%; margin-top: 8px; }
.button-group .comment-container input { width: 100%; padding: 8px 12px; border: 2px solid var(--primary-color); border-radius: 6px; background: var(--bg-color); color: var(--text-color); font-size: 13px; }
.button-group button.remove { border-color: #dc3545; color: #dc3545; }
.button-group button.remove.selected { background-color: #dc3545; color: white; }
.button-group .top-hits-select { display: block; width: 100%; margin-top: 6px; }
.button-group .special-container { flex: 1 1 100%; width: 100%; display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 8px; }
.button-group .special-container input { width: 100%; }
.dept-checkbox { display: block; margin-bottom: 5px; font-weight: normal; }
.form-group { margin-bottom: 15px; width: 300px; align-items: center; }
.form-group label { display: block; margin-bottom: 5px; font-weight: normal; }
.form-group input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box; }
.error-message { color: red; margin-top: 5px; display: none; }
.error { color: red; margin-top: 10px; }
.status-success { color: green; }
.status-warning { color: orange; }
.status-failure { color: red; }
table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
table:not(:has(th)):not(:has(td)) { display: none; margin-bottom: 0; }
th, td { padding: 12px; text-align: left; word-wrap: break-word; word-break: break-word; }
th { background-color: var(--qa-brand-alt); color: #fff; }
tr:nth-child(even) { background-color: var(--qa-secondary); }
tr:nth-child(odd) { background-color: var(--qa-primary) }
.hidden-frame { display: none; }
tr:hover { background-color: var(--qa-brand); }
.remove-queue-button { background-color: red; white-space: nowrap; font-size: 12px; color: white; cursor: pointer; border: none; }
.remove-queue-button:hover { background-color: darkred; }
.remove-queue-text { color: red; }
.remove-button { background: transparent; white-space: nowrap; font-size: 14px; color: #dc3545; cursor: pointer; border: none; margin-top: -8px; margin-bottom: -8px; transition: transform .12s ease, color .12s ease, filter .12s ease, box-shadow .12s ease; }
.remove-button:hover,
.remove-button:focus-visible { background: transparent; color: #ff5a6a; transform: translateY(-1px) scale(1.06); filter: drop-shadow(0 1px 4px rgba(220,53,69,0.35)); outline: none; text-decoration: none; }
.remove-button:disabled { background: transparent; color: darkred; cursor: not-allowed; filter: none; box-shadow: none; transform: none; }
.discard-row-btn { background: transparent; white-space: nowrap; font-size: 14px; color: #cbd5e1; cursor: pointer; border: none; margin-top: -8px; margin-bottom: -8px; transition: transform .12s ease, color .12s ease, filter .12s ease, box-shadow .12s ease; }
.discard-row-btn:hover,
.discard-row-btn:focus-visible { background: transparent; color: #e2e8f0; transform: translateY(-1px) scale(1.06); filter: drop-shadow(0 1px 4px rgba(203,213,225,0.35)); outline: none; text-decoration: none; }
.discard-row-btn:disabled { background: transparent; color: #6c757d; cursor: not-allowed; filter: none; box-shadow: none; transform: none; opacity: .6; }
html:not(.dark-mode) .discard-row-btn { color: #6c757d; }
html:not(.dark-mode) .discard-row-btn:hover,
html:not(.dark-mode) .discard-row-btn:focus-visible { color: #495057; filter: drop-shadow(0 1px 4px rgba(73,80,87,0.35)); }
.edit-button { background: transparent; white-space: nowrap; color: orange; font-size: 14px; cursor: pointer; border: none; margin-top: -8px; margin-bottom: -8px; transition: transform .12s ease, color .12s ease, filter .12s ease, box-shadow .12s ease; }
/* Verify page: mobile layout to place details below title */
@media (max-width: 768px) {
  .header-layout-page .item-header { flex-direction: column; align-items: flex-start; gap: 6px; }
  .header-layout-page .item-line-number { margin-bottom: 0; }
  /* Hide details in header on mobile */
  .header-layout-page .item-header .item-details { display: none !important; }
  /* Show the mobile details row below the title */
  .header-layout-page .item-details-mobile { width: 100%; display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; }
  /* Move Clear Selection to its own centered line on mobile */
  .header-layout-page .config-actions .clear-selection-btn.action {
    order: 1000;
    flex: 1 1 100%;
    margin: 8px auto 0 auto;
  }
}
.edit-button:hover,
.edit-button:focus-visible { background: transparent; color: #ffb84d; transform: translateY(-1px) scale(1.06); filter: drop-shadow(0 1px 4px rgba(255,165,0,0.35)); outline: none; text-decoration: none; }
.edit-button:focus { outline: none; }
.edit-button:disabled { background: transparent; color: gray; cursor: not-allowed; filter: none; box-shadow: none; transform: none; }
.assign-button,
.unassign-button { background: transparent; white-space: nowrap; color: var(--qa-brand-alt); font-size: 14px; cursor: pointer; border: none; margin-top: -8px; margin-bottom: -8px; transition: transform .12s ease, color .12s ease, filter .12s ease, box-shadow .12s ease; }
.assign-button:hover,
.assign-button:focus-visible,
.unassign-button:hover,
.unassign-button:focus-visible { background: transparent; color: var(--qa-brand); transform: translateY(-1px) scale(1.06); filter: drop-shadow(0 1px 4px color-mix(in srgb, var(--qa-brand) 35%, transparent)); outline: none; text-decoration: none; }
.assign-button:focus,
.unassign-button:focus { outline: none; }
.assign-button:disabled,
.unassign-button:disabled { background: transparent; color: gray; cursor: not-allowed; filter: none; box-shadow: none; transform: none; }
.centered-input { text-align: center; }
#searchQuery { width: 800px; height: 20px; font-size: 14px; padding: 5px; }
.popover { display: none; position: absolute; background-color: var(--secondary-color); border: 1px solid #ccc; width: 40%; overflow: hidden; padding: 8px; z-index: 100; box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1); }
.popover.show { display: block; }
/* AI confidence pill */
button.confidence-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 22px;
  padding: 2px 8px;
  line-height: 1;
  font-size: 11px;
  font-weight: 600;
  color: var(--qa-brand);
  background: var(--qa-secondary);
  border: 1px solid var(--qa-border);
  border-radius: 9999px;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease;
}
button.confidence-button:hover,
button.confidence-button:focus-visible {
  background: rgba(1,167,255,0.06);
  border-color: var(--qa-brand);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 0 0 1px var(--qa-brand);
  outline: none;
}
button.confidence-button.active {
  background: var(--qa-brand);
  border-color: var(--qa-brand);
  color: #fff;
  box-shadow: 0 2px 8px rgba(1,167,255,0.25);
}
/* premium/negative scoring variant */
button.confidence-button.premium {
  background: #FFF4D0;
  border-color: #EAD49A;
  color: #7A5A00;
}
/* =============================
   Keyboard Shortcuts Legend
   ============================= */
.page-header-controls .keyboard-legend { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--title-text-color); }
.page-header-controls .keyboard-legend-title { font-weight: 600; opacity: 0.9; }
.page-header-controls .keyboard-legend-items { display: flex; flex-wrap: wrap; gap: 10px; }
.page-header-controls .keyboard-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.page-header-controls .keyboard-legend-key { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; font-weight: 700; font-size: 11px; line-height: 1; color: var(--qa-brand); background: var(--qa-secondary); border: 1px solid var(--qa-border); border-radius: 6px; }
.page-header-controls .keyboard-legend-label { font-size: 11px; color: var(--qa-heading); }
@media (max-width: 1280px){ .header-layout-page .page-header-controls .keyboard-legend { display: none !important; } }
/* Hide keyboard shortcuts on touch devices (tablets/mobiles), including large tablets */
@media (hover: none) and (pointer: coarse){
  .header-layout-page .page-header-controls .keyboard-legend { display: none !important; }
}
#status-bar.hidden { display: none; }
.table-responsive { width: 100%; overflow-x: auto; }
form .form-group { margin-bottom: 15px; }
th.sorted-asc::after { content: " ▲"; font-size: 0.8em; }
th.sorted-desc::after { content: " ▼"; font-size: 0.8em; }
/* Basic report table fallbacks removed in favor of modern styles below */
.source_table { width: 100%; margin: 0px auto; border-collapse: collapse; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif; }
.source_table th, .source_table td { background-color: var(--qa-secondary); padding: 4px; text-align: left; word-wrap: break-word; word-break: break-word; }
.source_table th { background-color: var(--qa-secondary); color: #fff; font-weight: bold; }
.source_table tr:nth-child(even) { background-color: var(--qa-secondary); }
.source_table tr:hover { background-color: var(--qa-secondary); }
.plain_table { width: 100%; margin: 0px auto; background-color: transparent; border-collapse: collapse; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif; }
.plain_table th, .plain_table td { color: var(--text-color); background-color: transparent; padding: 8px 10px; text-align: left; }
.plain_table th { background-color: transparent; font-weight: bold; }
.plain_table tr:nth-child(odd),
.plain_table tr:nth-child(even) { background-color: transparent; }
.plain_table tr:hover { background-color: transparent; }
/* WMS Zones include/exclude row hover accents */
#grid-right-inc tr.order-row td,
#grid-right-exc tr.order-row td { background-color: var(--qa-secondary); border-bottom: 1px solid var(--qa-border); transition: background-color .15s ease, color .15s ease, border-color .15s ease; }
#grid-right-inc tr.order-row:hover td,
#grid-right-exc tr.order-row:hover td,
#grid-right-inc tr.order-row.open td,
#grid-right-exc tr.order-row.open td { background-color: var(--qa-brand); color: #fff; border-color: var(--qa-brand); }
/* Charts */
.graph-container { position: relative; height: 400px; width: 100%; margin-bottom: 20px; }
#reportChart { height: 100%; max-width: 100%; }
@media (max-width: 768px) { #reportChart { height: 300px; } }
@media (max-width: 480px) { #reportChart { height: 200px; } }
#outerContainer { position: relative; height: 75vh; overflow: auto; border: 0; font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Liberation Mono', 'Courier New', monospace; background-color: #1e1e1e; }
#linesContainer { position: relative; width: 100%; }
.log-line { height: 20px; overflow: hidden; white-space: nowrap; font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Liberation Mono', 'Courier New', monospace; position: absolute; left: 0; width: 100%; }
.timestamp { color: yellow; }
.server { color: lightblue; }
.thread { color: blue; }
.level-DEBUG { color: gray; }
.level-INFO { color: white; }
.level-WARNING { color: orange; }
.level-ERROR { color: red; }
.unmatched { color: white; }
.itemstate_pending { color: blue }
.itemstate_mapped { color: green }
.itemstate_marked_correct { color: green }
.itemstate_modified { color: orange }
.itemstate_needs_clarification { color: orange }
.itemstate_remove { color: red }
.itemstate_unknown { color: gray }
.toggle-switch { display: flex; align-items: center; gap: 8px; margin-left: 10px; }
.toggle-switch input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-switch-label {
  position: relative; display: inline-block;
  width: 42px; height: 24px;
  background: var(--qa-border);
  border-radius: 9999px;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out, transform 0.2s ease-in-out;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.12);
  flex: 0 0 42px; /* prevent flex shrink in tight spaces */
  min-width: 42px; /* ensure knob doesn’t overflow when container shrinks */
}
.toggle-switch-label::after {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
  transition: transform 0.2s ease-in-out, background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.toggle-switch input[type="checkbox"]:not(:disabled) + .toggle-switch-label:hover {
  background: color-mix(in srgb, var(--qa-border) 82%, var(--qa-brand) 18%);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.10), 0 1px 3px rgba(1,167,255,0.10);
}
.toggle-switch input[type="checkbox"]:not(:disabled) + .toggle-switch-label:hover::after {
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.toggle-switch input[type="checkbox"]:checked + .toggle-switch-label {
  background: var(--qa-brand-alt);
}
.toggle-switch input[type="checkbox"]:checked:not(:disabled) + .toggle-switch-label:hover {
  background: color-mix(in srgb, var(--qa-brand-alt) 88%, white 12%);
}
.toggle-switch input[type="checkbox"]:checked + .toggle-switch-label::after {
  transform: translateX(18px);
}
.toggle-switch input[type="checkbox"]:focus-visible + .toggle-switch-label,
.toggle-switch input[type="checkbox"]:focus + .toggle-switch-label {
  box-shadow: 0 0 0 3px rgba(1,167,255,0.25), inset 0 1px 2px rgba(0,0,0,0.12);
  outline: none;
}
.toggle-switch-text { margin-left: 2px; font-size: 13px; color: var(--qa-text); }
.toggle-switch input[type="checkbox"]:disabled + .toggle-switch-label {
  background-color: #c7c7c7; cursor: not-allowed; opacity: 0.7;
}
.toggle-switch input[type="checkbox"]:disabled + .toggle-switch-label::after { background-color: #f5f5f5; opacity: 0.8; }
.dropdown { position: relative; display: inline-block; }
.dropdown label { display: block; margin-bottom: 5px; font-weight: normal; }
.dropdown-content { display: none; position: absolute; background-color: var(--qa-secondary); min-width: 200px; max-height: 200px; overflow-y: auto; border: 1px solid var(--qa-border); z-index: 1; padding: 2px; }
/* Show the dropdown content when the button is clicked */
.show { display: block; }
#department-button { background-color: var(--qa-brand); color: #fff; cursor: pointer; }
/* Optional hover effect */
#department-button:hover { background-color: var(--qa-brand-alt); }
.dropdown-content label { display: flex; align-items: center; margin-top: 2px; margin-bottom: 2px; }
.dropdown-content input[type="checkbox"] { margin-right: 10px; margin-top: 2px; flex-shrink: 0; width: 20px; }
/* Styles for grayed out rows */
.grayed-out { color: gray; opacity: 0.6; }
/* Styles for status label */
.status-new { color: gray; font-weight: bold; }
.status-created { color: green; font-weight: bold; }
.status-downloaded { color: orange; font-weight: bold; }
.status-confirmed { color: gray; font-weight: bold; }
.status-debitreq { color: red; font-weight: bold; }
/* Styles for remarks */
.remarks-ok { color: green; }
.remarks-warning { color: orange; }
.remarks-error { color: rgb(255, 0, 0); }
.success { color: green; }
/* Global job/status variants (reusable) */
.status-pending { color: #6b7280; }
.status-analyzing { color: #d97706; }
.status-processing { color: #16a34a; }
.status-cancelled { color: #dc2626; }
.bulk-actions { margin-top: 10px; }
input, select, textarea { width: 300px; }
textarea { height: 80px; }
.hidden { display: none; }
/* Language Selector - Flag Button */
.language-selector-wrapper { position: relative; display: flex; align-items: center; margin-right: 16px; }
.language-flag-button { background-color: transparent; color: var(--qa-text); border-radius: 4px; padding: 6px 10px; font-size: 16px; cursor: pointer; transition: all 0.2s ease; outline: none; display: flex; align-items: center; justify-content: center; min-width: 40px; height: 32px; }
.dark-mode .language-flag-button { background-color: transparent; }
.language-flag-button:hover { background-color: rgba(245, 245, 245, 0.5); border-color: var(--qa-brand); box-shadow: 0 2px 8px rgba(1, 167, 255, 0.2); transform: translateY(-1px); }
.dark-mode .language-flag-button:hover { background-color: rgba(58, 58, 58, 0.5); }
.language-flag-button:active { transform: translateY(0); }
.language-dropdown-menu { display: none; position: absolute; top: 40px; right: 0; background-color: #fff; border: 1px solid #ddd; border-radius: 4px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); min-width: 160px; z-index: 1000; overflow: hidden; }
.dark-mode .language-dropdown-menu { background-color: #2e2e2e; border-color: #444; }
.language-dropdown-menu.show { display: block; animation: slideDown 0.2s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.language-option { display: flex; align-items: center; padding: 10px 12px; cursor: pointer; transition: background-color 0.15s ease; gap: 10px; }
.language-option:hover { background-color: #f5f5f5; }
.dark-mode .language-option:hover { background-color: #3a3a3a; }
.language-flag { font-size: 16px; line-height: 1; }
.language-name { font-size: 13px; font-weight: 500; color: var(--qa-text); }
.user-profile { position: relative; display: inline-block; margin-right: 20px; }
.user-initials { width: 40px; height: 40px; background-color: var(--qa-brand); color: #fff; border-radius: 50%; text-align: center; line-height: 40px; font-weight: bold; font-size: 14px; cursor: pointer; }
.user-popup { display: none; position: absolute; right: 0; top: 50px; background-color: var(--qa-primary); color: var(--qa-text); border: 1px solid rgba(0, 0, 0, 0.1); border-radius: 8px; padding: 0; width: 280px; z-index: 999; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif; font-size: 14px; overflow: hidden; animation: slideDown 0.2s ease-out; }
/* keep single slideDown keyframes (deduped) */
.user-popup-header { padding: 20px; background: linear-gradient(135deg, var(--qa-brand) 0%, var(--qa-brand-alt) 100%); color: #fff; text-align: center; }
.user-popup-avatar { width: 60px; height: 60px; background-color: rgba(255, 255, 255, 0.2); color: white; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: bold; font-size: 24px; margin-bottom: 10px; border: 3px solid rgba(255, 255, 255, 0.3); }
.user-popup-name { font-size: 16px; font-weight: 600; margin-top: 8px; }
.user-popup-divider { height: 1px; background-color: rgba(0, 0, 0, 0.08); }
.user-popup-info { padding: 12px 0; }
.user-popup-item { display: grid; grid-template-columns: 24px 1fr auto; gap: 12px; align-items: center; padding: 10px 20px; transition: background-color 0.15s ease; }
.user-popup-item:hover { background-color: var(--qa-secondary); }
.user-popup-item i { color: var(--qa-brand); font-size: 14px; width: 20px; text-align: center; }
.user-popup-label { font-size: 12px; color: #666; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.user-popup-value { font-size: 14px; font-weight: 500; color: var(--qa-text); text-align: right; }
.user-popup form { padding: 12px 16px; background-color: var(--qa-secondary); }
.user-popup-logout { width: 100%; background-color: #dc3545; color: white; border: none; padding: 12px 16px; font-size: 14px; font-weight: 500; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.2s ease; }
.user-popup-logout:hover { background-color: #c82333; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3); }
.user-popup-logout:active { transform: translateY(0); }
.user-popup-logout i { font-size: 16px; }
.progress-wrapper { align-items: center; display: flex; gap: 10px; }
.progress-bar-container { background-color: var(--qa-secondary); border-radius: 5px; height: 20px; overflow: hidden; position: relative; width: 78vw; }
.progress-bar { background-color: var(--qa-brand); border-radius: 5px; height: 100%; width: 0; }
#progress-percentage { font-weight: bold; line-height: 20px; }
.log-entries { background-color: var(--secondary-color); margin-top: 10px; max-height: 60vh; overflow-y: auto; padding: 5px; width: 80vw; }
.log-error { color: red; }
.log-warning { color: orange; }
.log-info { color: var(--edit-text-color); }
.upload-form label { display: inline-block; width: 120px; }
/* Modal styling */
  #modalOverlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); z-index: 10000; }
  #editModal { display: none; position: fixed; z-index: 10001; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 90%; max-width: 560px; background: var(--qa-primary); color: var(--text-color); border: 1px solid var(--qa-border); border-radius: var(--qa-radius-md); box-shadow: var(--qa-shadow-md); }
  #modalOverlay ~ .modal-box { z-index: 10001; }
  #editModal .modal-header { position: static; top: auto; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; background: var(--qa-primary); color: var(--text-color); padding: 12px 15px; border-bottom: 1px solid var(--qa-border); z-index: 1; }
  #editModal .modal-header h3 { margin: 0; color: var(--qa-heading); font-weight: 600; font-size: 1.1rem; }
  #editModal .modal-buttons { display: flex; gap: 8px; margin-left: auto; }
  #editModal .modal-body { max-height: calc(80vh - 120px); overflow-y: auto; padding: 15px; }
  #editModal #modalSpecialToggleLabel { display: inline-flex; padding-bottom: 10px; margin-bottom: 8px; }
.modal-header { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; background: var(--qa-brand-alt); padding: 10px 15px; color: #fff; z-index: 2; }
.modal-header .modal-alert-area { flex: 1 1 100%; margin-top: 10px; }
.modal-header h3 { margin: 0; font-size: 1.1rem; font-weight: normal; }
.modal-body { max-height: calc(90vh - 120px); overflow-y: auto; padding: 15px; }
.modal-buttons button { margin-left: 0; }
.modal-form-group { margin-bottom: 10px; display: flex; flex-direction: column; }
label { font-weight: bold; }
.modal-buttons { text-align: right; }
.modal-special-toggle { margin-bottom: 15px; padding: 5px 10px; background-color: transparent; border-radius: 4px; display: flex; align-items: center; gap: 8px; }
.modal-special-toggle input[type="checkbox"] { margin: 0; width: auto; vertical-align: middle; }
.modal-special-toggle label { margin: 0; font-weight: normal; vertical-align: middle; }
#specialItemFields, #regularItemFields { padding: 0; border: none; border-radius: 0; margin-bottom: 12px; }
.modal-error-message { color: #dc3545; font-size: 0.875rem; margin-top: 5px; display: block; }
.modal-form-group input[type="text"],
.modal-form-group input[type="email"],
.modal-form-group input[type="password"],
.modal-form-group input[type="number"],
.modal-form-group input[type="date"] { width: 100%; margin: 5px 0; padding: 8px 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; font-size: 11px; }
.modal-form-group select { width: 100%; margin: 5px 0; min-width: 0; }

/* Configuration JSON Modal (legacy markup support) */
.modal-overlay { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.5); z-index:5000; }
.modal-box { display:none; position:fixed; top:50%; left:50%; transform:translate(-50%, -50%); background: var(--qa-primary); color: var(--text-color); padding:20px; z-index:6000; border: 1px solid var(--qa-border); border-radius: var(--qa-radius-md); box-shadow: var(--qa-shadow-md); min-width: 400px; }
.modal-box h3 { margin: 0 0 10px; color: var(--qa-heading); font-weight: 600; }
.modal-box .btn-modern { height: 32px; }
.modal-box .btn-modern + .btn-modern { margin-left: 6px; }
.modal-box#addModal { width: 900px; max-width: 92vw; }
.modal-box#jsonModal { width: 900px; max-width: 92vw; }
.modal-box #jsonEditorContainer, #jsonEditorContainer { max-height: 400px; overflow-y: auto; }
.modal-form-group input { width: 100%; padding: 5px; box-sizing: border-box; background-color: var(--edit-text-bg-color); color: var(--edit-text-color); border: 1px solid var(--tertiary-color); }

/* Tables inside configuration JSON modal styled like app tables */
.modal-box table { width: 100%; border-collapse: separate; border-spacing: 0; background: transparent; }
.modal-box thead { background: linear-gradient(135deg, var(--qa-brand), var(--qa-brand-alt)); color: #fff; }
.modal-box thead th { padding: 12px; text-align: left; font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid rgba(255,255,255,0.2); }
.modal-box tbody tr { border-bottom: 1px solid var(--qa-border); transition: background-color .15s ease, transform .05s ease; }
.modal-box tbody tr:hover { background: rgba(1,167,255,0.05); }
.modal-box tbody td { padding: 10px 12px; font-size: 13px; color: var(--qa-text); vertical-align: middle; }
.order-progress-container { width: 100%; background-color: #f1f1f1; border-radius: 4px; position: relative; height: 20px; }
.order-progress-bar { height: 100%; background-color: #4CAF50; border-radius: 4px; transition: width 0.3s ease; }
.order-progress-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 12px; color: #000; text-shadow: 1px 1px 1px rgba(255,255,255,0.5); }
.progress-panel { margin-bottom: 20px; padding: 10px; background-color: var(--qa-secondary); border-radius: 5px; }
.progress-label { margin-bottom: 5px; font-weight: bold; }
.progress-bar-track { width: 100%; height: 20px; background-color: #e0e0e0; border-radius: 10px; overflow: hidden; }
.progress-bar-fill { height: 100%; background-color: #4CAF50; width: 0%; }
.debit-number-btn { background-color: #dc3545; color: white; border: none; padding: 5px 10px; border-radius: 4px; cursor: pointer; }
.debit-number-btn:hover { background-color: #c82333; }
.info-button { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; background-color: #01A7FF; color: white; font-weight: bold; font-style: italic; margin-left: 8px; border: none; cursor: pointer; font-size: 10px; }
.info-button:hover { background-color: #0056b3; }
.discount-item, .email-item { margin: 5px 0; padding: 5px; border: 1px solid #ddd; border-radius: 3px; display: flex; align-items: center; }
.remove-item { margin-left: 10px; color: red; cursor: pointer; }
.add-button { margin-top: 10px; }
.flags-container { display: flex; flex-direction: column; background-color: var(--qa-secondary); padding: 4px; max-height: 150px; overflow-y: auto; }
/* each flag = one row, checkbox + label side by side */
.flag-item { display: flex; align-items: center; margin-bottom: 6px; }
/* pull the label right up against the box */
.flag-item input[type="checkbox"] { margin: 0 8px 0 0; }
/* ensure no extra padding on the label */
.flag-item label { margin: 0 0 0 8px; font-size: 11px; }
.search-box { margin-bottom: 20px; }
.search-box input { padding: 8px; width: 300px; }
.search-box button { padding: 8px 16px; }
.stock-warning { margin-top: 8px; padding: 8px 12px; border-radius: 4px; background-color: #fff3cd; border-left: 4px solid #ffc107; font-size: 12px; }
.dark-mode .stock-warning { background: rgba(255, 193, 7, 0.2); color: #ffc107; }
.stock-warning-text { color: #856404; font-weight: 500; }
.dark-mode .stock-warning-text { color: #ffc107; }
.info-popup .stock-status.low { color: #d9534f; font-weight: bold; }
.info-popup .stock-status.ok { color: #5cb85c; font-weight: bold; }
.services-grid { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 30px; }
.service-block { padding: 15px; border-radius: 5px; width: 250px; box-shadow: 0 2px 5px rgba(0,0,0,0.2); color: #ffffff; font-weight: 500; }
.service-name { font-weight: bold; font-size: 14px; margin-bottom: 10px; }
.service-value { font-size: 18px; margin-bottom: 10px; }
.service-info { margin: 5px 0; font-size: 11px; }
.service-status-success { background-color: #2ecc71; border: 1px solid #27ae60; }
.service-status-warning { background-color: #f39c12; border: 1px solid #e67e22; }
.service-status-failure { background-color: #e74c3c; border: 1px solid #c0392b; }
.service-status-inactive { background-color: #7f8c8d; border: 1px solid #34495e; }
.today-info { font-size: 10px; color: #666; text-align: center; margin-top: 5px; }
/* in-modal alerts */
.modal-alert-area { margin-bottom: 15px; display: none; }
.modal-alert { padding: 10px 15px; border-radius: 4px; font-weight: 500; }
.modal-alert-error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.modal-alert-success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.modal-alert-info { background-color: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.modal-alert-warning { background-color: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
/* ---------- override global width/margin for checkboxes & radios ---------- */
input[type="checkbox"],
input[type="radio"] { width: auto !important; margin: 0 !important; }
/* make the autocomplete pull-down dark in dark-mode */
.dark-mode .ui-autocomplete { background-color: var(--bg-color); color: var(--text-color); border: 1px solid var(--primary-color); box-shadow: 0 2px 6px rgba(0,0,0,0.5); z-index: 2000; }
.dark-mode .ui-autocomplete .ui-menu-item a { color: var(--text-color); padding: 6px 10px; }
.dark-mode .ui-autocomplete .ui-menu-item.ui-state-focus a,
.dark-mode .ui-autocomplete .ui-menu-item.ui-state-active a { background-color: var(--primary-color); color: var(--white); }
.ui-tooltip { background: var(--qa-primary); color: var(--qa-text); border: 1px solid var(--qa-border); padding: 8px 12px; box-shadow: var(--qa-tooltip-shadow); }
.dark-mode .ui-tooltip { background: var(--bg-color); color: var(--qa-text); border-color: var(--qa-border); }
#editModalBody { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
/* make the items table span the full width */
#editModalBody fieldset { grid-column: 1 / -1; }
#editModal.modal-box { width: min(98vw, 1500px); max-width: min(98vw, 1500px); max-height: 82vh; padding: 0; overflow: hidden; }
#editModal .modal-body { max-height: calc(82vh - 88px); padding: 18px; }
#editModalBody .modal-form-group { margin-bottom: 0; }
#editModalBody .modal-static-value {
  min-height: 38px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--qa-text);
  box-sizing: border-box;
}
#editModalBody .modal-static-value--stack {
  gap: 2px;
  line-height: 1.15;
}
#editModalBody .modal-static-value--stack strong,
#editModalBody .modal-static-value--stack span {
  display: block;
}
#editModalBody .modal-inline-control-row { display: flex; align-items: center; gap: 10px; }
#editModalBody fieldset {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--qa-border);
  border-radius: var(--qa-radius-md);
  background: color-mix(in srgb, var(--qa-secondary) 30%, var(--qa-primary) 70%);
}
#editModalBody fieldset legend {
  padding: 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--qa-heading);
}
#editModalBody .custom-date-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
#editModalBody .custom-date-display {
  width: 100%;
  padding-right: 38px !important;
  cursor: pointer;
}
#editModalBody .custom-date-icon {
  position: absolute;
  right: 12px;
  color: var(--qa-brand-alt);
  pointer-events: none;
}
#editModalBody .custom-date-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
#editModalBody #itemTable,
#editModalBody #debitorTable { width: 100%; }
#editModalBody .modal-orders-table thead {
  background: transparent;
  color: var(--qa-heading);
}
#editModalBody .modal-orders-table thead th {
  background: color-mix(in srgb, var(--qa-secondary) 82%, var(--qa-primary) 18%);
  color: var(--qa-heading);
  text-transform: none;
  letter-spacing: normal;
  padding: 8px 10px;
  border-top: 1px solid rgba(0, 95, 153, 0.28);
  border-bottom: 1px solid rgba(0, 95, 153, 0.28);
  box-shadow: none;
}
#editModalBody .modal-orders-table thead th:first-child {
  border-left: 1px solid rgba(0, 95, 153, 0.28);
  border-top-left-radius: var(--qa-radius-sm);
  border-bottom-left-radius: var(--qa-radius-sm);
}
#editModalBody .modal-orders-table thead th:last-child {
  border-right: 1px solid rgba(0, 95, 153, 0.28);
  border-top-right-radius: var(--qa-radius-sm);
  border-bottom-right-radius: var(--qa-radius-sm);
}
#editModalBody .modal-orders-table tbody tr {
  background: transparent;
}
#editModalBody .modal-orders-table tbody td {
  vertical-align: middle;
}
#editModalBody #addItemBtn { margin-top: 12px; }
@media (max-width: 900px) {
  #editModal.modal-box { width: min(99vw, 1500px); max-width: min(99vw, 1500px); }
  #editModalBody { grid-template-columns: 1fr; }
  #editModalBody .modal-inline-control-row { align-items: stretch; }
}
/* dim & disable clicks on the editModal when a child modal is open */
#editModal.modal-disabled { filter: brightness(0.6); pointer-events: none; }
#lineNumberModalOverlay { z-index: 10002; }
#lineNumberModal.modal-box {
  display: none;
  width: min(90vw, 420px);
  max-width: 420px;
  padding: 0;
  overflow: hidden;
  z-index: 10003;
}
#lineNumberModal .modal-header {
  position: static;
  top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  background: var(--qa-primary);
  color: var(--text-color);
  padding: 12px 15px;
  border-bottom: 1px solid var(--qa-border);
  z-index: 1;
}
#lineNumberModal .modal-header h3 {
  margin: 0;
  color: var(--qa-heading);
  font-weight: 600;
  font-size: 1.1rem;
}
#lineNumberModal .modal-buttons {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
#lineNumberModal .modal-body {
  max-height: calc(80vh - 120px);
  overflow-y: auto;
  padding: 15px;
}
#lineNumberModal .modal-form-group { margin-bottom: 12px; }
#lineNumberModal .modal-form-group:last-child { margin-bottom: 0; }
#lineNumberModal .line-number-modal-description {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border: 2px solid var(--qa-border);
  border-radius: 6px;
  background: var(--qa-primary);
  color: var(--qa-text);
  box-sizing: border-box;
}
/* full-screen dark overlay for the search modal */
#searchModalOverlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 10004; }
/* center the search modal */
#searchModal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 980px);
  max-width: min(92vw, 980px);
  max-height: 80vh;
  padding: 0;
  overflow: hidden;
  background: var(--qa-primary);
  z-index: 10005;
}
#searchModal .modal-header {
  position: static;
  top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  background: var(--qa-primary);
  color: var(--text-color);
  padding: 12px 15px;
  border-bottom: 1px solid var(--qa-border);
  z-index: 1;
}
#searchModal .modal-header h3 {
  margin: 0;
  color: var(--qa-heading);
  font-weight: 600;
  font-size: 1.1rem;
}
#searchModal .modal-buttons {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
#searchModal .modal-body {
  max-height: calc(80vh - 72px);
  overflow-y: auto;
  padding: 15px;
}
#searchModal .search-box--modal {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
#searchModal .search-box--modal #searchInput {
  flex: 1 1 auto;
  width: 100%;
}
#searchModal .search-box--modal #searchBtn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
}
#searchModal .search-results-wrapper {
  max-height: calc(80vh - 160px);
  overflow: auto;
}
#searchModal .search-results-table {
  width: 100%;
}
#searchModal .search-results-table thead {
  background: transparent;
  color: inherit;
}
#searchModal .search-results-table thead th {
  background: transparent;
  color: var(--qa-heading);
  text-transform: none;
  letter-spacing: normal;
  padding: 6px 2px 8px 2px;
  border-bottom: 1px solid var(--qa-border);
  box-shadow: none;
}
#searchModal .search-results-table tbody tr {
  cursor: pointer;
}
#searchModal .search-results-table tbody tr.selected td {
  background: rgba(1, 167, 255, 0.12);
  border-top-color: var(--qa-brand);
  border-bottom-color: var(--qa-brand);
}
#searchModal .search-results-table tbody tr.selected td:first-child {
  border-left-color: var(--qa-brand);
}
#searchModal .search-results-table tbody tr.selected td:last-child {
  border-right-color: var(--qa-brand);
}
#totalAmount,
.total-warning-icon { display: inline-block; vertical-align: middle; }
.items-table-wrapper {
  position: relative;
  max-height: 36vh;
  overflow-y: auto;
  isolation: isolate;
  background: color-mix(in srgb, var(--qa-secondary) 82%, var(--qa-primary) 18%);
  border-radius: var(--qa-radius-sm);
}
.items-table-wrapper table { width: 100%; }
/* keep the table header stuck to the top of the wrapper */
.items-table-wrapper thead th {
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--qa-secondary) 82%, var(--qa-primary) 18%);
  background-clip: padding-box;
  z-index: 4;
}
#editModalBody .items-table-wrapper thead th::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  height: 8px;
  background: inherit;
  pointer-events: none;
}
@media (max-height: 600px) { .items-table-wrapper { max-height: min(30vh, 200px); } }
.filter-group { display: flex; align-items: center; gap: 10px; }
.filter-group label { font-weight: 600; min-width: 120px; }
.filter-group input[type="text"] { flex: 1; max-width: 300px; padding: 8px 12px; border: 1px solid #ccc; border-radius: 4px; font-size: 12px; }
.filter-group input[type="text"]:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25); }
.metric-icon { color: darkgreen; margin-right: 4px; position: relative; cursor: help; }
.metric_table { width: 100%; margin: 0px auto; background-color: transparent; border-collapse: collapse; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif; }
.metric_table th, .metric_table td { color: white; background-color: transparent; padding: 4px; text-align: left; }
.metric_table th { background-color: transparent; font-weight: bold; }
.metric_table tr:nth-child(odd),
.metric_table tr:nth-child(even) { background-color: transparent; }
.metric_table tr:hover { background-color: transparent; }
.items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(500px, 1fr)); gap: 16px; margin-bottom: 20px; }
@media (max-width: 1200px) { .items-grid { grid-template-columns: 1fr; } }
/* Flag filter partial now uses the same shared classes as the verify header */
#flagSelection.flag-filter { margin: 0 !important; }
#flagSelection.flag-filter .input-modern { min-width: 160px !important; width: 160px !important; margin: 0 !important; }
#flagSelection.flag-filter .btn-modern { margin: 0 !important; }
/* Prevent overflow on small screens: stack controls */
@media (max-width: 700px){
  #flagSelection.flag-filter { flex-direction: column !important; align-items: stretch !important; }
  #flagSelection.flag-filter label { white-space: normal !important; }
  #flagSelection.flag-filter .input-modern { width: 100% !important; min-width: 0 !important; }
  #flagSelection.flag-filter .btn-modern { width: 100% !important; justify-content: center !important; }
}
/* Modern text input styling - reusable across all pages */
.search-input-modern,
.input-modern { padding: 8px 12px !important; border: 2px solid var(--qa-border) !important; border-radius: 6px !important; background: var(--qa-primary) !important; color: var(--qa-text) !important; font-size: 13px !important; line-height: 1.5 !important; height: auto !important; min-height: 38px !important; transition: all 0.2s ease !important; box-sizing: border-box !important; }
.search-input-modern:focus,
.input-modern:focus { border-color: var(--qa-brand) !important; outline: none !important; box-shadow: 0 0 0 3px rgba(1, 167, 255, 0.1) !important; }
.search-input-modern::placeholder,
.input-modern::placeholder { color: #999 !important; opacity: 1 !important; }
/* Hover effect to match JSON editor open button */
.search-input-modern:hover,
.input-modern:hover { background: rgba(1,167,255,0.025) !important; border-color: rgba(1,167,255,0.38) !important; box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 0 0 1px rgba(1,167,255,0.12) !important; }
/* Utility: compact width for time inputs reused by WMS */
.input-time { width: 115px; min-width: 110px; }
@media (max-width: 700px){ .input-time { width: 140px; } }
/* Modern button styling aligned with configuration action buttons */
.btn-modern { display: inline-flex !important; align-items: center !important; justify-content: center !important; gap: 6px !important; padding: 8px 10px !important; height: 38px !important; min-height: 38px !important; box-sizing: border-box !important; border-radius: 8px !important; border: 1px solid var(--qa-border) !important; background: var(--qa-button-bg) !important; color: var(--qa-heading) !important; font-size: 13px !important; font-weight: 600 !important; line-height: 1 !important; cursor: pointer !important; transition: box-shadow .15s ease, border-color .15s ease, background-color .15s ease, color .15s ease !important; box-shadow: none !important; }
.btn-modern i { font-size: 14px; }
.btn-modern:hover,
.btn-modern:focus-visible { background: rgba(1,167,255,0.06) !important; border-color: var(--qa-brand) !important; box-shadow: 0 2px 10px rgba(0,0,0,0.10), 0 0 0 1px var(--qa-brand) !important; outline: none !important; transform: none !important; }
.btn-modern:active { background: rgba(1,167,255,0.1) !important; box-shadow: inset 0 1px 2px rgba(0,0,0,0.08) !important; transform: none !important; }
.btn-modern:disabled { opacity: 0.55 !important; cursor: not-allowed !important; box-shadow: none !important; }
/* WMS top navigation */
.wms-topnav { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.wms-topnav .btn-modern { width: 180px !important; justify-content: center !important; text-align: center !important; height: 35px !important; }
/* Generic toolbar wrapper for aligned action buttons */
.refresh-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--qa-secondary); border: 1px solid var(--qa-border); border-radius: 8px; padding: 8px 10px; }
/* Normalize control button height across pages */
.refresh-bar .btn-modern { height: 35px !important; }
/* Reusable panel (legacy) removed; modern .panel defined later */
/* Disabled/active state for nav buttons */
.btn-modern.disabled,
.btn-modern[aria-disabled="true"] { pointer-events: none !important; cursor: default !important; opacity: 0.55 !important; box-shadow: none !important; }
/* WMS Overview page styles */
.wms-toolbar { display:flex; gap:20px; align-items:center; flex-wrap:wrap; margin-bottom:16px; }
.muted { font-size:0.85rem; opacity:0.7; }
/* Left-side Configuration switcher on Zones/Users */
.split-layout, .config-layout { display:grid; grid-template-columns: minmax(120px, 10%) 1fr; gap:16px; align-items:stretch; min-height: 81vh; }
.config-nav { grid-column:1; min-width: 120px; display:flex; flex-direction:column; gap:8px; padding:10px; box-sizing:border-box; background: var(--qa-secondary); border:1px solid var(--qa-border); border-radius: 8px; align-self: stretch; }
.config-nav .btn-modern { width: 100% !important; box-sizing: border-box !important; }
.split-main, .config-main { grid-column:2; min-width: 0; box-sizing:border-box; }
@media (max-width: 900px){ .split-layout, .config-layout { display:block; background: none; min-height: auto; } .config-nav { min-width: 0; display:flex; flex-direction:row; gap:8px; margin-bottom: 12px; background: var(--qa-secondary); border:1px solid var(--qa-border); border-radius:8px; padding:10px; } .config-nav .btn-modern { width: auto !important; } }
#grid { width:100%; }
#grid th { cursor:pointer; }
#grid .progress { height:8px; background: var(--qa-secondary); border:1px solid var(--qa-border); border-radius:6px; overflow:hidden; }
#grid .progress > div { height:100%; background: var(--qa-brand); }
.badge { padding:2px 6px; border-radius:10px; font-size:0.75rem; border:1px solid var(--qa-border); }
.state5 { color:#198754; }
.state3 { color:#b58900; }
.state2, .state1 { color:#dc3545; }
.filter-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:16px; }
.filter-grid label { font-size:0.8rem; opacity:0.9; display:block; margin-bottom:6px; }
/* Reusable checkbox-as-button component */
.checkbox-button { display: inline-flex !important; align-items: center; gap: 10px; margin: 0; min-height: 38px; background: var(--qa-primary) !important; color: var(--qa-text) !important; border: 2px solid var(--qa-border); padding: 8px 12px; border-radius: 6px; height: 38px; box-sizing: border-box; transition: all 0.2s ease; position: relative; }
.checkbox-button:hover { border-color: var(--qa-brand); box-shadow: 0 2px 10px rgba(0,0,0,0.10), 0 0 0 1px var(--qa-brand); background: rgba(1,167,255,0.06) !important; }
.checkbox-button .cb-icon { flex: 0 0 18px; }
.checkbox-button .cb-text { line-height: 1; display: inline-flex; align-items: center; }
.checkbox-button:focus-within { border-color: var(--qa-brand); box-shadow: 0 0 0 3px rgba(1, 167, 255, 0.1); }
.form-group .checkbox-button { margin-top: 6px; }
.checkbox-button.is-checked { background: var(--qa-primary) !important; color: var(--qa-text) !important; border-color: var(--qa-border); }
.checkbox-button input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; margin: 0; }
.checkbox-button .cb-icon { width: 18px; height: 18px; border: 2px solid var(--qa-border); border-radius: 4px; display: inline-block; position: relative; background: transparent; }
.checkbox-button.is-checked .cb-icon { border-color: var(--qa-brand-alt); }
.checkbox-button.is-checked .cb-icon::after { content: ''; position: absolute; left: 4px; top: 1px; width: 6px; height: 10px; border-right: 2px solid var(--qa-brand-alt); border-bottom: 2px solid var(--qa-brand-alt); transform: rotate(45deg); }
/* Align picked/max ratio slash across rows */
.items-ratio { display: inline-grid; grid-template-columns: 2ch 1ch 2ch; align-items: baseline; column-gap: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
.items-ratio .picked { text-align: left; }
.items-ratio .slash { text-align: center; }
.items-ratio .max { text-align: right; }
/* Ensure filter inputs don’t overlap horizontally */
.filter-grid .form-group { width: auto !important; min-width: 0; }
/* Default end alignment helps action buttons; override on overview to align inputs */
.filter-grid { align-items: end; }
body.overview-page .filter-grid { align-items: start; }
.filter-grid .form-group > input,
.filter-grid .form-group > select,
.filter-grid .form-group > textarea,
.filter-grid .form-group > .search-input-modern { width: 100% !important; box-sizing: border-box; }
/* Improve readability for WMS Overview grid */
#grid th,
#grid td { padding: 10px 12px !important; line-height: 1.5; vertical-align: middle; }
/* WMS: Orders rows with blue background and white text */
#grid { border-collapse: separate !important; border-spacing: 0 8px !important; }
#grid tbody tr { background: transparent !important; }
#grid tbody td { background: var(--primary-color) !important; color: #fff !important; }
#grid tbody td:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
#grid tbody td:last-child  { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
#grid tbody a { color: #fff !important; }
/* Progress bar on blue background */
#grid .progress { background: rgba(255,255,255,0.25) !important; border-color: rgba(255,255,255,0.35) !important; }
#grid .progress > div { background: #ffffff !important; }
/* Badges readable on blue */
#grid .badge, .pill-grid .badge { display: inline-flex !important; align-items: center !important; justify-content: center !important; width: 110px !important; height: 26px !important; padding: 0 10px !important; border-radius: 9999px !important; font-weight: 600 !important; text-align: center !important; line-height: 1 !important; background: rgba(255,255,255,0.15) !important; color:#fff !important; border: 1px solid rgba(255,255,255,0.35) !important; }
/* State-specific accents akin to WMS */
#grid .badge.state5, .pill-grid .badge.state5 { border-color: rgba(134,239,172,.8) !important; background: rgba(25,135,84,0.25) !important; }
#grid .badge.state3, .pill-grid .badge.state3 { border-color: rgba(255,221,87,.8) !important; background: rgba(181,137,0,0.25) !important; }
#grid .badge.state2, #grid .badge.state1, .pill-grid .badge.state2, .pill-grid .badge.state1 { border-color: rgba(252,165,165,.8) !important; background: rgba(220,53,69,0.25) !important; }
/* Make the Target separator pill appear white (scoped to target rows) */
#grid tr.target-row .badge.state3 { background: rgba(255, 255, 255, 0.2) !important; border-color: rgb(255, 255, 255) !important; color: #ffffff !important; }
/* Highlight entire target rows for clearer separation */
#grid tbody tr.target-row td { background: var(--qa-brand-alt) !important; color: #fff !important; }
#grid tbody tr.target-row:hover td { background: var(--hover-color) !important; }
/* Hover: slightly darker blue for the whole row */
#grid tbody tr:not(.order-subrow):hover td { background: var(--qa-brand-alt) !important; }
/* Persist darker blue when a row is selected (open) in zones list */
#grid tbody tr.order-row.open td { background: var(--qa-brand-alt) !important; color: #fff !important; }
/* Remove gap between row and its submenu and adjust radii when open */
.order-subrow { position: relative; }
.order-subrow td { position: relative; top: -12px; }
/* Ensure stacking order: main row above, details below */
#grid tbody tr.order-row td { position: relative; z-index: 2; }
.order-subrow td { z-index: 1; }
/* Reuse #grid pill styling for secondary tables via class */
.pill-grid { border-collapse: separate !important; border-spacing: 0 8px !important; width:100%; }
.pill-grid th,
.pill-grid td { padding: 10px 12px !important; line-height: 1.5; vertical-align: middle; }
.pill-grid tbody td { height: 1.5em; }
.pill-grid tbody tr { background: transparent !important; }
.pill-grid tbody td { background: var(--qa-brand) !important; color: #fff !important; }
.pill-grid tbody td:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill-grid tbody td:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.pill-grid tbody td:last-child  { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
.pill-grid tbody a { color: #fff !important; }
.pill-grid tbody tr:not(.order-subrow):hover td { background: var(--hover-color) !important; }
.pill-grid tbody tr.order-row.open td { background: var(--hover-color) !important; color: #fff !important; }
/* Normalize action button height to avoid row growth */
.pill-grid .btn-link.small { padding: 4px 8px; font-size: 12px; line-height: 1.5; }
tr.order-row.submenu-open td:first-child { border-bottom-left-radius: 0 !important; }
tr.order-row.submenu-open td:last-child { border-bottom-right-radius: 0 !important; }
.order-row { cursor: pointer; }
.order-subrow td { background: var(--bg-color) !important; color: var(--text-color) !important; }
.order-submenu { border: none; border-radius: 0 0 8px 8px; padding: 0; background: transparent; box-shadow: none; }
.order-submenu-inner { background: var(--secondary-color); border-radius: 8px; padding: 12px; }
.order-submenu-inner.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
@media (max-width: 700px) { .order-submenu-inner.two-col { grid-template-columns: 1fr; } }
.order-subrow td, .order-subrow a, .order-subrow span { color: var(--text-color) !important; }
.order-submenu-inner .menu-line { display:flex; gap:10px; padding:4px 0; }
.order-submenu-inner .menu-label { width: 160px; color: var(--title-text-color); font-weight: 600; }
.order-submenu-inner .menu-value { flex: 1 1 auto; }
.order-submenu .menu-line { display:flex; gap:10px; padding: 4px 0; }
.order-submenu .menu-label { width: 160px; color: var(--title-text-color); font-weight: 600; }
.order-submenu .menu-value { flex: 1 1 auto; }
.form-group-apply { display:flex; align-items: flex-end; }
#applyBtn { min-height: 38px; width: 100%; }
.btn-modern.btn-danger { background: var(--qa-extra) !important; color: #111 !important; border-color: #e6b306 !important; }
.btn-modern.btn-danger:hover,
.btn-modern.btn-danger:focus-visible { background: #ffd24d !important; color: #111 !important; border-color: #d4a300 !important; }
#reportTable { width: 90%; border-collapse: separate; border-spacing: 0; background: var(--qa-primary); overflow: hidden; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); margin-top: 20px; }
#reportTable thead { background: linear-gradient(135deg, var(--qa-brand), var(--qa-brand-alt)); color: white; }
#reportTable thead th { padding: 14px 12px; text-align: left; font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid rgba(255, 255, 255, 0.2); position: relative; user-select: none; width: 10vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#reportTable thead th:hover { background: rgba(255, 255, 255, 0.1); }
#reportTable thead th.sorted-asc::after { content: ' ▲'; font-size: 10px; margin-left: 4px; }
#reportTable thead th.sorted-desc::after { content: ' ▼'; font-size: 10px; margin-left: 4px; }
#reportTable tbody tr { border-bottom: 1px solid var(--qa-border); transition: all 0.2s ease; }
#reportTable tbody tr:hover { background: rgba(1, 167, 255, 0.05); transform: scale(1.001); }
#reportTable tbody tr:last-child { border-bottom: none; }
#reportTable tbody td { padding: 12px; font-size: 13px; color: var(--qa-text); vertical-align: middle; width: 10vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#reportTable tbody tr:nth-child(even) { background: rgba(0, 0, 0, 0.02); }
.dark-mode #reportTable tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.02); }
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* Chart container styling */
.graph-container { background: var(--qa-primary); border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); margin-bottom: 20px; padding: 20px; }
.graph-container canvas { max-height: 400px; }
#reportResult h2 { color: var(--qa-heading); font-size: 24px; font-weight: 600; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 2px solid var(--qa-brand); }
/* Pricelist Import Page Styling */
.upload-form { background: var(--qa-primary); padding: 30px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); max-width: 600px; margin: 20px auto; }
.upload-form .form-group { margin-bottom: 20px; }
.upload-form label { display: block; font-size: 14px; font-weight: 600; color: var(--qa-heading); margin-bottom: 8px; }
.upload-form input[type="file"] { cursor: pointer; }
.upload-form input[type="file"]:disabled { opacity: 0.5; cursor: not-allowed; }
.alert { padding: 12px 20px; border-radius: 6px; margin: 20px 0; font-size: 14px; font-weight: 500; }
.alert-error { background: #fee; color: #c00; border-left: 4px solid #c00; }
.upload-info-card { background: var(--qa-primary); padding: 20px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); margin: 20px 0; border-left: 4px solid var(--qa-brand); }
.upload-info-card p { margin: 8px 0; font-size: 14px; color: var(--qa-text); }
.upload-info-card strong { color: var(--qa-heading); }
.progress-section { background: var(--qa-primary); border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); margin: 20px 0; padding: 30px; }
.progress-section h3 { color: var(--qa-heading); font-size: 20px; font-weight: 600; margin-bottom: 15px; }
.progress-section .progress-description { color: var(--qa-text); font-size: 14px; font-weight: 500; padding-bottom: 15px; }
.progress-section .progress-wrapper { align-items: center; display: flex; gap: 15px; margin-bottom: 20px; }
.progress-section .progress-bar-container { background: var(--qa-border); border-radius: 15px; box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2); flex: 1; height: 30px; overflow: hidden; }
.progress-section .progress-bar { background: linear-gradient(90deg, var(--qa-brand), #28a745); border-radius: 15px; box-shadow: 0 0 10px rgba(1, 167, 255, 0.5); height: 100%; transition: width 0.5s ease; }
.progress-section .progress-percentage { color: var(--title-text-color); font-size: 16px; font-weight: 600; min-width: 50px; text-align: right; }
.progress-section .log-entries { background: var(--qa-primary); border-radius: 6px; font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Liberation Mono', 'Courier New', monospace; font-size: 13px; margin-top: 20px; max-height: 400px; overflow-y: auto; padding: 15px; }
.progress-section .log-entries > div { border-left: 3px solid transparent; border-radius: 4px; margin: 4px 0; padding: 6px 10px; }
.progress-section .log-info { background: rgba(1, 167, 255, 0.1); border-left-color: var(--qa-brand); color: var(--qa-text); }
.progress-section .log-warning { background: rgba(255, 193, 7, 0.1); border-left-color: #ffc107; color: var(--qa-text); }
.progress-section .log-error { background: rgba(220, 53, 69, 0.1); border-left-color: #dc3545; color: var(--qa-text); }
.no-data-found { text-align: center; color: var(--qa-text); font-size: 16px; padding: 40px 0; }
/* Simple flex column for read-only details sections */
.user-details { display:flex; flex-direction:column; gap:10px; }
/* Spinner */
.loading-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.7); z-index: 50; display: none; align-items: center; justify-content: center; }
.dark-mode .loading-overlay { background: rgba(30, 30, 30, 0.7); }
.spinner { width: 40px; height: 40px; position: relative; animation: spinner-rotate 2s infinite linear; }
.spinner::before,
.spinner::after { content: ''; width: 60%; height: 60%; display: inline-block; position: absolute; top: 0; background-color: var(--primary-color); border-radius: 100%; animation: spinner-bounce 2s infinite ease-in-out; }
.spinner::after { top: auto; bottom: 0; animation-delay: -1s; }
@keyframes spinner-rotate { 100% { transform: rotate(360deg); } }
@keyframes spinner-bounce { 0%, 100% { transform: scale(0); } 50% { transform: scale(1); } }
.category-badge { display: inline-block; padding: 2px 4px; font-size: 11px; line-height: 13px; border: 1px solid #ffa000; border-radius: 3px; background-color: #fff8e1; color: #e65100; margin-left: 5px; margin-right: 5px; cursor: default; vertical-align: middle; font-weight: normal; }
/* Right-hand list (locations) styled like the overview list */
#grid-right { border-collapse: separate !important; border-spacing: 0 8px !important; width:100%; }
#grid-right th, #grid-right td { line-height: 1.5; padding: 10px 12px !important; vertical-align: middle; }
#grid-right tbody tr { background: transparent !important; }
#grid-right tbody td { background: var(--primary-color) !important; color: #fff !important; }
#grid-right tbody td:first-child { border-bottom-left-radius: 8px; border-top-left-radius: 8px; }
#grid-right tbody td:last-child  { border-bottom-right-radius: 8px; border-top-right-radius: 8px; }
#grid-right tbody tr:not(.order-subrow):hover td { background: var(--hover-color) !important; color: #fff !important; }
#grid-right tbody tr.order-row.open td { background: var(--hover-color) !important; color: #fff !important; }
/* WMS Planning page styles */
body.planning-page { height: 100%; overflow-y: hidden; }
.planning-wrapper { position: relative; min-height: 120px; }
.planning-layout { display:flex; gap:16px; align-items:flex-start; }
.planning-left  { flex: 0 0 30%; min-width: 280px; }
.planning-right { flex: 1 1 70%; }
.planning-left .orders-scroll { overflow-y: auto; }
.planning-right .users-scroll { overflow-y: auto; }
/* User cards and list layout */
.user-card { border:1px solid var(--tertiary-color); border-radius:8px; padding:10px; margin-bottom:12px; background: var(--secondary-color); break-inside: avoid; page-break-inside: avoid; -webkit-column-break-inside: avoid; display: block; width: auto; }
.user-card .user-title { font-weight:700; color: var(--title-text-color); margin-bottom:8px; display:flex; align-items:center; justify-content:space-between; }
.user-card .count-badge { font-size:0.8rem; opacity:0.8; }
.user-card.drag-over, .orders-scroll.drag-over { outline: 2px dashed var(--primary-color); outline-offset: -4px; }
/* Masonry two-column users grid */
.users-grid { columns: 2; column-gap: 12px; }
@media (max-width: 1200px) { .users-grid { columns: 1; } }
/* Pill table inside the card should not add extra top/bottom space */
.user-card .pill-grid { margin-top: -8px; margin-bottom: -8px; }
/* Ensure left orders header is not blue */
#ordersGrid thead th, #ordersGrid thead td { background: transparent !important; color: var(--text-color) !important; }
#ordersGrid thead tr { background: transparent !important; }
/* Make Assigned Lines column (first column) narrower on planning page */
body.planning-page #ordersGrid th:first-child,
body.planning-page #ordersGrid td:first-child { width: 90px; white-space: nowrap; }
body.planning-page #ordersGrid .badge { width: 80px !important; padding: 0 8px !important; font-size: 0.72rem !important; }
/* Modal Styling */
.modal { display: none; position: fixed; z-index: 6000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.6); align-items: center; justify-content: center; }
/* When displayed via style="display:flex", force flex */
.modal[style*="display: flex"] { display: flex !important; }
.modal-content { background-color: var(--modal-bg-color); color: var(--text-color); margin: auto; padding: 20px; border: 1px solid #888; width: 80%; max-width: 400px; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.3); text-align: center; position: relative; }
.modal .modal-buttons { margin-top: 20px; display: flex; justify-content: flex-end; gap: 15px; }
/* Match general btn-modern style */
.modal-btn { padding: 8px 16px; border: none; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s ease; }
.modal-btn.confirm { background-color: var(--primary-color); color: white; }
.modal-btn.confirm:hover { background: var(--hover-color); transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); }
.modal-btn.cancel { background-color: #6c757d; color: white; }
.modal-btn.cancel:hover { background: #5a6268; transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); }
/* Utility alignment */
.right { text-align: right; }
/* Mobile-friendly adjustments for WMS pages */
@media (max-width: 900px) {
    /* Stack planning panes vertically on small screens */
    .planning-layout { flex-direction: column; }
    .planning-left, .planning-right { flex: 1 1 auto; min-width: 0; }
    body.planning-page { overflow-y: auto; }
    /* Zones/users split panes stack */
    .zones-layout { flex-direction: column; }
    .zones-left { width: auto; min-width: 0; }
    .zones-right { border-left: none; border-top: 1px solid var(--tertiary-color); padding: 12px 0 0 0; }
    /* Dual lists become vertical */
    .dual-list { flex-direction: column; }
    /* Zones right-side include/exclude lists stack vertically */
    .zones-right .orders-scroll { display: flex; flex-direction: column !important; gap: 12px; }
    .zones-right .orders-scroll > div { min-width: 0 !important; width: 100% !important; }
}
@media (max-width: 700px) {
    /* Top toolbar wraps neatly */
    .wms-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
    /* Filters in a single column */
    .filter-grid { grid-template-columns: 1fr; }
    /* Nav buttons take full width */
    .wms-topnav { gap: 8px; }
    .wms-topnav .btn-modern { flex: 1 1 100% !important; width: 100% !important; }
    /* Tables constrain layout to avoid overflow */
    #grid, .pill-grid, .plain_table { table-layout: fixed; }
    /* Overview: on phones, show only Pick State, Sales Order, Progress; hide Delivery, Location, Debtor */
    body.overview-page #grid thead th:nth-child(3),
    body.overview-page #grid thead th:nth-child(4),
    body.overview-page #grid thead th:nth-child(6),
    body.overview-page #grid tbody td:nth-child(3),
    body.overview-page #grid tbody td:nth-child(4),
    body.overview-page #grid tbody td:nth-child(6) { display: none; }
    /* Fit colored pill rows within viewport on phones */
    body.overview-page #grid { border-spacing: 0 6px !important; }
    body.overview-page #grid th,
    body.overview-page #grid td { padding: 8px 8px !important; }
    /* Smaller, flexible badge so first column doesn't overflow */
    body.overview-page #grid .badge { width: auto !important; min-width: 56px !important; height: 22px !important; padding: 0 8px !important; font-size: 0.72rem !important; }
    /* Truncate Sales Order if space-constrained */
    body.overview-page #grid tbody td:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    /* Keep ratio wide enough for picked/max */
    body.overview-page #grid th:nth-child(5),
    body.overview-page #grid td:nth-child(5) { width: auto; }
}
@media (min-width: 701px) and (max-width: 1000px) {
    /* Show two nav buttons per row on mid-width screens */
    .wms-topnav .btn-modern { flex: 1 1 calc(50% - 10px) !important; width: auto !important; }
}
/* Quoti fAI Modern UI (scoped to header + navbar) */

/* Color tokens (scoped vars so we don't affect legacy theme) */
:root {
  --qa-brand: #01A7FF;
  --qa-brand-alt: #005F99;
  --qa-link-color: var(--qa-brand-alt);
  --qa-muted-text: #475569;
  --qa-muted-opacity: 0.82;
  --qa-tooltip-shadow: 0 0 10px rgba(0,0,0,0.18);
  --qa-header: #013A5D;
  --qa-heading: #0F172A;   /* deep slate-900 */
  --qa-text: #111827;      /* slate-900 */
  --qa-primary: #FFFFFF;   /* pure white base */
  --qa-button-bg: #D8E3F0;
  --qa-secondary: #EFF6FF; /* light blue surface for separation */
  --qa-border: #C5D1DC;    /* darker neutral border */
  --qa-subtle-bg: #E6F2FF; /* subtle accent backs */
  --qa-extra: #FFC107;

  --qa-shadow-sm: 0 1px 2px rgba(0,0,0,0.08);
  --qa-shadow-md: 0 6px 18px rgba(0,0,0,0.14);
  --qa-radius-sm: 6px;
  --qa-radius-md: 10px;
  --qa-radius-lg: 14px;
  --qa-chip-width: 120px;
}

/* Dark mode variables piggy-back on existing .dark-mode class */
.dark-mode {
  /* Lighten overall dark mode tone a touch */
  --bg-color: #1f2f3d;
  --qa-primary: #1f2f3d;    /* base surfaces */
  --qa-button-bg: #35516A;
  --qa-link-color: #42C2FF; /* brighter links */
  --qa-tooltip-shadow: 0 0 10px rgba(0,0,0,0.5);
  --qa-text: #FAFCFF;       /* brighter text */
  --qa-heading: #EEF4FA;    /* brighter headings */
  --qa-secondary: #1a3446;  /* subtle panels */
  --qa-border: #3a4650;     /* lighter borders */
  --qa-subtle-bg: #1a3446;  /* accents */
  --qa-shadow-sm: 0 1px 2px rgba(0,0,0,0.35);
  --qa-shadow-md: 0 10px 24px rgba(0,0,0,0.28);
}

/* ==========================
   Header (only)
   ========================== */
/* Modernize existing .centered-title without changing markup */
.centered-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--header-color, var(--qa-header)); /* environment-aware with token fallback */
  color: #FFFFFF;
  box-shadow: var(--qa-shadow-sm);
  padding: 10px 16px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* Ensure a visible fade in light mode to match dark */
html:not(.dark-mode) .centered-title {
  box-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.centered-title .center-container h1 {
  margin: 0;
  font: 600 18px/1.2 system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color: #FFFFFF;
}

/* Tweak the left logo image inside first child */
.centered-title > div:first-child img { height: 36px !important; padding-left: 8px !important; }

/* Brand logo (single variant used: white) */
.brand-logo { height: 36px; max-width: 180px; object-fit: contain; padding-left: 8px; }

/* Header badges (e.g., PREPROD) */
.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--qa-radius-sm);
  background: var(--qa-secondary);
  color: var(--qa-brand-alt);
  border: 1px solid var(--qa-border);
  font: 600 12px/1 system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}
.header-badge--preprod { background: #FFF4D0; color: #7A5A00; border-color: #EAD49A; }

/* Language selector (overrides only) */
.language-selector-wrapper { margin-right: 6px; }
.language-flag-button {
  border: 1px solid transparent;
  border-radius: var(--qa-radius-sm);
  height: 36px; min-width: 44px;
}
.language-flag-button:hover {
  border-color: var(--qa-brand);
  box-shadow: 0 2px 10px rgba(1, 167, 255, 0.25);
}
.language-dropdown-menu {
  border-color: var(--qa-border);
}
.language-option:hover { background: #f7fbff; }
.dark-mode .language-option:hover { background: #1a2b36; }

/* User profile chip + popup (overrides only) */
.user-initials {
  width: 38px; height: 38px; line-height: 38px;
  background: linear-gradient(135deg, var(--qa-brand), var(--qa-brand-alt));
  box-shadow: var(--qa-shadow-sm);
  border: 1px solid rgba(255,255,255,0.35);
}
.user-initials:hover { filter: brightness(1.04); }
.user-popup { border-color: var(--qa-border); box-shadow: var(--qa-shadow-md); }
.user-popup-header { background: linear-gradient(135deg, var(--qa-brand), var(--qa-brand-alt)); }

/* ==========================
   Main Menu / Navbar (only)
   ========================== */
.navbar {
  width: 220px; /* keep close to legacy size */
  background: linear-gradient(180deg, #013A5D 0%, var(--qa-brand) 100%);
  color: #FFFFFF;
  padding: 0 14px 16px 14px; /* remove top padding to sit flush with header */
  box-sizing: border-box;
  position: relative;
  z-index: 1100; /* ensure menu paints above header shadow */
  margin-top: -1px; /* overlap header by 1px to hide fade line */
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.12);
}

/* Right-side fade similar to header shadow */
.navbar::after {
  content: "";
  position: absolute;
  top: 0;
  right: -1px; /* extend slightly over content to create outside fade */
  width: 2px; /* match header's subtle fade footprint */
  height: 100%;
  pointer-events: none;
  background: linear-gradient(to right, rgba(0,0,0,0.6), rgba(0,0,0,0));
}

/* Smoothen the expand/collapse once ready (navigation.php adds .navbar-ready) */
.navbar.navbar-ready { transition: width 260ms ease; }

/* Collapsed state harmony with new width */
.navbar.collapsed { width: 84px; padding: 0 14px 16px 14px; }
.navbar.collapsed .navbar-toggle { text-align: center; }

/* Toggle button */
.navbar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  width: 40px;
  height: 40px;
  color: #FFFFFF;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--qa-radius-sm);
  padding: 0;
  margin: 8px 0 12px;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .1s ease;
}
.navbar-toggle:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.45); }
.navbar-toggle:active { transform: translateY(1px); }
.navbar-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(1,167,255,0.35); }

/* Static hamburger icon */
.hamburger { position: relative; width: 22px; height: 14px; display: inline-block; }
.hamburger .line { position: absolute; left: 0; right: 0; height: 2px; background: #FFFFFF; border-radius: 2px; transition: transform .2s ease, opacity .2s ease, background-color .2s ease; }
.hamburger .line1 { top: 0; }
.hamburger .line2 { top: 6px; }
.hamburger .line3 { bottom: 0; }

/* Keep the toggle anchored on the left when collapsed */
.navbar.collapsed .navbar-toggle { text-align: center; margin: 8px 0 12px; }

/* Items container */
.navbar-items { flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0; }

/* Themed scrollbars for the navbar list */
.navbar-items {
  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.6) rgba(255,255,255,0.15);
}
.navbar-items::-webkit-scrollbar {
  width: 10px;
}
.navbar-items::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.12);
  border-radius: 10px;
}
.navbar-items::-webkit-scrollbar-thumb {
  background-color: rgba(255,255,255,0.55);
  border-radius: 10px;
  border: 2px solid transparent; /* maintains gap from track */
}
.navbar-items::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255,255,255,0.75);
}
.navbar-items::-webkit-scrollbar-thumb:active {
  background-color: rgba(255,255,255,0.9);
}

/* Dark mode adjustments keep contrast on darker gradient */
.dark-mode .navbar-items {
  scrollbar-color: rgba(234,246,255,0.8) rgba(0,0,0,0.35);
}
.dark-mode .navbar-items::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.35);
}
.dark-mode .navbar-items::-webkit-scrollbar-thumb {
  background-color: rgba(234,246,255,0.8);
}
.dark-mode .navbar-items::-webkit-scrollbar-thumb:hover {
  background-color: #FFFFFF;
}

/* Global scrollbar style to match navbar */
html, body, .content {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.6) rgba(255,255,255,0.15);
}
html::-webkit-scrollbar,
body::-webkit-scrollbar,
.content::-webkit-scrollbar { width: 10px; }
html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
.content::-webkit-scrollbar-track { background: rgba(255,255,255,0.12); border-radius: 10px; }
html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
.content::-webkit-scrollbar-thumb { background-color: rgba(255,255,255,0.55); border-radius: 10px; border: 2px solid transparent; }
html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
.content::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,0.75); }
html::-webkit-scrollbar-thumb:active,
body::-webkit-scrollbar-thumb:active,
.content::-webkit-scrollbar-thumb:active { background-color: rgba(255,255,255,0.9); }

.dark-mode html, .dark-mode body, .dark-mode .content { scrollbar-color: rgba(234,246,255,0.8) rgba(0,0,0,0.35); }
.dark-mode html::-webkit-scrollbar-track,
.dark-mode body::-webkit-scrollbar-track,
.dark-mode .content::-webkit-scrollbar-track { background: rgba(0,0,0,0.35); }
.dark-mode html::-webkit-scrollbar-thumb,
.dark-mode body::-webkit-scrollbar-thumb,
.dark-mode .content::-webkit-scrollbar-thumb { background-color: rgba(234,246,255,0.8); }
.dark-mode html::-webkit-scrollbar-thumb:hover,
.dark-mode body::-webkit-scrollbar-thumb:hover,
.dark-mode .content::-webkit-scrollbar-thumb:hover { background-color: #FFFFFF; }

/* Light mode scrollbar overrides for better contrast on light backgrounds */
html:not(.dark-mode),
html:not(.dark-mode) body,
html:not(.dark-mode) .content { scrollbar-color: rgba(0,95,153,0.55) rgba(0,95,153,0.15); }
html:not(.dark-mode)::-webkit-scrollbar-thumb,
html:not(.dark-mode) body::-webkit-scrollbar-thumb,
html:not(.dark-mode) .content::-webkit-scrollbar-thumb { background-color: rgba(0,95,153,0.55); }
html:not(.dark-mode)::-webkit-scrollbar-thumb:hover,
html:not(.dark-mode) body::-webkit-scrollbar-thumb:hover,
html:not(.dark-mode) .content::-webkit-scrollbar-thumb:hover { background-color: rgba(1,167,255,0.75); }
html:not(.dark-mode)::-webkit-scrollbar-thumb:active,
html:not(.dark-mode) body::-webkit-scrollbar-thumb:active,
html:not(.dark-mode) .content::-webkit-scrollbar-thumb:active { background-color: rgba(1,167,255,0.9); }
html:not(.dark-mode)::-webkit-scrollbar-track,
html:not(.dark-mode) body::-webkit-scrollbar-track,
html:not(.dark-mode) .content::-webkit-scrollbar-track { background: rgba(0,95,153,0.12); }

/* Links */
.navbar a {
  color: #FFFFFF;
  text-decoration: none;
  display: flex; align-items: center;
  gap: 12px; padding: 10px 10px;
  border-radius: var(--qa-radius-sm);
}
.navbar a:hover { background: rgba(255,255,255,0.10); }

/* Icons */
.nav-icon { font-size: 18px; min-width: 20px; text-align: center; }

/* Active item override wins over legacy .navigation.active */
.navbar .navigation.active {
  background: #FFFFFF;
  color: var(--qa-brand-alt);
}
.navbar .navigation.active .nav-icon { color: var(--qa-brand-alt); }

/* Labels visibility in collapsed mode (align with legacy behavior) */
.navbar.collapsed .nav-label { opacity: 0; width: 0; overflow: hidden; }
.navbar.collapsed .toggle-switch-text { opacity: 0; width: 0; overflow: hidden; }
/* Hide dark mode toggle entirely when navbar is collapsed */
.navbar.collapsed .toggle-switch { display: none; }
.navbar.collapsed .navbar-version,
.navbar.collapsed .navbar-copyright { display: none; }

/* Footer */
.navbar-footer { margin-top: auto; padding-top: 12px; color: rgba(255,255,255,0.85); }
.navbar-version, .navbar-copyright { color: rgba(255,255,255,0.75); }

/* Dark mode tweaks for navbar */
.dark-mode .navbar {
  background: linear-gradient(180deg, #013A5D 0%, var(--qa-brand) 100%);
  border-right-color: rgba(0,0,0,0.5);
}
.dark-mode .navbar a:hover { background: rgba(0,0,0,0.18); }
.dark-mode .navbar .navigation.active { background: #0D2533; color: #EAF6FF; }
.dark-mode .navbar .navigation.active .nav-icon { color: #EAF6FF; }

/* Header auxiliary containers */
.header-right { display:flex; align-items:center; gap:10px; }
.header-left { display:flex; align-items:center; gap:8px; }
.mobile-navbar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  border: 1px solid rgba(0,95,153,0.18);
  border-radius: var(--qa-radius-sm);
  background: rgba(255,255,255,0.92);
  color: var(--qa-brand-alt);
  box-shadow: var(--qa-shadow-sm);
}
html:not(.dark-mode) .mobile-navbar-toggle:hover,
html:not(.dark-mode) .mobile-navbar-toggle:focus-visible {
  background: #FFFFFF;
  border-color: var(--qa-brand);
  box-shadow: 0 2px 10px rgba(0,0,0,0.10), 0 0 0 1px var(--qa-brand);
  outline: none;
}
.dark-mode .mobile-navbar-toggle {
  background: rgba(13,37,51,0.92);
  border-color: rgba(255,255,255,0.18);
  color: #EAF6FF;
}
.dark-mode .mobile-navbar-toggle:hover,
.dark-mode .mobile-navbar-toggle:focus-visible {
  background: #0D2533;
  border-color: rgba(255,255,255,0.32);
  box-shadow: 0 2px 10px rgba(0,0,0,0.24), 0 0 0 1px rgba(234,246,255,0.18);
  outline: none;
}
.mobile-navbar-toggle .hamburger .line {
  background: currentColor;
}
.navbar-backdrop {
  display: none;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  html, body { overflow-x: hidden; }
  .content{ padding: 6px; }
  .brand-logo { height: 32px; }
  .centered-title { padding: 8px 12px; }
}

@media (max-width: 768px) {
  .centered-title {
    position: sticky;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px 10px;
  }

  .brand-logo-wrap {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    margin-right: auto;
    position: relative;
    z-index: 1;
  }

  .center-container {
    order: 10;
    position: static;
    transform: none;
    flex: 0 0 100%;
    width: 100%;
    margin: 0;
    pointer-events: auto;
  }

  .centered-title .center-container h1 {
    font-size: 17px;
    line-height: 1.15;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brand-logo,
  .centered-title > div:first-child img {
    height: 26px !important;
    max-width: 132px;
    padding-left: 0 !important;
  }

  .mobile-navbar-toggle {
    display: inline-flex;
    width: 34px;
    height: 34px;
  }

  .language-selector-wrapper {
    margin-left: auto;
    margin-right: 2px;
    position: relative;
    z-index: 1;
  }

  .language-flag-button {
    min-width: 34px;
    height: 30px;
    padding: 4px 7px;
  }

  .user-profile {
    margin-right: 0;
    position: relative;
    z-index: 1;
  }

  .user-initials {
    width: 32px;
    height: 32px;
    line-height: 32px;
    font-size: 12px;
  }

  .centered-title > p {
    order: 4;
    margin-left: 8px;
    padding-right: 8px !important;
    font-size: 11px;
    white-space: nowrap;
  }

  .navbar {
    position: fixed;
    top: var(--app-header-height, 60px);
    left: 0;
    bottom: 0;
    width: min(240px, 76vw);
    height: calc(100dvh - var(--app-header-height, 60px));
    margin-top: 0;
    border-right: none;
    box-shadow: 0 18px 38px rgba(0,0,0,0.24);
    transform: translateX(0);
  }

  .navbar::after {
    display: none;
  }

  .navbar.navbar-ready {
    transition: transform 220ms ease, visibility 220ms ease;
  }

  .navbar-toggle {
    display: none;
  }

  .navbar.collapsed {
    width: min(240px, 76vw);
    padding: 0 14px 16px 14px;
    transform: translateX(-100%);
    visibility: hidden;
    pointer-events: none;
  }

  .navbar-backdrop {
    position: fixed;
    inset: var(--app-header-height, 60px) 0 0 0;
    z-index: 1090;
    background: rgba(2, 18, 28, 0.34);
    backdrop-filter: blur(2px);
  }

  body.navbar-mobile-open .navbar-backdrop {
    display: block;
  }

  body.navbar-mobile-open {
    overflow: hidden;
  }
}

/* On small screens, hide the navbar's double right separators */
@media (max-width: 700px){
  .navbar{ border-right: none !important; }
  .navbar::after{ display: none !important; }
}

/* Very small screens: ensure header elements fit and content respects navbar width */
@media (max-width: 560px){
  .header-center { display:block; width:100%; order:3; margin-top:4px; text-align:left; }
  .header-center h1 { font-size: 16px; }
  .centered-title {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
    padding: 5px 8px;
  }
  .center-container {
    flex: 0 0 100%;
    width: 100%;
    margin: 0;
  }
  .centered-title .center-container h1 {
    font-size: 16px;
  }
  .brand-logo,
  .centered-title > div:first-child img {
    height: 22px !important;
    max-width: 112px;
  }
  .mobile-navbar-toggle {
    width: 32px;
    height: 32px;
  }
  .language-flag-button {
    min-width: 30px;
    height: 28px;
    padding: 3px 6px;
  }
  .user-profile {
    margin-right: 4px;
  }
  .user-initials {
    width: 28px;
    height: 28px;
    line-height: 28px;
    font-size: 11px;
  }
  .results-wrapper,
  .panel,
  .orders-scroll,
  #grid,
  #details-grid,
  .plain_table,
  .source_table {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
  }
  .panel { padding-left: 8px; padding-right: 8px; }
  .header-right { gap:6px; flex-wrap: wrap; flex: 0 0 100%; justify-content: flex-end; }
  .user-profile, .language-selector-wrapper { margin-right: 0; }
}

/* On small screens, hide the environment/system badge text, keep page title */
@media (max-width: 560px){
  .centered-title > p { display: none !important; }
}

/* ==========================
   Configuration Page (scoped)
   ========================== */
  /* Make actions and tabs a touch tighter */
  .toolbar-actions .action, .config-actions .action { padding: 6px 8px; }
  .tabs-vertical .tab { min-width: 120px; padding: 8px 10px; }
  /* Header avatar and logo scale down */
  .brand-logo { height: 28px; }
  .user-initials { width: 32px; height: 32px; line-height: 32px; font-size: 12px; }
  .centered-title { padding: 6px 8px; flex-wrap: wrap; }
/* Removed configuration-only scoping to allow reuse across pages */

/* Unified header with tabs and actions */
.section-toolbar, .config-header {
  display:flex; align-items:flex-end; justify-content:space-between; gap:12px;
  margin-bottom:12px;
  background: var(--qa-secondary);
  border: 1px solid var(--qa-border);
  border-radius: var(--qa-radius-md);
  padding: 8px 12px;
  box-shadow: var(--qa-shadow-sm);
}
.tabs-horizontal, .config-tabs { display:flex; gap:16px; flex-wrap:wrap; }
.tabs-horizontal .tab, .config-tabs .tab {
  text-decoration:none; color: var(--qa-heading);
  padding:10px 8px; border-bottom:3px solid transparent; font-weight:600;
  border-radius: 6px;
}
.tabs-horizontal .tab:hover, .config-tabs .tab:hover {
  color: var(--qa-brand);
  background: rgba(1,167,255,0.08);
}
.tabs-horizontal .tab.is-active, .config-tabs .tab.is-active {
  color: var(--qa-brand-alt);
  border-bottom-color: var(--qa-brand);
}
.dark-mode .tabs-horizontal .tab, .dark-mode .config-tabs .tab { color:#EDEDED; }
.dark-mode .tabs-horizontal .tab.is-active, .dark-mode .config-tabs .tab.is-active { color:#EAF6FF; border-bottom-color: var(--qa-brand); }

.toolbar-actions, .config-actions { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.toolbar-actions .action, .config-actions .action { display:inline-flex; align-items:center; justify-content:center; gap:6px; padding:8px 10px; height:38px; min-height:38px; box-sizing: border-box; border-radius:8px; border:1px solid var(--qa-border); background: var(--qa-button-bg); color: var(--qa-heading); text-decoration:none; cursor:pointer; transition: box-shadow .15s ease, border-color .15s ease, background-color .15s ease; }
.toolbar-actions .action:hover, .config-actions .action:hover,
.toolbar-actions .action:focus-visible, .config-actions .action:focus-visible { background: rgba(1,167,255,0.06); border-color: var(--qa-brand); box-shadow: 0 2px 10px rgba(0,0,0,0.10), 0 0 0 1px var(--qa-brand); outline: none; }
.config-actions .action.selected { background: var(--qa-brand); color: #fff; border-color: var(--qa-brand); box-shadow: 0 2px 8px rgba(1,167,255,0.25); }
.config-actions .clear-selection-btn.action { margin-left: auto; }
.toolbar-actions .action.danger, .config-actions .action.danger { background: var(--qa-extra); color:#111; border-color:#e6b306; }
.toolbar-actions .action i, .config-actions .action i { font-size:14px; }

@media (max-width: 560px){ .toolbar-actions .action span, .config-actions .action span { display:none; } }

/* Mobile responsiveness for configuration page */
@media (max-width: 1024px){
  .section-toolbar, .config-header{ flex-wrap: wrap; align-items:center; }
  .tabs-horizontal, .config-tabs{ width:100%; }
  .toolbar-actions, .config-actions{ width:100%; justify-content:flex-start; }
}
@media (max-width: 560px){
  /* Removed configuration-only scoping */
  .section-toolbar, .config-header{ padding: 6px 8px; }
  .tabs-horizontal, .config-tabs{ overflow-x:auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .tabs-horizontal .tab, .config-tabs .tab{ display:inline-block; padding: 8px 6px; }
  /* Ensure full-width usage on very small screens */
  .container,
  .content,
  .panel { width: 100% !important; max-width: none !important; }
}

/* Transform table rows into cards on small screens */
@media (max-width: 820px){
  #config-table{ border-collapse: separate; border-spacing: 0; display:block; width:100%; }
  #config-table tbody{ display: table-row-group; }
  #config-table tr{ display:block; background: var(--qa-primary); border:1px solid var(--qa-border); border-radius: var(--qa-radius-sm); padding:10px; margin:8px 0; width: 100%; min-width: 0; box-sizing: border-box; }
  .dark-mode #config-table tr{ background: var(--bg-color); border-color:#334155; }
  #config-table tr.section-header{ background: transparent; border:none; padding:0; margin:16px 0 6px; }
  #config-table tr.section-header td{ padding: 10px 12px; }
  #config-table tr td{ display:block; width:100%; padding:4px 0; border:none !important; }
  #config-table tr td:nth-child(1){ font-weight:600; color: var(--qa-heading); }
  #config-table tr td:nth-child(2){ margin-top:4px; }
  #config-table tr td:nth-child(3){ margin-top:6px; opacity:0.9; }
  #config-table tr td:nth-child(4){ margin-top:8px; display:flex; gap:8px; justify-content:flex-end; }
  .action-button{ padding:6px; border-radius:6px; }
  .action-button:hover{ background: rgba(1,167,255,0.08); }
}

/* Make modals fit on mobile */
.modal-box{ max-width: min(92vw, 640px); width:auto; min-width: unset; }

/* Vertical tabs (sidenav) styled like horizontal tabs) */
.split-layout, .config-layout { display:grid; grid-template-columns: 220px 1fr; gap:12px; align-items: stretch; }
.tabs-vertical, .config-vert-tabs { display:flex; flex-direction:column; gap:6px; padding:8px; background: var(--qa-primary); border:1px solid var(--qa-border); border-radius: var(--qa-radius-md); box-shadow: var(--qa-shadow-sm); height: 100%; overflow:auto; box-sizing: border-box; }
.dark-mode .tabs-vertical, .dark-mode .config-vert-tabs { background: var(--bg-color); border-color: var(--qa-border); }
.tabs-vertical .tab, .config-vert-tabs .tab {
  position: relative;
  display:block;
  padding:10px 12px 10px 18px; /* room for accent */
  color: var(--qa-heading);
  text-decoration:none;
  background: #FFFFFF;
  border: 1px solid rgba(0, 95, 153, 0.40);
  border-radius: var(--qa-radius-sm);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 0 0 1px rgba(0, 95, 153, 0.40);
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.tabs-vertical .tab::before, .config-vert-tabs .tab::before {
  content: "";
  position: absolute;
  left: 8px; top: 6px; bottom: 6px;
  width: 6px; border-radius: 4px; background: var(--qa-brand);
}
.tabs-vertical .tab:hover, .config-vert-tabs .tab:hover { background: rgba(1,167,255,0.06); color: var(--qa-brand); border-color: var(--qa-brand); box-shadow: 0 2px 10px rgba(0,0,0,0.08), 0 0 0 1px var(--qa-brand); }
.tabs-vertical .tab.is-active, .config-vert-tabs .tab.is-active {
  color: var(--qa-brand-alt);
  font-weight: 700;
  background: rgba(1,167,255,0.06);
}
.dark-mode .tabs-vertical .tab, .dark-mode .config-vert-tabs .tab { color:#EDEDED; background: #223447; border-color: rgba(1,167,255,0.35); box-shadow: 0 6px 16px rgba(0,0,0,0.35), 0 0 0 1px rgba(1,167,255,0.35); }
.dark-mode .tabs-vertical .tab:hover, .dark-mode .config-vert-tabs .tab:hover { background: rgba(1,167,255,0.10); color: var(--qa-brand); box-shadow: 0 6px 16px rgba(0,0,0,0.35), 0 0 0 1px rgba(1,167,255,0.45); }
.dark-mode .tabs-vertical .tab.is-active, .dark-mode .config-vert-tabs .tab.is-active {
  background: rgba(1,167,255,0.14);
  color:#EAF6FF;
}
@media (max-width: 1024px){
  /* Stack layout: submenu first, then permissions, then details */
  .split-layout { display: block; }
  .tabs-vertical { height: auto; width: 100%; margin-bottom: 12px; }
}

/* On narrow screens, place the Roles/Permissions/Pages menu above and full-width */
@media (max-width: 820px){
  .tabs-vertical {
    flex-direction: row; flex-wrap: wrap; gap: 8px;
    width: 100%;
    max-width: none;
    margin: 0 0 12px 0;
    overflow-x: hidden;
  }
  .tabs-vertical .tab { flex: 1 1 120px; min-width: 110px; }
}

/* Extra-narrow phones: slightly tighter paddings and width */
@media (max-width: 560px){
  .tabs-vertical { max-width: min(480px, calc(100vw - 24px)); padding: 6px; }
}

/* Prevent horizontal overflow within tables on mobile */
@media (max-width: 560px){
  #grid, #details-grid { table-layout: fixed; width: 100%; }
  #grid th, #grid td, #details-grid th, #details-grid td { word-wrap: break-word; overflow-wrap: anywhere; }
}

/* Permissions table: make rows look like selectable cards */
#grid { width:100%; border-collapse: separate; border-spacing: 0 8px; }
#grid th {
  background: transparent;
  color: var(--qa-heading);
  font-weight: 700;
  padding: 6px 2px 8px 2px;
  text-align: left;
  border: none;
  box-shadow: none;
}
#grid th::before { display:none; }
.dark-mode #grid th { background: transparent; color:#EAF6FF; border:none; box-shadow:none; }

#grid tbody tr.order-row td { background: #FFFFFF !important; color: var(--qa-heading) !important; border: 1px solid rgba(0,95,153,0.40) !important; border-radius: var(--qa-radius-sm) !important; box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,95,153,0.40) !important; padding: 10px 12px; cursor: pointer; transition: background-color .15s ease, box-shadow .15s ease, border-color .15s ease; }
#grid tbody tr.order-row:hover td { background: rgba(1,167,255,0.03) !important; color: var(--qa-heading) !important; border-color: var(--qa-brand) !important; box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 0 0 1px var(--qa-brand) !important; }
#grid tbody tr.order-row.open td { background: rgba(1,167,255,0.04) !important; font-weight: 700; color: var(--qa-brand-alt) !important; box-shadow: inset 4px 0 0 var(--qa-brand), 0 1px 4px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,95,153,0.30) !important; border-color: rgba(0,95,153,0.30) !important; }
.dark-mode #grid tbody tr.order-row td { background: #223447 !important; border-color: var(--qa-brand-alt) !important; box-shadow: 0 6px 16px rgba(0,0,0,0.35), 0 0 0 1px var(--qa-brand-alt) !important; color:#EDEDED !important; }
.dark-mode #grid tbody tr.order-row:hover td { background: rgba(1,167,255,0.10) !important; box-shadow: 0 6px 14px rgba(0,0,0,0.35), 0 0 0 1px var(--qa-brand-alt) !important; }
.dark-mode #grid tbody tr.order-row.open td { background: rgba(1,167,255,0.12) !important; color:#EAF6FF !important; box-shadow: inset 4px 0 0 var(--qa-brand), 0 4px 12px rgba(0,0,0,0.35), 0 0 0 1px var(--qa-brand-alt) !important; }

/* Details grid: header like section header, body as soft panel */
#details-grid { width:100%; border-collapse: separate; border-spacing: 0 8px; }
#details-grid th { background: transparent; color: var(--qa-heading); font-weight: 700; padding: 6px 2px 8px 2px; text-align: left; border: none; box-shadow: none; }
#details-grid th::before { display:none; }
.dark-mode #details-grid th { background: transparent; color:#EAF6FF; border:none; box-shadow:none; }

#details-grid td { background: transparent; border: none; box-shadow: none; padding: 0; }
.dark-mode #details-grid td { background: transparent; border: none; box-shadow: none; }

/* Zone list items styled as chips/cards */
.zone-list { min-height: 120px; border: 1px solid rgba(0,95,153,0.30); border-radius: var(--qa-radius-sm); padding: 8px; background: transparent; }

/* ==========================
  Global utility components
  ========================== */
/* Generic chips/tags used for flags, counts, departments */
.qa-chip { display:inline-flex; align-items:center; justify-content:center; gap:6px; padding: 4px 10px; margin: 2px; border-radius: 9999px; font-size: 12px; font-weight: 600; letter-spacing: .01em; line-height: 1.2; border: 1px solid rgba(0,0,0,0.18); background: var(--qa-secondary); color: var(--qa-brand-alt); background-image: linear-gradient(to bottom, rgba(255,255,255,0.14), rgba(255,255,255,0)); transition: box-shadow .15s ease, border-color .15s ease, transform .08s ease; width: var(--qa-chip-width); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qa-chip:hover, .qa-chip:focus-visible { box-shadow: 0 2px 8px rgba(0,0,0,0.12); border-color: var(--qa-brand); outline: none; transform: translateY(-1px); }
.dark-mode .qa-chip { border-color: rgba(255,255,255,0.25); background: #223447; color: #EAF6FF; background-image: linear-gradient(to bottom, rgba(255,255,255,0.06), rgba(255,255,255,0)); }
.dark-mode .qa-chip:hover, .dark-mode .qa-chip:focus-visible { box-shadow: 0 4px 12px rgba(0,0,0,0.35); border-color: rgba(1,167,255,0.55); }
.qa-chip--success { background: #e6f7ec; color: #137333; border-color: #bde5c8; }
.dark-mode .qa-chip--success { background: #1b3a27; color: #b9f0c3; border-color: #2a5b3b; }

/* Chip groups and density modifiers (used e.g., for flags) */
.qa-chip-group { display: flex; flex-wrap: wrap; gap: 4px; }
.qa-chip-group--dense .qa-chip { width: 96px; padding: 2px 8px; font-size: 11px; }
.qa-chip-group--x-dense .qa-chip { width: 80px; padding: 1px 6px; font-size: 10px; }

/* Queue: missing customer marker */
.queue-customer-missing { color: #dc2626; font-weight: 700; }

/* Empty state pattern */
.empty-state { display:flex; flex-direction:column; align-items:center; justify-content:center; padding: 48px 16px; color: var(--qa-heading); opacity: 0.9; text-align: center; }
.empty-state i { font-size: 44px; color: var(--qa-brand); margin-bottom: 10px; }
.empty-state .empty-text { font-size: 14px; }

/* Compact date/time stack used in tables */
.qa-datetime { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.qa-datetime--compact .qa-date { font-size: 12px; font-weight: 600; }
.qa-datetime--compact .qa-time { font-size: 11px; opacity: 0.9; }
/* On mobile, render date and time inline (no newline) */
@media (max-width: 1280px){
  .qa-datetime { flex-direction: row; align-items: center; gap: 4px; line-height: 1.2; }
  .qa-datetime--compact .qa-time { font-size: 13px; opacity: 1; }
}

/* Separated table rows (card-like rows) */
.qa-table-separated { border-collapse: separate !important; border-spacing: 0 8px !important; width: 100%; }
.qa-table-separated thead th { background: transparent; border-bottom: 1px solid var(--qa-border); color: var(--qa-heading); padding: 6px 2px 8px 2px; box-shadow: none; }
.qa-table-separated tbody tr td { background: var(--qa-secondary); color: var(--qa-heading); border-top: 1px solid var(--qa-border); border-bottom: 1px solid var(--qa-border); border-left: 0; border-right: 0; box-shadow: none; padding: 10px 12px; }
.qa-table-separated tbody tr td:first-child { border-left: 1px solid rgba(0,95,153,0.40); border-top-left-radius: var(--qa-radius-sm); border-bottom-left-radius: var(--qa-radius-sm); }
.qa-table-separated tbody tr td:last-child { border-right: 1px solid rgba(0,95,153,0.40); border-top-right-radius: var(--qa-radius-sm); border-bottom-right-radius: var(--qa-radius-sm); }
.qa-table-separated tbody tr:hover td { background: rgba(1,167,255,0.03); border-top-color: var(--qa-brand); border-bottom-color: var(--qa-brand); }
.qa-table-separated tbody tr:hover td:first-child { border-left-color: var(--qa-brand); }
.qa-table-separated tbody tr:hover td:last-child { border-right-color: var(--qa-brand); }
/* Component colors use theme variables; no per-mode override needed */

/* Improve readability for order rows in light mode */
/* Readability handled by base + tokens */
/* Clear, accessible links inside rows */
.qa-table-separated tbody tr td a { color: var(--qa-link-color); text-decoration: none; }
.qa-table-separated tbody tr td a:hover, .qa-table-separated tbody tr td a:focus { text-decoration: underline; outline: none; }

/* ==========================
   Responsive Table Cards (generic)
   ========================== */
@media (max-width: 1280px){
  .table-cards, .mq-table { border-collapse: separate; border-spacing: 0; display: block; width: 100%; }
  .table-cards thead, .mq-table thead { display: none; }
  .table-cards tbody, .mq-table tbody { display: block; }
  .table-cards tr, .mq-table tr { display: block; background: var(--qa-secondary); border: 1px solid var(--qa-border); border-radius: var(--qa-radius-sm); padding: 10px 12px; margin: 8px 0; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
  .table-cards td, .mq-table td { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 6px 0; border: none !important; background: transparent !important; box-shadow: none !important; }
  .table-cards td::before, .mq-table td::before { content: attr(data-label); font-weight: 700; color: var(--qa-heading); margin-right: 12px; }
  .dark-mode .table-cards td::before, .dark-mode .mq-table td::before { color: #EAF6FF; }
  .table-cards td:last-child, .mq-table td:last-child { padding-bottom: 2px; }
  /* Ensure action cell takes full width so the button aligns right */
  .table-cards .col-action, .mq-table .col-action { width: 100%; text-align: initial; }
}

.dark-mode .table-cards tr, .dark-mode .mq-table tr { box-shadow: var(--qa-shadow-sm); }
.dark-mode .qa-accent-rows tbody tr td { box-shadow: var(--qa-shadow-md); }

/* ==========================
   Global: Accent rows (desktop)
   ========================== */
/* Make each data row visually match configuration headers with left accent */
.qa-accent-rows tbody tr { position: relative; }
.qa-accent-rows tbody tr td {
  background: var(--qa-secondary);
  color: var(--qa-heading);
  border-top: 1px solid var(--qa-border);
  border-bottom: 1px solid var(--qa-border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.qa-accent-rows tbody tr td:first-child {
  position: relative;
  padding-left: 18px; /* room for accent bar */
  border-left: 1px solid rgba(0, 95, 153, 0.30);
  border-top-left-radius: var(--qa-radius-sm);
  border-bottom-left-radius: var(--qa-radius-sm);
}
.qa-accent-rows tbody tr td:last-child {
  border-right: 1px solid rgba(0, 95, 153, 0.30);
  border-top-right-radius: var(--qa-radius-sm);
  border-bottom-right-radius: var(--qa-radius-sm);
}
.qa-accent-rows tbody tr td:first-child::before {
  content: "";
  position: absolute;
  left: 8px; top: 6px; bottom: 6px;
  width: 6px; border-radius: 4px; background: var(--qa-brand);
}
.qa-accent-rows tbody tr:hover td {
  background: rgba(1,167,255,0.03);
  border-top-color: var(--qa-brand);
  border-bottom-color: var(--qa-brand);
}
.qa-accent-rows tbody tr:hover td:first-child { border-left-color: var(--qa-brand); }
.qa-accent-rows tbody tr:hover td:last-child { border-right-color: var(--qa-brand); }


/* Keep chips aligned but narrower on small screens */
@media (max-width: 560px){
  :root { --qa-chip-width: 96px; }
}

/* Utilities */
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
/* Inherit-colored link without underline; underline on hover */
.link-inherit { color: inherit !important; text-decoration: none !important; }
.link-inherit:hover, .link-inherit:focus { text-decoration: underline !important; }
.text-center { text-align: center !important; }
.mt-10 { margin-top: 10px !important; }
.mt-20 { margin-top: 20px !important; }
.mb-15 { margin-bottom: 15px !important; }
.is-dimmed { opacity: .5 !important; }
html:not(.dark-mode) [data-review-tooltip] { color: var(--qa-muted-text); opacity: var(--qa-muted-opacity) !important; }
.w-10 { width: 10% !important; }
.w-20 { width: 20% !important; }
.w-30 { width: 30% !important; }
.w-40 { width: 40% !important; }

/* Empty state component (generic) */
.empty-state { display:flex; flex-direction:column; align-items:center; justify-content:center; padding: 48px 16px; color: var(--qa-heading); opacity: 0.9; text-align:center; }
.empty-state i { font-size: 44px; color: var(--qa-brand); margin-bottom: 10px; }
.empty-state .empty-text { font-size: 14px; color: var(--qa-text); }

/* Narrow action column so only the button fits */
.table-cards .col-action, .mq-table .col-action { width: 1%; white-space: nowrap; text-align: center; }
.table-cards .col-action form, .mq-table .col-action form { display: inline-block; }
.table-cards .col-action .remove-button, .mq-table .col-action .remove-button { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 28px; padding: 0 8px; color: #dc3545; font-size: 1.1em; transition: transform .12s ease, color .12s ease, filter .12s ease, box-shadow .12s ease; background: transparent; border: none; }
/* Subtle lift/glow on hover to match queue UX */
.table-cards .col-action .remove-button:hover,
.mq-table .col-action .remove-button:hover,
.table-cards .col-action .remove-button:focus-visible,
.mq-table .col-action .remove-button:focus-visible { background: transparent; color: #ff5a6a; transform: translateY(-1px) scale(1.06); filter: drop-shadow(0 1px 4px rgba(220,53,69,0.35)); outline: none; text-decoration: none; }
.table-cards .col-action .remove-button:focus, .mq-table .col-action .remove-button:focus { outline: none; }
.table-cards .col-action .remove-button:visited, .mq-table .col-action .remove-button:visited { color: #dc3545; text-decoration: none; }

/* On mobile card layout, let the action cell span and keep action buttons inline */
@media (max-width: 1280px){
  .table-cards .col-action, .mq-table .col-action {
    width: 100% !important;
    text-align: initial; /* allow flex spacing to control alignment */
  }
  .table-cards td.col-action, .mq-table td.col-action { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 10px; }
  .table-cards .col-action .remove-button, .mq-table .col-action .remove-button { min-width: 40px; height: 34px; padding: 0 10px; margin-right: 0; font-size: 1.2em; }
  /* Edit button parity with remove button in action cells */
  .table-cards .col-action .edit-button, .mq-table .col-action .edit-button { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 34px; padding: 0 10px; color: orange; font-size: 1.2em; transition: transform .12s ease, color .12s ease, filter .12s ease, box-shadow .12s ease; background: transparent; border: none; }
  .table-cards .col-action .edit-button:hover,
  .mq-table .col-action .edit-button:hover,
  .table-cards .col-action .edit-button:focus-visible,
  .mq-table .col-action .edit-button:focus-visible { background: transparent; color: #ffb84d; transform: translateY(-1px) scale(1.06); filter: drop-shadow(0 1px 4px rgba(255,165,0,0.35)); outline: none; text-decoration: none; }
  .table-cards .col-action .edit-button:focus, .mq-table .col-action .edit-button:focus { outline: none; }
}

/* Global table readability (applies to most pages using this stylesheet) */
/* Light mode */
html:not(.dark-mode) .plain_table th,
html:not(.dark-mode) .plain_table td,
html:not(.dark-mode) .source_table th,
html:not(.dark-mode) .source_table td {
  color: var(--qa-text);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html:not(.dark-mode) .plain_table a,
html:not(.dark-mode) .source_table a { color: var(--qa-link-color); text-decoration: none; }
html:not(.dark-mode) .plain_table a:hover,
html:not(.dark-mode) .source_table a:hover,
html:not(.dark-mode) .plain_table a:focus,
html:not(.dark-mode) .source_table a:focus { text-decoration: underline; outline: none; }

/* Dark mode */
.dark-mode .plain_table th,
.dark-mode .plain_table td,
.dark-mode .source_table th,
.dark-mode .source_table td {
  color: var(--qa-text);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.dark-mode .plain_table a,
.dark-mode .source_table a { color: var(--qa-link-color); text-decoration: none; }
.dark-mode .plain_table a:hover,
.dark-mode .source_table a:hover,
.dark-mode .plain_table a:focus,
.dark-mode .source_table a:focus { text-decoration: underline; outline: none; }
.dark-mode .qa-table-separated tbody tr:hover td { background: rgba(1,167,255,0.10); }
.zone-list.drag-over { background: rgba(1,167,255,0.06); }
.zone-item { background: #FFFFFF; color: var(--qa-heading); border: 1px solid rgba(0,95,153,0.40); border-radius: 8px; padding: 6px 8px; margin: 6px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,95,153,0.40); cursor: grab; transition: background-color .15s ease, box-shadow .15s ease, border-color .15s ease; }

/* ==========================
  Jobs Progress Bar (global)
  ========================== */
.order-progress-container { position: relative; width: 100%; height: 18px; background: var(--qa-primary); border: 1px solid var(--qa-border); border-radius: var(--qa-radius-sm); overflow: hidden; box-shadow: var(--qa-shadow-sm); }
.order-progress-bar { height: 100%; background: linear-gradient(90deg, var(--qa-brand), var(--qa-brand-alt)); transition: width .3s ease; position: relative; z-index: 0; }
.order-progress-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 12px; color: var(--qa-heading); text-shadow: 0 1px 0 rgba(255,255,255,0.4); pointer-events: none; z-index: 1; white-space: nowrap; }
.dark-mode .order-progress-container { background: #1b2a36; border-color: #334155; box-shadow: 0 6px 14px rgba(0,0,0,0.35); }
.dark-mode .order-progress-text { color: #EAF6FF; text-shadow: 0 1px 0 rgba(0,0,0,0.35); }
/* Light mode: keep progress text white for contrast on gradient bar */
html:not(.dark-mode) .order-progress-text { color: #FFFFFF; text-shadow: 0 1px 0 rgba(0,0,0,0.45); }

/* Make the jobs progress column wider on wide tables */
.qa-table-separated thead th.col-progress { width: 220px; }
.qa-table-separated tbody td.col-progress { width: 220px; }

/* Mobile: keep progress bar aligned to the right like values */
@media (max-width: 1280px){
  /* Ensure the label stays on the left and bar on the right */
  .table-cards .col-progress, .mq-table .col-progress { width: 100% !important; }
  .table-cards td.col-progress, .mq-table td.col-progress { align-items: center; }
  .table-cards td.col-progress .order-progress-container, .mq-table td.col-progress .order-progress-container {
    flex: 0 1 220px;       /* prefer ~220px but allow shrinking */
    width: 100%;           /* fill allocated space without overflowing */
    max-width: 220px;      /* cap at desktop target */
    margin-left: auto;     /* push the bar to the right side */
    margin-right: 25px;    /* match action button inset from edge */
  }
}
.zone-item:hover { background: rgba(1,167,255,0.03); border-color: var(--qa-brand); box-shadow: 0 2px 6px rgba(0,0,0,0.06), 0 0 0 1px var(--qa-brand); }
.zone-item:active { cursor: grabbing; }
.zone-item:active { background: rgba(1,167,255,0.06); box-shadow: inset 4px 0 0 var(--qa-brand), 0 1px 3px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,95,153,0.30); border-color: rgba(0,95,153,0.30); }
.dark-mode .zone-list { border-color: rgba(1,167,255,0.35); }
.dark-mode .zone-list.drag-over { background: rgba(1,167,255,0.14); }
.dark-mode .zone-item { background: #223447; color:#EDEDED; border-color: rgba(1,167,255,0.35); box-shadow: 0 6px 16px rgba(0,0,0,0.35), 0 0 0 1px rgba(1,167,255,0.35); }
.dark-mode .zone-item:hover { background: rgba(1,167,255,0.10); box-shadow: 0 6px 14px rgba(0,0,0,0.35), 0 0 0 1px rgba(1,167,255,0.45); }
.dark-mode .zone-item:active { background: rgba(1,167,255,0.14); box-shadow: inset 4px 0 0 var(--qa-brand), 0 4px 12px rgba(0,0,0,0.35), 0 0 0 1px rgba(1,167,255,0.45); }

/* Ensure available and assigned lists share equal height */
.dual-list { display:flex; gap:12px; align-items:stretch; }
.dual-list .list-column { flex:1; display:flex; flex-direction:column; }
.dual-list .list-column .zone-list { flex:1; min-height: 180px; }

.refresh-bar { display:flex; gap:8px; align-items:center; }
.results-wrapper { position: relative; min-height: 100px; }

.panel {
  background: var(--qa-primary);
  border: 1px solid var(--qa-border);
  border-radius: var(--qa-radius-md);
  box-shadow: var(--qa-shadow-sm);
  overflow: hidden;
  padding-left: 10px;
  padding-right: 10px;
}
.dark-mode .panel {
  background: var(--bg-color);
  border-color: var(--qa-border);
}

/* Zones layout (ported for mobile friendliness) */
.zones-layout { display:flex; gap:16px; align-items:flex-start; }
.zones-left { width: 420px; min-width: 300px; }
.zones-right { flex: 1 1 auto; padding: 0 12px; border-left: 1px solid var(--qa-border); margin-top: 0; }
.orders-scroll {
  height: auto;
  overflow: auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}
/* Stack columns on tablet to avoid narrow panes */
@media (min-width: 561px) and (max-width: 1024px){
  /* Make entire configuration area span full screen width on tablets */
  .split-layout { max-width: none; width: 100%; margin: 0; }

  /* Ensure all configuration panels use available width on tablets */
  .configuration-page .container,
  .configuration-page .content,
  .configuration-page .config-main,
  .configuration-page .panel,
  .configuration-page #grid,
  .configuration-page #details-grid,
  .configuration-page .orders-scroll {
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  /* Prevent tables from forcing horizontal overflow on tablets */
  .configuration-page #grid,
  .configuration-page #details-grid {
    table-layout: fixed;
  }

  .zones-layout { flex-direction: column; }
  .zones-left { width: 100%; min-width: 0; }
  .zones-right { width: 100%; border-left: none; padding-left: 0; border-top: 1px solid var(--tertiary-color); padding-top: 12px; }
  /* Restore right padding for details column for visual balance */
  .configuration-page .zones-right { padding-right: 12px; }
  /* Ensure inner panels use full width on tablets */
  .zones-left .panel,
  .zones-right .panel,
  .zones-left #grid,
  .zones-right #details-grid,
  .zones-left .orders-scroll,
  .zones-right .orders-scroll { max-width: none; width: 100%; }
  /* Ensure tabs and main content also take full width */
  .split-main { max-width: none; width: 100%; margin: 0; padding: 0; }
  .tabs-vertical { max-width: none; width: 100%; margin: 0 0 12px 0; }
  /* Keep tab container internal padding so button sizes remain unchanged */
  nav.tabs-vertical { padding-left: 8px; padding-right: 8px; }
  /* Zones layout spans full width as well */
  .configuration-page .zones-layout { max-width: none; width: 100%; margin: 0; }
}
@media (max-width: 560px){
  .zones-layout { flex-direction: column; }
  .zones-left { width: auto; min-width: 0; }
  .main-area, .container, .content { width: 100%; max-width: 100vw; overflow-x: hidden; }
  .results-wrapper,
  .panel,
  .orders-scroll,
  #grid,
  #details-grid,
  .plain_table,
  .source_table {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
  }
  .orders-scroll,
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Remove left divider line for stacked details column */
  .zones-right { border-left: none !important; padding-left: 0; }
}

/* Replace left divider with a subtle top divider on tablets/phones */
@media (max-width: 1024px){
  .zones-right {
    border-left: none;
    border-top: none;
    padding: 12px 0 0 0;
  }
}

#config-table { width:100%; border-collapse: separate; border-spacing: 0; }
#config-table td { padding: 10px 12px; border-top: 1px solid rgba(0,0,0,0.06); }
.dark-mode #config-table td { border-top-color: rgba(255,255,255,0.08); }
#config-table tr:first-child td { border-top: none; }

.configuration-page #config-table .section-header td,
.qa-accent-header td {
  position: relative;
  background: var(--qa-primary);
  color: var(--qa-heading);
  font-weight: 700;
  padding: 10px 12px 10px 18px; /* room for accent bar */
  border-top: none;
  border-bottom: none;
  /* Subtler blue border in light mode */
  border: 1px solid rgba(0, 95, 153, 0.30);
  border-radius: var(--qa-radius-sm);
  /* subtle elevation + softer blue ring in light mode */
  box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 0 0 1px rgba(0, 95, 153, 0.30);
}
#config-table .section-header td::before,
.qa-accent-header td::before {
  content: "";
  position: absolute;
  left: 8px; top: 6px; bottom: 6px;
  width: 6px;
  background: var(--qa-brand);
  border-radius: 4px;
}
/* Configuration page: add breathing room above first section set via container padding */
@media (min-width: 1025px){
  .configuration-page .panel { padding-top: 16px; }
}
.dark-mode #config-table .section-header td,
.dark-mode .qa-accent-header td {
  background: var(--bg-color);
  color: var(--qa-heading);
  border-color: var(--qa-brand-alt);
  /* darker elevation and ring for contrast on dark surfaces */
  box-shadow: 0 6px 16px rgba(0,0,0,0.35), 0 0 0 1px var(--qa-brand-alt);
}

/* Remove top border on first row after a section header to avoid visible stripe */
#config-table .section-header + tr td { border-top: none !important; }

.value-input.input-modern,
.input-modern,
select.value-input.input-modern {
  border-radius: 6px;
}

.json-edit-btn {
  display:inline-flex; align-items:center; justify-content:flex-start; min-height: 38px;
  cursor: pointer;
  color: var(--qa-heading);
  background: var(--qa-primary);
  border: 1px solid var(--qa-border);
  border-radius: 6px;
  padding: 6px 10px;
  text-align: left;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: var(--qa-shadow-sm);
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.json-edit-btn:hover,
.json-edit-btn:focus-visible { background: rgba(1,167,255,0.06); border-color: var(--qa-brand); box-shadow: 0 2px 10px rgba(0,0,0,0.10), 0 0 0 1px var(--qa-brand); outline: none; }

/* JSON editor inputs */
.editable-input { width: 100%; box-sizing: border-box; padding: 5px; border: 1px solid transparent; background: transparent; color: var(--text-color); }
.editable-input:focus { border: 1px solid var(--qa-border); background: var(--edit-text-bg-color); box-shadow: 0 0 0 2px rgba(1,167,255,0.15); }
.value-input { width: 100%; box-sizing: border-box; padding: 5px; background-color: var(--edit-text-bg-color); color: var(--edit-text-color); border: 1px solid var(--tertiary-color); }

/* =============================
  Shared Header Layout Styles
  ============================= */
.page-header-sticky { position: sticky; top: 0; z-index: 100; background: var(--qa-secondary); border: 1px solid var(--qa-border); border-radius: 0 0 var(--qa-radius-md) var(--qa-radius-md); box-shadow: var(--qa-shadow-sm); margin: 0 0 20px 0; isolation: isolate; }
.page-header-topbar { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; background: transparent; border-bottom: none; gap: 20px; position: relative; z-index: 1; flex-wrap: wrap; }
.page-header-filters { display: flex; gap: 16px; align-items: center; flex: 1; flex-wrap: wrap; min-width: 0; }
.page-header-stats { display: flex; gap: 12px; flex-wrap: wrap; }
.filter-item { display: flex; align-items: center; gap: 8px; }
.filter-item label { font-size: 13px; font-weight: 600; color: var(--title-text-color); white-space: nowrap; }
.filter-item select,
.filter-item input[type="text"] { min-width: 160px; }
.page-header-filters .toggle-item { margin-left: 0; }
.page-header-filters .toggle-group { margin-left: auto; display: flex; align-items: center; gap: 16px; flex-wrap: nowrap; }
/* Do not auto-push the first individual toggle now that a group exists */
.page-header-filters .toggle-item:first-of-type { margin-left: 0; }
/* Slightly reduce widths of flag and search fields on desktop */
.page-header-filters .flag-filter select { width: 160px; }
.page-header-filters #customerRefInput { width: 220px; }
/* If space is limited, push both toggles to their own next line together */
@media (max-width: 1200px) {
  .page-header-filters .filter-item:not(.toggle-item) { flex: 1 1 100%; }
  /* Move the entire toggle group to its own line together */
  .page-header-filters .toggle-group { flex: 1 1 100%; justify-content: flex-start; margin-left: 0; }
}
/* Broaden breakpoint to ensure left alignment whenever the group wraps */
@media (max-width: 1400px) {
  .page-header-filters .toggle-group { flex: 1 1 100%; justify-content: flex-start; margin-left: 0; }
}
/* Even broader to cover large but constrained layouts */
@media (max-width: 1800px) {
  .page-header-filters .toggle-group { flex: 1 1 100%; justify-content: flex-start; margin-left: 0; }
}
.filter-item input[type="text"]:focus { border-color: var(--primary-color); outline: none; box-shadow: 0 0 0 3px rgba(1,167,255,0.1); }
.toggle-item { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.toggle-item label { font-size: 13px; font-weight: 500; color: var(--text-color); margin: 0; cursor: pointer; user-select: none; }
.page-header-stats { display: flex; gap: 12px; }
.stat-card { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px 20px; background: var(--bg-color); border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.08); min-width: 80px; transition: all 0.2s ease; }
.stat-card:hover { box-shadow: 0 4px 8px rgba(0,0,0,0.12); transform: translateY(-1px); }
.stat-label { font-size: 11px; color: var(--title-text-color); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; font-weight: 600; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--primary-color); }
.stat-card[data-stat="reviewed"] .stat-value { color: #10b981; }
.stat-card[data-stat="remaining"] .stat-value { color: #f59e0b; }
.stat-card[data-stat="remaining"] { cursor: pointer; }
.stat-card[data-stat="remaining"]:hover { background: var(--secondary-color); }
.page-header-info { padding: 12px 20px; background: transparent; border-top: 1px solid var(--qa-border); position: relative; z-index: 1; }
.mail-info-content { display: grid; grid-template-columns: repeat(auto-fit,minmax(240px,1fr)); gap: 12px; font-size: 12px; }
.mail-info-item { display: flex; gap: 6px; align-items: center; min-width: 0; }
.mail-info-label { font-weight: 600; color: var(--title-text-color); }
.mail-info-value { color: var(--text-color); min-width: 0; }
/* Two-line variant for Historical Mail header */
.page-header-info.two-line .mail-info-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.page-header-info.two-line .mail-info-label { display: block; }
.page-header-info.two-line .mail-info-value { display: block; }
.mail-customer-missing { color: #dc2626; font-weight: 700; }
.debitor-missing-editor { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; width: 100%; min-width: 0; }
.debitor-search-input { flex: 1 1 220px; min-width: 0; width: 100%; max-width: 100%; padding: 6px 8px; border: 1px solid var(--tertiary-color); border-radius: 4px; background: var(--bg-color); color: var(--text-color); box-sizing: border-box; }
.debitor-save-button { border: none; border-radius: 4px; width: 30px; height: 30px; min-width: 30px; padding: 0; background: var(--primary-color); color: #fff; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.debitor-save-button:hover { background: var(--hover-color); }
.debitor-status { font-size: 11px; color: var(--title-text-color); white-space: nowrap; margin-left: 2px; }
.page-header-controls { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: transparent; border-top: 1px solid var(--qa-border); gap: 20px; position: relative; z-index: 1; }
.page-header-actions { display: flex; gap: 10px; }
.page-progress-track { height: 4px; background: var(--tertiary-color); overflow: hidden; }
.page-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary-color), #28a745); transition: width 0.3s ease; }
.items-list { max-width: 1400px; margin: 0 auto; padding: 0 20px 20px; }
.ai-reasoning-box { display: none; margin-top: 8px; padding: 10px 12px; background: rgba(1,167,255,0.05); border-left: 4px solid var(--primary-color); border-radius: 4px; font-size: 12px; line-height: 1.5; }
.ai-reasoning-box.show { display: block; }
.ai-reasoning-header { font-weight: 700; color: var(--primary-color); margin-bottom: 6px; text-transform: uppercase; font-size: 11px; letter-spacing: .5px; }
.ai-reasoning-content { color: var(--text-color); }
.item-error { display: none; margin-top: 8px; padding: 8px 12px; background: rgba(220,53,69,0.1); border-left: 4px solid #dc3545; border-radius: 4px; font-size: 12px; color: #dc3545; }
.item-error:not(:empty) { display: block !important; }
.mapping-summary { font-size: 12px; color: var(--title-text-color); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1280px){
  .page-header-topbar { flex-direction: column; align-items: stretch; }
  .page-header-filters { flex-direction: column; flex-wrap: wrap; }
  .filter-item { width: 100%; }
  .filter-item select, .filter-item input[type="text"] { flex: 1; min-width: 0; width: 100%; }
  .page-header-controls { flex-direction: column; align-items: stretch; }
  .page-header-actions { width: 100%; }
  .page-header-actions button { flex: 1; }
  .page-header-stats { justify-content: center; }
  /* Make header non-sticky on tablets/mobile */
  .header-layout-page .page-header-sticky { position: static; top: auto; }
  /* Prevent horizontal overflow in header on small screens */
  .header-layout-page .page-header-sticky { overflow-x: hidden; }
  .header-layout-page .page-header-topbar, .header-layout-page .page-header-controls { overflow-x: hidden; }
  .header-layout-page .filter-item label { white-space: normal; }
  .header-layout-page .toggle-item { margin-left: 0; }
  .header-layout-page .page-header-stats .stat-card { min-width: 0; flex: 1 1 100px; }
}
@media (max-width: 768px){ .page-header-filters { flex-direction: column; } .filter-item { width: 100%; flex-wrap: wrap; align-items: center; } .filter-item select, .filter-item input[type="text"] { flex: 1; min-width: 0; } .filter-item button, .filter-item .btn-modern { flex: 0 0 100%; } .page-header-controls { flex-direction: column; align-items: stretch; } .page-header-actions { width: 100%; } .page-header-actions button { flex: 1; } .mail-info-content { grid-template-columns: 1fr; } .mail-info-value { overflow-wrap: anywhere; word-break: break-word; } .table-cards td, .mq-table td { flex-wrap: wrap; align-items: flex-start; justify-content: flex-start; min-width: 0; overflow-wrap: anywhere; word-break: break-word; } .table-cards td::before, .mq-table td::before { flex: 0 0 100%; margin-right: 0; margin-bottom: 2px; } }
.header-layout-page .content { padding-top: 0; }
.dark-mode .item.item-processed { background-color: #3c5942; opacity: .8; }
.item.item-processed { background-color: #95e3a4; opacity: .8; }
.item.item-processed .button-group { justify-content: center; }